Added support for DE200C VFD
[lcdproc-de200c.git] / configure.in
blob50a73e7fa8f261293f0f39dad2a42fe02ff3c2bc
1 # -*- mode: m4; -*-
2 dnl Process this file with autoconf  2.50 (or higher) to produce a configure script.
3 AC_PREREQ(2.59)
4 AC_INIT(lcdproc, 0.5.2, lcdproc@lists.omnipotent.net)
5 AC_CONFIG_SRCDIR([clients/lcdproc/batt.c])
6 AM_INIT_AUTOMAKE(1.7)
8 AC_CONFIG_HEADERS(config.h)
10 AC_CANONICAL_HOST
11 case "$host" in
12 *-*-*linux*)      dnl i586-pc-linux-gnu
13         AC_DEFINE([LINUX],[1],[Define if you're using Linux.])
14         ac_system_host=Linux
15         ;;
16 *-*-*solaris*)
17         AC_DEFINE([SOLARIS],[1],[Define if you're using Solaris.])
18         ac_system_host=Solaris
19         ;;
20 *-*-*openbsd*)    dnl i386-unknown-openbsd3.0
21         AC_DEFINE([OPENBSD],[1],[Define if you're using OpenBSD.])
22         ac_system_host=OpenBSD
23         ;;
24 *-*-*netbsd*)
25         AC_DEFINE([NETBSD],[1],[Define if you're using NetBSD.])
26         ac_system_host=NetBSD
27         ;;
28 *-*-*freebsd*)
29         AC_DEFINE([FREEBSD],[1],[Define if you're using FreeBSD.])
30         ac_system_host=FreeBSD
31         ;;
32 *-*-*darwin*)
33         AC_DEFINE([DARWIN],[1],[Define if you're using Darwin/Mac OS X.])
34         ac_system_host=Darwin
35         ;;
36 esac
37 AC_DEFINE_UNQUOTED([SYSTEM_HOST], [$ac_system_host], [Set this to your system host (Linux, Solaris, OpenBSD, NetBSD, FreeBSD or Darwin)])
39 dnl treat Darwin special in Makefiles
40 AM_CONDITIONAL(DARWIN, test x$ac_system_host = xDarwin)
42 AC_MSG_CHECKING(whether to enable debugging)
43 AC_ARG_ENABLE(debug,
44   [  --enable-debug          show debug information],
45   if [[[ "$enableval" = "yes" ]]]; then
46         AC_DEFINE(DEBUG,[1],[Define to 1 to show debug information])
47         debug="yes"
48   else
49         debug="no"
50   fi,
51   debug="no"
53 AC_MSG_RESULT($debug)
55 if test $debug = "yes"; then
56 dnl Enable debugging information with minimal optimisation if not set differently
57 dnl (the spaces before $CFLAGS and -O are significant)
58         CFLAGS="$CFLAGS -g"
59         if ! echo " $CFLAGS" | grep -q -- " -O" ; then
60                 CFLAGS="$CFLAGS -O"
61         fi
62 else
63 dnl Maximum optimisation if not already set
64 dnl (the spaces before $CFLAGS and -O are significant)
65         if ! echo " $CFLAGS" | grep -q -- " -O" ; then
66                 CFLAGS="$CFLAGS -O3"
67         fi
70 dnl Checks for programs.
71 AC_PROG_CC
72 AC_PROG_CPP
73 AC_PROG_INSTALL
74 AC_PROG_RANLIB
76 dnl Avoid unused static function warnings
77 CFLAGS="-Wall $CFLAGS"
78 AX_CFLAGS_GCC_OPTION(-Wno-unused-function)
79 AX_CFLAGS_GCC_OPTION(-ftrampolines)
80 export CFLAGS
82 dnl Solaris
83 AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])
84 AC_CHECK_FUNC(connect,,[AC_CHECK_LIB(socket,connect)])
85 AC_CHECK_FUNC(inet_aton,,[AC_CHECK_LIB(resolv,inet_aton)])
86 AC_CHECK_LIB(kstat, kstat_open)
87 AC_CHECK_LIB(posix4, nanosleep)
88 AC_CHECK_FUNCS(getloadavg swapctl)
89 AC_CHECK_HEADERS(procfs.h sys/procfs.h sys/loadavg.h utmpx.h)
91 dnl Some versions of Solaris require -lelf for -lkvm
92 AC_CHECK_LIB(kvm, kvm_open,[
93   LIBS="-lkvm $LIBS"
94 ],[AC_MSG_CHECKING(for kvm_open in -lkvm with -lelf)
95    AC_CACHE_VAL(ac_cv_lib_kvm_with_elf,
96    [ac_save_LIBS="$LIBS"
97     LIBS="-lkvm -lelf $LIBS"
98     AC_LINK_IFELSE([AC_LANG_PROGRAM([[char kvm_open();]], [[kvm_open()]])],[ac_cv_lib_kvm_with_elf=yes],[ac_cv_lib_kvm_with_elf=no])
99     LIBS="$ac_save_LIBS"
100    ])
101    if test "$ac_cv_lib_kvm_with_elf" = "yes"; then
102      AC_MSG_RESULT(yes)
103      LIBS="-lkvm -lelf $LIBS"
104    else
105      AC_MSG_RESULT(no)
106    fi
109 dnl NetBSD, OpenBSD and FreeBSD
110 AC_CHECK_HEADERS(sched.h sys/sched.h machine/cpufunc.h sys/types.h machine/pio.h machine/sysarch.h sys/cpuvar.h)
111 ETR_SYSV_IPC
112 ETR_UNION_SEMUN
114 dnl sched_setscheduler on OpenBSD
115 AC_CHECK_FUNCS(sched_setscheduler)
116 AC_CHECK_LIB(posix4, sched_setscheduler, [
117       AC_DEFINE([HAVE_SCHED_SETSCHEDULER],[1],
118       [Define if you have the sched_setscheduler function.])
120 AC_CHECK_LIB(rt, sched_setscheduler, [
121       AC_DEFINE([HAVE_SCHED_SETSCHEDULER],[1],
122       [Define if you have the sched_setscheduler function.])
125 dnl i386_get_ioperm on NetBSD&OpenBSD
126 AC_CHECK_LIB(i386, i386_get_ioperm,
127         LIBS="-li386 $LIBS"
128         AC_DEFINE([HAVE_I386_IOPERM_NETBSD],[1],
129         [Define if you have the NetBSD&OpenBSD version of i386_ioperm functions.]),[
130         dnl i386_get_ioperm on FreeBSD
131         AC_CHECK_LIB(c, i386_get_ioperm,
132                 AC_DEFINE([HAVE_I386_IOPERM_FREEBSD],[1],
133                 [Define if you have the FreeBSD version of the i386_ioperm functions.]),
134         [])]
137 AC_CHECK_FUNCS(iopl)
138 AC_CHECK_FUNCS(ioperm)
139 AC_CHECK_HEADERS(sys/io.h)
141 dnl Check if we support this parallel (LPT) port
142 dnl IMPORTANT: we must do all the checks used in port.h before doing this test!
143 AC_CACHE_CHECK([for a parallel port], ac_cv_port_have_lpt,
144 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "${srcdir}/server/drivers/port.h"]], [[char val = port_in(0x350)]])],[ac_cv_port_have_lpt=yes],[ac_cv_port_have_lpt=no])])
146 if test "$ac_cv_port_have_lpt" = yes
147 then
148         AC_DEFINE([HAVE_PCSTYLE_LPT_CONTROL],[1],[Define if you have a parallel port and LCDproc knows how to talk to it.])
149 else
150         AC_MSG_WARN([Can't talk to the parallel port, disabling drivers that use it.])
153 dnl Checks for header files.
154 AC_HEADER_DIRENT
155 AC_HEADER_STDC
156 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h sys/io.h errno.h)
157 AC_CHECK_HEADERS(limits.h kvm.h sys/param.h sys/dkstat.h)
159 dnl check sys/sysctl.h seperately, as it requires other headers on at least OpenBSD
160 AC_CHECK_HEADERS([sys/sysctl.h], [], [],
161 [[#if HAVE_SYS_PARAM_H
162 # include <sys/param.h>
163 #endif
166 dnl Check for particular preprocessor macros
168 dnl Checks for typedefs, structures, and compiler characteristics.
169 AC_C_CONST
170 AC_C_INLINE
171 AC_TYPE_SIZE_T
172 AC_HEADER_TIME
173 AC_STRUCT_TM
174 AC_TYPE_UID_T
176 dnl Checks for library functions.
177 AC_PROG_GCC_TRADITIONAL
178 AC_TYPE_SIGNAL
179 AC_CHECK_FUNCS(select socket strdup strerror strtol uname cfmakeraw snprintf)
181 dnl Many people on non-GNU/Linux systems don't have getopt
182 AC_CONFIG_LIBOBJ_DIR(shared)
183 AC_CHECK_FUNC(getopt_long,
184   [
185     AC_ARG_WITH(included-getopt,
186       [  --with-included-getopt  Use the included getopt rather than glibc's],
187       with_getopt=$withval,
188       with_getopt=$no)
189     if test "x$with_getopt" = xyes; then
190       AC_LIBOBJ(getopt)
191       AC_LIBOBJ(getopt1)
192     fi
193   ],
194   [
195     AC_LIBOBJ(getopt)
196     AC_LIBOBJ(getopt1)
197   ])
200 dnl Check how to find the mtab file and how to get filesystem staticstics
201 AC_FIND_MTAB_FILE
202 AC_GET_FS_INFO
205 dnl Check for various defines and features
206 AC_ARG_WITH(lcdport,
207   [  --with-lcdport=<port>   the server port [13666]],
208   LCDPORT=$withval,
209   LCDPORT="13666"
211 AC_DEFINE_UNQUOTED(LCDPORT, $LCDPORT, [Set default port where LCDd should listen])
213 AC_DEFINE_UNQUOTED(PROTOCOL_VERSION, "0.3", [Define version of lcdproc client-server protocol])
215 AC_DEFINE_UNQUOTED(API_VERSION, "0.5", [Define version of lcdproc API])
218 dnl Check compiler flags to dynamically load modules
219 AC_MODULES_INFO
222 dnl ######################################################################
223 dnl USB support
225 dnl not all options have effect at the moment
227 AC_SUBST(libusb_libs)
228 AC_SUBST(libusb_cflags)
230 AC_MSG_CHECKING([if libusb support has been enabled]);
231 AC_ARG_ENABLE(
232   libusb,
233   [  --enable-libusb         compile with USB support using libusb.  ],
234   [ 
235     if test "$enableval" != "no"; then
236       enable_libusb="yes"
237     fi
238   ],
239   [ enable_libusb="yes" ]
241 AC_MSG_RESULT($enable_libusb) 
243 if test "$enable_libusb" = "yes"; then
244   AC_PATH_PROG(libusb_config, libusb-config, :)
246   AC_ARG_WITH(
247     libusb-includes,
248     [  --with-libusb-includes=DIR  
249                           libusb include files are in DIR
250                           (default: found by libusb-config).  ],
251     [ 
252       if test "$withval" != "no"; then 
253         libusb_includepath="$withval" 
254         libusb_cflags="-I$withval" 
255       fi
256     ],
257     [ 
258       AC_MSG_CHECKING(libusb CFLAGS)
259       if test "x$libusb_config" != x ; then
260         libusb_cflags=`$libusb_config --cflags`
261       else
262         for libusb_includepath in /usr/include /usr/local/include \
263             /usr/include/libusb /usr/local/include/libusb \
264             /usr/include/usb /usr/local/include/usb ; do \
265           if test -f "${libusb_includepath}/usb.h" ; then
266             libusb_cflags="-I$libusb_includepath"
267             break
268           fi
269         done
270       fi
271       AC_MSG_RESULT($libusb_cflags)
272     ]
273   )
275   if test x$libusb_includepath != x ; then
276   AC_CHECK_FILE(
277      $libusb_includepath/usb.h,
278     [ : ] ,
279     [ enable_libusb="no" ]
280   )
281   fi
284 if test "$enable_libusb" = "yes"; then
285   AC_ARG_WITH(
286     libusb-libraries,
287     [  --with-libusb-libraries=DIR 
288                           libusb library files are in DIR
289                           (default: found by libusb-config).  ],
290     [ 
291       if test "$withval" != "no"; then 
292         libusb_libs="-L$withval -lusb" 
293       fi
294     ],
295     [ 
296       AC_MSG_CHECKING(libusb library path)
297       if test "x$libusb_config" != x ; then
298         libusb_libs=`$libusb_config --libs`
299       else
300         for libusb_libpath in /lib /usr/lib /usr/local/lib \
301             /lib/libusb /usr/lib/libusb /usr/local/lib/libusb \
302             /lib/usb /usr/lib/usb /usr/local/lib/usb ; do
303           if test -f "${libusb_libpath}/libusb.a" -o -f "${libusb_libpath}/libusb.so"; then
304             libusb_libs="-L$libusb_libpath -lusb"
305             break
306           fi
307         done
308       fi
309       AC_MSG_RESULT($libusb_libs)
310     ]
311   )
313   AC_CHECK_LIB(
314     usb,
315     main,
316     [ : ],
317     [ enable_libusb="no" ],
318     $libusb_libs
319   )
322 if test "$enable_libusb" = "yes"; then
323   AC_DEFINE(HAVE_LIBUSB,[1],[Define to 1 if you have the libusb library])
324 else
325   libusb_libs="";
326   libusb_cflags="";
330 dnl Select drivers to build
331 LCD_DRIVERS_SELECT
334 # Features applicable to the server
335 AC_ARG_ENABLE(seamless-hbars,
336         [  --enable-seamless-hbars no gaps in horizontal bar graphs (if HW supports it)],
337         [ if test "$enableval" = "yes" ; then
338                 AC_DEFINE(SEAMLESS_HBARS,[1],
339                         [Define to 1 to avoid gaps in horizontal bar graphs (if HW supports it)])
340         fi ]
343 AC_ARG_ENABLE(testmenus,
344         [  --enable-testmenus      enable server test menus],
345         if test "$enableval" = "yes" ; then
346                 AC_DEFINE(LCDPROC_TESTMENUS,[1],
347                         [Define to 1 to enable server test menus])
348         fi
351 AC_ARG_ENABLE(permissive_menu_goto,
352           [  --enable-permissive-menu-goto allow transitions]
353           [                        between different client's menus],
354           if test "$enableval" = "yes" ; then
355                 AC_DEFINE(LCDPROC_PERMISSIVE_MENU_GOTO,[1],
356                         [Define to 1 to allow transitions between different client's menus])
357           fi
360 dnl Features applicable to the lcdproc client
361 AC_ARG_ENABLE(lcdproc-menus,
362           [  --enable-lcdproc-menus  enable menu support in lcdproc client],
363           if test "$enableval" = "yes" ; then
364                 AC_DEFINE(LCDPROC_MENUS,[1],
365                         [Define to 1 to enable menu support in lcdproc client])
366           fi
369 AC_ARG_ENABLE(stat-nfs,
370           [  --enable-stat-nfs       display NFS filesystem stats in lcdproc client],
371           if test "$enableval" = "yes" ; then
372                 AC_DEFINE(STAT_NFS,[1],
373                         [Define to 1 to display NFS filesystem stats in lcdproc client])
374           fi
377 AC_ARG_ENABLE(stat-smbfs,
378           [  --enable-stat-smbfs     display SMBFS filesystem stats in lcdproc client],
379           if test "$enableval" = "yes" ; then
380                 AC_DEFINE(STAT_SMBFS,[1],
381                         [Define to 1 to display SMBFS filesystem stats in lcdproc client])
382           fi
386 # check for doxygen
387 BB_ENABLE_DOXYGEN
389 AC_CONFIG_FILES([Makefile
390         shared/Makefile
391         server/Makefile
392         server/commands/Makefile
393         server/drivers/Makefile
394         clients/Makefile
395         clients/lcdproc/Makefile
396         clients/lcdexec/Makefile
397         clients/lcdvc/Makefile
398         clients/examples/Makefile
399         clients/metar/Makefile
400         docs/Makefile
401         docs/Doxyfile
402         docs/lcdproc-dev/Makefile
403         docs/lcdproc-user/Makefile
404         docs/lcdproc-user/drivers/Makefile
405         scripts/Makefile
406         scripts/init-LCDd.LSB
407         scripts/init-lcdproc.LSB
408         scripts/init-lcdexec.LSB
409         scripts/init-lcdvc.LSB
410         scripts/init-LCDd.debian
411         scripts/init-lcdproc.debian
412         scripts/init-lcdexec.debian
413         scripts/init-lcdvc.debian
414         scripts/init-LCDd.rpm
415         scripts/init-lcdproc.rpm])
416 AC_OUTPUT