autoconf: Split out krb5/gss tests 37/13237/4
authorAndrew Deason <adeason@sinenomine.net>
Fri, 29 Jun 2018 19:48:58 +0000 (14:48 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Sun, 12 Aug 2018 02:33:19 +0000 (22:33 -0400)
Move our krb5 and GSS-related autoconf tests into their own separate
files, in src/cf/krb5.m4 and src/cf/gss.m4.

Change-Id: I4202df5d810f2d3942fc4ffb3fd406869f68029b
Reviewed-on: https://gerrit.openafs.org/13237
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

configure.ac
src/cf/gss.m4 [new file with mode: 0644]
src/cf/krb5.m4 [new file with mode: 0644]

index 68fece9..ed47861 100644 (file)
@@ -22,100 +22,8 @@ AC_PROG_CC
 AC_PATH_PROGS([PATH_CPP], [cpp], [${CC-cc} -E], [$PATH:/lib:/usr/ccs/lib])
 AC_SUBST([PATH_CPP])
 OPENAFS_CONFIGURE_COMMON
-
-dnl Probe for Kerberos.  We have a few platform-specific overrides due to
-dnl weird Kerberos implementations and installation locations.
-AS_CASE([$AFS_SYSNAME],
-    [*_obsd*],
-    [KRB5_CPPFLAGS="-I/usr/include/kerberosV"],
-
-    [ppc_darwin_70],
-    [KRB5_CPPFLAGS="-I/usr/include"
-     KRB5_LDFLAGS="-L/usr/lib -Wl,-search_paths_first"])
-RRA_LIB_KRB5_OPTIONAL
-AS_CASE([$AFS_SYSNAME],
-    [hp_ux*|*_hpux*],
-    [KRB5_LIBS="-l:libkrb5.sl -l:libcom_err.sl"])
-
-dnl Check for the characteristics of whatever Kerberos we found, if we found
-dnl one.
-BUILD_KRB5=no
-MAKE_KRB5="#"
-AS_IF([test x"$KRB5_LIBS" != x],
-    [BUILD_KRB5=yes
-     MAKE_KRB5=
-     RRA_LIB_KRB5_SWITCH
-     AC_CHECK_FUNCS([add_error_table \
-       add_to_error_table \
-       encode_krb5_enc_tkt_part \
-       encode_krb5_ticket \
-       krb5_524_conv_principal \
-       krb5_allow_weak_crypto \
-       krb5_c_encrypt \
-       krb5_decode_ticket \
-       krb5_enctype_enable \
-       krb5_free_keytab_entry_contents \
-       krb5_free_unparsed_name \
-       krb5_get_init_creds_opt_alloc \
-       krb5_get_prompt_types \
-       krb5_princ_size \
-       krb5_principal_get_comp_string])
-     AC_CHECK_FUNCS([krb5_524_convert_creds], [],
-       [AC_CHECK_FUNCS([krb524_convert_creds_kdc], [],
-           [AC_CHECK_LIB([krb524], [krb524_convert_creds_kdc],
-               [LIBS="-lkrb524 $LIBS"
-                KRB5_LIBS="-lkrb524 $KRB5_LIBS"
-                AC_CHECK_LIB([krb524], [krb5_524_conv_principal],
-                    [AC_DEFINE([HAVE_KRB5_524_CONV_PRINCIPAL], [1],
-                        [Define to 1 if you have the `krb5_524_conv_principal' function.])
-                ])
-                AC_DEFINE([HAVE_KRB524_CONVERT_CREDS_KDC], [1],
-                    [Define to 1 if you have the `krb524_convert_creds_kdc' function.])
-           ])
-       ])
-     ])
-     AC_CHECK_HEADERS([kerberosIV/krb.h])
-     AC_CHECK_HEADERS([kerberosV/heim_err.h])
-     AC_CHECK_HEADERS([com_err.h et/com_err.h krb5/com_err.h])
-     AS_IF([test x"$ac_cv_header_com_err_h" != xyes \
-             && test x"$ac_cv_header_et_com_err_h" != xyes \
-             && test x"$ac_cv_header_krb5_com_err_h" != xyes],
-       [AC_MSG_ERROR([Cannot find a usable com_err.h])])
-     AC_CHECK_MEMBERS([krb5_creds.keyblock, krb5_creds.keyblock.enctype, krb5_creds.session,
-                      krb5_prompt.type], [], [], [#include <krb5.h>])
-     AC_CHECK_MEMBERS([krb5_keytab_entry.key, krb5_keytab_entry.keyblock],
-                     [], [], [#include <krb5.h>])
-dnl If we have krb5_creds.session, we are using heimdal
-dnl If we're using heimdal, aklog needs libasn1 for encode_EncTicketPart and a
-dnl few other functions. But just aklog; not any of the other stuff that uses
-dnl krb5.
-     AS_IF([test x"$ac_cv_member_krb5_creds_session" = xyes],
-          [AC_CHECK_LIB([asn1], [encode_EncTicketPart],
-              [AKLOG_KRB5_LIBS="-lasn1"])
-     ])
-     RRA_LIB_KRB5_RESTORE
-])
-AC_SUBST([BUILD_KRB5])
-AC_SUBST([MAKE_KRB5])
-AC_SUBST([AKLOG_KRB5_LIBS])
-
-dnl Probe for GSSAPI
-RRA_LIB_GSSAPI
-dnl Check for the characteristics of whatever GSSAPI we found, if we found one
-BUILD_GSSAPI=no
-AS_IF([test x"$GSSAPI_LIBS" != x],
-    [BUILD_GSSAPI=yes
-     RRA_LIB_GSSAPI_SWITCH
-     AC_CHECK_FUNCS([gss_pseudo_random \
-       krb5_gss_register_acceptor_identity \
-       gss_krb5_ccache_name \
-     ])
-dnl We only need gssapi for rxgk (at this point).  rxgk requires pseudo_random.
-     AS_IF([test x"$ac_cv_func_gss_pseudo_random" != xyes],
-          [BUILD_GSSAPI=no])
-     RRA_LIB_GSSAPI_RESTORE
-])
-AC_SUBST([BUILD_GSSAPI])
+OPENAFS_KRB5
+OPENAFS_GSS
 
 dnl Checks for summary
 OPENAFS_SUMMARY_CHECK_NAMEI
diff --git a/src/cf/gss.m4 b/src/cf/gss.m4
new file mode 100644 (file)
index 0000000..7b9b7d9
--- /dev/null
@@ -0,0 +1,16 @@
+AC_DEFUN([OPENAFS_GSS],
+dnl Probe for GSSAPI
+  [RRA_LIB_GSSAPI
+dnl Check for the characteristics of whatever GSSAPI we found, if we found one
+  BUILD_GSSAPI=no
+  AS_IF([test x"$GSSAPI_LIBS" != x],
+      [BUILD_GSSAPI=yes
+       RRA_LIB_GSSAPI_SWITCH
+       AC_CHECK_FUNCS([gss_pseudo_random \
+                       krb5_gss_register_acceptor_identity \
+                       gss_krb5_ccache_name])
+dnl We only need gssapi for rxgk (at this point).  rxgk requires pseudo_random.
+       AS_IF([test x"$ac_cv_func_gss_pseudo_random" != xyes],
+             [BUILD_GSSAPI=no])
+       RRA_LIB_GSSAPI_RESTORE])
+  AC_SUBST([BUILD_GSSAPI])])
diff --git a/src/cf/krb5.m4 b/src/cf/krb5.m4
new file mode 100644 (file)
index 0000000..23ed8a7
--- /dev/null
@@ -0,0 +1,70 @@
+AC_DEFUN([OPENAFS_KRB5],
+dnl Probe for Kerberos.  We have a few platform-specific overrides due to
+dnl weird Kerberos implementations and installation locations.
+  [AS_CASE([$AFS_SYSNAME],
+     [*_obsd*],
+     [KRB5_CPPFLAGS="-I/usr/include/kerberosV"],
+
+     [ppc_darwin_70],
+     [KRB5_CPPFLAGS="-I/usr/include"
+      KRB5_LDFLAGS="-L/usr/lib -Wl,-search_paths_first"])
+   RRA_LIB_KRB5_OPTIONAL
+   AS_CASE([$AFS_SYSNAME],
+     [hp_ux*|*_hpux*],
+     [KRB5_LIBS="-l:libkrb5.sl -l:libcom_err.sl"])
+
+dnl Check for the characteristics of whatever Kerberos we found, if we found
+dnl one.
+  BUILD_KRB5=no
+  MAKE_KRB5="#"
+  AS_IF([test x"$KRB5_LIBS" != x],
+    [BUILD_KRB5=yes
+     MAKE_KRB5=
+     RRA_LIB_KRB5_SWITCH
+     AC_CHECK_FUNCS([add_error_table \
+                     add_to_error_table \
+                     encode_krb5_enc_tkt_part \
+                     encode_krb5_ticket \
+                     krb5_524_conv_principal \
+                     krb5_allow_weak_crypto \
+                     krb5_c_encrypt \
+                     krb5_decode_ticket \
+                     krb5_enctype_enable \
+                     krb5_free_keytab_entry_contents \
+                     krb5_free_unparsed_name \
+                     krb5_get_init_creds_opt_alloc \
+                     krb5_get_prompt_types \
+                     krb5_princ_size \
+                     krb5_principal_get_comp_string])
+     AC_CHECK_FUNCS([krb5_524_convert_creds], [],
+       [AC_CHECK_FUNCS([krb524_convert_creds_kdc], [],
+          [AC_CHECK_LIB([krb524], [krb524_convert_creds_kdc],
+             [LIBS="-lkrb524 $LIBS"
+              KRB5_LIBS="-lkrb524 $KRB5_LIBS"
+              AC_CHECK_LIB([krb524], [krb5_524_conv_principal],
+                [AC_DEFINE([HAVE_KRB5_524_CONV_PRINCIPAL], [1],
+                           [Define to 1 if you have the `krb5_524_conv_principal' function.])])
+              AC_DEFINE([HAVE_KRB524_CONVERT_CREDS_KDC], [1],
+                        [Define to 1 if you have the `krb524_convert_creds_kdc' function.])])])])
+     AC_CHECK_HEADERS([kerberosIV/krb.h])
+     AC_CHECK_HEADERS([kerberosV/heim_err.h])
+     AC_CHECK_HEADERS([com_err.h et/com_err.h krb5/com_err.h])
+     AS_IF([test x"$ac_cv_header_com_err_h" != xyes \
+               && test x"$ac_cv_header_et_com_err_h" != xyes \
+               && test x"$ac_cv_header_krb5_com_err_h" != xyes],
+       [AC_MSG_ERROR([Cannot find a usable com_err.h])])
+     AC_CHECK_MEMBERS([krb5_creds.keyblock, krb5_creds.keyblock.enctype, krb5_creds.session,
+                       krb5_prompt.type], [], [], [#include <krb5.h>])
+     AC_CHECK_MEMBERS([krb5_keytab_entry.key, krb5_keytab_entry.keyblock],
+                      [], [], [#include <krb5.h>])
+dnl If we have krb5_creds.session, we are using heimdal
+dnl If we're using heimdal, aklog needs libasn1 for encode_EncTicketPart and a
+dnl few other functions. But just aklog; not any of the other stuff that uses
+dnl krb5.
+     AS_IF([test x"$ac_cv_member_krb5_creds_session" = xyes],
+           [AC_CHECK_LIB([asn1], [encode_EncTicketPart],
+                         [AKLOG_KRB5_LIBS="-lasn1"])])
+     RRA_LIB_KRB5_RESTORE])
+  AC_SUBST([BUILD_KRB5])
+  AC_SUBST([MAKE_KRB5])
+  AC_SUBST([AKLOG_KRB5_LIBS])])