diff --git a/auxdir/x_ac_munge.m4 b/auxdir/x_ac_munge.m4 new file mode 100644 index 0000000000000000000000000000000000000000..de8df469b7203ed4e13b1f373f11583cf7f64fd9 --- /dev/null +++ b/auxdir/x_ac_munge.m4 @@ -0,0 +1,60 @@ +##***************************************************************************** +## $Id$ +##***************************************************************************** +# AUTHOR: +# Chris Dunlap <cdunlap@llnl.gov> (originally for OpenSSL) +# Modified for munge by Christopher Morrone <morrone2@llnl.gov> +# +# SYNOPSIS: +# X_AC_MUNGE() +# +# DESCRIPTION: +# Check the usual suspects for an munge installation, +# updating CPPFLAGS and LDFLAGS as necessary. +# +# WARNINGS: +# This macro must be placed after AC_PROG_CC and before AC_PROG_LIBTOOL. +##***************************************************************************** + +AC_DEFUN([X_AC_MUNGE], [ + + _x_ac_munge_dirs="/usr /usr/local /opt/freeware /opt/munge" + + AC_ARG_WITH( + [munge], + AC_HELP_STRING( + [--with-munge=PATH], + [Specify path to munge installation]), + [_x_ac_munge_dirs="$withval $_x_ac_munge_dirs"]) + + AC_CACHE_CHECK( + [for munge installation], + [x_ac_cv_munge_dir], + [ + for d in $_x_ac_munge_dirs; do + test -d "$d" || continue + test -d "$d/include" || continue + test -f "$d/include/munge.h" || continue + test -d "$d/lib" || continue + _x_ac_munge_libs_save="$LIBS" + LIBS="-L$d/lib -lmunge $LIBS" + AC_LINK_IFELSE( + AC_LANG_CALL([], munge_encode), + AS_VAR_SET(x_ac_cv_munge_dir, $d)) + LIBS="$_x_ac_munge_libs_save" + test -n "$x_ac_cv_munge_dir" && break + done + ]) + + if test -z "$x_ac_cv_munge_dir"; then + AC_MSG_WARN([unable to locate munge installation]) + else + MUNGE_LIBS="-lmunge" + AC_SUBST(MUNGE_LIBS) + AM_CONDITIONAL(WITH_MUNGE, true) + if test "$x_ac_cv_munge_dir" != "/usr"; then + CPPFLAGS="$CPPFLAGS -I$x_ac_cv_munge_dir/include" + LDFLAGS="$LDFLAGS -L$x_ac_cv_munge_dir/lib" + fi + fi +]) diff --git a/configure.ac b/configure.ac index 9bac5a479983ee4a074a4902dbc2e5d378b87a27..ecd80d7495fc7306ba9b3ca3c9e5911368e7ca55 100644 --- a/configure.ac +++ b/configure.ac @@ -153,12 +153,7 @@ X_AC_SLURM_WITH_SSL dnl dnl Check for compilation of SLURM auth modules: dnl -AC_CHECK_LIB(munge, munge_encode, [have_munge=yes], [have_munge=no]) -if test "$have_munge" = "yes"; then - MUNGE_LIBS="-lmunge" - AC_SUBST(MUNGE_LIBS) -fi -AM_CONDITIONAL(WITH_MUNGE, test "x$have_munge" = "xyes") +X_AC_MUNGE AUTHD_LIBS="-lauth -le" savedLIBS="$LIBS"