dnl autoconf script for leafnode -*- m4 -*- vim: set tw=0: dnl written by Cornelius Krasel, 1999 dnl enhanced by Matthias Andree, 2000 - 2007 dnl Process this file with autoconf to produce a configure script. AC_INIT AC_PREREQ(2.55) AC_REVISION($Revision: 1.190 $) AC_CONFIG_SRCDIR([leafnode.h]) AM_INIT_AUTOMAKE(leafnode,1.11.6) AC_CONFIG_HEADERS([config.h]) AM_MAINTAINER_MODE dnl check whether called with --with-ipv6 AC_ARG_WITH(ipv6, AS_HELP_STRING([--with-ipv6],[support IPv6]), [if test "$withval" != "no" ; then AC_CHECK_DECL(AI_ADDRCONFIG,,AC_DEFINE(AI_ADDRCONFIG,0,[define to 0 if your system does not support AI_ADDRCONFIG]),[#include ]) AC_DEFINE(HAVE_IPV6, 1, [Define to 1 this to compile with IPv6 support.]) fi ]) dnl check where to put the confdir AC_ARG_WITH(confdir, AS_HELP_STRING([--with-confdir],[obsolete option, use --sysconfdir]), AC_MSG_ERROR([--with-confdir=D is obsolete. Please use --sysconfdir=D.])) if test "$sysconfdir" = '${prefix}/etc' && test "x$prefix" = "xNONE" ; then CONFDIR='/etc/leafnode' else CONFDIR="$sysconfdir" fi if test "$CONFDIR" != "$sysconfdir"; then AC_MSG_WARN([***]) AC_MSG_WARN([*** overriding sysconfdir to $CONFDIR]) AC_MSG_WARN([*** use --sysconfdir to fix]) AC_MSG_WARN([*** use --sysconfdir='\$prefix/etc' to get default autoconf behaviour]) AC_MSG_WARN([***]) sleep 1 fi sysconfdir=$CONFDIR AC_SUBST(sysconfdir) if test "$localstatedir" = '${prefix}/var' && test "$prefix" = NONE ; then myvar=/var else myvar="$localstatedir" fi dnl check where to put the spooldir AC_MSG_CHECKING(spooldir) AC_ARG_WITH(spooldir, AS_HELP_STRING([--with-spooldir],[news spool directory (/var/spool/news)]), [ case "${withval-}" in /*) ;; *) AC_MSG_ERROR(you must give an absolute path) ;; esac withval=`echo "$withval" | sed 'sx/*$xx;'`] , withval="$myvar/spool/news" ) SPOOLDIR=$withval AC_MSG_RESULT($SPOOLDIR) AC_SUBST(SPOOLDIR) dnl check where to put the lockfile AC_MSG_CHECKING(lockfile) AC_ARG_WITH(lockfile, AS_HELP_STRING([--with-lockfile],[lockfile path (${spooldir}/leaf.node/lock.file)]), [ case "${withval-}" in /*) ;; *) AC_MSG_ERROR(you must give an absolute path) ;; esac ] , withval="$SPOOLDIR/leaf.node/lock.file" ) LOCKFILE=$withval AC_MSG_RESULT($LOCKFILE) AC_SUBST(LOCKFILE) dnl Checks for programs. AC_PROG_AWK AC_PROG_CC dnl figure inline AC_C_INLINE dnl kill volatile if not understood: AC_C_VOLATILE dnl for ioctl: AC_PROG_GCC_TRADITIONAL AC_PROG_RANLIB AC_PROG_MAKE_SET AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_RANLIB AC_CHECK_TOOL([AR],ar,ar,$PATH:/usr/sbin:/usr/ccs/bin ) AC_CHECK_TOOL([STRIP],[strip]) AC_PATH_PROG( RPM, rpm ) AC_PATH_PROG([ID], [id], [false], /usr/xpg4/bin:/usr/bin:/bin) dnl Checks for types. AC_TYPE_MODE_T AC_TYPE_OFF_T AC_TYPE_UID_T dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_SYS_WAIT dnl Check whether all necessary include files are there AC_MSG_CHECKING(for system include files) AC_CACHE_VAL(cf_cv_sysheaders, AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include ]], [[ return 0; ]])],[ cf_cv_sysheaders="yes" ],[ cf_cv_sysheaders="no" ]) ) if test "$cf_cv_sysheaders" = "yes" then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) AC_MSG_ERROR(Kernel sources not installed - unable to continue) fi AC_HEADER_TIME AC_CHECK_HEADERS([errno.h fcntl.h limits.h sys/time.h syslog.h unistd.h sys/socket.h sys/sockio.h stdlib.h string.h strings.h]) AC_CHECK_TYPE(socklen_t, [], [AC_DEFINE(socklen_t,int,[Define to 'int' if does not define.])], [ #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SOCKET_H #include #endif ]) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_PID_T AC_TYPE_SIZE_T AC_STRUCT_TM AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[ #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif ]) dnl Coerce GLIBC 2.3 to GLIBC 2.2 compatibility. dnl May not be complete with future extensions, but appears to work dnl today, 2003-10-02. Matthias Andree AC_DEFINE(__NO_CTYPE,1,[Define __NO_CTYPE to 1 to avoid GLIBC_2.3-specific ctype.h functions.]) dnl check whether called with --with-newsuser AC_MSG_CHECKING(user) AC_ARG_WITH(user, AS_HELP_STRING([--with-user=],[name of user account to run as (news)]),, [ withval=news ]) if test "x$withval" = "xyes" ; then AC_MSG_ERROR([--with-user= requires an argument]) fi if test "x$withval" = "xno" ; then AC_MSG_ERROR([--without-user is not supported]) fi if test "x$withval" = "xroot" ; then AC_MSG_ERROR([--with-user=root is not allowed]) fi AC_DEFINE_UNQUOTED(NEWS_USER, "$withval", [what user ID to run as]) NEWS_USER="$withval" AC_MSG_RESULT($NEWS_USER) AC_SUBST(NEWS_USER) if $ID -u "$withval" >/dev/null 2>/dev/null ; then : else AC_MSG_WARN([User "$withval" does not exist.]) warned=1 fi dnl check whether called with --with-newsgroup AC_MSG_CHECKING(group) AC_ARG_WITH(group, AS_HELP_STRING([--with-group=],[name of news group to run as (news)]),, [ withval=news ] ) AC_DEFINE_UNQUOTED(NEWS_GROUP, "$withval", [what group ID to run as.]) if test "x$withval" = "xyes" ; then AC_MSG_ERROR([--with-group= requires an argument]) fi if test "x$withval" = "xno" ; then AC_MSG_ERROR([--without-group is not supported]) fi NEWS_GROUP="$withval" AC_MSG_RESULT($NEWS_GROUP) AC_SUBST(NEWS_GROUP) if test "x$withval" = "xroot" || test "x$withval" = "xwheel" ; then AC_MSG_WARN([--with-group=root and --with-group=wheel are not recommended]) warned=1 fi if find / -prune -group "$withval" >/dev/null 2>/dev/null ; then : else AC_MSG_WARN([Group "$withval" does not exist.]) warned=1 fi dnl ### Note that pcre-config is somewhat broken: dnl ### the CFLAGS contain -I which belong into CPPFLAGS dnl (found by William Hooper, July 2002) AC_ARG_VAR(PCRECONFIG,where the pcre-config script is installed) AC_PATH_PROG(PCRECONFIG,pcre-config,no) ORIG_CFLAGS="$CFLAGS" ORIG_CPPFLAGS="$CPPFLAGS" ORIG_LIBS="$LIBS" ORIG_LDFLAGS="$LDFLAGS" if test "$PCRECONFIG" != "no" ; then PCRE_CFLAGS=`$PCRECONFIG --cflags` PCRE_LIBS=`$PCRECONFIG --libs` else AC_MSG_WARN([cannot find pcre-config, this can cause PCRE to not be found.]) fi dnl check for PCRE CFLAGS="$CFLAGS $PCRE_CFLAGS" CPPFLAGS="$CPPFLAGS $PCRE_CFLAGS" LDFLAGS="$LDFLAGS $LIBS $PCRE_LIBS" AC_CHECK_HEADERS(pcre.h) AC_CHECK_LIB(pcre, pcre_compile,[PCRELIB="-lpcre"]) if test x$ac_cv_header_pcre_h = xno \ || test x$ac_cv_lib_pcre_pcre_compile = xno ; then cat <]], [[ char * pattern; int options; const char **errptr; int *erroffset; const unsigned char *tableptr; pcre_compile(pattern, options, errptr, erroffset, tableptr); ]])],[ cf_cv_new_pcre_compile="yes" ],[ cf_cv_new_pcre_compile="no" ]) ]) if test $cf_cv_new_pcre_compile = "yes" then AC_MSG_RESULT(>= 2.01) AC_DEFINE(NEW_PCRE_COMPILE,,[Define to 1 if you have PCRE 2.01 or newer.]) else AC_MSG_RESULT(<= 2.00) fi AC_MSG_CHECKING(for pcre_exec version) AC_CACHE_VAL(cf_cv_new_pcre_exec,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include ]], [[ const pcre *pattern; const pcre_extra *extra; const char *subject; int length; int options; int *ovec; int ovecsize; pcre_exec(pattern, extra, subject, length, options, ovec, ovecsize); ]])],[ cf_cv_new_pcre_exec=no ],[ cf_cv_new_pcre_exec=yes ]) ]) if test $cf_cv_new_pcre_exec = no ; then AC_MSG_RESULT(<= 2.05) else AC_MSG_RESULT(>= 2.06) AC_DEFINE(NEW_PCRE_EXEC,,[Define to 1 if you have PCRE 2.06 or newer.]) fi AC_SUBST(PCRELIB) AC_SUBST(PCREDEP) dnl Check for BSD4.2 syslog AC_MSG_CHECKING(for BSD4.2 syslog) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include ]], [[ openlog( "configure", LOG_PID|LOG_CONS, LOG_NEWS ); ]])],[ cf_cv_have_bsd42="no" ],[ cf_cv_have_bsd42="yes" ]) if test $cf_cv_have_bsd42 = "yes" then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_OLD_SYSLOG, 1, [Define to 1 if your openlog(3) takes only two arguments (BSD4.2 style).]) else AC_MSG_RESULT(no) fi dnl Checks for library functions. AC_TYPE_SIGNAL AC_FUNC_STRFTIME dnl AC_FUNC_UTIME_NULL dnl The next two aren't needed and just confuse dietlibc: dnl AC_FUNC_MALLOC dnl AC_FUNC_REALLOC AC_CHECK_FUNCS(setgid setuid) AC_CHECK_FUNC(lstat,,AC_DEFINE(lstat, stat, [Define to stat if you don't have lstat])) AC_REPLACE_FUNCS(getline strdup mkstemp strlcpy timegm) AC_FUNC_FORK dnl Check if system snprintf works AC_MSG_CHECKING(if your system's snprintf works) AC_RUN_IFELSE([[ /* tell xsnprintf.c to not include leafnode.h which depends * on config.h which doesn't exist at this time, * and we don't want the overrides just yet. */ #define RUN_FROM_CONFIGURE 1 `cat $srcdir/xsnprintf.c` ]], result=yes, result=no, result="unknown -- cross-compiling -- assuming no") AC_MSG_RESULT([$result]) if test "$result" = "yes" && test "$FORCE_SHIPPED_SNPRINTF" != yes ; then AC_DEFINE(HAVE_WORKING_SNPRINTF, 1, [Define to 1 if you have a _working_ 'snprintf' function.]) fi # Whenever both -lsocket and -lnsl are needed, it seems to be always the # case that gethostbyname requires -lnsl. So, check -lnsl first, for it # to be in LIBS before the setsockopt checks are performed. *However*, # on SINIX-N 5.43, this is false, and gethostent seems to be a better # candidate. So, let's use it below instead of gethostbyname, and see. # Stolen from GNU tar 1.12 AC_SEARCH_LIBS(gethostent, nsl) AC_SEARCH_LIBS(setsockopt, socket) AC_SEARCH_LIBS(syslog, bsd socket inet) AC_MSG_CHECKING(if your sockaddr has sa_len) AC_CACHE_VAL(cf_cv_have_salen, AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include #include ]], [[ struct sockaddr sa; (void)sa.sa_len;]])],[ cf_cv_have_salen="yes" ],[ cf_cv_have_salen="no" ]) ) if test $cf_cv_have_salen = yes then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SALEN, 1, [Define to 1 if your ifreq's if_addr has a sa_len member.]) else AC_MSG_RESULT(no) fi if test "$GCC" = yes ; then AC_MSG_CHECKING([if $CC is really Intel C++]) case "`$CC -V 2>&1`" in [[iI][nN][tT][eE][lL]]*) ICC=yes ;; *) ICC=no ;; esac AC_MSG_RESULT($ICC) fi if test "$GCC" = yes && test "x$GCC_FLAGS" = "x" && test "$ICC" = no then AC_MSG_CHECKING(for some good GCC flags) AC_LANG_CONFTEST() for i in -Wall -W -Wformat=2 -Wstrict-prototypes -Wmissing-prototypes do if $CC $i -c conftest.c then GCC_FLAGS="$GCC_FLAGS $i" fi done rm -f conftest.c conftest.o AC_MSG_RESULT($GCC_FLAGS) fi export GCC_FLAGS AC_SUBST(GCC_FLAGS) AC_SUBST(BINDIR) AC_SUBST(SYSCONFDIR) dnl ICC breaks the check if test "$ICC" = no then AC_FUNC_SETVBUF_REVERSED fi dnl check for rpm build dir AC_MSG_CHECKING(rpm build dir) dnl avoid checking against /SPECS d=${RPMSRC:-/usr/src/rpm} test -d ${d}/SPECS || d=/usr/src/rpm test -d ${d}/SPECS || d=/usr/src/packages test -d ${d}/SPECS || d=/usr/src/redhat test -d ${d}/SPECS || d=none RPMSRC=${d} AC_MSG_RESULT(${RPMSRC}) AC_SUBST(RPMSRC) dnl figure path to some tools AC_ARG_VAR(TCPSERVER, where tcpserver is installed) AC_PATH_PROG([TCPSERVER],tcpserver,none,/command /usr/local/bin $PATH) AC_ARG_VAR(ARGV0, where argv0 is installed) AC_PATH_PROG([ARGV0],argv0,none,/command /usr/local/bin $PATH) AC_ARG_VAR(TCPD, where tcpd is installed) AC_PATH_PROG([TCPD],tcpd,none,/usr/sbin /usr/libexec /usr/lbin /usr/etc /usr/bin /usr/local/sbin /usr/local/bin $PATH) dnl sysconfdir can still contain unexpanded variables, so we try to dnl expand them, hopefully safely enough. tmp="`echo $sysconfdir | sed -f ${srcdir}/sanitize.sed`" msysconfdir="`( if test "x$prefix" = xNONE ; then prefix=$ac_default_prefix fi eval echo \"\\\"$tmp\\\"\" )`" AC_SUBST(msysconfdir) AC_CONFIG_FILES([subst leafnode.spec Makefile doc_german/Makefile genlsm.sh]) AC_CONFIG_COMMANDS([default],[[echo timestamp >stamp-h]],[[]]) AC_OUTPUT cat <