Imported Upstream version 3.3.2
[debian/amanda] / config / amanda / libs.m4
index 6e27add4cc9fa5e15e9a3a7f148210bdc284224f..e6acb04cd4b9b0d6409401d2ddd100ebb174279b 100644 (file)
 #   the libcurl distribution for details.
 #
 AC_DEFUN([AMANDA_CHECK_LIBCURL], [
-    case "$host" in
-        sparc-sun-solaris2.10) # Solaris 10
-        # curl is not in the LD_LIBRARY_PATH on Solaris 10, so we search
-        # for it in a few common paths; we then extract the -L flags and
-        # translate them to -R flags, as required by the runtime linker.
-        AC_PATH_PROG(CURL_CONFIG, curl-config, [], $LOCSYSPATH:/opt/csw/bin:/usr/local/bin:/opt/local/bin)
-        if test -n "$CURL_CONFIG"; then
-            curlflags=`$CURL_CONFIG --libs 2>/dev/null`
-            for flag in curlflags; do
-                case $flag in
-                    -L*) LDFLAGS="$LDFLAGS "`echo "x$flag" | sed -e 's/^x-L/-R/'`;;
-                esac
-            done
-        fi
-        ;;
-    esac
-
     LIBCURL_CHECK_CONFIG(yes, 7.10.0, HAVE_CURL=yes, HAVE_CURL=no)
     if test x"$HAVE_CURL" = x"yes"; then
        AMANDA_ADD_LIBS($LIBCURL)
        AMANDA_ADD_CPPFLAGS($LIBCURL_CPPFLAGS)
 
        AMANDA_CHECK_TYPE([curl_off_t], [off_t], [curl/curl.h])
+       case "$host" in
+           *sun-solaris2*) # Solaris, all versions.
+           # we extract the -L flags and translate them to -R flags, as required
+           # by the runtime linker.
+           if test -n "$_libcurl_config"; then
+               curlflags=`$_libcurl_config --libs 2>/dev/null`
+               for flag in curlflags; do
+                   case $flag in
+                       -L*) LDFLAGS="$LDFLAGS "`echo "x$flag" | sed -e 's/^x-L/-R/'`;;
+                   esac
+               done
+           fi
+           ;;
+       esac
     fi
+
 ])
 
 # SYNOPSIS
@@ -100,13 +98,14 @@ AC_DEFUN([AMANDA_CHECK_NET_LIBS], [
 #   "out of the box" on more boxes.
 #
 AC_DEFUN([AMANDA_CHECK_GLIB], [
-    AC_ARG_VAR(GLIB_CFLAGS, [CFLAGS to build with glib; disables use of pkg-config])
-    AC_ARG_VAR(GLIB_LIBS, [libraries to build with glib; disables use of pkg-config])
-    AC_ARG_VAR(GLIB_GENMARSHAL, [genmarshal binary to use with glib; disables use of pkg-config])
-    AC_ARG_VAR(GOBJECT_QUERY, [gobject_query binary to use with glib; disables use of pkg-config])
-    AC_ARG_VAR(GLIB_MKENUMS, [mkenums binary to use with glib; disables use of pkg-config])
-
-    # if any of the precious variables are set, disable the pkg-config run
+    AC_ARG_VAR(GLIB_CFLAGS, [CFLAGS to build with glib; disables use of pkg-config; must specify all GLIB_ vars])
+    AC_ARG_VAR(GLIB_LIBS, [libraries to build with glib; disables use of pkg-config; must specify all GLIB_vars])
+    AC_ARG_VAR(GLIB_GENMARSHAL, [genmarshal binary to use with glib; disables use of pkg-config; must specify all GLIB_ vars])
+    AC_ARG_VAR(GOBJECT_QUERY, [gobject_query binary to use with glib; disables use of pkg-config; must specify all GLIB_ vars])
+    AC_ARG_VAR(GLIB_MKENUMS, [mkenums binary to use with glib; disables use of pkg-config; must specify all GLIB_ vars])
+
+    # if any of the precious variables are set, disable the pkg-config run.
+    # Further, if any is specified, all must be specified.
     explicit_glib=no
     test x"$GLIB_CFLAGS" = x"" || explicit_glib=yes
     test x"$GLIB_LIBS" = x"" || explicit_glib=yes
@@ -136,7 +135,16 @@ AC_DEFUN([AMANDA_CHECK_GLIB], [
            AC_MSG_ERROR(glib not found or too old; See http://wiki.zmanda.com/index.php/Installation for help)
        ], gmodule gobject gthread)
     else
-       AC_MSG_ERROR(explicit glib)
+        # Confirm that all GLIB_ variables are set
+        if test ! x"$GLIB_CFLAGS" = x"" && \
+           test ! x"$GLIB_LIBS" = x"" && \
+           test ! x"$GLIB_GENMARSHAL" = x"" && \
+           test ! x"$GOBJECT_QUERY" = x"" && \
+           test ! x"$GLIB_MKENUMS" = x""; then
+            :
+        else
+            AC_MSG_ERROR(Not all precious glib variables were set.)
+        fi
     fi
 
     # GLIB_CPPFLAGS is not set by autoconf, yet GLIB_CFLAGS contains what GLIB_CPPFLAGS should contain.
@@ -213,7 +221,8 @@ AC_DEFUN([LIBCURL_CHECK_CONFIG],
   AH_TEMPLATE([LIBCURL_PROTOCOL_TFTP],[Defined if libcurl supports TFTP])
 
   AC_ARG_WITH(libcurl,
-     AC_HELP_STRING([--with-libcurl=DIR],[look for the curl library in DIR]),
+     AC_HELP_STRING([--with-libcurl=PREFIX],
+       [look for the curl library in PREFIX/lib and headers in PREFIX/include]),
      [_libcurl_with=$withval],[_libcurl_with=ifelse([$1],,[yes],[$1])])
 
   if test "$_libcurl_with" != "no" ; then
@@ -227,9 +236,9 @@ AC_DEFUN([LIBCURL_CHECK_CONFIG],
      if test -d "$_libcurl_with" ; then
         LIBCURL_CPPFLAGS="-I$withval/include"
         _libcurl_ldflags="-L$withval/lib"
-        AC_PATH_PROG([_libcurl_config],[curl-config],["$withval/bin"],["$withval/bin"])
+        AC_PATH_PROG([_libcurl_config],[curl-config],[],["$withval/bin"])
      else
-        AC_PATH_PROG([_libcurl_config],[curl-config])
+        AC_PATH_PROG([_libcurl_config],[curl-config],[],[$PATH])
      fi
 
      if test x$_libcurl_config != "x" ; then
@@ -297,7 +306,7 @@ AC_DEFUN([LIBCURL_CHECK_CONFIG],
            _libcurl_save_libs=$LIBS
            LIBS="$LIBCURL $LIBS"
 
-           AC_LINK_IFELSE(AC_LANG_PROGRAM([#include <curl/curl.h>],[
+           AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <curl/curl.h>]],[[
 /* Try and use a few common options to force a failure if we are
    missing symbols or can't link. */
 int x;
@@ -308,7 +317,7 @@ x=CURLOPT_FILE;
 x=CURLOPT_ERRORBUFFER;
 x=CURLOPT_STDERR;
 x=CURLOPT_VERBOSE;
-]),libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no)
+]])],[libcurl_cv_lib_curl_usable=yes],[libcurl_cv_lib_curl_usable=no])
 
            CPPFLAGS=$_libcurl_save_cppflags
            LIBS=$_libcurl_save_libs
@@ -372,6 +381,41 @@ x=CURLOPT_VERBOSE;
         fi
      fi
 
+      LIBCURL_USE_NSS=no
+      LIBCURL_USE_GNUTLS=no
+      LIBCURL_USE_OPENSSL=yes
+     _libcurl_configures=`$_libcurl_config --configure`
+     for _libcurl_configure in $_libcurl_configures ; do
+       if [[[ $_libcurl_configure = \'--with-nss* ]]]; then
+           LIBCURL_USE_NSS=yes
+       fi
+       if [[[ $_libcurl_configure = \'--without-nss* ]]]; then
+           LIBCURL_USE_NSS=no
+       fi
+       if [[[ $_libcurl_configure = \'--with-gnutls* ]]]; then
+           LIBCURL_USE_GNUTLS=yes
+       fi
+       if [[[ $_libcurl_configure = \'--without-gnutls* ]]]; then
+           LIBCURL_USE_GNUTLS=no
+       fi
+       if [[[ $_libcurl_configure = \'--with-ssl* ]]]; then
+           LIBCURL_USE_OPENSSL=yes
+       fi
+       if [[[ $_libcurl_configure = \'--without-ssl* ]]]; then
+           LIBCURL_USE_OPENSSL=no
+       fi
+     done
+
+     if test "x$LIBCURL_USE_NSS" = "xyes"; then
+       AC_DEFINE(LIBCURL_USE_NSS, 1, [Defined if libcurl use NSS])
+     fi
+     if test "x$LIBCURL_USE_GNUTLS" = "xyes"; then
+       AC_DEFINE(LIBCURL_USE_GNUTLS, , [Defined if libcurl use GnuTLS])
+     fi
+     if test "x$LIBCURL_USE_OPENSSL" = "xyes"; then
+       AC_DEFINE(LIBCURL_USE_OPENSSL, 1, [Defined if libcurl use OpenSSL])
+     fi
+
      unset _libcurl_try_link
      unset _libcurl_version_parse
      unset _libcurl_config
@@ -381,6 +425,8 @@ x=CURLOPT_VERBOSE;
      unset _libcurl_protocols
      unset _libcurl_version
      unset _libcurl_ldflags
+     unset _libcurl_configure
+     unset _libcurl_configures
   fi
 
   if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then