xref: /freebsd/contrib/openpam/configure.ac (revision cfd6422a5217410fbd66f7a7a8a64d9d85e61229)
1dnl $OpenPAM: configure.ac 947 2019-02-24 20:18:17Z des $
2
3AC_PREREQ([2.62])
4AC_REVISION([$OpenPAM: configure.ac 947 2019-02-24 20:18:17Z des $])
5AC_INIT([OpenPAM], [20190224], [des@des.no], [openpam], [http://www.openpam.org/])
6AC_CONFIG_SRCDIR([lib/libpam/pam_start.c])
7AC_CONFIG_MACRO_DIR([m4])
8AM_INIT_AUTOMAKE([foreign])
9AM_CONFIG_HEADER([config.h])
10
11# C compiler and features
12AC_LANG(C)
13AC_PROG_CC
14AC_PROG_CC_STDC
15AC_PROG_CPP
16AC_GNU_SOURCE
17AC_C_CONST
18AC_C_RESTRICT
19AC_C_VOLATILE
20
21# libtool
22LT_PREREQ([2.2.6])
23LT_INIT([disable-static dlopen])
24
25# pkg-config
26AX_PROG_PKG_CONFIG
27
28# other programs
29AC_PROG_INSTALL
30
31LIB_MAJ=2
32AC_SUBST(LIB_MAJ)
33AC_DEFINE_UNQUOTED(LIB_MAJ, $LIB_MAJ, [OpenPAM library major number])
34
35AC_ARG_ENABLE([debug],
36    AC_HELP_STRING([--enable-debug],
37	[turn debugging macros on]),
38    AC_DEFINE(OPENPAM_DEBUG, 1, [Turn debugging macros on]))
39
40AC_ARG_ENABLE([unversioned-modules],
41    AC_HELP_STRING([--disable-unversioned-modules],
42	[support loading of unversioned modules]),
43    [AS_IF([test x"$enableval" = x"no"], [
44	AC_DEFINE(DISABLE_UNVERSIONED_MODULES,
45	    1,
46	    [Whether loading unversioned modules support is disabled])
47    ])])
48
49AC_ARG_WITH([modules-dir],
50    AC_HELP_STRING([--with-modules-dir=DIR],
51	[OpenPAM modules directory]),
52    [AS_IF([test x"$withval" != x"no"], [
53	OPENPAM_MODULES_DIR="$withval"
54	AC_DEFINE_UNQUOTED(OPENPAM_MODULES_DIR,
55	    "${OPENPAM_MODULES_DIR%/}",
56	    [OpenPAM modules directory])
57    ])])
58AC_SUBST(OPENPAM_MODULES_DIR)
59AM_CONDITIONAL([CUSTOM_MODULES_DIR], [test x"$OPENPAM_MODULES_DIR" != x""])
60
61AC_ARG_WITH([doc],
62    AC_HELP_STRING([--without-doc], [do not build documentation]),
63    [],
64    [with_doc=yes])
65AM_CONDITIONAL([WITH_DOC], [test x"$with_doc" = x"yes"])
66
67AC_ARG_WITH([pam-unix],
68    AC_HELP_STRING([--with-pam-unix], [build sample pam_unix(8) module]),
69    [],
70    [with_pam_unix=no])
71AM_CONDITIONAL([WITH_PAM_UNIX], [test x"$with_pam_unix" = x"yes"])
72
73AC_ARG_WITH(pamtest,
74    AC_HELP_STRING([--with-pamtest], [build test application]),
75    [],
76    [with_pamtest=no])
77AM_CONDITIONAL([WITH_PAMTEST], [test x"$with_pamtest" = x"yes"])
78
79AC_ARG_WITH(su,
80    AC_HELP_STRING([--with-su], [build sample su(1) implementation]),
81    [],
82    [with_su=no])
83AM_CONDITIONAL([WITH_SU], [test x"$with_su" = x"yes"])
84
85AC_ARG_WITH(system-libpam,
86    AC_HELP_STRING([--with-system-libpam], [use system libpam]),
87    [],
88    [with_system_libpam=no])
89AM_CONDITIONAL([WITH_SYSTEM_LIBPAM], [test x"$with_system_libpam" = x"yes"])
90
91AC_CHECK_HEADERS([crypt.h])
92
93AC_CHECK_FUNCS([asprintf vasprintf])
94AC_CHECK_FUNCS([dlfunc fdlopen])
95AC_CHECK_FUNCS([fpurge])
96AC_CHECK_FUNCS([setlogmask])
97AC_CHECK_FUNCS([strlcat strlcmp strlcpy strlset])
98
99saved_LIBS="${LIBS}"
100LIBS=""
101AC_CHECK_LIB([dl], [dlopen])
102DL_LIBS="${LIBS}"
103LIBS="${saved_LIBS}"
104AC_SUBST(DL_LIBS)
105
106saved_LIBS="${LIBS}"
107LIBS=""
108AC_CHECK_LIB([pam], [pam_start])
109SYSTEM_LIBPAM="${LIBS}"
110LIBS="${saved_LIBS}"
111AC_SUBST(SYSTEM_LIBPAM)
112
113AX_PKG_CONFIG_CHECK([cryb-test],
114  [AC_MSG_NOTICE([Cryb test framework found, unit tests enabled.])],
115  [AC_MSG_WARN([Cryb test framework not found, unit tests disabled.])])
116AM_CONDITIONAL([WITH_TEST], [test x"$CRYB_TEST_LIBS" != x""])
117
118AC_ARG_ENABLE([developer-warnings],
119    AS_HELP_STRING([--enable-developer-warnings], [enable strict warnings (default is NO)]),
120    [CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual"])
121AC_ARG_ENABLE([debugging-symbols],
122    AS_HELP_STRING([--enable-debugging-symbols], [enable debugging symbols (default is NO)]),
123    [CFLAGS="${CFLAGS} -O0 -g -fno-inline"])
124AC_ARG_ENABLE([werror],
125    AS_HELP_STRING([--enable-werror], [use -Werror (default is NO)]),
126    [CFLAGS="${CFLAGS} -Werror"])
127
128AC_CONFIG_FILES([
129    Makefile
130    bin/Makefile
131    bin/openpam_dump_policy/Makefile
132    bin/pamtest/Makefile
133    bin/su/Makefile
134    doc/Makefile
135    doc/man/Makefile
136    include/Makefile
137    include/security/Makefile
138    lib/Makefile
139    lib/libpam/Makefile
140    misc/Makefile
141    modules/Makefile
142    modules/pam_deny/Makefile
143    modules/pam_permit/Makefile
144    modules/pam_return/Makefile
145    modules/pam_unix/Makefile
146    t/Makefile
147])
148AC_CONFIG_FILES([mkpkgng],[chmod +x mkpkgng])
149AC_CONFIG_FILES([misc/coverage.sh],[chmod +x misc/coverage.sh])
150AC_CONFIG_FILES([misc/coverity.sh],[chmod +x misc/coverity.sh])
151AC_OUTPUT
152