summaryrefslogtreecommitdiffstats
path: root/kstars/configure.in.in
blob: 9065ba5da1cf65de3b4a78a0995b0c3604c32a8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
dnl KStars configuration

timezone_int=no
AC_TRY_COMPILE(
	#include <time.h>
	,
	daylight = 0;
	timezone = 0;
	,
	AC_DEFINE(TIMEZONE_IS_INT,1,[The symbol timezone is an int, not a function])
	,
	AC_DEFINE(TIMEZONE_IS_INT,0,[The symbol timezone is an int, not a function])
	)

# KStars INDI driver for the FLI CCD
case "${host_os}" in
       *linux* ) OSDIR=linux ;;
       *bsd*   ) OSDIR=bsd   ;;
       *       ) OSDIR=null  ;;
esac

# This variable to is check for the availability of libusb
have_libusb="no"

dnl --enable-libusb=PATH
AC_ARG_ENABLE(libusb,
	AC_HELP_STRING([--enable-libusb=PATH],[libusb path (default /usr)]),
	[
		case ${enableval} in
			"" | "yes" | "YES")
				;;
			"no" | "NO")
				use_libusb=false
				;;
			*)
				CPPFLAGS="$CPPFLAGS -I${enableval}/include"
				LDFLAGS="$LDFLAGS -L${enableval}/lib"
				;;
		esac
	]
)

dnl check if libusb is available
if test "${use_libusb}" != false ; then
	AC_LANG_SAVE
	AC_LANG_CPLUSPLUS
	ac_save_CXXFLAGS="$CXXFLAGS"
	ac_save_LDFLAGS="$LDFLAGS"
	if test -z "$tqt_includes"; then
		CXXFLAGS="$CXXFLAGS"
	else
		CXXFLAGS="$CXXFLAGS -I$tqt_includes"
	fi
	LDFLAGS="$LDFLAGS -ltqt"

	AC_SUBST(LIBUSB)
	AC_CHECK_HEADERS(usb.h, [have_libusb="yes"],
		[ AC_MSG_WARN([usb.h not found, use --enable-libusb=PATH. Otherwise, INDI will compile without Apogee USB support.]) ])

	ac_save_LIBS="$LIBS"
	LIBS="$LIBS $COREFOUNDATION $IOKIT"
	AC_CHECK_LIB(usb, usb_init, [LIBUSB="$LIBUSB -lusb" have_libusb="yes"],
		[ AC_MSG_WARN([libusb not found. INDI will compile without Apogee USB support.]) ])
	LIBS="$ac_save_LIBS"

	CXXFLAGS="$ac_save_CXXFLAGS"
	LDFLAGS="$ac_save_LDFLAGS"
	AC_LANG_RESTORE

fi

dnl check if v4l2 is available
have_v4l2=false
case "$target" in
   *-*-linux*)
	AC_ARG_ENABLE(v4l2,
	              [AC_HELP_STRING([--disable-v4l2],
		                      [disable V4L2 interface for KStars])],
		      [ case "${enableval}" in
		        no)  disable_v4l2=yes ;;
			yes) disable_v4l2=no ;;
			 *) AC_MSG_ERROR(bad value ${enableval} for --disable-v4l2) ;;
			 esac],
		      [disable_v4l2=no])
        if test x$disable_v4l2 = xno; then
	  AC_CHECK_TYPE([struct v4l2_buffer], 
                        [have_v4l2=true],
	                [have_v4l2=false],
		        [#include <sys/time.h>
		         #include <linux/videodev2.h>])
	 if test x$have_v4l2 = xfalse; then
	    KERNEL_VERSION=`uname -r`
	    AC_CHECK_FILE(/lib/modules/$KERNEL_VERSION/build/include/linux/videodev2.h,
	                  [AC_MSG_WARN([])
			   AC_MSG_WARN([])
			  AC_MSG_WARN([We cannot locate videodev2.h in /usr/include/linux])
			  AC_MSG_WARN([])
			  AC_MSG_WARN([This file is responsible for V4L2 in KStars])
			   AC_MSG_WARN([This file is correct in /lib/modules/$KERNEL_VERSION/build/include])
			   AC_MSG_WARN([It is recommended that you copy this file and videodev.h to /usr/include/linux])
			   AC_MSG_WARN([])
			   ])
	  fi
        else
            have_v4l2=false
        fi
	;;
    *)
	;;
   esac

if test x$have_v4l2 = xtrue; then
  AC_DEFINE(HAVE_LINUX_VIDEODEV2_H, 1, [Define to 1 if you have the <linux/videodev2.h> header file.])
  KDE_CHECK_HEADERS([sys/io.h],
    [AC_DEFINE(HAVE_IOPERM, 1, [Defined to 1 if <sys/io.h> defines ioperm function.])]
  )
fi

AM_CONDITIONAL(BSD, test x$OSDIR = xbsd)
AM_CONDITIONAL(LINUX, test x$OSDIR = xlinux)
AM_CONDITIONAL(NULL, test x$OSDIR = xnull)
AM_CONDITIONAL(HAVE_LIBUSB, test x$have_libusb = xyes)
AM_CONDITIONAL(HAVE_V4L2, [test x$have_v4l2 = xtrue])