forked from beatgammit/simple-pam
-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.ac
103 lines (88 loc) · 2.72 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Initialize autoconf.
AC_COPYRIGHT([
See the included file: COPYING for copyright information.
])
AC_INIT([pam_ipahbac], [0.1.0], [[email protected]],
[pam_ipahbac], [https://github.com/rseabra/pam_ipahbac/])
# Force autoconf to be at least this version number:
AC_PREREQ([2.68])
# Safety check - list a source file that wouldn't be in other directories:
AC_CONFIG_SRCDIR([src/pam_ipahbac.c])
# Put configuration results here, so we can easily #include them:
AC_CONFIG_HEADERS([config.h])
# Put autotools auxiliary files in subdirectories to reduce clutter:
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([m4])
# Enable "automake" to simplify creating makefiles:
AM_INIT_AUTOMAKE([tar-pax])
# Checks for programs, e.g., AC_PROG_CC
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AM_PROG_LIBTOOL
# Checks for libraries.
AC_CHECK_LIB(pam, pam_start)
case "$host_os" in
*aix*)
echo "checking for ldap_init in AIX: LDAP Libraries must be provided by aix rpm spec"
LDAP_LIBS=""
;;
*)
AC_SEARCH_LIBS([ldap_init], ["ldap" "ldap -llber" "ldap -llber -lssl -lcrypto" ], [ LDAP_LIBS="$ac_res" ], AC_MSG_ERROR([Unable to find OpenLDAP libs]))
;;
esac
LIBS="${_LIBS} ${LDAP_LIBS}"
# Checks for header files.
AC_CHECK_HEADERS([ldap.h])
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
# Choose what to build
AC_ARG_ENABLE([pamdir], [AS_HELP_STRING([--enable-pamdir],
[Location to install the pam module ($libdir/security)])],
[pamdir=$enableval], [pamdir=$libdir/security])
AC_SUBST(pamdir)
AH_TEMPLATE(HAVE_LDAP, [Define to 1 if you use LDAP.])
AC_ARG_WITH(ldap, [AS_HELP_STRING([--with-ldap[[=DIR]]], [enable LDAP support])],
[case $with_ldap in
no) ;;
*) AC_DEFINE(HAVE_LDAP)
AC_MSG_CHECKING(whether to use sudoers from LDAP)
AC_MSG_RESULT(yes)
;;
esac])
case "$host_os" in
*solaris2.10*)
LIBS="$LIBS -lresolv"
AC_SUBST(pammisc,[])
AC_SUBST(WARNINGS,["-Wall"])
AC_DEFINE([SOLARIS_BUILD], [1], [Whether to build against Solaris])
AC_DEFINE([SOLARIS_OLD], [1], [Whether to build against pre Solaris 11])
;;
*solaris2.11*)
LIBS="$LIBS -lresolv"
AC_SUBST(pammisc,[])
AC_SUBST(WARNINGS,["-Wall"])
AC_SUBST(STACKPROT,[""])
AC_DEFINE([SOLARIS_BUILD], [1], [Whether to build against Solaris])
;;
*aix*)
AC_SUBST(pammisc,[])
AC_DEFINE([AIX_BUILD], [1], [Whether to build against AIX])
AC_SUBST(WARNINGS,[""])
;;
*)
AC_SUBST(WARNINGS,["-Wall"])
AC_SUBST(STACKPROT,["-fstack-protector-strong"])
AC_DEFINE([GNULINUX_BUILD], [1], [Whether to build against a GNU/Linux system [default]])
;;
esac
LIBDIR=`eval echo $LIBDIR`
AC_SUBST([LIBDIR])
AC_SUBST([VERSION])
# Do final output.
AC_CONFIG_FILES([
Makefile
src/Makefile
])
AC_OUTPUT