dnl Autoconf script for the GPL Speedtouch driver dnl Written by Francois Rogler dnl June 2001 dnl dnl Supported options dnl dnl --enable-release dnl --enable-debug dnl --enable-syslog (experimental) dnl --enable-static (experimental) AC_INIT(speedtouch, 1.3, speedtouch@ml.free.fr) VERSION="1.3" AC_CONFIG_SRCDIR(AUTHORS) dnl default prefix for user installed programs, RPMs will pass a new prefix AC_PREFIX_DEFAULT("/usr/local") AC_CANONICAL_HOST dnl Check for several programs AC_PROG_CC AC_PROG_MAKE_SET AC_PROG_INSTALL test -n "GCC" && CWARN="-Wall" test "x$enable_syslog" = "x" && enable_syslog="yes"; test "x$enable_syslog" = "xno" && unset enable_syslog; # if no --sysconfdir is specified, default to /etc # --sysconfdir='${prefix}/etc' is considered the system default test "x$sysconfdir" = 'x${prefix}/etc' && sysconfdir="/etc" CFLAGS=`echo $CFLAGS | sed s/"-g"/""/g` dnl User options AC_ARG_ENABLE(release,[ --enable-release set the compiler flags to -O6], CFLAGS="-O6") AC_ARG_ENABLE(debug,[ --enable-debug set the compiler flags to -g],[ CFLAGS="-g"; debug_flags="-DDEBUG"]) AC_ARG_ENABLE(syslog,[ --enable-syslog log messages via syslog], syslog_flags="-DUSE_SYSLOG") AC_ARG_ENABLE(install,[ --enable-install=user install as non-root user], installuser=$enable_install) : ${installuser:=root} AC_ARG_ENABLE(static,[ --enable-static statically link libs (to avoid lib dependancies for cross-compiles)], [link_opts="--static"]) dnl Check for several headers AC_CHECK_HEADERS( stdio.h \ unistd.h \ fcntl.h \ errno.h \ time.h \ signal.h \ stdlib.h \ termios.h \ limits.h \ stdarg.h \ string.h \ sys/resource.h \ sys/ioctl.h \ sys/types.h \ sys/stat.h \ sys/time.h \ sys/param.h \ sys/socket.h \ syslog.h , , AC_MSG_ERROR(Missing header file)) dnl Check for several types AC_TYPE_PID_T AC_TYPE_SIZE_T AC_C_CONST AC_TYPE_SIGNAL dnl Check for several functions AC_CHECK_FUNCS([alarm]) AC_CHECK_FUNCS([gettimeofday]) AC_CHECK_FUNCS([memmove]) AC_CHECK_FUNCS([memset]) AC_CHECK_FUNCS([mkfifo]) AC_CHECK_FUNCS([select]) AC_CHECK_FUNCS([strdup]) AC_CHECK_FUNCS([strerror]) dnl pthread lib MAKE_INSTALL_SCRIPT="" case "$host" in *-freebsd4*) st_compile="modem_run pppoa2 pppoa3" THREAD_LIBS="-pthread" AC_MSG_WARN(pppoa3 is still experimental) AC_CHECK_HEADER(semaphore.h, , [AC_MSG_WARN([Missing header file, pppoa3 won't be compiled]); st_compile="modem_run pppoa2"]) DOCDIR="doc-bsd" PUSB_SOURCE="pusb-bsd.c" AC_DEFINE(FREEBSD) ;; *-freebsd5*) st_compile="modem_run pppoa2 pppoa3" THREAD_LIBS="-lkse" AC_CHECK_HEADER(semaphore.h, , [AC_MSG_WARN([Missing header file, pppoa3 won't be compiled]); st_compile="modem_run pppoa2"]) DOCDIR="doc-bsd" PUSB_SOURCE="pusb-bsd.c" AC_DEFINE(FREEBSD) ;; *-netbsd*) st_compile="modem_run pppoa2" AC_MSG_WARN(pthread lib not yet supported) DOCDIR="doc-bsd" PUSB_SOURCE="pusb-bsd.c" AC_DEFINE(NETBSD) ;; *-openbsd*) st_compile="modem_run pppoa2" AC_MSG_WARN(pthread lib not yet supported) DOCDIR="doc-bsd" PUSB_SOURCE="pusb-bsd.c" AC_DEFINE(NETBSD) ;; *-linux*) st_compile="modem_run pppoa2 pppoa3" AC_CHECK_LIB(pthread, pthread_create, THREAD_LIBS="-pthread", [AC_MSG_WARN(pthread lib wasn't found : pppoa3 won't be compiled); st_compile="modem_run pppoa2"]) DOCDIR="doc-linux" PUSB_SOURCE="pusb-linux.c" AC_DEFINE(LINUX) ;; *) AC_MSG_ERROR(Your OS isn't supported) ;; esac AC_SUBST(THREAD_LIBS) AC_SUBST(st_compile) AC_SUBST(MAKE_INSTALL_SCRIPT) dnl Check for the existence of RPM tools and get the build root dnl Either way we subsitute the RPM variables as nothing should dnl break in the process. AC_CHECK_PROG(RPM_ROOT,rpm,`rpm --eval=%_topdir`) AC_SUBST(RPM_ROOT) PWD=`pwd` AC_SUBST(PWD) AC_SUBST(CWARN) AC_SUBST(VERSION) AC_SUBST(DOCDIR) AC_SUBST(PUSB_SOURCE) AC_SUBST(USE_SYSLOG) AC_SUBST(ac_configure_args) AC_SUBST(installuser) AC_SUBST(syslog_flags) AC_SUBST(link_opts) AC_CONFIG_FILES( Makefile \ src/Makefile \ src/speedtouch-setup \ src/speedtouch-start \ src/speedtouch-stop \ hotplug/Makefile \ hotplug/speedtouch \ doc-linux/Makefile \ doc-bsd/Makefile \ speedtouch.spec) AC_OUTPUT