1AC_PREREQ([2.69]) 2AC_INIT([OpenPAM], [20250531], [des@des.dev], [openpam], [https://openpam.org/]) 3AC_CONFIG_SRCDIR([lib/libpam/pam_start.c]) 4AC_CONFIG_MACRO_DIR([m4]) 5AM_INIT_AUTOMAKE([foreign]) 6AC_CONFIG_HEADERS([config.h]) 7 8# C compiler and features 9AC_LANG(C) 10AC_USE_SYSTEM_EXTENSIONS 11AC_PROG_CC([clang gcc cc]) 12AC_PROG_CPP 13AC_PROG_CXX([clang++ g++ c++]) 14AC_C_CONST 15AC_C_RESTRICT 16AC_C_VOLATILE 17AX_COMPILER_VENDOR 18 19# libtool 20LT_PREREQ([2.2.6]) 21LT_INIT([disable-static dlopen]) 22 23# pkg-config 24AX_PROG_PKG_CONFIG 25 26# other programs 27AC_PROG_INSTALL 28 29LIB_MAJ=2 30AC_SUBST(LIB_MAJ) 31AC_DEFINE_UNQUOTED(LIB_MAJ, $LIB_MAJ, [OpenPAM library major number]) 32 33AC_ARG_ENABLE([debug], 34 AS_HELP_STRING([--enable-debug], 35 [turn debugging macros on]), 36 AC_DEFINE(OPENPAM_DEBUG, 1, [Turn debugging macros on])) 37 38AC_ARG_ENABLE([unversioned-modules], 39 AS_HELP_STRING([--disable-unversioned-modules], 40 [support loading of unversioned modules]), 41 [AS_IF([test x"$enableval" = x"no"], [ 42 AC_DEFINE(DISABLE_UNVERSIONED_MODULES, 43 1, 44 [Whether loading unversioned modules support is disabled]) 45 ])]) 46 47AC_ARG_WITH([modules-dir], 48 AS_HELP_STRING([--with-modules-dir=DIR], 49 [OpenPAM modules directory]), 50 [AS_IF([test x"$withval" != x"no"], [ 51 OPENPAM_MODULES_DIR="$withval" 52 AC_DEFINE_UNQUOTED(OPENPAM_MODULES_DIR, 53 "${OPENPAM_MODULES_DIR%/}", 54 [OpenPAM modules directory]) 55 ])]) 56AC_SUBST(OPENPAM_MODULES_DIR) 57AM_CONDITIONAL([CUSTOM_MODULES_DIR], [test x"$OPENPAM_MODULES_DIR" != x""]) 58 59AS_IF([test x"$LOCALBASE" = x""], [ 60 AS_IF([test x"$prefix" = x"NONE"], 61 [LOCALBASE=/usr/local], [LOCALBASE=$prefix])]) 62AC_ARG_WITH([localbase], 63 AS_HELP_STRING([--with-localbase=DIR], 64 [Base directory for local policies and modules]), 65 AS_CASE([$withval], 66 [no], [LOCALBASE=], 67 [yes], [LOCALBASE=$ac_default_prefix], 68 [*], [LOCALBASE="$withval"])) 69AS_IF([test x"$LOCALBASE" != x""], [ 70 AC_DEFINE_UNQUOTED(LOCALBASE, "${LOCALBASE%/}", 71 [Base directory for local policies and modules])]) 72 73AC_ARG_WITH([doc], 74 AS_HELP_STRING([--without-doc], [do not build documentation]), 75 [], 76 [with_doc=yes]) 77AM_CONDITIONAL([WITH_DOC], [test x"$with_doc" = x"yes"]) 78 79AC_ARG_WITH([pam-unix], 80 AS_HELP_STRING([--with-pam-unix], [build sample pam_unix(8) module]), 81 [], 82 [with_pam_unix=no]) 83AM_CONDITIONAL([WITH_PAM_UNIX], [test x"$with_pam_unix" = x"yes"]) 84 85AC_ARG_WITH(pamtest, 86 AS_HELP_STRING([--with-pamtest], [build test application]), 87 [], 88 [with_pamtest=no]) 89AM_CONDITIONAL([WITH_PAMTEST], [test x"$with_pamtest" = x"yes"]) 90 91AC_ARG_WITH(su, 92 AS_HELP_STRING([--with-su], [build sample su(1) implementation]), 93 [], 94 [with_su=no]) 95AM_CONDITIONAL([WITH_SU], [test x"$with_su" = x"yes"]) 96 97AC_ARG_WITH(system-libpam, 98 AS_HELP_STRING([--with-system-libpam], [use system libpam]), 99 [], 100 [with_system_libpam=no]) 101AM_CONDITIONAL([WITH_SYSTEM_LIBPAM], [test x"$with_system_libpam" = x"yes"]) 102 103AC_CHECK_HEADERS([crypt.h]) 104 105AC_CHECK_FUNCS([asprintf vasprintf]) 106AC_CHECK_FUNCS([dlfunc fdlopen]) 107AC_CHECK_FUNCS([fpurge]) 108AC_CHECK_FUNCS([setlogmask]) 109AC_CHECK_FUNCS([strlcat strlcmp strlcpy strlset]) 110 111saved_LIBS="${LIBS}" 112LIBS="" 113AC_CHECK_LIB([dl], [dlopen]) 114DL_LIBS="${LIBS}" 115LIBS="${saved_LIBS}" 116AC_SUBST(DL_LIBS) 117 118saved_LIBS="${LIBS}" 119LIBS="" 120AC_CHECK_LIB([pam], [pam_start]) 121SYSTEM_LIBPAM="${LIBS}" 122LIBS="${saved_LIBS}" 123AC_SUBST(SYSTEM_LIBPAM) 124 125AX_PKG_CONFIG_CHECK([cryb-test], 126 [AC_MSG_NOTICE([Cryb test framework found, unit tests enabled.])], 127 [AC_MSG_WARN([Cryb test framework not found, unit tests disabled.])]) 128AM_CONDITIONAL([WITH_TEST], [test x"$CRYB_TEST_LIBS" != x""]) 129 130AC_ARG_ENABLE([developer-warnings], 131 AS_HELP_STRING([--enable-developer-warnings], [enable strict warnings (default is NO)]), 132 [CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual"]) 133AC_ARG_ENABLE([debugging-symbols], 134 AS_HELP_STRING([--enable-debugging-symbols], [enable debugging symbols (default is NO)]), 135 [CFLAGS="${CFLAGS} -O0 -g -fno-inline"]) 136AC_ARG_ENABLE([werror], 137 AS_HELP_STRING([--enable-werror], [use -Werror (default is NO)]), 138 [CFLAGS="${CFLAGS} -Werror"]) 139 140AC_ARG_ENABLE([code-coverage], 141 AS_HELP_STRING([--enable-code-coverage], 142 [enable code coverage])) 143AS_IF([test x"$enable_code_coverage" = x"yes"], [ 144 AM_COND_IF([WITH_TEST], [ 145 AS_IF([test x"$ax_cv_c_compiler_vendor" = x"clang"], [ 146 CFLAGS="${CFLAGS} -fprofile-instr-generate -fcoverage-mapping" 147 clang_code_coverage="yes" 148 AC_SUBST([clang_ver], [${CC#clang}]) 149 ], [ 150 AC_MSG_ERROR([code coverage is only supported with clang]) 151 ]) 152 AC_DEFINE([WITH_CODE_COVERAGE], [1], [Define to 1 if code coverage is enabled]) 153 AC_MSG_NOTICE([code coverage enabled]) 154 ], [ 155 AC_MSG_ERROR([code coverage requires unit tests]) 156 ]) 157]) 158AM_CONDITIONAL([WITH_CODE_COVERAGE], [test x"$enable_code_coverage" = x"yes"]) 159AM_CONDITIONAL([CLANG_CODE_COVERAGE], [test x"$clang_code_coverage" = x"yes"]) 160 161AC_CONFIG_FILES([ 162 Makefile 163 bin/Makefile 164 bin/openpam_dump_policy/Makefile 165 bin/pamtest/Makefile 166 bin/su/Makefile 167 doc/Makefile 168 doc/man/Makefile 169 freebsd/Makefile 170 include/Makefile 171 include/security/Makefile 172 lib/Makefile 173 lib/libpam/Makefile 174 misc/Makefile 175 modules/Makefile 176 modules/pam_deny/Makefile 177 modules/pam_permit/Makefile 178 modules/pam_return/Makefile 179 modules/pam_unix/Makefile 180 t/Makefile 181]) 182AC_CONFIG_FILES([misc/coverity.sh],[chmod +x misc/coverity.sh]) 183AC_OUTPUT 184