xref: /freebsd/contrib/openpam/configure.ac (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1dnl $Id: configure.ac 816 2014-09-12 07:50:22Z des $
2
3AC_PREREQ([2.62])
4AC_REVISION([$Id: configure.ac 816 2014-09-12 07:50:22Z des $])
5AC_INIT([OpenPAM], [20140912], [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], [compile 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], [compile 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], [compile sample su(1) implementation]),
78    [],
79    [with_su=no])
80AM_CONDITIONAL([WITH_SU], [test x"$with_su" = x"yes"])
81
82AC_CHECK_HEADERS([crypt.h])
83
84AC_CHECK_FUNCS([asprintf vasprintf])
85AC_CHECK_FUNCS([dlfunc fdlopen])
86AC_CHECK_FUNCS([fpurge])
87AC_CHECK_FUNCS([setlogmask])
88AC_CHECK_FUNCS([strlcat strlcmp strlcpy strlset])
89
90saved_LIBS="${LIBS}"
91LIBS=""
92AC_CHECK_LIB([dl], [dlopen])
93DL_LIBS="${LIBS}"
94LIBS="${saved_LIBS}"
95AC_SUBST(DL_LIBS)
96
97saved_LIBS="${LIBS}"
98LIBS=""
99AC_CHECK_LIB([crypt], [crypt])
100CRYPT_LIBS="${LIBS}"
101LIBS="${saved_LIBS}"
102AC_SUBST(CRYPT_LIBS)
103
104saved_LIBS="${LIBS}"
105LIBS=""
106AC_CHECK_LIB([crypto], [HMAC_CTX_init])
107CRYPTO_LIBS="${LIBS}"
108LIBS="${saved_LIBS}"
109AC_SUBST(CRYPTO_LIBS)
110
111AC_ARG_ENABLE([developer-warnings],
112    AS_HELP_STRING([--enable-developer-warnings], [enable strict warnings (default is NO)]),
113    [CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual"])
114AC_ARG_ENABLE([debugging-symbols],
115    AS_HELP_STRING([--enable-debugging-symbols], [enable debugging symbols (default is NO)]),
116    [CFLAGS="${CFLAGS} -O0 -g -fno-inline"])
117AC_ARG_ENABLE([werror],
118    AS_HELP_STRING([--enable-werror], [use -Werror (default is NO)]),
119    [CFLAGS="${CFLAGS} -Werror"])
120
121AC_CONFIG_FILES([
122    Makefile
123    bin/Makefile
124    bin/openpam_dump_policy/Makefile
125    bin/pamtest/Makefile
126    bin/su/Makefile
127    doc/Makefile
128    doc/man/Makefile
129    include/Makefile
130    include/security/Makefile
131    lib/Makefile
132    lib/libpam/Makefile
133    modules/Makefile
134    modules/pam_deny/Makefile
135    modules/pam_permit/Makefile
136    modules/pam_unix/Makefile
137    t/Makefile
138])
139AC_CONFIG_FILES([pamgdb],[chmod +x pamgdb])
140AC_CONFIG_FILES([mkpkgng],[chmod +x mkpkgng])
141AC_OUTPUT
142