AC_INIT(fetchmail.h) dnl A distinctive file to look for in srcdir.
AC_CONFIG_HEADER(config.h)
-# We want these before the checks, so the checks can modify their values.
-test -z "$CFLAGS" && CFLAGS=-g AC_SUBST(CFLAGS)
-test -z "$LDFLAGS" && LDFLAGS=-g AC_SUBST(LDFLAGS)
+dnl We want these before the checks, so the checks can modify their values.
+test -z "$CFLAGS" && CFLAGS="-O" AC_SUBST(CFLAGS)
+test -z "$LDFLAGS" && LDFLAGS=-s AC_SUBST(LDFLAGS)
AC_CANONICAL_HOST
AC_PROG_CC
AC_TYPE_SIZE_T
AC_TYPE_PID_T
AC_TYPE_SIGNAL
-AC_CHECK_HEADERS(unistd.h termios.h termio.h sgtty.h stdarg.h alloca.h sys/itimer.h)
+AC_CHECK_HEADERS(unistd.h termios.h termio.h sgtty.h stdarg.h alloca.h sys/itimer.h fcntl.h sys/fcntl.h memory.h sys/wait.h)
AC_C_CONST dnl getopt needs this.
AC_PROG_LEX
AC_PROG_YACC
+AC_SUBST(CPFLAGS)
+AC_SUBST(CEFLAGS)
+AC_SUBST(LDEFLAGS)
AC_SUBST(LIBOBJS)
+AC_SUBST(POMAKE)
-AC_CHECK_LIB(nsl,inet_addr)
-AC_CHECK_LIB(socket,socket)
-AC_CHECK_LIB(inet,socket)
+PACKAGE=`sed -n '/PACKAGE *= *\(.*\)/s//\1/p' <$srcdir/Makefile.in`
+AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
+AC_SUBST(PACKAGE)
+
+VERSION=`sed -n '/VERSION *= *\(.*\)/s//\1/p' <$srcdir/Makefile.in`
+AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
+AC_SUBST(VERSION)
+
+# Check for LynxOS special case: -lbsd needed (at least on 2.3.0) and -s
+# not working.
+if test `uname` = "LynxOS"
+then
+ echo "Adding -lbsd to standard libraries"
+ LIBS="$LIBS -lbsd"
+ LDFLAGS=""
+ echo "Prepending standard include path to gcc flags"
+ CPFLAGS="-I/usr/include"
+fi
+
+# Check for FreeBSD special case: -lkvm needed
+if test `uname` = "FreeBSD"
+then
+ echo "Adding -lkvm to standard libraries"
+ LIBS="$LIBS -lkvm"
+fi
+
+# i18n
+# Arnaldo Carvalho de Melo <acme@conectiva.com.br>
+# Sat Nov 7 15:39:03 EDT 1998
+
+ALL_LINGUAS="pt_BR es pl fr"
+
+AM_GNU_GETTEXT
+
+# end i18n
+
+# Under sysV68, socket and friends are provided by the C library.
+# -linet does not provide socket, but causes multiple definition
+# errors at link-time. It is thus better to only use the C library.
+# So don't add -linet to the link list unless it's necessary
+AC_CHECK_FUNC(socket,
+ AC_MSG_RESULT(using libc's socket),
+ AC_CHECK_LIB(socket,socket)
+ AC_CHECK_LIB(inet,socket))
+
+# If gettext isn't in the C library, maybe there's a -lintl.
+AC_CHECK_FUNC(gettext,
+ AC_MSG_RESULT(using libc's gettext),
+ AC_CHECK_LIB(intl,gettext))
+
+# The condition in this test copes with the presence of inet_addr in libc6.
+AC_CHECK_FUNC(inet_addr,
+ AC_MSG_RESULT(using libc's inet_addr),
+ AC_CHECK_LIB(nsl,inet_addr))
+
+dnl Port hack for Interactive UNIX System V/386 Release 3.2
+AC_CHECK_LIB(cposix, strchr,
+ [EXTRADEFS="$EXTRADEFS -D_SYSV3"
+ LIBS="$LIBS -lcposix"])
AC_CHECK_FUNC(strstr, AC_DEFINE(HAVE_STRSTR),
[EXTRASRC="$EXTRASRC \$(srcdir)/strstr.c"
[EXTRASRC="$EXTRASRC \$(srcdir)/strcasecmp.c"
EXTRAOBJ="$EXTRAOBJ strcasecmp.o"])
+AC_CHECK_FUNC(memmove, AC_DEFINE(HAVE_MEMMOVE),
+ [EXTRASRC="$EXTRASRC \$(srcdir)/memmove.c"
+ EXTRAOBJ="$EXTRAOBJ memmove.o"])
+
AC_CHECK_FUNC(getopt_long, AC_DEFINE(HAVE_GETOPTLONG),
[EXTRASRC="$EXTRASRC \$(srcdir)/getopt.c \$(srcdir)/getopt1.c"
EXTRAOBJ="$EXTRAOBJ getopt.o getopt1.o"])
EXTRAOBJ="$EXTRAOBJ alloca.o"
fi
-if test -f "/usr/kerberos/include/krb.h"
-then
- CFLAGS="$CFLAGS -DKERBEROS_V4 -I/usr/kerberos/include"
- LDFLAGS="$LDFLAGS -L/usr/kerberos/lib"
- LIBS="$LIBS -lkrb -ldes"
-fi
-
-if test -f "/usr/athena/include/krb.h"
-then
- CFLAGS="$CFLAGS -DKERBEROS_V4 -I/usr/athena/include"
- LDFLAGS="$LDFLAGS -L/usr/athena/lib"
- LIBS="$LIBS -lkrb -ldes"
-fi
-
-dnl All AC_CHECK_FUNCs must precede the following AC_SUBSTs
+dnl AC_CHECK_FUNC calls that might hack the Makefile must precede
+dnl the following AC_SUBSTs
+AC_SUBST(EXTRADEFS)
AC_SUBST(EXTRASRC)
AC_SUBST(EXTRAOBJ)
-AC_CHECK_FUNCS(tcsetattr stty setsid seteuid gethostbyname res_search herror \
- strrchr strerror setlinebuf syslog snprintf vsnprintf vsyslog atexit)
+AC_CHECK_FUNCS(tcsetattr stty setsid geteuid seteuid gethostbyname \
+ res_search herror strrchr strerror setlinebuf syslog \
+ snprintf vprintf vsnprintf vsyslog \
+ atexit inet_aton strftime setrlimit socketpair sigprocmask)
# Under Red Hat 4.0 (and many other Linuxes) -lresolv is seriously flaky
# and breaks gethostbyname(2). It's better to use the bind stuff in the C
[AC_DEFINE(HAVE_VOIDPOINTER) AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no))
+dnl Check for ANSI volatile
+AC_MSG_CHECKING(for ANSI volatile)
+AC_TRY_COMPILE([],
+ [volatile int n;],
+ [AC_DEFINE(HAVE_VOLATILE) AC_MSG_RESULT(yes)],
+ AC_MSG_RESULT(no))
+
dnl Check out the wait reality. We have to assume sys/wait.h is present.
AC_CHECK_FUNCS(waitpid wait3)
AC_MSG_CHECKING(for union wait);
[AC_DEFINE(SYS_SIGLIST_DECLARED) AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no))
-AC_OUTPUT(Makefile, [
-# Makefile uses this timestamp file to know when to remake Makefile,
-# build.sh, and glob/Makefile.
-touch stamp-config])
+# Find the right directory to put the root-mode PID file in
+for dir in "/var/run" "/etc"
+do
+ if test -d $dir
+ then
+ break;
+ fi
+done
+AC_MSG_RESULT(root-mode pid file will go in $dir)
+AC_DEFINE_UNQUOTED(PID_DIR, "$dir")
+
+AC_CHECK_SIZEOF(short)
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(long)
+
+if test "$USE_NLS" = "yes"
+then
+ echo 'Enabling internationalization support...'
+ POMAKE='$(MAKE) -C po'
+ if test "x$prefix" != xNONE; then
+ EXTRADEFS="$EXTRADEFS -DLOCALEDIR='\"$prefix/share/locale\"'"
+ else
+ EXTRADEFS="$EXTRADEFS -DLOCALEDIR='\"$ac_default_prefix/share/locale\"'"
+ fi
+else
+ echo 'Disabling internationalization support...'
+ POMAKE="@echo '(NLS support disabled)'; #"
+fi
+
+### use option --enable-POP2 to compile in the POP2 support
+AC_ARG_ENABLE(POP2,
+ [ --enable-POP2 compile in POP2 protocol support (obsolete)],
+ [with_POP2=$enableval],
+ [with_POP2=no])
+test "$with_POP2" = "yes" && AC_DEFINE(POP2_ENABLE)
+
+### use option --disable-POP3 to omit the POP3 support
+AC_ARG_ENABLE(POP3,
+ [ --disable-POP3 don't compile in POP3 protocol support],
+ [with_POP3=$enableval],
+ [with_POP3=yes])
+test "$with_POP3" = "yes" && AC_DEFINE(POP3_ENABLE)
+
+### use option --disable-IMAP to omit the IMAP support
+AC_ARG_ENABLE(IMAP,
+ [ --disable-IMAP don't compile in IMAP protocol support],
+ [with_IMAP=$enableval],
+ [with_IMAP=yes])
+test "$with_IMAP" = "yes" && AC_DEFINE(IMAP_ENABLE)
+
+### use option --disable-ETRN to omit the ETRN support
+AC_ARG_ENABLE(ETRN,
+ [ --disable-ETRN don't compile in ETRN protocol support],
+ [with_ETRN=$enableval],
+ [with_ETRN=yes])
+test "$with_ETRN" = "yes" && AC_DEFINE(ETRN_ENABLE)
+
+### use option --enable-RPA to compile in the RPA support
+AC_ARG_ENABLE(RPA,
+ [ --enable-RPA compile in RPA protocol support],
+ [with_RPA=$enableval],
+ [with_RPA=no])
+test "$with_RPA" = "yes" && AC_DEFINE(RPA_ENABLE)
+
+### use option --enable-SDPS to compile in the SDPS support
+AC_ARG_ENABLE(SDPS,
+ [ --enable-SDPS compile in SDPS protocol support],
+ [with_SDPS=$enableval],
+ [with_SDPS=no])
+test "$with_SDPS" = "yes" && AC_DEFINE(SDPS_ENABLE)
+
+### use option --enable-opie to compile in the OPIE support
+AC_ARG_ENABLE(opie,
+ [ --enable-opie support OTP through the OPIE library],
+ [ AC_CHECK_HEADER(opie.h,, [echo 'configure: cannot find <opie.h>, which is required for OPIE support.'; exit 1])
+ AC_CHECK_LIB(opie,opiegenerator,, [echo 'configure: cannot find libopie, which is required for OPIE support.'; exit 1])
+ AC_DEFINE(OPIE,1) ],
+ [with_opie=no])
+
+AC_ARG_ENABLE(inet6,
+ [ --enable-inet6 support IPv6 (requires the inet6-apps library)],
+ [ unset ac_cv_lib_inet6_getaddrinfo; AC_CHECK_LIB(inet6, getaddrinfo,,
+ [ unset ac_cv_lib_inet6_getaddrinfo; LDFLAGS="$LDFLAGS -L/usr/inet6/lib"; AC_CHECK_LIB(inet6, getaddrinfo,,
+ [ echo 'configure: cannot find libinet6, which is required for IPv6 support.'; exit 1]) ])
+ AC_DEFINE(INET6, 1) ])
+
+AC_ARG_ENABLE(netsec,
+ [ --enable-netsec support network security (requires inet6-apps library)],
+ [ unset ac_cv_lib_inet6_net_security_strtorequest; AC_CHECK_LIB(inet6, net_security_strtorequest,,
+ [ unset ac_cv_lib_inet6_net_security_strtorequest; LDFLAGS="$LDFLAGS -L/usr/inet6/lib"; AC_CHECK_LIB(inet6, net_security_strtorequest,,
+ [ echo 'configure: cannot find net_security_strtorequest in libinet6, which is required';
+ echo ' for network security support. Either it does not exist, or it was';
+ echo ' not built with network security support enabled.';
+ exit 1]) ])
+ unset ac_cv_header_net_security_h; AC_CHECK_HEADER(net/security.h,,
+ [ unset ac_cv_header_net_security_h; CPPFLAGS="$CPPFLAGS -I/usr/inet6/include"; CFLAGS="$CFLAGS -I/usr/inet6/include"; AC_CHECK_HEADER(net/security.h,,
+ [ echo 'configure: cannot find <net/security.h>, which is required for network security';
+ echo ' support.';
+ exit 1]) ])
+ AC_DEFINE(NET_SECURITY, 1) ])
+
+### use option --with-kerberos5=DIR to point at a Kerberos 5 directory
+AC_ARG_WITH(kerberos5,
+ [ --with-kerberos5=DIR point fetchmail compilation at a Kerberos 5 directory])
+
+# The "then" arm (nonempty $with_kerberos5) is kind of a crock. It works for
+# configuring the BSD/OS Kerberos IV support, though.
+if test -n "$with_kerberos5"
+then
+ # Path given
+ CEFLAGS="$CEFLAGS -DKERBEROS_V5 -I$with_kerberos5/include"
+ LDEFLAGS="$LDEFLAGS -L$with_kerberos5/lib"
+ LIBS="$LIBS -lkrb5 -lcrypto -lcom_err"
+else
+ for dir in /usr/kerberos /usr/local/krb5 /usr/athena
+ do
+ if test -f "$dir/include/krb5.h"
+ then
+ CEFLAGS="$CEFLAGS -DKERBEROS_V5 -I$dir/include"
+ LDEFLAGS="$LDEFLAGS -L$dir/lib"
+ LIBS="$LIBS -lkrb5 -lcrypto -lcom_err"
+ with_kerberos5=$dir
+ break
+ fi
+ done
+fi
+
+### use option --with-kerberos=DIR to point at a Kerberos directory
+AC_ARG_WITH(kerberos,
+ [ --with-kerberos=DIR point fetchmail compilation at a Kerberos directory])
+
+# The "elif" arm (nonempty $with_kerberos) is kind of a crock. It works for
+# configuring the BSD/OS Kerberos IV support, though.
+
+# Check for a NetBSD special case
+if test "$with_kerberos" = "yes" -a `uname` = "NetBSD"
+then
+ echo "Configuring kerberosIV for NetBSD"
+ CEFLAGS="$CEFLAGS -DKERBEROS_V4 -I/usr/include/kerberosIV"
+ LIBS="$LIBS -lkrb -ldes"
+elif test -n "$with_kerberos" -a -n "$with_kerberos5"
+then
+ CEFLAGS="$CEFLAGS -DKERBEROS_V4 -I$with_kerberos/include"
+ LDEFLAGS="$LDEFLAGS -L$with_kerberos/lib"
+ LIBS="-lkrb4 -ldes425 $LIBS"
+elif test -n "$with_kerberos5"
+then
+ for dir in /usr/kerberos /usr/kerberosIV /usr/athena
+ do
+ if test -f "$dir/include/kerberosIV/krb.h"
+ then
+ CEFLAGS="$CEFLAGS -DKERBEROS_V4 -I$dir/include"
+ LDEFLAGS="$LDEFLAGS -L$dir/lib"
+ LIBS="-lkrb4 -ldes425 $LIBS"
+ break
+ fi
+ done
+elif test -n "$with_kerberos"
+then
+ CEFLAGS="$CEFLAGS -DKERBEROS_V4 -I$with_kerberos/include"
+ LDEFLAGS="$LDEFLAGS -L$with_kerberos/lib"
+ LIBS="$LIBS -lkrb -ldes"
+else
+ for dir in /usr/kerberos /usr/kerberosIV /usr/athena
+ do
+ if test -f "$dir/include/krb.h"
+ then
+ CEFLAGS="$CEFLAGS -DKERBEROS_V4 -I$dir/include"
+ LDEFLAGS="$LDEFLAGS -L$dir/lib"
+ LIBS="$LIBS -lkrb -ldes"
+ break
+ fi
+ done
+fi
+
+### use option --with-socks=DIR to point at SOCKS library
+AC_ARG_WITH(socks,
+ [ --with-socks[=DIR] add built-in SOCKS firewall access],
+[
+if test "$with_socks" != no
+then
+ if test "$with_socks" != yes
+ then
+ LDEFLAGS="$LDEFLAGS -L$with_socks"
+ else
+ AC_CHECK_LIB(socks, Rconnect,,
+ AC_MSG_ERROR([could not find libsocks which is needed for built-in SOCKS support]))
+ fi
+ AC_DEFINE(HAVE_SOCKS)
+ CEFLAGS="$CEFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
+ LIBS="-lsocks $LIBS"
+fi])
+
+### use option --with-hesiod=DIR to point at a HESIOD directory
+AC_ARG_WITH(hesiod,
+ [ --with-hesiod=DIR point fetchmail compilation at a HESIOD directory])
+
+if test -n "$with_hesiod"
+then
+ # Path given
+ CEFLAGS="$CEFLAGS -DHESIOD -I$with_hesiod/include"
+ LDEFLAGS="$LDEFLAGS -L$with_hesiod/lib"
+ LIBS="$LIBS -lhesiod"
+else
+ for dir in /usr/athena /usr /usr/local
+ do
+ if test -f "$dir/include/hesiod.h"
+ then
+ CEFLAGS="$CEFLAGS -DHESIOD -I$dir/include"
+ LDEFLAGS="$LDEFLAGS -L$dir/lib"
+ LIBS="$LIBS -lhesiod"
+ with_hesiod=$dir
+ break
+ fi
+ done
+fi
+
+### use option --with-gssapi=DIR to compile in GSSAPI support
+AC_ARG_WITH(gssapi,
+ [ --with-gssapi[=DIR] compile in GSSAPI support using libraries in DIR],
+[
+if test "$with_gssapi" != "no"
+then
+ if test "$with_gssapi" = "yes" -a -n "$with_kerberos5"
+ then
+ with_gssapi=$with_kerberos5
+ fi
+ if test "$with_gssapi" != "yes" -a -n "$with_gssapi"
+ then
+ CFLAGS="$CFLAGS -I$with_gssapi/include"
+ LDFLAGS="$LDFLAGS -L$with_gssapi/lib"
+ fi
+
+ AC_CHECK_LIB(krb5, krb5_init_context,,
+ AC_MSG_ERROR([could not find libkrb5 which is needed for GSSAPI support]))
+ AC_CHECK_LIB(gssapi_krb5, gss_init_sec_context,,
+ AC_MSG_ERROR([could not find libgssapi_krb5 which is needed for GSSAPI support]), -lkrb5)
+ AC_DEFINE(GSSAPI)
+ LIBS="$LIBS -lgssapi_krb5 -lkrb5"
+fi])
+
+AC_OUTPUT([Makefile intl/Makefile po/Makefile.in], [
+ # The reason for this odd makedepend line is that we want
+ # to have all dependencies evaluated relative to the source directory
+ # and let VPATH do all the dirty work when we build remotely
+ echo "You can ignore any makedepend error messages";
+ (cd $srcdir; makedepend -f - *.c) >>Makefile])
dnl Local Variables:
dnl comment-start: "dnl "