summaryrefslogtreecommitdiff
path: root/configure.in
blob: 91354aed16319737f2e1426f58466ee7a45bbed4 (plain)
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
dnl Process this file with autoconf to produce a configure script.
AC_INIT(conf/pam_conv1/pam_conv.y)

dnl The configuration header file
AC_CONFIG_HEADER(_pam_aconf.h)

dnl
dnl Release specific
dnl

LIBPAM_VERSION_MAJOR=0
LIBPAM_VERSION_MINOR=76

AC_SUBST(LIBPAM_VERSION_MAJOR)
AC_SUBST(LIBPAM_VERSION_MINOR)
AC_DEFINE(LIBPAM_VERSION_MAJOR)
AC_DEFINE(LIBPAM_VERSION_MINOR)

dnl
dnl By default, everything under PAM is installed under the root fs.
dnl

AC_PREFIX_DEFAULT()

dnl
dnl Useful info (believed to be portable)
dnl
LOCALSRCDIR=`/bin/pwd`         ; AC_SUBST(LOCALSRCDIR)
OS=`uname|sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
AC_SUBST(OS)

dnl
dnl Rules needed for the following (hardcoded Linux defaults for now)
dnl

CONF_CFLAGS=			; AC_SUBST(CONF_CFLAGS)
MKDIR="mkdir -p"		; AC_SUBST(MKDIR)

SHLIBMODE=755			; AC_SUBST(SHLIBMODE)

dnl These are most likely platform specific - I think HPUX differs
USESONAME=yes			; AC_SUBST(USESONAME)
SOSWITCH=-soname		; AC_SUBST(SOSWITCH)
NEEDSONAME=no			; AC_SUBST(NEEDSONAME)
LDCONFIG=/sbin/ldconfig		; AC_SUBST(LDCONFIG)

dnl ### Should enable this INSTALL detection.
dnl ### Would need to distribute GNU's config.guess and config.sub
dnl AC_PROG_INSTALL
if test "$OS" = "aix"; then
  INSTALL=/usr/ucb/install -c
else
  INSTALL=/usr/bin/install
fi
AC_SUBST(INSTALL)

dnl Checks for programs.
AC_PROG_CC
dnl ### AC_PROG_CXX
AC_PROG_YACC
AC_PROG_LEX
dnl AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET

dnl
dnl options and defaults
dnl

dnl lots of debugging information goes to /tmp/pam-debug.log
AC_ARG_ENABLE(debug,
[  --enable-debug           qspecify you are building with debugging on],
	WITH_DEBUG=yes ; AC_DEFINE(DEBUG) , WITH_DEBUG=no)
AC_SUBST(WITH_DEBUG)

dnl build specially named libraries (for debugging purposes)
AC_ARG_ENABLE(libdebug,
[  --enable-libdebug        specify you are building debugging libraries],
	WITH_LIBDEBUG=yes ; AC_DEFINE(WITH_LIBDEBUG) , WITH_LIBDEBUG=no)
AC_SUBST(WITH_LIBDEBUG)

dnl packaging convenience
AC_ARG_ENABLE(fakeroot,
[  --enable-fakeroot=<path to packaging directory>], FAKEROOT=$enableval)
AC_SUBST(FAKEROOT)

AC_ARG_ENABLE(securedir,
[  --enable-securedir=<path to location of PAMs> [default \$libdir/security]],
	SECUREDIR=$enableval, SECUREDIR=$libdir/security)
AC_SUBST(SECUREDIR)

AC_ARG_ENABLE(sconfigdir,
[  --enable-sconfigdir=<path to module conf files> [default \$sysconfdir/security]],
	SCONFIGDIR=$enableval, SCONFIGDIR=$sysconfdir/security)
AC_SUBST(SCONFIGDIR)

AC_ARG_ENABLE(suplementedir,
[  --enable-suplementedir=<path to module helper binaries> [default \$sbindir]],
	SUPLEMENTED=$enableval, SUPLEMENTED=$sbindir)
AC_SUBST(SUPLEMENTED)

AC_ARG_ENABLE(includedir,
[  --enable-includedir=<path to include location> - where to put <security>],
	INCLUDEDIR=$enableval, INCLUDEDIR=/usr/include)
AC_SUBST(INCLUDEDIR)

AC_ARG_ENABLE(pamlocking,
[  --enable-pamlocking      configure libpam to observe a global authentication lock],
	WITH_PAMLOCKING=yes ; AC_DEFINE(PAM_LOCKING) , WITH_PAMLOCKING=no)
AC_SUBST(WITH_PAMLOCKING)

AC_ARG_ENABLE(uglyhack,
[  --enable-uglyhack        configure libpam to try to honor old pam_strerror syntax],
	AC_DEFINE(UGLY_HACK_FOR_PRIOR_BEHAVIOR_SUPPORT))

AC_ARG_ENABLE(read-both-confs,
[  --enable-read-both-confs  read both /etc/pam.d and /etc/pam.conf files],
	AC_DEFINE(PAM_READ_BOTH_CONFS))
AC_SUBST(PAM_READ_BOTH_CONFS)

AC_ARG_ENABLE(static-libpam, [  --enable-static-libpam   build a libpam.a library],
	STATIC_LIBPAM=yes , STATIC_LIBPAM=no)
AC_SUBST(STATIC_LIBPAM)

AC_ARG_ENABLE(dynamic-libpam,
[  --disable-dynamic-libpam do not build a shared libpam library],
	DYNAMIC_LIBPAM=no, DYNAMIC_LIBPAM=yes)
AC_SUBST(DYNAMIC_LIBPAM)

DYNAMIC=-DPAM_DYNAMIC
AC_SUBST(DYNAMIC)

AC_ARG_ENABLE(static-modules,
[  --enable-static-modules  do not make the modules dynamically loadable],
	STATIC=-DPAM_STATIC)
AC_SUBST(STATIC)

AC_ARG_ENABLE(lckpwdf,
[  --disable-lckpwdf do not use the lckpwdf function],
	WITH_LCKPWDF=no, WITH_LCKPWDF=yes)
AC_SUBST(WITH_LCKPWDF)

AC_CHECK_HEADERS(paths.h)
AC_ARG_WITH(mailspool,
[  --with-mailspool         path to mail spool directory
                           [default _PATH_MAILDIR if defined in paths.h, otherwise /var/spool/mail]],
with_mailspool=${withval})
if test x$with_mailspool != x ; then
	pam_mail_spool="\"$with_mailspool\""
else
	AC_TRY_RUN([
#include <paths.h>
int main() {
#ifdef _PATH_MAILDIR
exit(0);
#else
exit(1);
#endif
}], pam_mail_spool="_PATH_MAILDIR",
pam_mail_spool="\"/var/spool/mail\"",
pam_mail_spool="\"/var/spool/mail\"")
fi
AC_DEFINE_UNQUOTED(PAM_PATH_MAILDIR, $pam_mail_spool)

dnl Checks for libraries.
AC_CHECK_LIB(c, __libc_sched_setscheduler, PAM_NEEDS_LIBC=, PAM_NEEDS_LIBC=-lc)
AC_SUBST(PAM_NEEDS_LIBC)

dnl Checks for the existence of lckpwdf in libc
AC_CHECK_LIB(c, lckpwdf, HAVE_LCKPWDF=yes, HAVE_LCKPWDF=no)
AC_SUBST(HAVE_LCKPWDF)

dnl Checks for the existence of libdl - on BSD its part of libc
AC_CHECK_LIB(dl, dlopen, LIBDL=-ldl) 
AC_SUBST(LIBDL)

dnl
dnl At least on Solaris, the existing libcrack must be dynamic.
dnl Ought to introduce a check for this.
dnl
AC_CHECK_LIB(crack, FascistCheck, HAVE_LIBCRACK=yes ; AC_DEFINE(HAVE_LIBCRACK),
	HAVE_LIBCRACK=no)
AC_SUBST(HAVE_LIBCRACK)

AC_CHECK_LIB(crypt, fcrypt, HAVE_LIBCRYPT=yes ; AC_DEFINE(HAVE_LIBCRYPT),
	HAVE_LIBCRYPT=no)
AC_SUBST(HAVE_LIBCRYPT)
AC_CHECK_LIB(util, logwtmp, HAVE_LIBUTIL=yes ; AC_DEFINE(HAVE_LIBUTIL),
	HAVE_LIBUTIL=no)
AC_SUBST(HAVE_LIBUTIL)
AC_CHECK_LIB(ndbm, dbm_store, HAVE_LIBNDBM=yes ; AC_DEFINE(HAVE_LIBNDBM),
	HAVE_LIBNDBM=no)
AC_SUBST(HAVE_LIBNDBM)
AC_CHECK_LIB(db, dbm_store, HAVE_LIBDB=yes ; AC_DEFINE(HAVE_LIBDB),
	HAVE_LIBDB=no)
if test x$HAVE_LIBDB != xyes ; then
	AC_CHECK_LIB(db, db_create, HAVE_LIBDB=yes ; AC_DEFINE(HAVE_LIBDB),
	HAVE_LIBDB=no)
fi
AC_SUBST(HAVE_LIBDB)
AC_CHECK_LIB(fl, yylex, yyterminate, HAVE_LIBFL=yes ; AC_DEFINE(HAVE_LIBFL),
	HAVE_LIBFL=no)
AC_SUBST(HAVE_LIBFL)
AC_CHECK_LIB(nsl, yp_maplist, HAVE_LIBNSL=yes ; AC_DEFINE(HAVE_LIBNSL),
	HAVE_LIBNSL=no)
AC_SUBST(HAVE_LIBNSL)
AC_CHECK_LIB(pwdb, pwdb_db_name, HAVE_LIBPWDB=yes ; AC_DEFINE(HAVE_LIBPWDB),
	HAVE_LIBPWDB=no)
AC_SUBST(HAVE_LIBPWDB)

dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/file.h sys/ioctl.h sys/time.h syslog.h termio.h unistd.h)

dnl Linux wants features.h in some of the source files.
AC_CHECK_HEADERS(features.h)

dnl For module/pam_cracklib
AC_CHECK_HEADERS(crypt.h)

dnl For module/pam_userdb
AC_CHECK_HEADERS(ndbm.h db.h)
dnl I suspect the following two lines are a hack.
HAVE_NDBM_H=$ac_cv_header_ndbm_h
AC_SUBST(HAVE_NDBM_H)

dnl For module/pam_lastlog
AC_CHECK_HEADERS(lastlog.h utmp.h utmpx.h)

dnl This following rule should be made conditional upon HAVE_LIBCRYPT
dnl being found.

dnl Look for cracklib dictionary
AC_MSG_CHECKING(path to cracklib dictionary)
DICT_DIR_CANDIDATES="/usr/lib /usr/share/dict /usr/share/lib \
  /usr/local/lib /usr/local/share/lib"
DICT_FILE_CANDIDATES="pw_dict cracklib_dict"
CRACKLIB_DICTPATH=""
for d in $DICT_DIR_CANDIDATES ; do
      for f in $DICT_FILE_CANDIDATES ; do
              if test -r $d/$f.hwm ; then
                      CRACKLIB_DICTPATH=$d/$f
                      break 2
              elif test -r $d/dict/$f.hwm ; then
                      CRACKLIB_DICTPATH=$d/dict/$f
                      break 2
              fi
      done
done
if test -z "$CRACKLIB_DICTPATH" ; then
      AC_MSG_RESULT(none found)
else
      AC_MSG_RESULT($CRACKLIB_DICTPATH)
fi
AC_SUBST(CRACKLIB_DICTPATH)

dnl Set FLAGS, linker options etc. depending on C compiler.
dnl gcc is tested and much preferred; others less so, if at all
dnl
dnl If compiling with gcc, linking is also supposed to be done with gcc;
dnl since we use linker-specific arguments, we may not gain anything by
dnl switching LD_L over, but I think we can use LD_D as-is.
dnl
dnl For the moment, gcc is enforced above at "CC=gcc".
dnl
dnl There is an issue over _POSIX_SOURCE _BSD_SOURCE and _GNU_SOURCE .
dnl The original "Linux-PAM" had blanket inclusion.  But portability
dnl requires their default absence: if particular OSes require them,
dnl this should be done selectively.

GCC_WARNINGS="-Wall -Wwrite-strings \
	-Wpointer-arith -Wcast-qual -Wcast-align \
	-Wstrict-prototypes -Wmissing-prototypes \
	-Wnested-externs -Winline -Wshadow"

if test "$GCC" = yes; then
	CC=gcc				; AC_SUBST(CC)
### May need per-OS attention
### Example: -D_POSIX_SOURCE: needed on Linux but harms Solaris.
	case $OS in
	linux)
		OS_CFLAGS="-ansi -D_POSIX_SOURCE -pedantic"
		LD_D="gcc -shared -Xlinker -x"
		WARNINGS="$GCC_WARNINGS"
		PIC="-fPIC"
		DYNTYPE=so
		LD=ld				
		LD_L="$LD -x -shared"
		RANLIB=ranlib
		STRIP=strip
		CC_STATIC="-Xlinker -export-dynamic"
		;;
	sunos)
		OS_CFLAGS="-ansi -pedantic"
		LD_D="gcc -shared -Xlinker -x"
		WARNINGS="$GCC_WARNINGS"
		PIC="-fPIC"
		DYNTYPE=so
		LD=ld				
		LD_L="$LD -x -shared"
		RANLIB=ranlib
		STRIP=strip
		CC_STATIC="-Xlinker -export-dynamic"
		;;
	aix)
		OS_CFLAGS=""
		DYNTYPE=lo
		LD=ld				
		LD_L=ld -bexpall -bM:SRE -bnoentry
		LD_D="$LD_L"
		RANLIB=ranlib
		STRIP=strip
		;;
	*)
		OS_CFLAGS=""
		;;
	esac
else
###
### Non-gcc needs attention on per-OS basis
###
	case "$OS" in
	solaris)
	    ### Support for Solaris-C
	    OS_CFLAGS=""
	    WARNINGS=""
	    PIC="-K pic"
	    LD=ld
	    LD_D="cc -z text -G -R."
	    LD_L="$LD_D"
	    RANLIB=ranlib
	    STRIP=strip
	    CC_STATIC=
	    ;;
	irix*)
	    OSRELEASE=`uname -r`
	    if test "$OSRELEASE" = 6.5; then
		OS_CFLAGS=""
		WARNINGS="-fullwarn"
		PIC=                    #PIC code is default for IRIX
		LD="cc -shared"         # modules friendly approach
		LD_D="cc -shared"
		LD_L="ld -G -z redlocsym"
		RANLIB=echo
		STRIP=strip
		CC_STATIC=
	    else
		echo "IRIX prior to 6.5 not allowed for"
		exit
	    fi
	    ;;
       *) echo "Native compiler on $OS is not yet supported"
               exit
	    ;;
       esac
fi

AC_SUBST(DYNTYPE)
AC_SUBST(OS_CFLAGS)
AC_SUBST(WARNINGS)
AC_SUBST(PIC)
AC_SUBST(LD)
AC_SUBST(LD_D)
AC_SUBST(LD_L)
AC_SUBST(RANLIB)
AC_SUBST(STRIP)
AC_SUBST(CC_STATIC)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_BIGENDIAN
AC_C_CONST
AC_TYPE_UID_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM

dnl Checks for library functions.
AC_TYPE_GETGROUPS
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(gethostname gettimeofday mkdir select strcspn strdup strerror strspn strstr strtol uname)

AC_CHECK_FUNCS(getpwnam_r getgrnam_r)

dnl Checks for programs/utilities
AC_CHECK_PROG(HAVE_SGML2TXT, sgml2txt, yes, no)
AC_CHECK_PROG(HAVE_SGML2HTML, sgml2html, yes, no)
AC_CHECK_PROG(HAVE_SGML2LATEX, sgml2latex, yes, no)
if test $HAVE_SGML2LATEX = "yes" ; then
  if sgml2latex -h | grep -e --paper | grep  ' -p ' > /dev/null ; then
    PSER="sgml2latex -o ps"
  else
    PSER="sgml2latex -p"
  fi
else
  AC_CHECK_PROG(HAVE_SGML2PS, sgml2ps, yes, no)
  if test $HAVE_SGML2PS = yes ; then
    PSER="sgml2ps"
  fi
fi
AC_SUBST(PSER)

dnl Files to be created from when we run configure
AC_OUTPUT(Make.Rules)