From dbb34b1d0800a6ebe99adf437969e81a08c404ae Mon Sep 17 00:00:00 2001 From: ueno Date: Fri, 17 Nov 2000 16:25:05 +0000 Subject: [PATCH] * configure.in: Rewrite. * starttls.c: Use `NEED_ADDRINFO_H' instead of `HAVE_GETADDRINFO'. --- configure.in | 75 ++++++++++++++++++++++++++-------------------------------- starttls.c | 4 ++-- 2 files changed, 35 insertions(+), 44 deletions(-) diff --git a/configure.in b/configure.in index f737add..9ad79be 100644 --- a/configure.in +++ b/configure.in @@ -9,58 +9,49 @@ AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_RANLIB -AC_CHECK_HEADERS(libgen.h sys/select.h socks.h netinet6/in6.h) +AC_CHECK_HEADERS(libgen.h sys/select.h socks.h) AC_CHECK_LIB(nsl, gethostbyname) AC_CHECK_LIB(socket, socket) - AC_CHECK_TYPE(fd_set, int) +AC_REPLACE_FUNCS(basename getaddrinfo) -dnl checking if the system supports ipv6 address space or not -AC_CACHE_CHECK([for struct in6_addr], ac_cv_struct_in6_addr, -[AC_TRY_COMPILE([#include -#include -#include -#include ], [struct in6_addr v6; v6.s6_addr32[3];], -ac_cv_struct_in6_addr=yes, ac_cv_struct_in6_addr=no)]) -test "x$ac_cv_struct_in6_addr" = "xyes" && AC_DEFINE(HAVE_IN6_ADDR) +AC_CACHE_CHECK([for struct addrinfo], ac_cv_struct_addrinfo, +[AC_TRY_COMPILE([#include +], [struct addrinfo a], +ac_cv_struct_addrinfo=yes, ac_cv_struct_addrinfo=no)]) +if test "$ac_cv_struct_addrinfo" = "yes"; then + AC_DEFINE(HAVE_ADDRINFO) +else + AC_DEFINE(NEED_ADDRINFO_H) +fi -dnl checking if the system supports tcp over ipv6 support or not -AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_struct_sockaddr_in6, -[AC_TRY_COMPILE([#include -#include -#include -#include ], [struct sockaddr_in6 v6; v6.sin6_addr;], -ac_cv_struct_sockaddr_in6=yes, ac_cv_struct_sockaddr_in6=no)]) -test "x$ac_cv_struct_sockaddr_in6" = "xyes" && AC_DEFINE(HAVE_SOCKADDR_IN6) +AC_CACHE_CHECK([for NI_MAXSERV], ac_cv_ni_maxserv, +[AC_EGREP_CPP(yes, [#include +#ifdef NI_MAXSERV +yes +#endif +], ac_cv_ni_maxserv=yes, ac_cv_ni_maxserv=no)]) +test "$ac_cv_ni_maxserv" = "yes" || AC_DEFINE(NEED_ADDRINFO_H) + +AC_CACHE_CHECK([for NI_NOFQDN], ac_cv_ni_nofqdn, +[AC_EGREP_CPP(yes, [#include +#ifdef NI_NOFQDN +yes +#endif +], ac_cv_ni_nofqdn=yes, ac_cv_ni_nofqdn=no)]) +test "$ac_cv_ni_nofqdn" = "yes" || AC_DEFINE(NEED_ADDRINFO_H) -dnl -dnl Test for OpenSSL -dnl AC_ARG_WITH(openssl,[ --with-openssl=PATH use OpenSSL from PATH]) -case "$with_openssl" in - yes|"") - with_openssl=${prefix}/ssl -esac - -CPPFLAGS="${CPPFLAGS} -I${with_openssl}/include" -AC_CHECK_HEADER(openssl/ssl.h,,with_openssl="no") - -LDFLAGS="${LDFLAGS} -L${with_openssl}/lib" -AC_CHECK_LIB(crypto,BIO_accept,LIBS=" -lcrypto ${LIBS}",with_openssl="no") -AC_CHECK_LIB(ssl,SSL_CTX_new,LIBS=" -lssl ${LIBS}",with_openssl="no") - -AC_MSG_CHECKING(for openssl) -AC_MSG_RESULT($with_openssl) - -if test "$with_openssl" != "no"; then - AC_DEFINE(HAVE_SSL) -else -AC_MSG_ERROR("Unable to find openssl libraries.") -exit 1; +if test -n "$with_openssl"; then + CPPFLAGS="${CPPFLAGS} -I${with_openssl}/include" + LDFLAGS="${LDFLAGS} -L${with_openssl}/lib" fi -AC_REPLACE_FUNCS(basename getaddrinfo) +AC_CHECK_HEADER(openssl/ssl.h, [ + AC_CHECK_LIB(crypto, BIO_accept, LIBS="-lcrypto ${LIBS}") + AC_CHECK_LIB(ssl, SSL_CTX_new, LIBS="-lssl ${LIBS}")], + AC_MSG_ERROR([OpenSSL not installed - please install first])) AC_OUTPUT(Makefile) diff --git a/starttls.c b/starttls.c index 7268983..6b78ca6 100644 --- a/starttls.c +++ b/starttls.c @@ -53,9 +53,9 @@ #include #endif -#ifndef HAVE_GETADDRINFO +#ifdef NEED_ADDRINFO_H #include "addrinfo.h" -#endif /* !HAVE_GETADDRINFO */ +#endif #include #include -- 1.7.10.4