]> granicus.if.org Git - linux-pam/blob - configure.in
Relevant BUGIDs: 124386
[linux-pam] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(conf/pam_conv1/pam_conv.y)
3
4 dnl The configuration header file
5 AC_CONFIG_HEADER(_pam_aconf.h)
6
7 dnl
8 dnl Release specific
9 dnl
10
11 LIBPAM_VERSION_MAJOR=0
12 LIBPAM_VERSION_MINOR=74
13
14 AC_SUBST(LIBPAM_VERSION_MAJOR)
15 AC_SUBST(LIBPAM_VERSION_MINOR)
16 AC_DEFINE(LIBPAM_VERSION_MAJOR)
17 AC_DEFINE(LIBPAM_VERSION_MINOR)
18
19 dnl
20 dnl By default, everything under PAM is installed under the root fs.
21 dnl
22
23 AC_PREFIX_DEFAULT()
24
25 dnl
26 dnl Rules needed for the following (hardcoded Linux defaults for now)
27 dnl
28
29 CC=gcc                          ; AC_SUBST(CC)
30 CONF_CFLAGS=                    ; AC_SUBST(CONF_CFLAGS)
31 MKDIR="mkdir -p"                ; AC_SUBST(MKDIR)
32 LOCALSRCDIR=`/bin/pwd`          ; AC_SUBST(LOCALSRCDIR)
33 OS=`uname|sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXWZ/abcdefghijklmonpqrstuvwxyz/'`
34 AC_SUBST(OS)
35
36 dnl These are most likely platform specific - I think HPUX differs
37 DYNTYPE=so                      ; AC_SUBST(DYNTYPE)
38 LIBDL=-ldl                      ; AC_SUBST(LIBDL)
39 USESONAME=yes                   ; AC_SUBST(USESONAME)
40 NEEDSONAME=yes                  ; AC_SUBST(NEEDSONAME)
41 SHLIBMODE=755                   ; AC_SUBST(SHLIBMODE)
42
43 dnl ### Should enable this INSTALL detection.
44 dnl ### Would need to distribute GNU's config.guess and config.sub
45 dnl AC_PROG_INSTALL
46 INSTALL=/usr/bin/install        ; AC_SUBST(INSTALL)
47
48 dnl
49 dnl options and defaults
50 dnl
51
52 dnl lots of debugging information goes to /tmp/pam-debug.log
53 AC_ARG_ENABLE(debug,
54 [  --enable-debug           qspecify you are building with debugging on],
55         WITH_DEBUG=yes ; AC_DEFINE(DEBUG) , WITH_DEBUG=no)
56 AC_SUBST(WITH_DEBUG)
57
58 dnl build specially named libraries (for debugging purposes)
59 AC_ARG_ENABLE(libdebug,
60 [  --enable-libdebug        specify you are building debugging libraries],
61         WITH_LIBDEBUG=yes ; AC_DEFINE(WITH_LIBDEBUG) , WITH_LIBDEBUG=no)
62 AC_SUBST(WITH_LIBDEBUG)
63
64 dnl packaging convenience
65 AC_ARG_ENABLE(fakeroot,
66 [  --enable-fakeroot=<path to packaging directory>], FAKEROOT=$enableval)
67 AC_SUBST(FAKEROOT)
68
69 AC_ARG_ENABLE(securedir,
70 [  --enable-securedir=<path to location of PAMs> [default \$libdir/security]],
71         SECUREDIR=$enableval, SECUREDIR=$libdir/security)
72 AC_SUBST(SECUREDIR)
73
74 AC_ARG_ENABLE(sconfigdir,
75 [  --enable-sconfigdir=<path to module conf files> [default \$sysconfdir/security]],
76         SCONFIGDIR=$enableval, SCONFIGDIR=$sysconfdir/security)
77 AC_SUBST(SCONFIGDIR)
78
79 AC_ARG_ENABLE(suplementedir,
80 [  --enable-suplementedir=<path to module helper binaries> [default \$sbindir]],
81         SUPLEMENTED=$enableval, SUPLEMENTED=$sbindir)
82 AC_SUBST(SUPLEMENTED)
83
84 AC_ARG_ENABLE(includedir,
85 [  --enable-includedir=<path to include location> - where to put <security>],
86         INCLUDEDIR=$enableval, INCLUDEDIR=/usr/include)
87 AC_SUBST(INCLUDEDIR)
88
89 AC_ARG_ENABLE(pamlocking,
90 [  --enable-pamlocking      configure libpam to observe a global authentication lock],
91         WITH_PAMLOCKING=yes ; AC_DEFINE(PAM_LOCKING) , WITH_PAMLOCKING=no)
92 AC_SUBST(WITH_PAMLOCKING)
93
94 AC_ARG_ENABLE(uglyhack,
95 [  --enable-uglyhack        configure libpam to try to honor old pam_strerror syntax],
96         AC_DEFINE(UGLY_HACK_FOR_PRIOR_BEHAVIOR_SUPPORT))
97
98 AC_ARG_ENABLE(read-both-confs,
99 [  --enable-read-both-confs  read both /etc/pam.d and /etc/pam.conf files],
100         AC_DEFINE(PAM_READ_BOTH_CONFS))
101 AC_SUBST(PAM_READ_BOTH_CONFS)
102
103 AC_ARG_ENABLE(static-libpam, [  --enable-static-libpam   build a libpam.a library],
104         STATIC_LIBPAM=yes , STATIC_LIBPAM=no)
105 AC_SUBST(STATIC_LIBPAM)
106
107 AC_ARG_ENABLE(dynamic-libpam,
108 [  --disable-dynamic-libpam do not build a shared libpam library],
109         DYNAMIC_LIBPAM=no, DYNAMIC_LIBPAM=yes)
110 AC_SUBST(DYNAMIC_LIBPAM)
111
112 DYNAMIC=-DPAM_DYNAMIC
113 AC_SUBST(DYNAMIC)
114
115 AC_ARG_ENABLE(static-modules,
116 [  --enable-static-modules  do not make the modules dynamically loadable],
117         STATIC=-DPAM_STATIC)
118 AC_SUBST(STATIC)
119
120 AC_ARG_ENABLE(lckpwdf,
121 [  --disable-lckpwdf do not use the lckpwdf function],
122         WITH_LCKPWDF=no, WITH_LCKPWDF=yes)
123 AC_SUBST(WITH_LCKPWDF)
124
125 dnl Checks for programs.
126 AC_PROG_CXX
127 AC_PROG_YACC
128 AC_PROG_LEX
129 AC_PROG_CC
130 dnl AC_PROG_INSTALL
131 AC_PROG_LN_S
132 AC_PROG_MAKE_SET
133
134 dnl Checks for libraries.
135 AC_CHECK_LIB(c, __libc_sched_setscheduler, PAM_NEEDS_LIBC=, PAM_NEEDS_LIBC=-lc)
136 AC_SUBST(PAM_NEEDS_LIBC)
137
138 dnl Checks for the existence of lckpwdf in libc
139 AC_CHECK_LIB(c, lckpwdf, HAVE_LCKPWDF=yes, HAVE_LCKPWDF=no)
140 AC_SUBST(HAVE_LCKPWDF)
141
142 dnl
143 dnl At least on Solaris, the existing libcrack must be dynamic.
144 dnl Ought to introduce a check for this.
145 dnl
146 AC_CHECK_LIB(crack, FascistCheck, HAVE_LIBCRACK=yes ; AC_DEFINE(HAVE_LIBCRACK),
147         HAVE_LIBCRACK=no)
148 AC_SUBST(HAVE_LIBCRACK)
149
150 AC_CHECK_LIB(crypt, fcrypt, HAVE_LIBCRYPT=yes ; AC_DEFINE(HAVE_LIBCRYPT),
151         HAVE_LIBCRYPT=no)
152 AC_SUBST(HAVE_LIBCRYPT)
153 AC_CHECK_LIB(ndbm, dbm_store, HAVE_LIBNDBM=yes ; AC_DEFINE(HAVE_LIBNDBM),
154         HAVE_LIBNDBM=no)
155 AC_SUBST(HAVE_LIBNDBM)
156 AC_CHECK_LIB(db, dbm_store, HAVE_LIBDB=yes ; AC_DEFINE(HAVE_LIBDB),
157         HAVE_LIBDB=no)
158 AC_SUBST(HAVE_LIBDB)
159 AC_CHECK_LIB(fl, yylex, yyterminate, HAVE_LIBFL=yes ; AC_DEFINE(HAVE_LIBFL),
160         HAVE_LIBFL=no)
161 AC_SUBST(HAVE_LIBFL)
162 AC_CHECK_LIB(nsl, yp_maplist, HAVE_LIBNSL=yes ; AC_DEFINE(HAVE_LIBNSL),
163         HAVE_LIBNSL=no)
164 AC_SUBST(HAVE_LIBNSL)
165 AC_CHECK_LIB(pwdb, pwdb_db_name, HAVE_LIBPWDB=yes ; AC_DEFINE(HAVE_LIBPWDB),
166         HAVE_LIBPWDB=no)
167 AC_SUBST(HAVE_LIBPWDB)
168
169 dnl Checks for header files.
170 AC_HEADER_DIRENT
171 AC_HEADER_STDC
172 AC_HEADER_SYS_WAIT
173 AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/file.h sys/ioctl.h sys/time.h syslog.h termio.h unistd.h)
174
175 dnl Linux wants features.h in some of the source files.
176 AC_CHECK_HEADERS(features.h)
177
178 dnl For module/pam_cracklib
179 AC_CHECK_HEADERS(crypt.h)
180
181 dnl For module/pam_userdb
182 AC_CHECK_HEADERS(ndbm.h db.h)
183 dnl I suspect the following two lines are a hack.
184 HAVE_NDBM_H=$ac_cv_header_ndbm_h
185 AC_SUBST(HAVE_NDBM_H)
186
187 dnl For module/pam_lastlog
188 AC_CHECK_HEADERS(lastlog.h utmp.h utmpx.h)
189
190 dnl This following rule should be made conditional upon HAVE_LIBCRYPT
191 dnl being found.
192
193 dnl Look for cracklib dictionary
194 AC_MSG_CHECKING(path to cracklib dictionary)
195 DICT_DIR_CANDIDATES="/usr/lib /usr/share/dict /usr/share/lib \
196   /usr/local/lib /usr/local/share/lib"
197 DICT_FILE_CANDIDATES="pw_dict cracklib_dict"
198 CRACKLIB_DICTPATH=""
199 for d in $DICT_DIR_CANDIDATES ; do
200       for f in $DICT_FILE_CANDIDATES ; do
201               if test -r $d/$f.hwm ; then
202                       CRACKLIB_DICTPATH=$d/$f
203                       break 2
204               elif test -r $d/dict/$f.hwm ; then
205                       CRACKLIB_DICTPATH=$d/dict/$f
206                       break 2
207               fi
208       done
209 done
210 if test -z $CRACKLIB_DICTPATH ; then
211       AC_MSG_RESULT(none found)
212 else
213       AC_MSG_RESULT($CRACKLIB_DICTPATH)
214 fi
215 AC_SUBST(CRACKLIB_DICTPATH)
216
217 dnl Set FLAGS, linker options etc. depending on C compiler.
218 dnl gcc is tested and much preferred; others less so, if at all
219 dnl
220 dnl If compiling with gcc, linking is also supposed to be done with gcc;
221 dnl since we use linker-specific arguments, we may not gain anything by
222 dnl switching LD_L over, but I think we can use LD_D as-is.
223 dnl
224 dnl For the moment, gcc is enforced above at "CC=gcc".
225 dnl
226 dnl There is an issue over _POSIX_SOURCE _BSD_SOURCE and _GNU_SOURCE .
227 dnl The original "Linux-PAM" had blanket inclusion.  But portability
228 dnl requires their default absence: if particular OSes require them,
229 dnl this should be done selectively.
230
231 GCC_WARNINGS="-Wall -Wwrite-strings \
232         -Wpointer-arith -Wcast-qual -Wcast-align \
233         -Wtraditional -Wstrict-prototypes -Wmissing-prototypes \
234         -Wnested-externs -Winline -Wshadow"
235
236 if test "$GCC" = yes; then
237 ###
238 ### Non-Linux needs attention on per-OS basis
239         OS_CFLAGS="-ansi -D_POSIX_SOURCE -pedantic"
240         WARNINGS="$GCC_WARNINGS"
241         PIC="-fPIC"
242 #can/should we use LD=gcc ???
243         LD=ld                           
244         LD_D="gcc -shared -Xlinker -x"
245         LD_L="$LD -x -shared"
246         STRIP=strip
247 else
248 ###
249 ### Non-gcc needs attention on per-OS basis
250 ###
251 ### [These are Solaris-C specific...]
252         OS_CFLAGS=""
253         WARNINGS=""
254         PIC="-K pic"
255         LD=ld
256         LD_D="cc -z text -G -R."
257         LD_L="$LD_D"
258         STRIP=strip
259 fi
260
261 AC_SUBST(OS_CFLAGS)
262 AC_SUBST(WARNINGS)
263 AC_SUBST(PIC)
264 AC_SUBST(LD)
265 AC_SUBST(LD_D)
266 AC_SUBST(LD_L)
267 AC_SUBST(STRIP)
268
269 dnl Checks for typedefs, structures, and compiler characteristics.
270 AC_C_BIGENDIAN
271 AC_C_CONST
272 AC_TYPE_UID_T
273 AC_TYPE_OFF_T
274 AC_TYPE_PID_T
275 AC_TYPE_SIZE_T
276 AC_HEADER_TIME
277 AC_STRUCT_TM
278
279 dnl Checks for library functions.
280 AC_TYPE_GETGROUPS
281 AC_PROG_GCC_TRADITIONAL
282 AC_FUNC_MEMCMP
283 AC_FUNC_VPRINTF
284 AC_CHECK_FUNCS(gethostname gettimeofday mkdir select strcspn strdup strerror strspn strstr strtol uname)
285
286 dnl Checks for programs/utilities
287 AC_CHECK_PROG(HAVE_SGML2TXT, sgml2txt, yes, no)
288 AC_CHECK_PROG(HAVE_SGML2HTML, sgml2html, yes, no)
289 AC_CHECK_PROG(HAVE_SGML2LATEX, sgml2latex, yes, no)
290 if test $HAVE_SGML2LATEX = "yes" ; then
291   if sgml2latex -h | grep -e --paper | grep  ' -p ' > /dev/null ; then
292     PSER="sgml2latex -o ps"
293   else
294     PSER="sgml2latex -p"
295   fi
296 else
297   AC_CHECK_PROG(HAVE_SGML2PS, sgml2ps, yes, no)
298   if test $HAVE_SGML2PS = yes ; then
299     PSER="sgml2ps"
300   fi
301 fi
302 AC_SUBST(PSER)
303
304 dnl Files to be created from when we run configure
305 AC_OUTPUT(Make.Rules)