Fix a couple of bugs in OpenSSL detection. Also, deal better when there are multiple SSLs installed.

svn:r6148
This commit is contained in:
Nick Mathewson 2006-03-13 04:58:46 +00:00
parent 94dac6b139
commit b318bd8989

View File

@ -165,12 +165,13 @@ AC_CACHE_CHECK([whether we need extra options to link libevent],
ac_cv_libevent_linker_option, [ ac_cv_libevent_linker_option, [
saved_LDFLAGS="$LDFLAGS" saved_LDFLAGS="$LDFLAGS"
le_runs=no le_runs=no
linked_with=nothing
for le_extra in "" "-Wl,-R$le_libdir" "-R$le_libdir" ; do for le_extra in "" "-Wl,-R$le_libdir" "-R$le_libdir" ; do
LDFLAGS="$le_extra $saved_LDFLAGS" LDFLAGS="$le_extra $saved_LDFLAGS"
AC_TRY_RUN([void *event_init(void); AC_TRY_RUN([void *event_init(void);
int main(int c, char **v) { int main(int c, char **v) {
event_init(); return 0; event_init(); return 0;
}], }],
libevent_runs=yes, libevent_runs=no) libevent_runs=yes, libevent_runs=no)
if test $libevent_runs = yes ; then if test $libevent_runs = yes ; then
if test -z "$le_extra" ; then if test -z "$le_extra" ; then
@ -254,6 +255,7 @@ AC_CACHE_CHECK([whether we need extra options to link OpenSSL],
ac_cv_openssl_linker_option, [ ac_cv_openssl_linker_option, [
saved_LDFLAGS="$LDFLAGS" saved_LDFLAGS="$LDFLAGS"
ssl_runs=no ssl_runs=no
linked_with=nothing
for ssl_extra in "" "-Wl,-R$ssl_libdir" "-R$ssl_libdir" ; do for ssl_extra in "" "-Wl,-R$ssl_libdir" "-R$ssl_libdir" ; do
LDFLAGS="$ssl_extra $saved_LDFLAGS" LDFLAGS="$ssl_extra $saved_LDFLAGS"
AC_TRY_RUN([ AC_TRY_RUN([
@ -269,22 +271,40 @@ int main(void)
], ],
openssl_runs=yes, openssl_runs=no) openssl_runs=yes, openssl_runs=no)
if test $openssl_runs = yes ; then if test $openssl_runs = yes ; then
if test -z "$ssl_extra" ; then if test "$linked_with" = nothing; then
ac_cv_openssl_linker_option='(none)' linked_with="$ssl_extra"
else
ac_cv_openssl_linker_option=$ssl_extra
fi fi
ssl_runs=yes AC_TRY_RUN([
break #include <openssl/opensslv.h>
fi int main(void) { return OPENSSL_VERSION_NUMBER == SSLeay(); }],
right_version=yes, right_version=no)
if test "$right_version" = yes; then
if test -z "$ssl_extra" ; then
ac_cv_openssl_linker_option='(none)'
else
ac_cv_openssl_linker_option=$ssl_extra
fi
ssl_runs=yes
break
fi
fi
done done
if test ssl_runs = no ; then if test $ssl_runs = no ; then
AC_MSG_ERROR([Found linkable OpenSSL in $ac_cv_openssl_dir, but it doesn't run, even with -R. Maybe specify another using --with-ssl-dir?]) if test "$linked_with" = 'nothing' ; then
AC_MSG_ERROR([Found linkable OpenSSL in $ac_cv_openssl_dir, but it doesn't run, even with -R. Maybe specify another using --with-ssl-dir?])
else
if test -z "$linked_with" ; then
ac_cv_openssl_linker_option='(none)'
else
ac_cv_openssl_linker_option=$linked_with
fi
AC_MSG_WARN([I managed to make OpenSSL link and run, but I couldn't make it run with the same version as the headers made us expect.])
fi
fi fi
LDFLAGS="$saved_LDFLAGS" LDFLAGS="$saved_LDFLAGS"
]) ])
if test $ac_cv_openssl_linker_option != '(none)' ; then if test "$ac_cv_openssl_linker_option" != '(none)' ; then
LDFLAGS="$ac_cv_openssl_linker_option $LDFLAGS" LDFLAGS="$ac_cv_openssl_linker_option $LDFLAGS"
fi fi