changeset 5816:5de7b6d1e752

Check for TLS headers as well as libraries. See xemacs-patches message <CAHCOHQ=6SZuGB1zmOwQMgVqVtOXdaLy_=4yfOqULDkRjHEiNcA@mail.gmail.com>.
author Jerry James <james@xemacs.org>
date Thu, 09 Oct 2014 15:45:16 -0600
parents d59bfb050ca8
children a58070ee1f31
files ChangeLog configure configure.ac
diffstat 3 files changed, 197 insertions(+), 139 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Oct 08 12:58:20 2014 -0600
+++ b/ChangeLog	Thu Oct 09 15:45:16 2014 -0600
@@ -1,3 +1,7 @@
+2014-10-09  Jerry James  <james@xemacs.org>
+
+	* configure.ac: Check for TLS headers as well as libraries.
+
 2014-10-07  Jerry James  <james@xemacs.org>
 
 	* configure.ac: Add TLS support.
--- a/configure	Wed Oct 08 12:58:20 2014 -0600
+++ b/configure	Thu Oct 09 15:45:16 2014 -0600
@@ -21021,7 +21021,9 @@
 
 fi
 
-if test "$with_tls" = "yes"; then
+if test "$with_tls" = "gnutls"; then
+  ac_fn_c_check_header_mongrel "$LINENO" "gnutls/gnutls.h" "ac_cv_header_gnutls_gnutls_h" "$ac_includes_default"
+if test "x$ac_cv_header_gnutls_gnutls_h" = xyes; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls_global_init in -lgnutls" >&5
 $as_echo_n "checking for gnutls_global_init in -lgnutls... " >&6; }
 if ${ac_cv_lib_gnutls_gnutls_global_init+:} false; then :
@@ -21061,6 +21063,17 @@
 if test "x$ac_cv_lib_gnutls_gnutls_global_init" = xyes; then :
   with_tls=gnutls
 else
+  { echo "Error:" "Required gnutls support cannot be provided." >&2; exit 1; }
+fi
+
+else
+  { echo "Error:" "Required gnutls support cannot be provided." >&2; exit 1; }
+fi
+
+
+elif test "$with_tls" = "nss"; then
+  ac_fn_c_check_header_mongrel "$LINENO" "nss.h" "ac_cv_header_nss_h" "$ac_includes_default"
+if test "x$ac_cv_header_nss_h" = xyes; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for NSS_InitContext in -lnss3" >&5
 $as_echo_n "checking for NSS_InitContext in -lnss3... " >&6; }
 if ${ac_cv_lib_nss3_NSS_InitContext+:} false; then :
@@ -21100,6 +21113,162 @@
 if test "x$ac_cv_lib_nss3_NSS_InitContext" = xyes; then :
   with_tls=nss
 else
+  { echo "Error:" "Required NSS support cannot be provided." >&2; exit 1; }
+fi
+
+else
+  { echo "Error:" "Required NSS support cannot be provided." >&2; exit 1; }
+fi
+
+
+elif test "$with_tls" = "openssl"; then
+  ac_fn_c_check_header_mongrel "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default"
+if test "x$ac_cv_header_openssl_ssl_h" = xyes; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_library_init in -lssl" >&5
+$as_echo_n "checking for SSL_library_init in -lssl... " >&6; }
+if ${ac_cv_lib_ssl_SSL_library_init+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lssl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char SSL_library_init ();
+int
+main ()
+{
+return SSL_library_init ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_ssl_SSL_library_init=yes
+else
+  ac_cv_lib_ssl_SSL_library_init=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_library_init" >&5
+$as_echo "$ac_cv_lib_ssl_SSL_library_init" >&6; }
+if test "x$ac_cv_lib_ssl_SSL_library_init" = xyes; then :
+  with_tls=openssl
+else
+  { echo "Error:" "Required openssl support cannot be provided." >&2; exit 1; }
+fi
+
+else
+  { echo "Error:" "Required openssl support cannot be provided." >&2; exit 1; }
+fi
+
+
+fi
+if test "$with_tls" = "yes"; then
+  ac_fn_c_check_header_mongrel "$LINENO" "gnutls/gnutls.h" "ac_cv_header_gnutls_gnutls_h" "$ac_includes_default"
+if test "x$ac_cv_header_gnutls_gnutls_h" = xyes; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls_global_init in -lgnutls" >&5
+$as_echo_n "checking for gnutls_global_init in -lgnutls... " >&6; }
+if ${ac_cv_lib_gnutls_gnutls_global_init+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lgnutls  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char gnutls_global_init ();
+int
+main ()
+{
+return gnutls_global_init ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_gnutls_gnutls_global_init=yes
+else
+  ac_cv_lib_gnutls_gnutls_global_init=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gnutls_gnutls_global_init" >&5
+$as_echo "$ac_cv_lib_gnutls_gnutls_global_init" >&6; }
+if test "x$ac_cv_lib_gnutls_gnutls_global_init" = xyes; then :
+  with_tls=gnutls
+fi
+
+fi
+
+
+fi
+if test "$with_tls" = "yes"; then
+  ac_fn_c_check_header_mongrel "$LINENO" "nss.h" "ac_cv_header_nss_h" "$ac_includes_default"
+if test "x$ac_cv_header_nss_h" = xyes; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for NSS_InitContext in -lnss3" >&5
+$as_echo_n "checking for NSS_InitContext in -lnss3... " >&6; }
+if ${ac_cv_lib_nss3_NSS_InitContext+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lnss3  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char NSS_InitContext ();
+int
+main ()
+{
+return NSS_InitContext ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_nss3_NSS_InitContext=yes
+else
+  ac_cv_lib_nss3_NSS_InitContext=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nss3_NSS_InitContext" >&5
+$as_echo "$ac_cv_lib_nss3_NSS_InitContext" >&6; }
+if test "x$ac_cv_lib_nss3_NSS_InitContext" = xyes; then :
+  with_tls=nss
+fi
+
+fi
+
+
+fi
+if test "$with_tls" = "yes"; then
+  ac_fn_c_check_header_mongrel "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default"
+if test "x$ac_cv_header_openssl_ssl_h" = xyes; then :
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_library_init in -lssl" >&5
 $as_echo_n "checking for SSL_library_init in -lssl... " >&6; }
 if ${ac_cv_lib_ssl_SSL_library_init+:} false; then :
@@ -21144,136 +21313,6 @@
 
 fi
 
-fi
-
-elif test "$with_tls" = "gnutls"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls_global_init in -lgnutls" >&5
-$as_echo_n "checking for gnutls_global_init in -lgnutls... " >&6; }
-if ${ac_cv_lib_gnutls_gnutls_global_init+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lgnutls  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char gnutls_global_init ();
-int
-main ()
-{
-return gnutls_global_init ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_gnutls_gnutls_global_init=yes
-else
-  ac_cv_lib_gnutls_gnutls_global_init=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gnutls_gnutls_global_init" >&5
-$as_echo "$ac_cv_lib_gnutls_gnutls_global_init" >&6; }
-if test "x$ac_cv_lib_gnutls_gnutls_global_init" = xyes; then :
-  with_tls=gnutls
-else
-  { echo "Error:" "Required gnutls support cannot be provided." >&2; exit 1; }
-fi
-
-elif test "$with_tls" = "nss"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for NSS_InitContext in -lnss3" >&5
-$as_echo_n "checking for NSS_InitContext in -lnss3... " >&6; }
-if ${ac_cv_lib_nss3_NSS_InitContext+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lnss3  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char NSS_InitContext ();
-int
-main ()
-{
-return NSS_InitContext ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_nss3_NSS_InitContext=yes
-else
-  ac_cv_lib_nss3_NSS_InitContext=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nss3_NSS_InitContext" >&5
-$as_echo "$ac_cv_lib_nss3_NSS_InitContext" >&6; }
-if test "x$ac_cv_lib_nss3_NSS_InitContext" = xyes; then :
-  with_tls=nss
-else
-  { echo "Error:" "Required NSS support cannot be provided." >&2; exit 1; }
-fi
-
-elif test "$with_tls" = "openssl"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_library_init in -lssl" >&5
-$as_echo_n "checking for SSL_library_init in -lssl... " >&6; }
-if ${ac_cv_lib_ssl_SSL_library_init+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lssl  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char SSL_library_init ();
-int
-main ()
-{
-return SSL_library_init ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_ssl_SSL_library_init=yes
-else
-  ac_cv_lib_ssl_SSL_library_init=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_library_init" >&5
-$as_echo "$ac_cv_lib_ssl_SSL_library_init" >&6; }
-if test "x$ac_cv_lib_ssl_SSL_library_init" = xyes; then :
-  with_tls=openssl
-else
-  { echo "Error:" "Required openssl support cannot be provided." >&2; exit 1; }
-fi
 
 fi
 if test "$with_tls" != "no"; then
--- a/configure.ac	Wed Oct 08 12:58:20 2014 -0600
+++ b/configure.ac	Thu Oct 09 15:45:16 2014 -0600
@@ -5332,20 +5332,35 @@
 fi
 
 dnl TLS support
-if test "$with_tls" = "yes"; then
-  AC_CHECK_LIB(gnutls, gnutls_global_init, [with_tls=gnutls],
-    AC_CHECK_LIB(nss3, NSS_InitContext, [with_tls=nss],
-      AC_CHECK_LIB(ssl, SSL_library_init, [with_tls=openssl], [with_tls=no])))
-elif test "$with_tls" = "gnutls"; then
-  AC_CHECK_LIB(gnutls, gnutls_global_init, [with_tls=gnutls],
+if test "$with_tls" = "gnutls"; then
+  AC_CHECK_HEADER([gnutls/gnutls.h],
+    [AC_CHECK_LIB(gnutls, gnutls_global_init, [with_tls=gnutls],
+      [XE_DIE("Required gnutls support cannot be provided.")])],
     [XE_DIE("Required gnutls support cannot be provided.")])
 elif test "$with_tls" = "nss"; then
-  AC_CHECK_LIB(nss3, NSS_InitContext, [with_tls=nss],
+  AC_CHECK_HEADER([nss.h],
+    [AC_CHECK_LIB(nss3, NSS_InitContext, [with_tls=nss],
+      [XE_DIE("Required NSS support cannot be provided.")])],
     [XE_DIE("Required NSS support cannot be provided.")])
 elif test "$with_tls" = "openssl"; then
-  AC_CHECK_LIB(ssl, SSL_library_init, [with_tls=openssl],
+  AC_CHECK_HEADER([openssl/ssl.h],
+    [AC_CHECK_LIB(ssl, SSL_library_init, [with_tls=openssl],
+      [XE_DIE("Required openssl support cannot be provided.")])],
     [XE_DIE("Required openssl support cannot be provided.")])
 fi
+dnl Autodetection
+if test "$with_tls" = "yes"; then
+  AC_CHECK_HEADER([gnutls/gnutls.h],
+    [AC_CHECK_LIB(gnutls, gnutls_global_init, [with_tls=gnutls])])
+fi
+if test "$with_tls" = "yes"; then
+  AC_CHECK_HEADER([nss.h],
+    [AC_CHECK_LIB(nss3, NSS_InitContext, [with_tls=nss])])
+fi
+if test "$with_tls" = "yes"; then
+  AC_CHECK_HEADER([openssl/ssl.h],
+    [AC_CHECK_LIB(ssl, SSL_library_init, [with_tls=openssl], [with_tls=no])])
+fi
 if test "$with_tls" != "no"; then
   AC_DEFINE(WITH_TLS)
   if test "$with_tls" = "gnutls"; then