-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfigure.ac
172 lines (124 loc) · 4.46 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
dnl
dnl File: configure.ac
dnl Revision: $Id: configure.ac,v 1.14 2017/05/22 03:50:05 $
dnl Created: 2017/05/22
dnl Author: José Miguel Silva Caldeira <[email protected]>
dnl
dnl ---------------------------------------------------------------------------
AC_PREREQ([2.59])
AC_COPYRIGHT([
See the included file: COPYING for copyright information.
])
AC_INIT([log-credentials], [1.0.3], [[email protected]], [], [www.ncdc.pt])
AC_CONFIG_AUX_DIR(config)
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_SRCDIR([log_credentials.c])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIR([config])
AC_USE_SYSTEM_EXTENSIONS
AC_CANONICAL_HOST
dnl --------------------------------------------------------------------
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
dnl disable static
LT_INIT([disable-static])
dnl --------------------------------------------------------------------
# Checks for libraries.
AC_CHECK_LIB(pam,pam_start)
AC_CHECK_LIB(pam_misc,pam_misc_setenv)
dnl --------------------------------------------------------------------
dnl Autoheader
AH_TOP([
/*****
**** LOG-CREDENTIALS ************************************************
**
** log-credentials
** Sends to the logging system the credentials used during authentication:
** HOST SERVICE USER PASSWORD
**
** Description: config.h.in (generated by autoheader from configure.ac)
**
***********************************************************************
****/
])
dnl --------------------------------------------------------------------
dnl Checks the modules directories.
MODROOTDIR=$(dirname $(ldd /bin/su | grep "/libpam_" | cut -d ' ' -f 3))
PAMMODULEDIR=$MODROOTDIR/security
AC_ARG_WITH(pam-dir,
AC_HELP_STRING([--with-pam-dir=DIR], [Where to install the PAM module]), [
case "${withval}" in
/*) PAMMODULEDIR="${withval}";;
*) AC_MSG_ERROR(Bad value for --with-pam-dir="${$PAMMODULEDIR}");;
esac
])
AC_SUBST(PAMMODULEDIR, "$PAMMODULEDIR")
NSSMODULEDIR=$MODROOTDIR
AC_ARG_WITH(nss-dir,
AC_HELP_STRING([--with-nss-dir=DIR], [Where to install the NSS module]), [
case "${withval}" in
/*) NSSMODULEDIR="${withval}";;
./*|../*|"") AC_MSG_ERROR(Bad value for --with-nss-dir="${$MODDIR}");;
*);;
esac
])
AC_SUBST(NSSMODULEDIR, $NSSMODULEDIR)
if test x"$NSSMODULEDIR" == x; then
AC_MSG_ERROR(Could not find the location of the modules nss: use --with-nss-dir=${NSSMODULEDIR})
fi
if test x"$PAMMODULEDIR" == x; then
AC_MSG_ERROR(Could not find the location of the modules pam: use --with-pam-dir=${PAMMODULEDIR})
fi
if ! test -d "$NSSMODULEDIR"; then
AC_MSG_ERROR(Directory does not exist: --with-nss-dir=${NSSMODULEDIR})
fi
if ! test -d "$PAMMODULEDIR"; then
AC_MSG_ERROR(Directory does not exist: --with-pam-dir=${PAMMODULEDIR})
fi
dnl --------------------------------------------------------------------
dnl Check distro.
if cat /proc/version | grep -i Centos; then
AC_DEFINE([DISTRO], centos, [distro Centos])
fi
if cat /proc/version | grep -i Ubuntu; then
AC_DEFINE([DISTRO], ubuntu, [distro Ubuntu])
fi
dnl --------------------------------------------------------------------
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([nss.h], [],
[AC_MSG_ERROR([*** Sorry, you must install the NSS development headers nss.h ***])])
AC_CHECK_HEADERS([security/pam_appl.h security/pam_modules.h security/pam_appl.h], [],
[AC_MSG_ERROR([*** Sorry, you must install the PAM development module ***])])
dnl --------------------------------------------------------------------
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
dnl --------------------------------------------------------------------
dnl Checks for library functions.
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(vsyslog)
if test $ac_cv_func_vsyslog = no; then
# syslog is not in the default libraries. See if it's in some other.
for lib in bsd socket inet; do
AC_CHECK_LIB($lib, vsyslog, [AC_DEFINE(HAVE_VSYSLOG)
LIBS="$LIBS -l$lib"; break])
done
fi
dnl --------------------------------------------------------------------
dnl Generate made files
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
dnl Summary of build options
AC_MSG_NOTICE([Summary of build options:
Version: ${VERSION}
Host type: ${host}
Compiler: ${CC}
CFLAGS: ${CFLAGS}
Library types: Shared=${enable_shared}, Static=${enable_static}
PAM Module Directory: $PAMMODULEDIR
NSS Module Directory: $NSSMODULEDIR
])