James Ralston <qralston+ml.inn-workers at andrew.cmu.edu> writes:
> If you feel it's a bug that glibc doesn't make certain symbols visible
> unless certain feature-test macros are used, then the proper course of
> action is to report that bug to the glibc maintainers. But until the
> glibc maintainers change the behavior (if they ever do), on glibc
> systems, please take the pragmatic approach of setting the _GNU_SOURCE
> macro. If you don't, based on what I saw from the hour or so I spent
> slogging through the glibc feature-test macros, you and the rest of the
> active INN developers are going to wind up wasting lots of time tracking
> down annoying little bugs--bugs that will all ultimately stem from the
> decision to deliberately disdain the feature-test macros on glibc
> systems.
Okay, I looked at all of this again, and I'm committing the following
patch now to fix the pread/pwrite problems by defining _GNU_SOURCE on
Linux. I'm not quite sure what to do about STABLE; I think it's probably
easiest to leave it broken since we needed the symbol renaming patch in
CURRENT to be able to do this.
People should yell if I broke anything. (This also fiddles with the way
that SSL is detected, as there were various latent problems with the old
mechanism on systems where link order mattered.)
Index: configure.in
===================================================================
RCS file: /dist1/cvs/isc/inn/inn/configure.in,v
retrieving revision 1.207
diff -u -r1.207 configure.in
--- configure.in 2001/07/18 14:37:21 1.207
+++ configure.in 2001/07/19 05:29:19
@@ -353,23 +351,34 @@
if test x"$OPENSSL_DIR" = xyes ; then
AC_MSG_ERROR(Can not find OpenSSL)
else
+ AC_MSG_RESULT($OPENSSL_DIR)
SSL_BIN="${OPENSSL_DIR}/bin"
SSL_INC="-I${OPENSSL_DIR}/include"
- AC_MSG_RESULT($OPENSSL_DIR)
- SSL_LIB="-L${OPENSSL_DIR}/lib"
+
+ # This is mildly tricky. In order to satisfy most linkers, libraries
+ # have to be listed in the right order, which means that libraries
+ # with dependencies on other libraries need to be listed first. But
+ # the -L flag for the OpenSSL library directory needs to go first of
+ # all. So put the -L flag into LIBS and accumulate actual libraries
+ # into SSL_LIB, and then at the end, restore LIBS and move -L to the
+ # beginning of SSL_LIB.
+ inn_save_LIBS=$LIBS
+ LIBS="$LIBS -L${OPENSSL_DIR}/lib"
+ SSL_LIB=''
AC_CHECK_LIB(rsaref, RSAPublicEncrypt,
[AC_CHECK_LIB(RSAglue, RSAPublicEncrypt,
- SSL_LIB="-lRSAglue -lrsaref ${SSL_LIB}",,-lrsaref $SSL_LIB)]
- ,,$SSL_LIB)
- AC_CHECK_LIB(ssl, SSL_CTX_new,
- SSL_LIB="${SSL_LIB} -lssl";
- [AC_MSG_ERROR(Can not find OpenSSL)],
- $SSL_LIB)
- AC_CHECK_LIB(crypto,BIO_accept,
- SSL_LIB="${SSL_LIB} -lcrypto",
- [AC_DEFINE(HAVE_SSL, 1, [Define if OpenSSL is available.])],
- [AC_MSG_ERROR(Can not find OpenSSL)],
- $SSL_LIB)
+ [SSL_LIB="-lRSAglue -lrsaref"], , -lrsaref)])
+ AC_CHECK_LIB(crypto, BIO_new,
+ SSL_LIB="-lcrypto $SSL_LIB",
+ [AC_MSG_ERROR(Can not find OpenSSL)],
+ $SSL_LIB)
+ AC_CHECK_LIB(ssl, SSL_library_init,
+ [SSL_LIB="-lssl $SSL_LIB"],
+ [AC_MSG_ERROR(Can not find OpenSSL)],
+ $SSL_LIB)
+ SSL_LIB="-L${OPENSSL_DIR}/lib $SSL_LIB"
+ LIBS=$inn_save_LIBS
+ AC_DEFINE(HAVE_SSL, 1, [Define if OpenSSL is available.])
fi
fi
AC_SUBST(SSL_BIN)
@@ -764,6 +776,14 @@
AC_MSG_RESULT(no)
AC_MSG_ERROR([Large files not supported on this platform])
;;
+ *-linux*)
+ AC_MSG_RESULT(maybe)
+ LFS_CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
+ LFS_LDFLAGS=""
+ LFS_LIBS=""
+ AC_DEFINE([_GNU_SOURCE], 1,
+ [Some versions of glibc need this defined for pread/pwrite.])
+ ;;
*-solaris*)
AC_MSG_RESULT(ok)
AC_PATH_PROG(GETCONF, getconf)
--
Russ Allbery (rra at stanford.edu) <http://www.eyrie.org/~eagle/>