aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2007-12-26 14:37:09 +0000
committerMatthias Andree <matthias.andree@gmx.de>2007-12-26 14:37:09 +0000
commite7189017e19dd5162f40a91050a730c5de982d9a (patch)
tree678ce6efc0e26688e0686d8dbe7bab7a3fcb9b77 /configure.ac
parentd723cc008d7793334260e6ac0d7412ce13e1cf29 (diff)
downloadfetchmail-e7189017e19dd5162f40a91050a730c5de982d9a.tar.gz
fetchmail-e7189017e19dd5162f40a91050a730c5de982d9a.tar.bz2
fetchmail-e7189017e19dd5162f40a91050a730c5de982d9a.zip
Merge portability patch from Peter O'Gorman, fetchmail-devel 2007-10-31.
This requires some minor fixes though. svn path=/branches/BRANCH_6-3/; revision=5145
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac118
1 files changed, 77 insertions, 41 deletions
diff --git a/configure.ac b/configure.ac
index 6e06ba16..3433a5c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,11 +49,17 @@ AC_HEADER_TIME
AC_TYPE_SIZE_T
AC_TYPE_PID_T
AC_TYPE_SIGNAL
-AC_CHECK_TYPE(u_int32_t,unsigned int)
AC_CHECK_HEADERS([unistd.h termios.h termio.h sgtty.h stdarg.h \
sys/itimer.h fcntl.h sys/fcntl.h memory.h sys/wait.h \
- arpa/inet.h arpa/nameser.h netinet/in.h net/socket.h \
+ arpa/inet.h arpa/nameser.h netinet/in.h net/socket.h netdb.h \
sys/select.h sys/socket.h sys/time.h langinfo.h])
+AC_CHECK_TYPE(u_int32_t,,
+ AC_DEFINE(u_int32_t,unsigned int,
+ [Define to unsigned int if <sys/types.h> does not define.]),
+ [AC_INCLUDES_DEFAULT
+#ifdef HAVE_ARPA_NAMESER_H
+#include <arpa/nameser.h>
+#endif])
AC_CHECK_HEADERS([resolv.h],,,[
#include <sys/types.h>
#ifdef HAVE_NETINET_IN_H
@@ -74,7 +80,7 @@ AC_PROG_YACC
case $target_os in
darwin*)
AC_MSG_NOTICE(found Darwin - Adding -DBIND_8_COMPAT to CFLAGS)
- CPFLAGS="-DBIND_8_COMPAT"
+ CPPFLAGS="$CPPFLAGS -DBIND_8_COMPAT"
;;
# Check for FreeBSD special case: more libs needed
freebsd*)
@@ -88,7 +94,7 @@ lynxos*)
LIBS="$LIBS -lbsd"
LDFLAGS=`echo $LDFLAGS | sed "s/-s //"`
AC_MSG_NOTICE(found LynxOS - Prepending standard include path to gcc flags)
- CPFLAGS="-I/usr/include"
+ CPPFLAGS="$CPPFLAGS -I/usr/include"
;;
# Check for Rhapsody special case: it doesn't like -s
rhapsody*)
@@ -431,13 +437,47 @@ AC_ARG_ENABLE(opie,
[with_opie=no])
test "$with_opie" = "yes" && AC_DEFINE(OPIE_ENABLE,1,Define if you want OPIE support compiled in)
-AC_SEARCH_LIBS(getaddrinfo, inet6, [AC_DEFINE(HAVE_GETADDRINFO,1,[define to 1 if you have the getaddrinfo function])])
-AC_CHECK_FUNCS(getnameinfo inet_ntop)
-AM_CONDITIONAL(NEED_GETADDRINFO, test "$ac_cv_search_getaddrinfo" != "none required")
-AM_CONDITIONAL(NEED_GETNAMEINFO, test "$ac_cv_func_getnameinfo" != yes)
+dnl Mostly stolen from gnulib's getaddrinfo.m4
+AC_SEARCH_LIBS(getaddrinfo, [nsl socket])
+AC_CACHE_CHECK([for getaddrinfo],[fm_cv_getaddrinfo],[
+ AC_TRY_LINK([
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+ ], [getaddrinfo(0, 0, 0, 0);],
+ [ fm_cv_getaddrinfo=yes],
+ [ fm_cv_getaddrinfo=no ])
+])
+
+if test x"$fm_cv_getaddrinfo" = "xyes"; then
+ AC_DEFINE(HAVE_GETADDRINFO, 1,
+ [Define to 1 if you have the getaddrinfo function.])
+fi
+AC_CACHE_CHECK([for getnameinfo],[fm_cv_getnameinfo],[
+ AC_TRY_LINK([
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+ ], [getnameinfo(NULL,0, NULL,0, NULL, 0, 0);],
+ [ fm_cv_getnameinfo=yes],
+ [ fm_cv_getnameinfo=no ])
+])
+
+AM_CONDITIONAL(NEED_GETADDRINFO, test "$fm_cv_getaddrinfo" != yes)
+AM_CONDITIONAL(NEED_GETNAMEINFO, test "$fm_cv_getnameinfo" != yes)
+
+AC_CHECK_FUNCS(inet_ntop)
dnl Check if getaddrinfo is async-signal-safe - most implementations aren't
-if test "$ac_cv_search_getaddrinfo" = "none required" ; then
+if test "$fm_cv_getaddrinfo" = yes ; then
AC_MSG_CHECKING(if your getaddrinfo is async-signal-safe)
gai_ts=no
dnl we have getaddrinfo() - check if the OS is known to have a async-signal-safe implementation
@@ -481,23 +521,23 @@ then
AS_MESSAGE(checking kerberosV for OpenBSD...)
AC_DEFINE(HEIMDAL,1,Define if you have HEIMDAL kerberos 5)
AC_DEFINE(KERBEROS_V5,1,Define if you have Kerberos V5)
- CEFLAGS="$CEFLAGS -I/usr/include/kerberosV"
+ CFLAGS="$CFLAGS -I/usr/include/kerberosV"
LIBS="$LIBS -lasn1 -lkrb5 -lcom_err -lkafs"
elif krb5-config 2> /dev/null >/dev/null ; then
krb5_prefix=`krb5-config --prefix krb5`
AC_MSG_RESULT([krb5-config points to kerberosV under $krb5_prefix])
if test -f ${krb5_prefix}/include/et/com_err.h && \
! test -f ${krb5_prefix}/include/com_err.h ; then
- CEFLAGS="$CEFLAGS -I${krb5_prefix}/include/et"
+ CFLAGS="$CFLAGS -I${krb5_prefix}/include/et"
fi
unset krb5_prefix
- CEFLAGS="$CEFLAGS `krb5-config --cflags krb5`"
+ CFLAGS="$CFLAGS `krb5-config --cflags krb5`"
LIBS="$LIBS `krb5-config --libs krb5`"
AC_DEFINE(KERBEROS_V5)
else
if test "$with_kerberos5" != "yes"
then
- LDEFLAGS="$LDEFLAGS -L${with_kerberos5}/lib"
+ LDFLAGS="$LDFLAGS -L${with_kerberos5}/lib"
searchdirs="$with_kerberos5"
else
searchdirs="/usr/kerberos /usr/local/krb5 /usr/athena /usr"
@@ -507,7 +547,7 @@ else
do AC_MSG_CHECKING([for Kerberos V in $dir])
if test -f "$dir/include/krb5.h" || test -f "$dir/include/krb5/krb5.h"
then
- if test -d "$dir/include/krb5" ; then CPFLAGS="$CPFLAGS -I$dir/include/krb5" ; fi
+ if test -d "$dir/include/krb5" ; then CPPFLAGS="$CPPFLAGS -I$dir/include/krb5" ; fi
ac_krblibs=
if test -f "$dir/include/roken.h" || test -f "$dir/include/krb5/roken.h"
then
@@ -516,12 +556,12 @@ else
dnl Attempt to detect if we need to -ldb2 to link Heimdal
dnl we assume we do if it is available
AC_CHECK_LIB(db2, db_open, ac_krblibs="$ac_krblibs -ldb2", [],
- ${LDEFLAGS})
+ ${LDFLAGS})
AC_CHECK_LIB(des, des_string_to_key, libk5crypto=-ldes,
AC_CHECK_LIB(ssl, MD5_Init, [],
AC_MSG_ERROR([DES libraries not found. Try adding --with-ssl to enable OpenSSL support]),
- ${LDEFLAGS} ${ac_krblibs}),
- ${LDEFLAGS} ${ac_krblibs})
+ ${LDFLAGS} ${ac_krblibs}),
+ ${LDFLAGS} ${ac_krblibs})
AC_DEFINE(HEIMDAL)
else
AC_MSG_RESULT([found])
@@ -533,15 +573,15 @@ else
krb5_des_string_to_key,
libk5crypto=-lk5crypto,
AC_MSG_ERROR([Kerberos 5 DES libraries not found]),
- ${LDEFLAGS} ${ac_krblibs}),
- ${LDEFLAGS} ${ac_krblibs})
+ ${LDFLAGS} ${ac_krblibs}),
+ ${LDFLAGS} ${ac_krblibs})
fi
AC_CHECK_LIB(krb5, krb5_init_context,[],
continue,
- ${LDEFLAGS} ${ac_krblibs})
+ ${LDFLAGS} ${ac_krblibs})
AC_DEFINE(KERBEROS_V5)
- test "$dir" != "/usr" && CEFLAGS="$CEFLAGS -I$dir/include"
- LDEFLAGS="$LDEFLAGS -L$dir/lib"
+ test "$dir" != "/usr" && CFLAGS="$CFLAGS -I$dir/include"
+ LDFLAGS="$LDFLAGS -L$dir/lib"
LIBS="$LIBS $ac_krblibs $libk5crypto"
with_kerberos5=$dir
break
@@ -569,7 +609,7 @@ if test "$with_kerberos" = "yes" && ( test `uname` = "NetBSD" || test `uname` =
then
AS_MESSAGE(checking kerberosIV for `uname`...)
KERBEROS_V4=1
- CEFLAGS="$CEFLAGS -I/usr/include/kerberosIV"
+ CFLAGS="$CFLAGS -I/usr/include/kerberosIV"
case `uname` in
NetBSD) LIBS="$LIBS -lkrb -ldes -lroken -lcom_err" ;;
OpenBSD) LIBS="$LIBS -lkrb -ldes" ;;
@@ -578,7 +618,7 @@ elif krb4-config 2> /dev/null >/dev/null ; then
krb4_prefix=`krb4-config --prefix`
AC_MSG_RESULT([krb4-config points to kerberosIV under $krb4_prefix])
unset krb4_prefix
- CEFLAGS="$CEFLAGS `krb4-config --cflags`"
+ CFLAGS="$CFLAGS `krb4-config --cflags`"
LIBS="$LIBS `krb4-config --libs`"
KERBEROS_V4=1
elif krb5-config 2> /dev/null >/dev/null ; then
@@ -588,7 +628,7 @@ elif krb5-config 2> /dev/null >/dev/null ; then
AC_DEFINE(KERBEROS_V4_V5,1,Define if you have Kerberos V4 headers under a kerberosIV directory)
fi
unset krb4_prefix
- CEFLAGS="$CEFLAGS `krb5-config --cflags krb4`"
+ CFLAGS="$CFLAGS `krb5-config --cflags krb4`"
LIBS="$LIBS `krb5-config --libs krb4`"
KERBEROS_V4=1
else
@@ -631,8 +671,8 @@ else
fi
KERBEROS_V4=1
test -f "$with_kerberos5/roken.h" && AC_DEFINE(HEIMDAL)
- test "$dir" != "/usr/include" && CEFLAGS="$CEFLAGS -I$dir"
- LDEFLAGS="$LDEFLAGS -L$with_kerberos/lib"
+ test "$dir" != "/usr/include" && CFLAGS="$CFLAGS -I$dir"
+ LDFLAGS="$LDFLAGS -L$with_kerberos/lib"
break
done
if test -z "$with_kerberos" ; then
@@ -695,22 +735,22 @@ then
then
### ssl.h found under openssl. Use openssl configuration preferentially,
AC_MSG_NOTICE(Enabling OpenSSL support in $with_ssl.)
- test "$with_ssl" != "/usr" && CEFLAGS="$CEFLAGS -I$with_ssl/include"
+ test "$with_ssl" != "/usr" && CFLAGS="$CFLAGS -I$with_ssl/include"
### In Red Hat 9, this file includes a reference to <krb5.h>, so we
### force the Kerberos direcory onto the include path so it will build.
- CEFLAGS="$CEFLAGS -I/usr/kerberos/include"
+ CFLAGS="$CFLAGS -I/usr/kerberos/include"
### OpenBSD comes with ssl headers
else
AC_MSG_ERROR([SSL support enabled, but OpenSSL not found])
fi
- LDEFLAGS="$LDEFLAGS -L$with_ssl/lib"
+ LDFLAGS="$LDFLAGS -L$with_ssl/lib"
LIBS="$LIBS -lssl -lcrypto"
dnl check if -ldl is needed
AC_MSG_CHECKING([for additional library dependencies of SSL])
found=0
save_LIBS="$LIBS"
for i in "" "-ldl" ; do
- LIBS="$LDEFLAGS $save_LIBS $i"
+ LIBS="$LDFLAGS $save_LIBS $i"
AC_LINK_IFELSE([AC_LANG_PROGRAM(,[SSL_library_init()])],[found=1; break])
done
if test $found = 0 ; then
@@ -734,13 +774,13 @@ if test "$with_socks" != no
then
if test "$with_socks" != yes
then
- LDEFLAGS="$LDEFLAGS -L$with_socks"
+ LDFLAGS="$LDFLAGS -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,1,Define if you want built-in SOCKS support)
- CEFLAGS="$CEFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
+ CFLAGS="$CFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
LIBS="-lsocks $LIBS"
fi])
@@ -752,14 +792,14 @@ if test "$with_socks5" != no
then
if test "$with_socks5" != yes
then
- LDEFLAGS="$LDEFLAGS -L$with_socks5"
+ LDFLAGS="$LDFLAGS -L$with_socks5"
fi
ac_savedLDFLAGS="$LDFLAGS"
- LDFLAGS="$LDEFLAGS $LDFLAGS"
+ LDFLAGS="$LDFLAGS $LDFLAGS"
AC_CHECK_LIB(socks5, SOCKSconnect,,
AC_MSG_ERROR([could not find libsocks5 which is needed for built-in SOCKS5 support]))
AC_DEFINE(HAVE_SOCKS)
- CEFLAGS="$CEFLAGS -Dconnect=SOCKSconnect -Dgetsockname=SOCKSgetsockname -Dbind=SOCKSbind -Daccept=SOCKSaccept -Dlisten=SOCKSlisten -Dselect=SOCKSselect -Drecvfrom=SOCKSrecvfrom -Dsendto=SOCKSsendto -Drecv=SOCKSrecv -Dsend=SOCKSsend -Dread=SOCKSread -Dwrite=SOCKSwrite -Drresvport=SOCKSrresvport -Dshutdown=SOCKSshutdown -Dlisten=SOCKSlisten -Dclose=SOCKSclose -Ddup=SOCKSdup -Ddup2=SOCKSdup2 -Dgethostbyname=SOCKSgethostbyname"
+ CFLAGS="$CFLAGS -Dconnect=SOCKSconnect -Dgetsockname=SOCKSgetsockname -Dbind=SOCKSbind -Daccept=SOCKSaccept -Dlisten=SOCKSlisten -Dselect=SOCKSselect -Drecvfrom=SOCKSrecvfrom -Dsendto=SOCKSsendto -Drecv=SOCKSrecv -Dsend=SOCKSsend -Dread=SOCKSread -Dwrite=SOCKSwrite -Drresvport=SOCKSrresvport -Dshutdown=SOCKSshutdown -Dlisten=SOCKSlisten -Dclose=SOCKSclose -Ddup=SOCKSdup -Ddup2=SOCKSdup2 -Dgethostbyname=SOCKSgethostbyname"
AC_CHECK_FUNC(SOCKSfclose, [CFLAGS="$CFLAGS -Dfclose=SOCKSfclose"])
LDFLAGS="$ac_savedLDFLAGS"
fi])
@@ -816,7 +856,7 @@ then
fi
AC_DEFINE(GSSAPI,1,Define if you want GSSAPI authentication)
if test "$with_gssapi" != yes ; then
- CPPFLAGS="-I$with_gssapi/include"
+ CPPFLAGS="$CPPFLAGS-I$with_gssapi/include"
fi
AC_CHECK_HEADERS(gss.h gssapi.h gssapi/gssapi.h gssapi/gssapi_generic.h)
if test "$ac_cv_header_gssapi_h" = "yes"; then
@@ -826,10 +866,6 @@ then
fi
fi])
-AC_SUBST(CPFLAGS)
-AC_SUBST(CEFLAGS)
-AC_SUBST(LDEFLAGS)
-
dnl ,------------------------------------------------------------------
dnl Check if we need TRIO
needtrio=0