xref: /freebsd/contrib/openpam/configure.ac (revision f5147e312f43a9050468de539aeafa072caa1a60)
1dnl $OpenPAM: configure.ac 939 2017-04-30 21:36:50Z des $
2
3AC_PREREQ([2.62])
4AC_REVISION([$OpenPAM: configure.ac 939 2017-04-30 21:36:50Z des $])
5AC_INIT([OpenPAM], [20170430], [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# other programs
26AC_PROG_INSTALL
27
28LIB_MAJ=2
29AC_SUBST(LIB_MAJ)
30AC_DEFINE_UNQUOTED(LIB_MAJ, $LIB_MAJ, [OpenPAM library major number])
31
32AC_ARG_ENABLE([debug],
33    AC_HELP_STRING([--enable-debug],
34	[turn debugging macros on]),
35    AC_DEFINE(OPENPAM_DEBUG, 1, [Turn debugging macros on]))
36
37AC_ARG_ENABLE([unversioned-modules],
38    AC_HELP_STRING([--disable-unversioned-modules],
39	[support loading of unversioned modules]),
40    [AS_IF([test x"$enableval" = x"no"], [
41	AC_DEFINE(DISABLE_UNVERSIONED_MODULES,
42	    1,
43	    [Whether loading unversioned modules support is disabled])
44    ])])
45
46AC_ARG_WITH([modules-dir],
47    AC_HELP_STRING([--with-modules-dir=DIR],
48	[OpenPAM modules directory]),
49    [AS_IF([test x"$withval" != x"no"], [
50	OPENPAM_MODULES_DIR="$withval"
51	AC_DEFINE_UNQUOTED(OPENPAM_MODULES_DIR,
52	    "${OPENPAM_MODULES_DIR%/}",
53	    [OpenPAM modules directory])
54    ])])
55AC_SUBST(OPENPAM_MODULES_DIR)
56AM_CONDITIONAL([CUSTOM_MODULES_DIR], [test x"$OPENPAM_MODULES_DIR" != x""])
57
58AC_ARG_WITH([doc],
59    AC_HELP_STRING([--without-doc], [do not build documentation]),
60    [],
61    [with_doc=yes])
62AM_CONDITIONAL([WITH_DOC], [test x"$with_doc" = x"yes"])
63
64AC_ARG_WITH([pam-unix],
65    AC_HELP_STRING([--with-pam-unix], [build sample pam_unix(8) module]),
66    [],
67    [with_pam_unix=no])
68AM_CONDITIONAL([WITH_PAM_UNIX], [test x"$with_pam_unix" = x"yes"])
69
70AC_ARG_WITH(pamtest,
71    AC_HELP_STRING([--with-pamtest], [build test application]),
72    [],
73    [with_pamtest=no])
74AM_CONDITIONAL([WITH_PAMTEST], [test x"$with_pamtest" = x"yes"])
75
76AC_ARG_WITH(su,
77    AC_HELP_STRING([--with-su], [build sample su(1) implementation]),
78    [],
79    [with_su=no])
80AM_CONDITIONAL([WITH_SU], [test x"$with_su" = x"yes"])
81
82AC_ARG_WITH(system-libpam,
83    AC_HELP_STRING([--with-system-libpam], [use system libpam]),
84    [],
85    [with_system_libpam=no])
86AM_CONDITIONAL([WITH_SYSTEM_LIBPAM], [test x"$with_system_libpam" = x"yes"])
87
88AC_CHECK_HEADERS([crypt.h])
89
90AC_CHECK_FUNCS([asprintf vasprintf])
91AC_CHECK_FUNCS([dlfunc fdlopen])
92AC_CHECK_FUNCS([fpurge])
93AC_CHECK_FUNCS([setlogmask])
94AC_CHECK_FUNCS([strlcat strlcmp strlcpy strlset])
95
96saved_LIBS="${LIBS}"
97LIBS=""
98AC_CHECK_LIB([dl], [dlopen])
99DL_LIBS="${LIBS}"
100LIBS="${saved_LIBS}"
101AC_SUBST(DL_LIBS)
102
103saved_LIBS="${LIBS}"
104LIBS=""
105AC_CHECK_LIB([crypt], [crypt])
106CRYPT_LIBS="${LIBS}"
107LIBS="${saved_LIBS}"
108AC_SUBST(CRYPT_LIBS)
109
110saved_LIBS="${LIBS}"
111LIBS=""
112AC_CHECK_LIB([crypto], [HMAC_CTX_init])
113CRYPTO_LIBS="${LIBS}"
114LIBS="${saved_LIBS}"
115AC_SUBST(CRYPTO_LIBS)
116
117saved_LIBS="${LIBS}"
118LIBS=""
119AC_CHECK_LIB([pam], [pam_start])
120SYSTEM_LIBPAM="${LIBS}"
121LIBS="${saved_LIBS}"
122AC_SUBST(SYSTEM_LIBPAM)
123
124save_LIBS="${LIBS}"
125LIBS=""
126AC_SEARCH_LIBS([cryb_test_version], [cryb-test], [
127  CRYB_TEST_LIBS="${LIBS}"
128], [
129  CRYB_TEST_LIBS=""
130  AC_MSG_WARN([cryb-test library not available, unit tests disabled])
131])
132LIBS="${save_LIBS}"
133AC_SUBST(CRYB_TEST_LIBS)
134AM_CONDITIONAL([WITH_TEST], [ test x"$CRYB_TEST_LIBS" != x"" ])
135
136AC_ARG_ENABLE([developer-warnings],
137    AS_HELP_STRING([--enable-developer-warnings], [enable strict warnings (default is NO)]),
138    [CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual"])
139AC_ARG_ENABLE([debugging-symbols],
140    AS_HELP_STRING([--enable-debugging-symbols], [enable debugging symbols (default is NO)]),
141    [CFLAGS="${CFLAGS} -O0 -g -fno-inline"])
142AC_ARG_ENABLE([werror],
143    AS_HELP_STRING([--enable-werror], [use -Werror (default is NO)]),
144    [CFLAGS="${CFLAGS} -Werror"])
145
146AC_CONFIG_FILES([
147    Makefile
148    bin/Makefile
149    bin/openpam_dump_policy/Makefile
150    bin/pamtest/Makefile
151    bin/su/Makefile
152    doc/Makefile
153    doc/man/Makefile
154    include/Makefile
155    include/security/Makefile
156    lib/Makefile
157    lib/libpam/Makefile
158    misc/Makefile
159    modules/Makefile
160    modules/pam_deny/Makefile
161    modules/pam_permit/Makefile
162    modules/pam_return/Makefile
163    modules/pam_unix/Makefile
164    t/Makefile
165])
166AC_CONFIG_FILES([mkpkgng],[chmod +x mkpkgng])
167AC_CONFIG_FILES([misc/coverage.sh],[chmod +x misc/coverage.sh])
168AC_CONFIG_FILES([misc/coverity.sh],[chmod +x misc/coverity.sh])
169AC_OUTPUT
170