X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-sp-resolver.git;a=blobdiff_plain;f=configure.ac;h=9803375aea3300e1ff00c548696b9a3b4942ce46;hp=c3b411b87df0158aa7c4b8f1be1153af51ae0086;hb=8c308951c88a1c5e3f3db97f25a706492f7d234c;hpb=98219f6cccb312505dd0cfe7e30373c465e9c1c2 diff --git a/configure.ac b/configure.ac index c3b411b..9803375 100644 --- a/configure.ac +++ b/configure.ac @@ -1,13 +1,14 @@ AC_PREREQ([2.50]) -AC_INIT([shibboleth-resolver], [0.1], [shibboleth-users@internet2.edu], [shibboleth-resolver]) -AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE([shibboleth-resolver],[0.1]) - -sinclude(acx_pthread.m4) +AC_INIT([shibboleth-resolver], [0.2], [MOONSHOT-COMMUNITY@JISCMAIL.AC.UK], [shibboleth-resolver]) +AC_CONFIG_SRCDIR(src) +AC_CONFIG_AUX_DIR(build-aux) +AC_CONFIG_MACRO_DIR(m4) +AM_INIT_AUTOMAKE +AC_DISABLE_STATIC +AC_PROG_LIBTOOL AC_ARG_ENABLE(debug, - AC_HELP_STRING(--enable-debug, [Have GCC compile with symbols (Default = no) -]), + AS_HELP_STRING([--enable-debug],[Have GCC compile with symbols (Default = no)]), enable_debug=$enableval, enable_debug=no) if test "$enable_debug" = "yes" ; then @@ -18,6 +19,10 @@ else GCC_CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG" fi +AC_CONFIG_HEADERS([config.h src/shibresolver/config_pub.h]) +AC_CONFIG_FILES([resolver.spec Portfile]) +AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile]) + AC_PROG_CC([gcc gcc3 cc]) AC_PROG_CXX([g++ g++3 c++ CC]) AC_CANONICAL_HOST @@ -46,9 +51,6 @@ else esac fi -AC_DISABLE_STATIC -AC_PROG_LIBTOOL - AC_LANG(C) # Checks for typedefs, structures, and compiler characteristics. @@ -64,7 +66,7 @@ ACX_PTHREAD([enable_threads="pthread"],[enable_threads="no"]) if test $enable_threads != "pthread"; then AC_MSG_ERROR([unable to find pthreads, currently this is required]) else - AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]) + AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.]) LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$PTHREAD_CFLAGS $CFLAGS" CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS" @@ -73,13 +75,27 @@ fi AC_LANG(C++) # C++ requirements -AC_CXX_REQUIRE_STL AC_CXX_NAMESPACES +AC_CXX_REQUIRE_STL + +# are covariant methods allowed? +AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[]], + [[ + class base { public: virtual base *GetPtr( void ) { return this; } }; + class derived: virtual public base { public: virtual derived *GetPtr( void ) { return this; } }; + ]])], + [AC_DEFINE([HAVE_COVARIANT_RETURNS],[1],[Define to 1 if C++ compiler supports covariant virtual methods.])]) + +# is nullptr supported? +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[]],[[const char* ptr = nullptr;]])], + [AC_DEFINE([HAVE_NULLPTR],[1],[Define to 1 if C++ compiler supports nullptr keyword.])]) # log4shib settings (favor this version over the log4cpp code) AC_PATH_PROG(LOG4SHIB_CONFIG,log4shib-config) AC_ARG_WITH(log4shib, - AC_HELP_STRING([--with-log4shib=PATH], [where log4shib-config is installed]), + AS_HELP_STRING([--with-log4shib=PATH],[where log4shib-config is installed]), [ LOG4SHIB_CONFIG="${with_log4shib}" if ! test -f "${LOG4SHIB_CONFIG}" ; then @@ -87,15 +103,15 @@ AC_ARG_WITH(log4shib, fi ]) if test -f "${LOG4SHIB_CONFIG}"; then - LDFLAGS="`${LOG4SHIB_CONFIG} --libs` $LDFLAGS" + LIBS="`${LOG4SHIB_CONFIG} --libs` $LIBS" CPPFLAGS="`${LOG4SHIB_CONFIG} --cflags` $CPPFLAGS" AC_CHECK_HEADER([log4shib/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4shib header files])) - AC_TRY_LINK( - [#include -#include ], - [log4shib::Category::getInstance("foo").errorStream() << log4shib::eol], - [AC_DEFINE(SHIBRESOLVER_LOG4SHIB,1,[Define if log4shib library is used.])], - [AC_MSG_ERROR([unable to link with log4shib])]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include +#include ]], + [[log4shib::Category::getInstance("foo").errorStream() << log4shib::eol]])], + [AC_DEFINE([SHIBRESOLVER_LOG4SHIB],[1],[Define to 1 if log4shib library is used.])], + [AC_MSG_ERROR([unable to link with log4shib])]) else AC_MSG_WARN([log4shib-config not found, may need to use --with-log4shib option]) AC_MSG_WARN([will look for original log4cpp library]) @@ -103,7 +119,7 @@ else # log4cpp settings AC_PATH_PROG(LOG4CPP_CONFIG,log4cpp-config) AC_ARG_WITH(log4cpp, - AC_HELP_STRING([--with-log4cpp=PATH], [where log4cpp-config is installed]), + AS_HELP_STRING([--with-log4cpp=PATH],[where log4cpp-config is installed]), [ LOG4CPP_CONFIG="${with_log4cpp}" if ! test -f "${LOG4CPP_CONFIG}" ; then @@ -112,30 +128,30 @@ else ]) if test -f "${LOG4CPP_CONFIG}"; then AC_MSG_WARN([will try to use log4cpp, note that most non-Internet2 supplied versions are not thread-safe]) - LDFLAGS="`${LOG4CPP_CONFIG} --libs` $LDFLAGS" + LIBS="`${LOG4CPP_CONFIG} --libs` $LIBS" CPPFLAGS="`${LOG4CPP_CONFIG} --cflags` $CPPFLAGS" AC_CHECK_HEADER([log4cpp/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4cpp header files])) - AC_TRY_LINK( - [#include -#include ], - [log4cpp::Category::getInstance("foo").errorStream() << log4cpp::eol], - [AC_DEFINE(SHIBRESOLVER_LOG4CPP,1,[Define if log4cpp library is used.])], - [AC_MSG_ERROR([unable to link with log4cpp, need version 1.0 or later])]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include +#include ]], + [[log4cpp::Category::getInstance("foo").errorStream() << log4cpp::eol]])], + [AC_DEFINE([SHIBRESOLVER_LOG4CPP],[1],[Define to 1 if log4cpp library is used.])], + [AC_MSG_ERROR([unable to link with log4cpp, need version 1.0 or later])]) else AC_MSG_ERROR([log4cpp-config not found, may need to use --with-log4cpp option]) fi fi # Xerces settings -AC_ARG_WITH(xerces, - AC_HELP_STRING([--with-xerces=PATH], [where xerces-c is installed]), - [if test x_$with_xerces != x_/usr; then - LDFLAGS="-L${with_xerces}/lib $LDFLAGS" - CPPFLAGS="-I${with_xerces}/include $CPPFLAGS" - fi]) +# Xerces settings +AC_ARG_WITH(xerces, + AS_HELP_STRING([--with-xerces=PATH],[where xerces-c is installed]), + [if test x_$with_xerces != x_/usr; then + LDFLAGS="-L${with_xerces}/lib $LDFLAGS" + CPPFLAGS="-I${with_xerces}/include $CPPFLAGS" + fi]) LIBS="-lxerces-c $LIBS" -AC_CHECK_HEADER([xercesc/dom/DOM.hpp],, - AC_MSG_ERROR([unable to find xerces header files])) +AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,AC_MSG_ERROR([unable to find xerces header files])) AC_MSG_CHECKING([Xerces version]) AC_PREPROC_IFELSE( [AC_LANG_PROGRAM([#include ], @@ -146,29 +162,27 @@ int i = 0; #endif])], [AC_MSG_RESULT(OK)], [AC_MSG_FAILURE([Xerces-C v2.6.0 has bugs that inhibit use with signed XML, please use a newer version])]) -AC_TRY_LINK( - [#include ], - [xercesc::XMLPlatformUtils::Initialize()], - [AC_DEFINE(HAVE_LIBXERCESC,1,[Define if Xerces-C library was found])], - [AC_MSG_ERROR([unable to link with Xerces])]) +AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[xercesc::XMLPlatformUtils::Initialize()]])], + ,[AC_MSG_ERROR([unable to link with Xerces])]) #XML-Tooling settings AC_ARG_WITH(xmltooling, - AC_HELP_STRING([--with-xmltooling=PATH], [where xmltooling-c is installed]), - [if test x_$with_xmltooling != x_/usr; then - LDFLAGS="-L${with_xmltooling}/lib $LDFLAGS" - CPPFLAGS="-I${with_xmltooling}/include $CPPFLAGS" - fi]) + AS_HELP_STRING([--with-xmltooling=PATH],[where xmltooling-c is installed]), + [if test x_$with_xmltooling != x_/usr; then + LDFLAGS="-L${with_xmltooling}/lib $LDFLAGS" + CPPFLAGS="-I${with_xmltooling}/include $CPPFLAGS" + fi]) LITE_LIBS="-lxmltooling-lite" XMLSEC_LIBS="-lxmltooling" -AC_CHECK_HEADER([xmltooling/base.h],, - AC_MSG_ERROR([unable to find xmltooling header files])) +AC_CHECK_HEADER([xmltooling/base.h],,AC_MSG_ERROR([unable to find xmltooling header files])) # XML-Security settings AC_ARG_WITH(xmlsec, - AC_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),, - [with_xmlsec=/usr]) + AS_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),, + [with_xmlsec=/usr]) if test x_$with_xmlsec != x_/usr; then LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS" @@ -191,9 +205,9 @@ int i = 0; #endif])], [AC_MSG_RESULT(OK)], [AC_MSG_FAILURE([XML-Security version 1.4.0 or greater is required.])]) -AC_TRY_LINK( - [#include ], - [XSECPlatformUtils::Initialise()],, +AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[XSECPlatformUtils::Initialise()]])],, [AC_MSG_ERROR([unable to link with XML-Security])]) # restore master libs @@ -201,7 +215,7 @@ LIBS="$save_LIBS" # OpenSAML settings AC_ARG_WITH(saml, - AC_HELP_STRING([--with-saml=PATH], [where saml is installed]), + AS_HELP_STRING([--with-saml=PATH],[where saml is installed]), [if test x_$with_saml != x_/usr; then LDFLAGS="-L${with_saml}/lib $LDFLAGS" CPPFLAGS="-I${with_saml}/include $CPPFLAGS" @@ -212,20 +226,18 @@ XMLSEC_LIBS="-lsaml $XMLSEC_LIBS" save_LIBS="$LIBS" LIBS="$XMLSEC_LIBS $LIBS" -AC_CHECK_HEADER([saml/saml2/metadata/Metadata.h],, - AC_MSG_ERROR([unable to find OpenSAML header files])) -AC_TRY_LINK( - [#include ], - [opensaml::SAMLConfig::getConfig()], - [AC_DEFINE(HAVE_SAML,1,[Define if saml library was found])], - [AC_MSG_ERROR([unable to link with OpenSAML])]) +AC_CHECK_HEADER([saml/saml2/metadata/Metadata.h],,AC_MSG_ERROR([unable to find OpenSAML header files])) +AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[opensaml::SAMLConfig::getConfig()]])], + ,[AC_MSG_ERROR([unable to link with OpenSAML])]) # restore master libs LIBS="$save_LIBS" # Shibboleth SP settings AC_ARG_WITH(shibsp, - AC_HELP_STRING([--with-shibsp=PATH], [where Shibboleth SP is installed]), + AS_HELP_STRING([--with-shibsp=PATH],[where Shibboleth SP is installed]), [if test x_$with_shibsp != x_/usr; then LDFLAGS="-L${with_shibsp}/lib $LDFLAGS" CPPFLAGS="-I${with_shibsp}/include $CPPFLAGS" @@ -237,33 +249,173 @@ XMLSEC_LIBS="-lshibsp $XMLSEC_LIBS" save_LIBS="$LIBS" LIBS="$XMLSEC_LIBS $LIBS" -AC_CHECK_HEADER([shibsp/SPConfig.h],, - AC_MSG_ERROR([unable to find Shibboleth SP header files])) -AC_TRY_LINK( - [#include ], - [shibsp::SPConfig::getConfig()], - [AC_DEFINE(HAVE_SHIBSP,1,[Define if Shibboleth SP library was found])], - [AC_MSG_ERROR([unable to link with Shibboleth SP])]) +AC_CHECK_HEADER([shibsp/SPConfig.h],,AC_MSG_ERROR([unable to find Shibboleth SP header files])) +AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[shibsp::SPConfig::getConfig()]])], + ,[AC_MSG_ERROR([unable to link with Shibboleth SP])]) AC_MSG_CHECKING([whether SP library supports non-plugin remoting]) -AC_TRY_COMPILE([#include ], - [shibsp::ServiceProvider* sp; - sp->regListener(NULL,NULL); - ], - [AC_MSG_RESULT([yes])] - [AC_DEFINE([SHIBRESOLVER_SHIBSP_HAS_REMOTING], [1], [Define to 1 if Shibboleth SP supports non-plugin remoting.])], +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include + ]], + [[shibsp::ServiceProvider* sp; sp->regListener(NULL,NULL);]])], + [AC_MSG_RESULT([yes])AC_DEFINE([SHIBRESOLVER_SHIBSP_HAS_REMOTING],[1],[Define to 1 if Shibboleth SP supports non-plugin remoting.])], [AC_MSG_RESULT([no])]) # restore master libs LIBS="$save_LIBS" -AC_SUBST(LITE_LIBS) -AC_SUBST(XMLSEC_LIBS) +# GSS-API checking + +GSSAPI_ROOT="/usr" +AC_ARG_WITH(gssapi-includes, + AS_HELP_STRING([--with-gssapi-includes=DIR],[Specify location of GSSAPI header]), + [ GSSAPI_INCS="-I$withval" + want_gss="yes" ] +) + +AC_ARG_WITH(gssapi-libs, + AS_HELP_STRING([--with-gssapi-libs=DIR],[Specify location of GSSAPI libs]), + [ GSSAPI_LIB_DIR="-L$withval" + want_gss="yes" ] +) + +AC_ARG_WITH(gssapi, + AS_HELP_STRING([--with-gssapi=DIR],[Where to look for GSSAPI]), + [ GSSAPI_ROOT="$withval" + if test x"$GSSAPI_ROOT" != xno; then + want_gss="yes" + if test x"$GSSAPI_ROOT" = xyes; then + dnl if yes, then use default root + GSSAPI_ROOT="/usr" + fi + fi +]) -AC_CONFIG_FILES([resolver.spec Portfile]) +save_CPPFLAGS="$CPPFLAGS" +AC_MSG_CHECKING([if GSSAPI support is requested]) +if test x"$want_gss" = xyes; then + AC_MSG_RESULT(yes) + + if test -z "$GSSAPI_INCS"; then + if test -f "$GSSAPI_ROOT/bin/krb5-config"; then + GSSAPI_INCS=`$GSSAPI_ROOT/bin/krb5-config --cflags gssapi` + elif test "$GSSAPI_ROOT" != "yes"; then + GSSAPI_INCS="-I$GSSAPI_ROOT/include" + fi + fi -# output the underlying makefiles -AC_CONFIG_FILES([Makefile doc/Makefile shibresolver/Makefile]) + CPPFLAGS="$CPPFLAGS $GSSAPI_INCS" + + AC_CHECK_HEADER(gss.h, + [ + dnl found in the given dirs + AC_DEFINE([SHIBRESOLVER_HAVE_GSSGNU],[1],[if you have the GNU gssapi libraries]) + gnu_gss=yes + ], + [ + dnl not found, check Heimdal or MIT + AC_CHECK_HEADERS([gssapi/gssapi.h], [], [not_mit=1]) + AC_CHECK_HEADERS( + [gssapi/gssapi_generic.h gssapi/gssapi_krb5.h], + [], + [not_mit=1], + [ +AC_INCLUDES_DEFAULT +#ifdef HAVE_GSSAPI_GSSAPI_H +#include +#endif + ]) + if test "x$not_mit" = "x1"; then + dnl MIT not found, check for Heimdal + AC_CHECK_HEADER([gssapi.h], + [ + dnl found + AC_DEFINE([SHIBRESOLVER_HAVE_GSSHEIMDAL],[1],[if you have the Heimdal gssapi libraries]) + ], + [ + dnl no header found, disabling GSS + want_gss=no + AC_MSG_WARN([disabling GSSAPI since no header files was found]) + ] + ) + else + dnl MIT found + AC_DEFINE([SHIBRESOLVER_HAVE_GSSMIT],[1],[if you have the MIT gssapi libraries]) + dnl check if we have a really old MIT kerberos (<= 1.2) + AC_MSG_CHECKING([if gssapi headers declare GSS_C_NT_HOSTBASED_SERVICE]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#include +#include +#include + ]],[[ + gss_import_name( + (OM_uint32 *)0, + (gss_buffer_t)0, + GSS_C_NT_HOSTBASED_SERVICE, + (gss_name_t *)0); + ]]) + ],[ + AC_MSG_RESULT([yes]) + ],[ + AC_MSG_RESULT([no]) + AC_DEFINE([HAVE_OLD_GSSMIT],[1],[if you have an old MIT gssapi library, lacking GSS_C_NT_HOSTBASED_SERVICE]) + ]) + fi + ] + ) +else + AC_MSG_RESULT(no) +fi +if test x"$want_gss" = xyes; then + AC_DEFINE([SHIBRESOLVER_HAVE_GSSAPI],[1],[if you have the gssapi libraries]) + + if test -n "$gnu_gss"; then + LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR" + LIBS="$LIBS -lgss" + elif test -z "$GSSAPI_LIB_DIR"; then + case $host in + *-*-darwin*) + LIBS="$LIBS -lgssapi_krb5 -lresolv" + ;; + *) + if test -f "$GSSAPI_ROOT/bin/krb5-config"; then + dnl krb5-config doesn't have --libs-only-L or similar, put everything + dnl into LIBS + gss_libs=`$GSSAPI_ROOT/bin/krb5-config --libs gssapi` + LIBS="$LIBS $gss_libs" + elif test "$GSSAPI_ROOT" != "yes"; then + LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff" + LIBS="$LIBS -lgssapi" + else + LIBS="$LIBS -lgssapi" + fi + ;; + esac + else + LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR" + LIBS="$LIBS -lgssapi" + fi + + AC_MSG_CHECKING([whether GSS-API naming extensions are available]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[gss_get_name_attribute(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);]])], + [AC_MSG_RESULT([yes])AC_DEFINE([HAVE_GSSAPI_NAMINGEXTS],[1],[Define to 1 if GSS-API naming extensions are available.])], + [AC_MSG_RESULT([no])]) + +else + CPPFLAGS="$save_CPPFLAGS" +fi + + +AC_SUBST(LITE_LIBS) +AC_SUBST(XMLSEC_LIBS) LIBTOOL="$LIBTOOL --silent"