summaryrefslogtreecommitdiff
path: root/configure.in
blob: 7971ef94c13e1c8ef061af18e61a5e6cc1cd9f0a (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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(conf/pam_conv1/pam_conv.y)
AM_INIT_AUTOMAKE("Linux-PAM", 0.99.0.3)
AM_CONFIG_HEADER(config.h)
AC_CANONICAL_HOST

AC_SUBST(PACKAGE)
AC_SUBST(VERSION)

ALL_LINGUAS="cs de es fr hu it ja nb pa pt_BR pt zh_CN zh_TW"

dnl
dnl By default, everything under PAM is installed below /usr.
dnl
AC_PREFIX_DEFAULT(/usr)

dnl and some hacks to use /etc and /lib
test "${prefix}" = "NONE" && prefix="/usr"
if test ${prefix} = '/usr'
then
dnl If we use /usr as prefix, use /etc for config files
        if test ${sysconfdir} = '${prefix}/etc'
        then
                sysconfdir="/etc"
        fi
	if test ${libdir} = '${exec_prefix}/lib'
	then
		libdir="/lib"
	fi
	if test ${sbindir} = '${exec_prefix}/sbin'
        then
                sbindir="/sbin"
        fi
dnl If we use /usr as prefix, use /usr/share/man for manual pages
        if test ${mandir} = '${prefix}/man'
        then
                mandir='${prefix}/share/man'
        fi
dnl Add security to include directory
	if test ${includedir} = '${prefix}/include'
	then
		includedir="${prefix}/include/security"
	fi
fi


dnl Checks for programs.
AC_GNU_SOURCE
AC_PROG_CC
AC_PROG_YACC
AM_PROG_LEX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
# per default don't build static libraries
AC_DISABLE_STATIC
AC_PROG_LIBTOOL

if test "$enable_static" = yes; then
   CFLAGS="$CFLAGS -DPAM_STATIC"
fi
if test "$enable_shared" = yes; then
   CFLAGS="$CFLAGS -DPAM_DYNAMIC"
fi

# Largefile support
AC_SYS_LARGEFILE

if eval "test x$GCC = xyes"; then
  for flag in \
      -W \
      -Wall \
      -Wbad-function-cast \
      -Wcast-align \
      -Wcast-qual \
      -Wmissing-declarations \
      -Wmissing-prototypes \
      -Wpointer-arith \
      -Wreturn-type \
      -Wstrict-prototypes \
      -Wwrite-strings \
      -Winline \
      -Wshadow
  do
    JAPHAR_GREP_CFLAGS($flag, [ CFLAGS="$CFLAGS $flag" ])
  done
fi

AC_C___ATTRIBUTE__

dnl
dnl Check if --version-script is supported by ld
dnl 
AC_CACHE_CHECK(for .symver assembler directive, libc_cv_asm_symver_directive,
[cat > conftest.s <<EOF
${libc_cv_dot_text}
_sym:
.symver _sym,sym@VERS
EOF
if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
  libc_cv_asm_symver_directive=yes
else
  libc_cv_asm_symver_directive=no
fi
rm -f conftest*])
AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl
if test $libc_cv_asm_symver_directive = yes; then
  cat > conftest.s <<EOF
${libc_cv_dot_text}
_sym:
.symver _sym,sym@VERS
EOF
  cat > conftest.map <<EOF
VERS_1 {
        global: sym;
};

VERS_2 {
        global: sym;
} VERS_1;
EOF
  if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; 
then
    if AC_TRY_COMMAND([${CC-cc} $CFLAGS $LDFLAGS -shared
                                -o conftest.so conftest.o
                                -nostartfiles -nostdlib
                                -Wl,--version-script,conftest.map
                       1>&AS_MESSAGE_LOG_FD]);
    then
      libc_cv_ld_version_script_option=yes
    else
      libc_cv_ld_version_script_option=no
    fi
  else
    libc_cv_ld_version_script_option=no
  fi
else
  libc_cv_ld_version_script_option=no
fi
rm -f conftest*])
AM_CONDITIONAL([HAVE_VERSIONING],
	[test "$libc_cv_ld_version_script_option" = "yes"])

dnl
dnl options and defaults
dnl

AM_PATH_LIBPRELUDE([0.9.0])
if test "$LIBPRELUDE_CONFIG" != "no" ; then
  LIBPRELUDE_CFLAGS="$LIBPRELUDE_CFLAGS -DPRELUDE=1"
fi

dnl lots of debugging information goes to /var/run/pam-debug.log
AC_ARG_ENABLE([debug],
    AC_HELP_STRING([--enable-debug],
	[specify you are building with debugging on]),
	WITH_DEBUG=yes ; AC_DEFINE([DEBUG],,
		[lots of stuff gets written to /var/run/pam-debug.log]),
		WITH_DEBUG=no)
AC_SUBST(WITH_DEBUG)

AC_ARG_ENABLE([memory-debug],
    AC_HELP_STRING([--enable-memory-debug],[specify you want every malloc etc. call tracked]),
    WITH_MEMORY_DEBUG=$enableval, WITH_MEMORY_DEBUG=no)
if test "$WITH_MEMORY_DEBUG" != "no" ; then
    AC_DEFINE([MEMORY_DEBUG], 1, [Every malloc etc. call will be tracked])
fi
AH_VERBATIM([_MEMORY_DEBUG],
[#ifdef MEMORY_DEBUG
/*
 * this is basically a hack - we need to include a semiarbitrary
 * number of headers to ensure that we don't get silly prototype/macro
 */
# include <string.h>
# include <stdlib.h>
# include <security/pam_malloc.h>
#endif /* MEMORY_DEBUG */])

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([isadir],
	AC_HELP_STRING([--enable-isadir=DIR],[path to arch-specific module files [default ../../`basename $libdir`/security]]),
ISA=$enableval,
ISA=../../`basename $libdir`/security)
unset mylibdirbase
AC_DEFINE_UNQUOTED(_PAM_ISA,"$ISA",[Define to the path, relative to SECUREDIR, where PAMs specific to this architecture can be found.])
AC_MSG_RESULT([Defining \$ISA to "$ISA"])

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(docdir,
[  --enable-docdir=<path to store documentation in - /usr/share/doc/pam>],
	DOCDIR=$enableval, DOCDIR=/usr/share/doc/pam)
AC_SUBST(DOCDIR)


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

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],,
		[read both /etc/pam.d and /etc/pam.conf files]))
AC_SUBST(PAM_READ_BOTH_CONFS)

AC_ARG_ENABLE([lckpwdf],
	AC_HELP_STRING([--disable-lckpwdf],[do not use the lckpwdf function]),
	WITH_LCKPWDF=$enableval, WITH_LCKPWDF=yes)
if test "$WITH_LCKPWDF" == "yes" ; then
    AC_DEFINE([USE_LCKPWDF], 1,
		[Define to 1 if the lckpwdf function should be used])
fi

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,
	[Path where mails are stored])

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

BACKUP_LIBS=$LIBS
AC_SEARCH_LIBS([FascistCheck],[crack], LIBCRACK="-l$ac_lib", LIBCRACK="")
LIBS=$BACKUP_LIBS
AC_SUBST(LIBCRACK)
AM_CONDITIONAL([HAVE_LIBCRACK], [test ! -z "$LIBCRACK"])

BACKUP_LIBS=$LIBS
AC_SEARCH_LIBS([crypt],[xcrypt crypt], LIBCRYPT="-l$ac_lib", LIBCRYPT="")
LIBS=$BACKUP_LIBS
AC_SUBST(LIBCRYPT)

dnl check for libndbm or libdb as fallback
BACKUP_LIBS=$LIBS
AC_CHECK_LIB([ndbm],[dbm_store], LIBDB="-lndbm", LIBDB="") 
LIBS=$BACKUP_LIBS
if test -z "$LIBDB" ; then
    BACKUP_LIBS=$LIBS
    AC_CHECK_LIB([db], [dbm_store], LIBDB="-ldb", LIBDB="")
    LIBS=$BACKUP_LIBS
fi
if test -z "$LIBDB" ; then
    BACKUP_LIBS=$LIBS
    AC_CHECK_LIB([db], [db_create], LIBDB="-ldb", LIBDB="")
    LIBS=$BACKUP_LIBS
fi
AC_SUBST(LIBDB)
AM_CONDITIONAL([HAVE_LIBDB], [test ! -z "$LIBDB"])

BACKUP_LIBS=$LIBS
AC_CHECK_LIB([nsl],[yp_get_default_domain], LIBNSL="-lnsl", LIBNSL="")
LIBS=$BACKUP_LIBS
AC_SUBST(LIBNSL)

BACKUP_LIBS=$LIBS
AC_CHECK_LIB([selinux],[getfilecon], LIBSELINUX="-lselinux", LIBSELINUX="")
LIBS=$BACKUP_LIBS
AC_SUBST(LIBSELINUX)
AM_CONDITIONAL([HAVE_LIBSELINUX], [test ! -z "$LIBSELINUX"])

BACKUP_LIBS=$LIBS
AC_CHECK_LIB([pwdb],[pwdb_db_name], LIBPWDB="-lpwdb", LIBPWDB="")
LIBS=$BACKUP_LIBS
AC_SUBST(LIBPWDB)
AM_CONDITIONAL([HAVE_LIBPWDB], [test ! -z "$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 sys/fsuid.h inittypes.h)

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 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 lckpwdf mkdir select strcspn strdup strerror strspn strstr strtol uname)

AC_CHECK_FUNCS(getpwnam_r getpwuid_r getgrnam_r getgrgid_r getspnam_r getgrouplist)

dnl Checks for programs/utilities
AC_CHECK_PROG(SGML2PS, sgml2ps, yes, no)
AC_CHECK_PROG(SGML2TXT, sgml2txt, yes, no)
AC_CHECK_PROG(SGML2HTML, sgml2html, yes, no)
AC_CHECK_PROG(SGML2LATEX, sgml2latex, yes, no)
AC_CHECK_PROG(PS2PDF, ps2pdf, yes, no)
AM_CONDITIONAL([HAVE_SGML2PS], [test "$SGML2PS" = yes || test "$SGML2LATEX" = yes])
AM_CONDITIONAL([HAVE_SGML2TXT], [test "$SGML2TXT" = yes])
AM_CONDITIONAL([HAVE_SGML2HTML], [test "$SGML2HTML" = yes])
AM_CONDITIONAL([HAVE_PS2PDF], [test "$PS2PDF" = yes])
if test $SGML2LATEX = "yes" ; then
  if sgml2latex -h | grep -e --paper | grep  ' -p ' > /dev/null ; then
    PSER="sgml2latex -o ps"
  else
    PSER="sgml2latex -p"
  fi
else
  if test $SGML2PS = yes ; then
    PSER="sgml2ps"
  fi
fi
AC_SUBST(PSER)

AM_GNU_GETTEXT_VERSION
AM_GNU_GETTEXT([external])

AH_VERBATIM([_ZZENABLE_NLS],
[#ifdef ENABLE_NLS
#include <libintl.h>
#define _(msgid) dgettext("Linux-PAM", msgid)
#define N_(msgid) msgid
#else
#define _(msgid) (msgid)
#define N_(msgid) msgid
#endif /* ENABLE_NLS */])

dnl Files to be created from when we run configure
AC_OUTPUT(Makefile libpam/Makefile libpamc/Makefile libpamc/test/Makefile \
	libpam_misc/Makefile conf/Makefile conf/pam_conv1/Makefile \
	po/Makefile.in \
	modules/Makefile modules/pammodutil/Makefile \
	modules/pam_access/Makefile modules/pam_cracklib/Makefile \
        modules/pam_debug/Makefile modules/pam_deny/Makefile \
	modules/pam_env/Makefile modules/pam_filter/Makefile \
	modules/pam_filter/upperLOWER/Makefile \
	modules/pam_ftp/Makefile modules/pam_group/Makefile \
	modules/pam_issue/Makefile modules/pam_lastlog/Makefile \
	modules/pam_limits/Makefile modules/pam_listfile/Makefile \
	modules/pam_localuser/Makefile modules/pam_mail/Makefile \
	modules/pam_mkhomedir/Makefile modules/pam_motd/Makefile \
	modules/pam_nologin/Makefile modules/pam_permit/Makefile \
	modules/pam_pwdb/Makefile modules/pam_radius/Makefile \
	modules/pam_rhosts/Makefile modules/pam_rootok/Makefile \
	modules/pam_securetty/Makefile modules/pam_selinux/Makefile \
	modules/pam_shells/Makefile modules/pam_stress/Makefile \
	modules/pam_succeed_if/Makefile modules/pam_tally/Makefile \
	modules/pam_time/Makefile modules/pam_umask/Makefile \
	modules/pam_unix/Makefile modules/pam_userdb/Makefile \
	modules/pam_warn/Makefile modules/pam_wheel/Makefile \
	modules/pam_xauth/Makefile doc/Makefile examples/Makefile)