Fix backslashes in SHIBSP_PREFIX variable by manually creating it during the script...
[shibboleth/sp.git] / configure.ac
index bc0a2df..ef10e95 100644 (file)
@@ -69,7 +69,7 @@ AC_STRUCT_TM
 # Checks for library functions.
 AC_FUNC_STRFTIME
 AC_FUNC_STRERROR_R
-AC_CHECK_FUNCS([strchr strdup strstr timegm gmtime_r ctime_r strtok_r strcasecmp])
+AC_CHECK_FUNCS([strchr strdup strstr timegm gmtime_r strtok_r strcasecmp])
 
 # checks for pthreads
 ACX_PTHREAD([enable_threads="pthread"],[enable_threads="no"])
@@ -82,6 +82,61 @@ else
     CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
 fi
 
+# Thank you Solaris, really.
+AC_MSG_CHECKING(for ctime_r)
+ if test -z "$ac_cv_ctime_args"; then
+     AC_TRY_COMPILE(
+     [#include <time.h>],
+     [
+         time_t clock;
+         char buf[26];
+         ctime_r(&clock, buf);
+     ], ac_cv_ctime_args=2)
+
+     AC_TRY_COMPILE(
+     [#include <time.h>],
+     [
+         time_t clock;
+         char buf[26];
+         ctime_r(&clock, buf, 26);
+     ], ac_cv_ctime_args=3)
+ fi
+ if test -z "$ac_cv_ctime_args"; then
+     AC_MSG_RESULT(no)
+ else
+     if test "$ac_cv_ctime_args" = 2; then
+         AC_DEFINE(HAVE_CTIME_R_2,1,[Define if ctime_r is present with 2 parameters.])
+     elif test "$ac_cv_ctime_args" = 3; then
+         AC_DEFINE(HAVE_CTIME_R_3,1,[Define if ctime_r is present with 3 parameters.])
+     fi
+     AC_MSG_RESULT([yes, and it takes $ac_cv_ctime_args arguments])
+ fi 
+
+# OpenSSL settings
+AC_ARG_WITH(openssl,
+    AC_HELP_STRING([--with-openssl=PATH], [where openssl is installed]),
+    [if test x_$with_openssl != x_/usr; then
+        SSLFLAGS="-I${with_openssl}/include"
+    fi])
+
+if test "x$SSLFLAGS" = "x" ; then
+    AC_PATH_PROG(PKG_CONFIG, pkg-config)
+    if test "x$PKG_CONFIG" != x && test "x$PKG_CONFIG" != "xno" ; then
+        if pkg-config openssl ; then
+            SSLFLAGS="`$PKG_CONFIG --cflags openssl`"
+        else
+            AC_MSG_ERROR([OpenSSL not supported by pkg-config, try --with-openssl instead])
+        fi
+    fi
+fi
+
+AC_MSG_CHECKING(for OpenSSL cflags)
+AC_MSG_RESULT($SSLFLAGS)
+CPPFLAGS="$SSLFLAGS $CPPFLAGS"
+
+AC_CHECK_HEADER([openssl/x509.h],,
+                AC_MSG_ERROR([unable to find openssl header files]))
+
 AC_LANG(C++)
 
 # C++ requirements
@@ -184,14 +239,10 @@ if test "x$with_xmltooling" = "x" ; then
 fi
 if test -f $with_xmltooling/share/xml/xmltooling/catalog.xml ; then
     XMLTOOLINGXMLDIR="$with_xmltooling"
-else
-    if test -f $with_xerces/share/xml/xmltooling/catalog.xml ; then
-        XMLTOOLINGXMLDIR="$with_xerces"
-    else
-        if test -f $with_log4shib/share/xml/xmltooling/catalog.xml ; then
-            XMLTOOLINGXMLDIR="$with_log4shib"
-        fi
-    fi
+elif test -f $with_xerces/share/xml/xmltooling/catalog.xml ; then
+    XMLTOOLINGXMLDIR="$with_xerces"
+elif test -f $with_log4shib/share/xml/xmltooling/catalog.xml ; then
+    XMLTOOLINGXMLDIR="$with_log4shib"
 fi
 if test "x$XMLTOOLINGXMLDIR" = "x" ; then
     AC_MSG_ERROR([xmltooling XML catalog not found, may need to use --with-xmltooling option])
@@ -269,18 +320,12 @@ if test "x$with_saml" = "x" ; then
 fi
 if test -f $with_saml/share/xml/opensaml/saml20-catalog.xml ; then
     OPENSAMLXMLDIR="$with_saml"
-else
-    if test -f $with_xmltooling/share/xml/opensaml/saml20-catalog.xml ; then
-        OPENSAMLXMLDIR="$with_xmltooling"
-    else
-        if test -f $with_xerces/share/xml/opensaml/saml20-catalog.xml ; then
-            OPENSAMLXMLDIR="$with_xerces"
-        else
-            if test -f $with_log4shib/share/xml/opensaml/saml20-catalog.xml ; then
-                OPENSAMLXMLDIR="$with_log4shib"
-            fi
-        fi
-    fi
+elif test -f $with_xmltooling/share/xml/opensaml/saml20-catalog.xml ; then
+    OPENSAMLXMLDIR="$with_xmltooling"
+elif test -f $with_xerces/share/xml/opensaml/saml20-catalog.xml ; then
+    OPENSAMLXMLDIR="$with_xerces"
+elif test -f $with_log4shib/share/xml/opensaml/saml20-catalog.xml ; then
+    OPENSAMLXMLDIR="$with_log4shib"
 fi
 if test "x$OPENSAMLXMLDIR" = "x" ; then
     AC_MSG_ERROR([opensaml XML catalogs not found, may need to use --with-saml option])
@@ -331,14 +376,14 @@ if test "$WANT_NSAPI" != "no"; then
   if test -d $WANT_NSAPI/include ; then
     NSAPI_INCLUDE=$WANT_NSAPI/include
     AC_MSG_RESULT(Netscape-Enterprise 3.x style)
-    AC_CHECK_HEADERS([$NSAPI_INCLUDE/nsapi.h])
+    AC_CHECK_HEADERS([$NSAPI_INCLUDE/nsapi.h],,,[#define XP_UNIX])
     NSAPI_INCLUDE="$NSAPI_INC_DIR -I$NSAPI_INCLUDE"
   fi
   if test -d $WANT_NSAPI/plugins/include ; then
     test -n "$NSAPI_INCLUDE" && NSAPI_INC_DIR="-I$NSAPI_INCLUDE"
     NSAPI_INCLUDE="$WANT_NSAPI/plugins/include"
     AC_MSG_RESULT(iPlanet 4.x / SunONE 6.x style)
-    AC_CHECK_HEADERS([$NSAPI_INCLUDE/nsapi.h])
+    AC_CHECK_HEADERS([$NSAPI_INCLUDE/nsapi.h],,,[#define XP_UNIX])
     NSAPI_INCLUDE="$NSAPI_INC_DIR -I$NSAPI_INCLUDE"
   fi
   if test "$NSAPI_INCLUDE" = ""; then
@@ -499,7 +544,7 @@ if test "$WANT_APACHE_13" = "yes" ; then
 
     # extract settings we need from APXS -q
     APXS_CC="`$APXS -q CC`"
-    APXS_CFLAGS="`$APXS -q CPPFLAGS` `$APXS -q CFLAGS` `$APXS -q CFLAGS_SHLIB`"
+    APXS_CFLAGS="`$APXS -q CFLAGS` `$APXS -q CFLAGS_SHLIB`"
     APXS_INCLUDE="`$APXS -q INCLUDEDIR`"
 fi
 
@@ -590,7 +635,7 @@ if test "$WANT_APACHE_20" = "yes" ; then
 
     # extract settings we need from APXS2 -q
     APXS2_CC="`$APXS2 -q CC`"
-    APXS2_CFLAGS="`$APXS2 -q CPPFLAGS` `$APXS2 -q CFLAGS` `$APXS2 -q CFLAGS_SHLIB` $APR_CFLAGS"
+    APXS2_CFLAGS="`$APXS2 -q CPPFLAGS` `$APXS2 -q CFLAGS` $APR_CFLAGS"
     APXS2_INCLUDE="`$APXS2 -q INCLUDEDIR`"
 fi
 
@@ -681,7 +726,7 @@ if test "$WANT_APACHE_22" = "yes" ; then
 
     # extract settings we need from APXS22 -q
     APXS22_CC="`$APXS22 -q CC`"
-    APXS22_CFLAGS="`$APXS22 -q CPPFLAGS` `$APXS22 -q CFLAGS` `$APXS22 -q CFLAGS_SHLIB` $APR1_CFLAGS"
+    APXS22_CFLAGS="`$APXS22 -q CPPFLAGS` `$APXS22 -q CFLAGS` $APR1_CFLAGS"
     APXS22_INCLUDE="`$APXS22 -q INCLUDEDIR`"
 fi
 
@@ -741,24 +786,20 @@ if test "$build_odbc" = "yes" ; then
                AC_MSG_ERROR([Try running --disable-odbc instead.])
              elif test "$with_odbc" != yes ; then
                odbc_dir="$with_odbc/bin"
+               if test "$with_odbc" != /usr ; then
+                 ODBC_CFLAGS="-I$with_odbc/include"
+                 ODBC_LIBS="-L$with_odbc/lib"
+               fi
              fi ])
 
    AC_PATH_PROG(ODBC_CONFIG, odbc_config, no, $odbc_dir $PATH )
-
    if test "$ODBC_CONFIG" = no ; then
-      if test "$odbc_enabled" = "yes" ; then
-        AC_MSG_ERROR(Cannot find odbc_config)
-      else
-        AC_MSG_WARN(ODBC not found, skipping.)
-      fi
+      AC_MSG_WARN([Cannot find odbc_config, will try to guess settings.])
+      ODBC_LIBS="$ODBC_LIBS -lodbc"
+   else
+      ODBC_CFLAGS=`$ODBC_CONFIG --cflags`
+      ODBC_LIBS=`$ODBC_CONFIG --libs`
    fi
-fi
-
-if test "$build_odbc" = yes ; then
-   ODBC_CFLAGS=`$ODBC_CONFIG --cflags`
-   ODBC_CFLAGS=`eval echo $ODBC_CFLAGS`
-   ODBC_LIBS=`$ODBC_CONFIG --libs`
-   ODBC_LIBS=`eval echo $ODBC_LIBS`
 
    save_CPPFLAGS="$CPPFLAGS"
    CPPFLAGS="$CPPFLAGS $ODBC_CFLAGS"