2 dnl Process this file with autoconf 2.50 (or higher) to produce a configure script.
4 AC_INIT(lcdproc, 0.5.2, lcdproc@lists.omnipotent.net)
5 AC_CONFIG_SRCDIR([clients/lcdproc/batt.c])
8 AC_CONFIG_HEADERS(config.h)
12 *-*-*linux*) dnl i586-pc-linux-gnu
13 AC_DEFINE([LINUX],[1],[Define if you're using Linux.])
17 AC_DEFINE([SOLARIS],[1],[Define if you're using Solaris.])
18 ac_system_host=Solaris
20 *-*-*openbsd*) dnl i386-unknown-openbsd3.0
21 AC_DEFINE([OPENBSD],[1],[Define if you're using OpenBSD.])
22 ac_system_host=OpenBSD
25 AC_DEFINE([NETBSD],[1],[Define if you're using NetBSD.])
29 AC_DEFINE([FREEBSD],[1],[Define if you're using FreeBSD.])
30 ac_system_host=FreeBSD
33 AC_DEFINE([DARWIN],[1],[Define if you're using Darwin/Mac OS X.])
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)
44 [ --enable-debug show debug information],
45 if [[[ "$enableval" = "yes" ]]]; then
46 AC_DEFINE(DEBUG,[1],[Define to 1 to show debug information])
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)
59 if ! echo " $CFLAGS" | grep -q -- " -O" ; then
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
70 dnl Checks for programs.
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)
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,[
94 ],[AC_MSG_CHECKING(for kvm_open in -lkvm with -lelf)
95 AC_CACHE_VAL(ac_cv_lib_kvm_with_elf,
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])
101 if test "$ac_cv_lib_kvm_with_elf" = "yes"; then
103 LIBS="-lkvm -lelf $LIBS"
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)
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,
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.]),
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
148 AC_DEFINE([HAVE_PCSTYLE_LPT_CONTROL],[1],[Define if you have a parallel port and LCDproc knows how to talk to it.])
150 AC_MSG_WARN([Can't talk to the parallel port, disabling drivers that use it.])
153 dnl Checks for header files.
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>
166 dnl Check for particular preprocessor macros
168 dnl Checks for typedefs, structures, and compiler characteristics.
176 dnl Checks for library functions.
177 AC_PROG_GCC_TRADITIONAL
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,
185 AC_ARG_WITH(included-getopt,
186 [ --with-included-getopt Use the included getopt rather than glibc's],
187 with_getopt=$withval,
189 if test "x$with_getopt" = xyes; then
200 dnl Check how to find the mtab file and how to get filesystem staticstics
205 dnl Check for various defines and features
207 [ --with-lcdport=<port> the server port [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
222 dnl ######################################################################
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]);
233 [ --enable-libusb compile with USB support using libusb. ],
235 if test "$enableval" != "no"; then
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, :)
248 [ --with-libusb-includes=DIR
249 libusb include files are in DIR
250 (default: found by libusb-config). ],
252 if test "$withval" != "no"; then
253 libusb_includepath="$withval"
254 libusb_cflags="-I$withval"
258 AC_MSG_CHECKING(libusb CFLAGS)
259 if test "x$libusb_config" != x ; then
260 libusb_cflags=`$libusb_config --cflags`
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"
271 AC_MSG_RESULT($libusb_cflags)
275 if test x$libusb_includepath != x ; then
277 $libusb_includepath/usb.h,
279 [ enable_libusb="no" ]
284 if test "$enable_libusb" = "yes"; then
287 [ --with-libusb-libraries=DIR
288 libusb library files are in DIR
289 (default: found by libusb-config). ],
291 if test "$withval" != "no"; then
292 libusb_libs="-L$withval -lusb"
296 AC_MSG_CHECKING(libusb library path)
297 if test "x$libusb_config" != x ; then
298 libusb_libs=`$libusb_config --libs`
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"
309 AC_MSG_RESULT($libusb_libs)
317 [ enable_libusb="no" ],
322 if test "$enable_libusb" = "yes"; then
323 AC_DEFINE(HAVE_LIBUSB,[1],[Define to 1 if you have the libusb library])
330 dnl Select drivers to build
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)])
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])
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])
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])
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])
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])
389 AC_CONFIG_FILES([Makefile
392 server/commands/Makefile
393 server/drivers/Makefile
395 clients/lcdproc/Makefile
396 clients/lcdexec/Makefile
397 clients/lcdvc/Makefile
398 clients/examples/Makefile
399 clients/metar/Makefile
402 docs/lcdproc-dev/Makefile
403 docs/lcdproc-user/Makefile
404 docs/lcdproc-user/drivers/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])