import from HEAD:
[freeradius.git] / configure.in
index 02eae0c..28ba5ef 100644 (file)
@@ -26,7 +26,7 @@ AC_REVISION($Revision$)dnl
 
 dnl # The version of the software
 RADIUSD_MAJOR_VERSION=1
-RADIUSD_MINOR_VERSION=1.0-pre0
+RADIUSD_MINOR_VERSION=1.1
 RADIUSD_VERSION="${RADIUSD_MAJOR_VERSION}.${RADIUSD_MINOR_VERSION}"
 
 dnl #############################################################
@@ -263,29 +263,28 @@ AC_ARG_WITH(experimental-modules,
 )
 
 dnl #
-dnl # extra argument: --openssl-includes=dir
+dnl # extra argument: --with-openssl-includes=dir
 dnl #
+OPENSSL_INCLUDE_DIR=
 AC_ARG_WITH(openssl-includes,
 [  --with-openssl-includes=DIR      Directory to look for OpenSSL include files],
 [ case "$withval" in
-    *) OPENSSL_INCLUDE="$withval"
+    *) OPENSSL_INCLUDE_DIR="$withval"
        ;;
   esac ]
 )
-AC_SUBST(OPENSSL_INCLUDE)
 
 dnl #
-dnl # extra argument: --openssl-libraries=dir
+dnl # extra argument: --with-openssl-libraries=dir
 dnl #
+OPENSSL_LIB_DIR=
 AC_ARG_WITH(openssl-libraries,
 [  --with-openssl-libraries=DIR     Directory to look for OpenSSL library files],
 [ case "$withval" in
-    *) OPENSSL_LIBS="$withval"
+    *) OPENSSL_LIB_DIR="$withval"
        ;;
   esac ]
 )
-AC_SUBST(OPENSSL_LIBS)
-
 
 dnl #
 dnl #  These next two arguments don't actually do anything.  They're
@@ -453,6 +452,28 @@ dnl Check if we need -lnsl. Usually if we want to
 dnl link against -lsocket we need to include -lnsl as well.
 AC_CHECK_LIB(nsl, inet_ntoa)
 
+dnl Check for OpenSSL libraries.
+OPENSSL_LIBS=
+old_LIBS=$LIBS
+if test "x$OPENSSL_LIB_DIR" != "x"; then
+    LIBS="-L$OPENSSL_LIB_DIR $LIBS"
+fi
+AC_CHECK_LIB(crypto, DH_new,
+    [
+       AC_DEFINE(HAVE_LIBCRYPTO, 1,
+           [Define to 1 if you have the `crypto' library (-lcrypto).])
+       AC_CHECK_LIB(ssl, SSL_new,
+           [
+               AC_DEFINE(HAVE_LIBSSL, 1,
+                   [Define to 1 if you have the `ssl' library (-lssl).])
+               if test "x$OPENSSL_LIB_DIR" != "x"; then
+                   OPENSSL_LIBS="-L$OPENSSL_LIB_DIR"
+               fi
+               OPENSSL_LIBS="$OPENSSL_LIBS -lcrypto -lssl -lcrypto"
+           ], [])
+    ], [])
+LIBS=$old_LIBS
+
 dnl #############################################################
 dnl #
 dnl #  3. Checks for header files
@@ -538,56 +559,50 @@ then
   AC_DEFINE(OSFSIA)
 fi
 
-smart_try_dir="$OPENSSL_INCLUDE"
-dnl # stupid RedHat shit
-CFLAGS="$CFLAGS -DOPENSSL_NO_KRB5"
-AC_SMART_CHECK_INCLUDE(openssl/ssl.h)
-if test "x$ac_cv_header_openssl_ssl_h" = "xyes"; then
-  AC_DEFINE(HAVE_OPENSSL_SSL_H)
-  old_CPPFLAGS="$CPPFLAGS"
-  if test "x$OPENSSL_INCLUDE" != "x"; then
-      CPPFLAGS="-I$OPENSSL_INCLUDE $CPPFLAGS"
-  fi
-  AC_CHECK_HEADERS( \
-         openssl/err.h \
-         openssl/crypto.h \
-         openssl/rand.h \
-         openssl/engine.h
-  )
-  CPPFLAGS="$old_CPPFLAGS"
-
-  AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
-       old_CPPFLAGS=$CPPFLAGS
-       if test "x$OPENSSL_INCLUDE" != "x"; then
-           CPPFLAGS="-I$OPENSSL_INCLUDE"
-          fi
-       AC_EGREP_CPP(yes,
-       [#include <openssl/crypto.h>
-       #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
-        yes
-       #endif
-       ], goodssl="yes")
-           if test "x$goodssl" != "xyes"; then
-             AC_MSG_RESULT(no)
-            OPENSSL_INCLUDE=
-            OPENSSL_LIBS=
-           else
-             AC_MSG_RESULT(yes)
-
-             # Look for the OpenSSL libraries.
-            smart_try_dir=$OPENSSL_LIBS
-            AC_SMART_CHECK_LIB(crypto, DH_new)
-            if test "x$ac_cv_lib_crypto_DH_new" = "xyes"; then
-              AC_SMART_CHECK_LIB(ssl, SSL_new)
-              if test "x$ac_cv_lib_ssl_SSL_new" != "xyes"; then
-                OPENSSL_INCLUDE=
-                OPENSSL_LIBS=
-              fi
-              export OPENSSL_INCLUDE OPENSSL_LIBS
-            fi
-           fi
-       CPPFLAGS=$old_CPPFLAGS
+dnl Check for OpenSSL includes.
+OPENSSL_INCLUDE="-DNO_OPENSSL"
+if test "x$OPENSSL_LIBS" = "x"; then
+    AC_MSG_WARN([skipping test for openssl/ssl.h])
+else
+    old_CPPFLAGS=$CPPFLAGS
+    if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
+       CPPFLAGS="$CPPFLAGS -I$OPENSSL_INCLUDE_DIR"
+    fi
+    dnl # stupid RedHat shit
+    CPPFLAGS="$CPPFLAGS -DOPENSSL_NO_KRB5"
+    AC_CHECK_HEADERS( \
+       openssl/ssl.h \
+       openssl/crypto.h \
+       openssl/err.h \
+       openssl/engine.h,
+       [],
+       OPENSSL_LIBS=
+    )
+    if test "x$OPENSSL_LIBS" != "x"; then
+       AC_MSG_CHECKING([for OpenSSL version >= 0.9.7])
+       AC_EGREP_CPP(yes,
+           [#include <openssl/crypto.h>
+            #if (OPENSSL_VERSION_NUMBER >= 0x00907000L)
+            yes
+            #endif
+           ], goodssl="yes")
+       if test "x$goodssl" != "xyes"; then
+           AC_MSG_RESULT(no)
+           OPENSSL_LIBS=
+       else
+           AC_MSG_RESULT(yes)
+           if test "x$OPENSSL_INCLUDE_DIR" != "x"; then
+               OPENSSL_INCLUDE="-I$OPENSSL_INCLUDE_DIR -DOPENSSL_NO_KRB5"
+           else
+               OPENSSL_INCLUDE="-DOPENSSL_NO_KRB5"
+           fi
+       fi
+    fi
+    CPPFLAGS=$old_CPPFLAGS
 fi
+AC_SUBST(OPENSSL_INCLUDE)
+AC_SUBST(OPENSSL_LIBS)
+export OPENSSL_LIBS
 
 dnl #############################################################
 dnl #