-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
471 lines (436 loc) · 11 KB
/
configure.in
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
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
dnl Process this file with autoconf to produce a configure script.
dnl
dnl @(#) $Id: configure.in,v d58abe72e2af 2009/12/03 14:12:28 roberto $
dnl
AC_INIT(calife.c, [3.0], [[email protected]])
AC_CONFIG_HEADER(config.h)
AC_PREFIX_DEFAULT(/usr/local)
AC_CANONICAL_HOST
dnl Checks for programs.
AC_PROG_CC
BINGRP="wheel"
case "$host" in
*-*-sunos*)
CFLAGS="$CFLAGS -DSUNOS4"
os_sunos=yes
;;
*-sgi-irix6*)
if test "`uname -s`" = "IRIX64"; then
CFLAGS="-32 $CFLAGS"
LDFLAGS="-32 $LDFLAGS"
fi
;;
*-ibm-aix3.2|*-ibm-aix3.2.0|*-ibm-aix3.2.1|*-ibm-aix3.2.2|*-ibm-aix3.2.3|*-ibm-aix3.2.4)
os_aix=yes
CFLAGS="$CFLAGS -DAIX"
AC_CHECK_LIB(s, getuserattr)
;;
*-ibm-aix*)
os_aix=yes
CFLAGS="$CFLAGS -DAIX"
AC_CHECK_LIB(s, getuserattr)
;;
*-sun-solaris2.10)
CFLAGS="$CFLAGS -DSUNOS510"
os_solaris=yes
;;
*-sun-solaris2*)
os_solaris=yes
WITH_PAM=yes
with_pam=yes
AC_DEFINE(WITH_PAM)
;;
*-apple-darwin10*)
os_darwin=yes
WITH_PAM=yes
with_pam=yes
AC_DEFINE(WITH_PAM)
CFLAGS="$CFLAGS -DOSX=106"
;;
*-apple-darwin*)
os_darwin=yes
WITH_PAM=yes
with_pam=yes
AC_DEFINE(WITH_PAM)
;;
*-dec-ultrix*)
AC_TRY_COMPILE([#include <syslog.h>],
[int foo = LOG_DAEMON; ],
,
AC_DEFINE(NEED_SYS_SYSLOG_H))
;;
*-*-hpux*)
# HPUX flags from [email protected]
CFLAGS="$CFLAGS -DHPUX"
BINGRP="sys"
os_hpux=yes
;;
alpha-dec-osf*)
AC_MSG_CHECKING(for OSF/1 C2 security package)
osfc2sec=`/usr/sbin/setld -i | grep '^OSFC2SEC'`
if test -n "$osfc2sec"; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_OSF1_C2_SECURITY)
AC_CHECK_LIB(security, set_auth_parameters,
LIBS="$LIBS -lsecurity",
AC_MSG_ERROR("Could not find libsecurity even though C2 security installed."))
CONFOBJS="$CONFOBJS osfc2.o"
else
AC_MSG_RESULT(no)
fi
;;
*-next-nextstep*)
# NeXT has sys/wait.h but use "union wait".
AC_DEFINE(HAVE_NON_POSIX_WAIT_H)
;;
*-*-linux*|*-*-mklinux*)
os_linux=yes
CFLAGS="-D_GNU_SOURCE $CFLAGS"
AC_CHECK_FUNC(getspnam)
if test $ac_cv_func_getspnam = no; then
AC_CHECK_LIB(shadow, getspnam)
fi
if test $ac_cv_func_getspnam = yes; then
AC_DEFINE(HAVE_ETC_SHADOW)
fi
no_shadows_password_checking=yes
AC_CHECK_FUNCS(pw_encrypt, pwencrypt=yes)
if test $ac_cv_func_pw_encrypt = no; then
AC_CHECK_LIB(shadow, pw_encrypt, [
pwencrypt=yes
pwencryptlib="-lshadow" ])
fi
AC_MSG_CHECKING([whether to enable pw_encrypt])
AC_ARG_ENABLE(deprecated-linux-pw-encrypt,
[ --enable-deprecated-linux-pw-encrypt
Enable using of deprecated linx pw_encrypt
function.],
[ if test -z "$pwencrypt"; then
AC_MSG_RESULT(no)
else
AC_DEFINE(crypt,pw_encrypt)
AC_MSG_RESULT(no)
if test -n "$pwencryptlib"; then
LIBS="$LIBS $pwencryptlib"
fi
fi ],
AC_MSG_RESULT(no) )
;;
*-*-sysv4*)
CFLAGS="$CFLAGS -DSVR4"
AC_CHECK_LIB(gen, openlog)
BINGRP="sys"
;;
i*86-unknown-sco*)
LIBS="$LIBS -L/usr/lib/libp"
AC_DEFINE(HAVE_SCO_ETC_SHADOW)
AC_DEFINE(SCO)
AC_CHECK_LIB(prot, accept_pw)
AC_CHECK_LIB(x, chsize)
;;
*)
;;
esac
if test -z "$no_pipe"; then
if test -n "$GCC"; then
AC_MSG_CHECKING([if the compiler understands -pipe])
OLDCC="$CC"
CC="$CC -pipe"
AC_TRY_COMPILE(,,
AC_MSG_RESULT(yes),
CC="$OLDCC"
AC_MSG_RESULT(no))
fi
fi
AC_PROG_INSTALL
AC_PATH_PROG(SU_CMD, su, "/bin/su")
AC_DEFINE_UNQUOTED(SU_CMD, "$SU_CMD")
AC_PATH_PROG(GROFF, groff, ":")
AC_PATH_PROG(RM, rm, "/bin/rm")
AC_PATH_PROG(MV, mv, "/bin/mv")
AC_PROGRAMS_CHECK(MAKEDEP, makedepend makedep, makedepend)
if test "$ac_cv_prog_GROFF" = no; then
ac_msg='you don''t have groff so use the preformatted man pages'
AC_MSG_WARN($ac_msg)
fi
dnl Checks for libraries.
AC_CHECK_LIB(crypt,crypt)
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h libgen.h shadow.h stdarg.h stdlib.h)
AC_CHECK_HEADERS(string.h syslog.h unistd.h)
AC_CHECK_HEADERS(sys/param.h sys/resource.h sys/time.h)
AC_CHECK_HEADERS([utime.h], [], [],
[[#ifdef HAVE_UTIME_H
# include <utime.h>
#endif
]])
AC_CHECK_HEADERS([sys/resource.h], [], [],
[[#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
#endif
]])
AC_MSG_CHECKING(whether unistd.h needs _XOPEN_SOURCE for crypt(3))
AC_CACHE_VAL(su_cv_unistd_needs_xopen_source,
[AC_EGREP_CPP(yes, [#define crypt yes
#include <unistd.h>], su_cv_unistd_needs_xopen_source=no,
AC_EGREP_CPP(yes, [#define crypt yes
#define _XOPEN_SOURCE
#include <unistd.h>], su_cv_unistd_needs_xopen_source=yes,
su_cv_unistd_needs_xopen_source=no))])
AC_MSG_RESULT($su_cv_unistd_needs_xopen_source)
test $su_cv_unistd_needs_xopen_source = yes &&
AC_DEFINE(_XOPEN_SOURCE)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_TYPE_PID_T
dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(openlog syslog)
AC_CHECK_FUNCS(seteuid)
AC_CHECK_FUNCS(setresuid)
AC_CHECK_FUNCS(setrlimit getrlimit)
AC_CHECK_FUNCS(basename)
AC_CHECK_FUNCS(sigaction)
AC_CHECK_FUNCS(sigprocmask)
AC_CHECK_FUNCS(initgroups)
AC_CHECK_FUNCS(getspnam)
AC_CHECK_FUNCS(getpassphrase)
AC_CHECK_FUNCS(sysconf)
dnl Define HAVE_RLIMIT if getrlimit/setrlimit exists and the symbol
dnl we're interested in exists (in HP-UX 9, it doesn't !!!).
AC_MSG_CHECKING(for a working set/getrlimit)
if test $ac_cv_func_setrlimit = yes -a $ac_cv_func_getrlimit = yes; then
AC_EGREP_CPP(yes,
[#include <sys/resource.h>
#ifdef RLIMIT_CORE
yes
#endif
], have_rlimit_core=yes, have_rlimit_core=no)
if test $have_rlimit_core = yes; then
AC_DEFINE(HAVE_RLIMIT)
fi
fi
AC_MSG_RESULT($have_rlimit_core)
dnl Define NO_SYSLOG if openlog/syslog don't exist
if test $ac_cv_func_openlog = no -o $ac_cv_func_syslog = no; then
AC_DEFINE(NO_SYSLOG)
fi
dnl Look for a proper POSIX sysconf
AC_MSG_CHECKING(for a working POSIX sysconf)
if test $ac_cv_func_sysconf = yes; then
AC_EGREP_CPP(yes,
[#include <unistd.h>
#ifdef _SC_LINE_MAX
yes
#endif
], have_line_max=yes, have_line_max=no)
if test $have_line_max = yes; then
AC_DEFINE(HAVE_WORKING_SYSCONF)
fi
fi
AC_MSG_RESULT($have_line_max)
dnl What style of signal do you have (POSIX, BSD, or SYSV)?
AC_MSG_CHECKING(what style of signals to use)
if test $ac_cv_func_sigaction = yes -a $ac_cv_func_sigprocmask = yes; then
signals_style=POSIX_SIGNALS
AC_DEFINE(HAVE_POSIX_SIGNALS)
fi
AC_MSG_RESULT($signals_style)
AC_MSG_CHECKING(how to name the installed binary)
AC_ARG_WITH(program,
[ --with-program=NAME Installed binary name (default calife)],
[ case "$withval" in
no)
AC_MSG_ERROR(Need PROGRAM.)
;;
yes)
AC_MSG_ERROR(Need PROGRAM.)
;;
*)
IPROGRAM="$withval"
AC_MSG_RESULT($withval)
;;
esac ],
IPROGRAM="calife"
AC_MSG_RESULT(calife)
)
AC_ARG_WITH(pam, [ --with-pam enable PAM support],
[case $with_pam in
yes) AC_DEFINE(WITH_PAM)
AC_MSG_CHECKING(whether to use PAM authentication)
AC_MSG_RESULT(yes)
with_passwd=no
LIBS="$LIBS -lpam"
WITH_PAM=yes
;;
no) ;;
*) AC_MSG_ERROR(["--with-pam does not take an argument."])
;;
esac])
dnl
dnl Extra PAM foolishness
dnl
if test "$with_pam" = "yes"; then
dnl
dnl Some PAM implementations (MacOS X for example) put the PAM headers
dnl in /usr/include/pam instead of /usr/include/security...
dnl
AC_CHECK_HEADERS([pam/pam_appl.h])
fi
if test -n "$WITH_PAM"; then
enable_dynamic=yes
else
if test -n "$GCC"; then
AC_MSG_CHECKING(if the command should be linked dynamically)
AC_ARG_ENABLE(dynamic,
[ --enable-dynamic Build the program dynamically (default static)],
[ case "$withval" in
no)
if test x$os_solaris = xyes -o x$os_hpux = xyes -o \
x$os_darwin = xyes -o x$os_linux = xyes; then
ac_msg='it will not work on HP-UX, Linux, MacOS X & Solaris, \
linking dynamically.'
AC_MSG_WARN($ac_msg)
AC_MSG_RESULT(yes)
undef STATIC_LINK
else
LDFLAGS="$LDFLAGS -static"
AC_MSG_RESULT(no)
STATIC_LINK=1
fi
;;
yes)
AC_MSG_RESULT(yes)
;;
*)
AC_MSG_RESULT(yes)
;;
esac ],
if test x$os_solaris != xyes -a x$os_hpux != xyes -a \
x$os_darwin != xyes -a x$os_linux != xyes; then
LDFLAGS="$LDFLAGS -static"
STATIC_LINK=1
fi
AC_MSG_RESULT(yes)
)
fi
fi dnl # WITH_PAM
AC_MSG_CHECKING(where to put calife.auth)
AC_ARG_WITH(etcdir,
[ --with-etcdir=PATH Directory containing calife.auth (default /etc)],
[ case "$withval" in
no)
AC_MSG_ERROR(Need ETCDIR.)
;;
yes)
ETCDIR="/etc"
AC_MSG_RESULT(/etc)
;;
*)
ETCDIR="$withval"
AC_MSG_RESULT($withval)
;;
esac ],
ETCDIR="/etc"
AC_MSG_RESULT(/etc)
)
AC_MSG_CHECKING(whether we want to execute /etc/calife.out)
AC_ARG_ENABLE(global-rc,
[ --enable-global-rc Add /etc/calife.out support],
[ case "$withval" in
yes)
AC_DEFINE(WANT_GLOBAL_RC)
AC_MSG_RESULT(yes)
;;
no)
AC_MSG_RESULT(no)
;;
*)
AC_DEFINE(WANT_GLOBAL_RC)
AC_MSG_RESULT(yes)
;;
esac ],
AC_MSG_RESULT(no)
)
case "$host" in
*-*-linux*)
# New option to enable/disable getspnam(3) usage
AC_MSG_CHECKING(whether we want to disable shadow passwords)
AC_ARG_ENABLE(shadow,
[ --disable-shadow Disable getspnam(3) usage for some Linuxes],
[ case "$withval" in
yes)
AC_DEFINE(UNUSED_SHADOW)
AC_MSG_RESULT(yes)
;;
no)
AC_MSG_RESULT(no)
;;
*)
AC_DEFINE(UNUSED_SHADOW)
AC_MSG_RESULT(yes)
;;
esac ],
AC_MSG_RESULT(no)
)
esac
AC_MSG_CHECKING(whether we want debugging output)
AC_ARG_ENABLE(debug,
[ --enable-debug Set the debugging mode (default is no)],
[ case "$withval" in
no)
AC_MSG_RESULT(no)
;;
yes)
AC_DEFINE(DEBUG)
AC_MSG_RESULT(yes)
;;
*)
AC_DEFINE(DEBUG)
AC_MSG_RESULT(yes)
;;
esac ],
AC_MSG_RESULT(no)
)
AC_MSG_CHECKING(whether we have a setuid-aware shell)
AC_ARG_ENABLE(shellhack,
[ --enable-shellhack Try to fool the shell about our setuidness],
[ case "$withval" in
no)
AC_MSG_RESULT(no)
;;
yes)
AC_DEFINE(NO_SETUID_SHELL)
AC_MSG_RESULT(yes)
;;
*)
AC_MSG_RESULT(no)
;;
esac ],
AC_MSG_RESULT(no)
)
AC_ARG_ENABLE(warnings,
[ --enable-warnings Enable -Wall if using gcc.],
[ if test -n "$GCC"; then
AC_MSG_RESULT(Adding -Wall to CFLAGS.)
CFLAGS="$CFLAGS -Wall"
fi])
AC_ARG_ENABLE(pedantic,
[ --enable-pedantic Enable -pedantic if using gcc.],
[ if test -n "$GCC"; then
AC_MSG_RESULT(Adding -pedantic to CFLAGS.)
CFLAGS="$CFLAGS -pedantic"
fi])
AC_SUBST(IPROGRAM)
AC_SUBST(ETCDIR)
AC_SUBST(GROFF)
AC_SUBST(MV)
AC_SUBST(RM)
AC_SUBST(BINGRP)
AC_OUTPUT(Makefile calife.1 calife.auth.5)