Files
lcdproc/configure.in
T

522 lines
14 KiB
Plaintext

dnl Process this file with autoconf 2.50 (or higher) to produce a configure script.
AC_PREREQ(2.59)
AC_INIT
AC_CONFIG_SRCDIR([clients/lcdproc/batt.c])
AM_INIT_AUTOMAKE(lcdproc, 0.5dev)
AM_CONFIG_HEADER(config.h)
AC_EXEEXT
AC_CANONICAL_HOST
case "$host" in
*-*-*linux*) dnl i586-pc-linux-gnu
AC_DEFINE([LINUX],[1],[Define if you're using Linux.])
ac_system_host=Linux
;;
*-*-*solaris*)
AC_DEFINE([SOLARIS],[1],[Define if you're using Solaris.])
ac_system_host=Solaris
;;
*-*-*openbsd*) dnl i386-unknown-openbsd3.0
AC_DEFINE([OPENBSD],[1],[Define if you're using OpenBSD.])
ac_system_host=OpenBSD
;;
*-*-*netbsd*)
AC_DEFINE([NETBSD],[1],[Define if you're using NetBSD.])
ac_system_host=NetBSD
;;
*-*-*freebsd*)
AC_DEFINE([FREEBSD],[1],[Define if you're using FreeBSD.])
ac_system_host=FreeBSD
;;
esac
AC_DEFINE_UNQUOTED([SYSTEM_HOST], [$ac_system_host], [Set this to your system host (Linux, Solaris, OpenBSD, NetBSD or FreeBSD)])
AC_MSG_CHECKING(whether to enable debugging)
AC_ARG_ENABLE(debug,
[ --enable-debug show debug information],
if [[[ "$enableval" = "yes" ]]]; then
AC_DEFINE(DEBUG,[1],[Define to 1 to show debug information])
debug="yes"
else
debug="no"
fi,
debug="no"
)
AC_MSG_RESULT($debug)
if test $debug = "yes"; then
dnl Enable debugging information with minimal optimisation
CFLAGS="-g -O"
else
dnl Maximum optimisation
CFLAGS="-O3"
fi
CFLAGS="-Wall $CFLAGS"
export CFLAGS
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_RANLIB
dnl Solaris
AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])
AC_CHECK_FUNC(connect,,[AC_CHECK_LIB(socket,connect)])
AC_CHECK_FUNC(inet_aton,,[AC_CHECK_LIB(resolv,inet_aton)])
AC_CHECK_LIB(kstat, kstat_open)
AC_CHECK_LIB(posix4, nanosleep)
AC_CHECK_FUNCS(getloadavg swapctl)
AC_CHECK_HEADERS(procfs.h sys/procfs.h sys/loadavg.h utmpx.h)
dnl Some versions of Solaris require -lelf for -lkvm
AC_CHECK_LIB(kvm, kvm_open,[
LIBS="-lkvm $LIBS"
],[AC_MSG_CHECKING(for kvm_open in -lkvm with -lelf)
AC_CACHE_VAL(ac_cv_lib_kvm_with_elf,
[ac_save_LIBS="$LIBS"
LIBS="-lkvm -lelf $LIBS"
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])
LIBS="$ac_save_LIBS"
])
if test "$ac_cv_lib_kvm_with_elf" = "yes"; then
AC_MSG_RESULT(yes)
LIBS="-lkvm -lelf $LIBS"
else
AC_MSG_RESULT(no)
fi
])
dnl NetBSD, OpenBSD and FreeBSD
AC_CHECK_HEADERS(sched.h sys/sched.h machine/cpufunc.h sys/types.h machine/pio.h machine/sysarch.h sys/cpuvar.h)
ETR_SYSV_IPC
ETR_UNION_SEMUN
dnl sched_setscheduler on OpenBSD
AC_CHECK_FUNCS(sched_setscheduler)
AC_CHECK_LIB(posix4, sched_setscheduler)
AC_CHECK_LIB(posix4, sched_setscheduler, [
AC_DEFINE([HAVE_SCHED_SETSCHEDULER],[1],
[Define if you have the sched_setscheduler function.])
])
AC_CHECK_LIB(rt, sched_setscheduler)
AC_CHECK_LIB(rt, sched_setscheduler, [
AC_DEFINE([HAVE_SCHED_SETSCHEDULER],[1],
[Define if you have the sched_setscheduler function.])
])
dnl i386_get_ioperm on NetBSD&OpenBSD
AC_CHECK_LIB(i386, i386_get_ioperm)
AC_CHECK_LIB(i386, i386_get_ioperm,
AC_DEFINE([HAVE_I386_IOPERM_NETBSD],[1],
[Define if you have the NetBSD&OpenBSD version of i386_ioperm functions.]),[
dnl i386_get_ioperm on FreeBSD
AC_CHECK_LIB(c, i386_get_ioperm)
AC_CHECK_LIB(c, i386_get_ioperm,
AC_DEFINE([HAVE_I386_IOPERM_FREEBSD],[1],
[Define if you have the FreeBSD version of the i386_ioperm functions.]),
[])]
)
AC_CHECK_FUNCS(iopl)
AC_CHECK_FUNCS(ioperm)
AC_CHECK_HEADERS(sys/io.h)
dnl Check if we support this parallel (LPT) port
dnl IMPORTANT: we must do all the checks used in port.h before doing this test!
AC_CACHE_CHECK([for a parallel port], ac_cv_port_have_lpt,
[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])])
if test "$ac_cv_port_have_lpt" = yes
then
AC_DEFINE([HAVE_PCSTYLE_LPT_CONTROL],[1],[Define if you have a parallel port and LCDproc knows how to talk to it.])
else
AC_MSG_WARN([Can't talk to the parallel port, disabling drivers that use it.])
fi
dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h sys/io.h errno.h)
AC_CHECK_HEADERS(limits.h kvm.h sys/param.h sys/sysctl.h sys/dkstat.h)
dnl Check for particular preprocessor macros
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_TYPE_UID_T
dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(select socket strdup strerror strtol uname cfmakeraw snprintf)
dnl Check for various defines and features
AC_FIND_MTAB_FILE
AC_GET_FS_INFO
AC_ARG_ENABLE(stat-nfs,
[ --enable-stat-nfs display filesystem stats for NFS],
AC_DEFINE(STAT_NFS,[1],[Define to 1 to display filesystem stats for NFS])
)
AC_ARG_ENABLE(stat-smbfs,
[ --enable-stat-smbfs display filesystem stats for SMBFS],
AC_DEFINE(STAT_SMBFS,[1],[Define to 1 to display filesystem stats for SMBFS])
)
AC_ARG_WITH(lcdport,
[ --with-lcdport=<port> the server port [13666]],
LCDPORT=$withval,
LCDPORT="13666"
)
AC_DEFINE_UNQUOTED(LCDPORT, $LCDPORT, [Set default port where LCDd should listen])
AC_DEFINE_UNQUOTED(PROTOCOL_VERSION, "0.3", [Define version of lcdproc client-server protocol])
AC_DEFINE_UNQUOTED(API_VERSION, "0.5", [Define version of lcdproc API])
AC_ARG_WITH(loadmax,
[ --with-loadmax=<load> Max Load Avg at which the backlight will]
[ start blinking [1.3]],
LOAD_MAX=$withval,
LOAD_MAX=1.3
)
AC_DEFINE_UNQUOTED(LOAD_MAX, $LOAD_MAX, [Define max Load Avg at which the backlight will start blinking])
AC_ARG_WITH(loadmin,
[ --with-loadmin=<load> Min Load Avg at which the backlight will]
[ turn off (asleep) [0.05]],
LOAD_MIN=$withval,
LOAD_MIN=0.05
)
AC_DEFINE_UNQUOTED(LOAD_MIN, $LOAD_MIN, [Define min Load Avg at which the backlight will turn off])
AC_MODULES_INFO
dnl ######################################################################
dnl USB support
dnl
dnl not all options have effect at the moment
AC_SUBST(libusb_libs)
AC_SUBST(libusb_cflags)
enable_libusb=yes
AC_MSG_CHECKING([if libusb support has been enabled]);
AC_ARG_ENABLE(
libusb,
[ --enable-libusb compile with USB support using libusb. ],
[
if test "$enable_libusb" = "yes"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
],
[
enable_libusb="no";
AC_MSG_RESULT(no)
]
)
AC_PATH_PROG(libusb_config,libusb-config, :)
if test "$enable_libusb" = "yes"; then
AC_ARG_WITH(
libusb-includes,
[ --with-libusb-includes=DIR
libusb include files are in DIR
(default: found by libusb-config). ],
[
if test "$withval" = "no"; then
libusb_build_dir="";
else
libusb_includepath="$withval"
libusb_cflags="-I$withval"
fi
],
[
AC_MSG_CHECKING(libusb CFLAGS)
if test "x$libusb_config" != x ; then
libusb_cflags=`$libusb_config --cflags`
else
for libusb_includepath in /usr/include /usr/local/include \
/usr/include/libusb /usr/local/include/libusb \
/usr/include/usb /usr/local/include/usb ; do \
if test -f "${ibusb_includepath}/libusb.h"; then
libusb_cflags="-I$libusb_includepath"
break
fi
done
fi
AC_MSG_RESULT($libusb_cflags)
]
)
if test x$libusb_includepath != x ; then
AC_CHECK_FILE(
$libusb_includepath/usb.h,
[ : ] ,
[ enable_libusb="no" ]
)
fi
fi
if test "$enable_libusb" = "yes"; then
AC_ARG_WITH(
libusb-libraries,
[ --with-libusb-libraries=DIR
libusb library files are in DIR
(default: found by libusb-config). ],
[
if test "$withval" = "no"; then
libusb_build_dir="";
else
libusb_libs="-L$withval -lusb"
fi
],
[
AC_MSG_CHECKING(libusb library path)
if test "x$libusb_config" != x ; then
libusb_libs=`$libusb_config --libs`
else
for libusb_libpath in /lib /usr/lib /usr/local/lib \
/lib/libusb /usr/lib/libusb /usr/local/lib/libusb \
/lib/usb /usr/lib/usb /usr/local/lib/usb ; do
if test -f "${libusb_libpath}/libusb.a" -o -f "${libusb_libpath}/libusb.so"; then
libusb_libs="-L$libusb_libpath -lusb"
break
fi
done
fi
AC_MSG_RESULT($libusb_libs)
]
)
AC_CHECK_LIB(
usb,
main,
[ : ],
[ enable_libusb="no" ],
$libusb_libs
)
fi
if test "$enable_libusb" = "yes"; then
AC_DEFINE(HAVE_LIBUSB,[1],[Define to 1 if you have the libusb library])
else
libusb_libs="";
libusb_cflags="";
fi
LCD_DRIVERS_SELECT
dnl ######################################################################
dnl Open LDAP
dnl based on code from perdition http://www.vergenet.net/linux/perdition/
dnl
dnl not all options have effect at the moment
AC_SUBST(ldap_libs)
AC_SUBST(ldap_includes)
AC_SUBST(ldap_schemadir)
AC_MSG_CHECKING([if LDAP support has been enabled]);
AC_ARG_ENABLE(
ldap,
[ --enable-ldap compile with LDAP support. ],
[
if test "$enable_ldap" = "yes"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
],
[
enable_ldap="no";
AC_MSG_RESULT(no)
]
)
if test "$enable_ldap" = "yes"; then
AC_ARG_WITH(
ldap-includes,
[ --with-ldap-includes=DIR
Open LDAP include files are in DIR. ],
[
if test "$withval" = "no"; then
ldap_build_dir="";
else
ldap_includepath="$withval"
fi
],
[
AC_MSG_CHECKING(OpenLDAP include path)
for ldap_includepath in /usr/openldap/include /usr/local/openldap/include \
/usr/include/openldap /usr/local/include/openldap \
/usr/include /usr/local/include; do
if test -f "${ldap_includepath}/ldap.h"; then
break
fi
done
AC_MSG_RESULT($ldap_includepath)
]
)
fi
ldap_includes="-I$ldap_includepath"
if test "$enable_ldap" = "yes"; then
AC_ARG_WITH(
ldap-libraries,
[ --with-ldap-libraries=DIR
Open LDAP library files are in DIR. ],
[
if test "$withval" = "no"; then
ldap_build_dir="";
else
ldap_libpath="$withval"
fi
],
[
AC_MSG_CHECKING(OpenLDAP library path)
for ldap_libpath in /usr/openldap/lib /usr/local/openldap/lib \
/usr/lib/openldap /usr/local/lib/openldap \
/usr/lib /usr/local/lib; do
if test -f "${ldap_libpath}/libldap.a" \
-o -f "${ldap_libpath}/libldap.so"; then
break
fi
done
AC_MSG_RESULT($ldap_libpath)
]
)
fi
ldap_libs="-L$ldap_libpath -lldap -llber"
if test "$enable_ldap" = "yes"; then
AC_CHECK_FILE(
$ldap_includepath/ldap.h,
[ : ] ,
[ enable_ldap="no" ]
)
fi
if test "$enable_ldap" = "yes"; then
AC_CHECK_LIB(
ldap,
ldap_url_parse,
[ : ],
[ enable_ldap="no" ],
$ldap_libs
)
fi
if test "$enable_ldap" = "yes"; then
AC_MSG_CHECKING(OpenLDAP lud_exts in LDAPURLDesc)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
#include <lber.h>
#include <ldap.h>]], [[LDAPURLDesc ludp;
ludp.lud_exts[0] = NULL;]])],[AC_MSG_RESULT(yes)
AC_DEFINE(WITH_LDAP_LUD_EXTS, 1, Compile with LDAP lud_exts)],[AC_MSG_RESULT(no)
AC_MSG_WARN(
""
"************************************************************"
"* Password and Username support will not be built in the"
"* LDAP module. For Password and Username support compile"
"* openldap2. Available from openldap.org"
"************************************************************"
)
])
fi
if test "$enable_ldap" = "yes"; then
AC_CHECK_LIB(ldap, ldap_set_option,
AC_DEFINE(WITH_LDAP_SET_OPTION, 1, Compile with LDAP set_option),
AC_MSG_WARN(
""
"************************************************************"
"* Cannot expicitly set network timeout or ldap protocol"
"* version. For ldap_set_option support please use openlap2."
"* Available from openldap.org"
"************************************************************"
),)
fi
if test "$enable_ldap" = "yes"; then
AC_ARG_WITH(
ldap-schema-directory,
[ --with-ldap-schema-directory=DIR
Open LDAP schema files are in DIR. ],
[
if test "$withval" = "no"; then
ldap_schemadir="";
else
ldap_schemadir="$withval"
fi
],
[
AC_MSG_CHECKING(OpenLDAP schema path)
for ldap_schemadir in /etc/openldap/schema /etc/ldap/schema \
/usr/local/openldap/etc/schema; do
if test -f "${ldap_schemadir}/openldap.schema"; then
break
fi
ldap_schemadir="Not found"
done
AC_MSG_RESULT($ldap_schemadir)
if test "$ldap_schemadir" = "Not found"; then
AC_MSG_WARN(
""
"************************************************************"
"* Could not find OpenLDAP schema directory."
"* lcdproc.schema will not be installed"
"************************************************************"
)
ldap_schemadir=""
fi
]
)
fi
if test "$enable_ldap" = "yes"; then
AC_DEFINE(WITH_LDAP_SUPPORT, 1, Compile in LDAP support)
else
ldap_libs="";
ldap_includes="";
fi
AC_CONFIG_FILES([Makefile
shared/Makefile
server/Makefile
server/commands/Makefile
server/drivers/Makefile
clients/Makefile
clients/lcdproc/Makefile
clients/lcdexec/Makefile
clients/examples/Makefile
clients/headlines/Makefile
clients/metar/Makefile
docs/Makefile
docs/lcdproc-dev/Makefile
docs/lcdproc-user/Makefile
docs/lcdproc-user/drivers/Makefile
scripts/Makefile
scripts/init-LCDd.debian
scripts/init-LCDd.rpm
scripts/init-lcdproc.debian
scripts/init-lcdproc.rpm])
AC_OUTPUT