use AS_HELP_STRING instead of AC_HELP_STRING
[metze/heimdal/wip.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION($Revision$)
3 AC_PREREQ([2.59])
4 test -z "$CFLAGS" && CFLAGS="-g"
5 AC_INIT([Heimdal],[0.8pre],[heimdal-bugs@pdc.kth.se])
6 AC_CONFIG_SRCDIR([kuser/kinit.c])
7 AC_CONFIG_HEADERS(include/config.h)
8
9 AM_INIT_AUTOMAKE([foreign no-dependencies 1.8])
10 AM_MAINTAINER_MODE
11
12 dnl Checks for programs.
13 AC_PROG_CC
14 AM_PROG_CC_C_O
15 AC_PROG_CPP
16
17 AC_PREFIX_DEFAULT(/usr/heimdal)
18
19 test "$sysconfdir" = '${prefix}/etc' && sysconfdir='/etc'
20 test "$localstatedir" = '${prefix}/var' && localstatedir='/var/heimdal'
21
22 AC_CANONICAL_HOST
23 CANONICAL_HOST=$host
24 AC_SUBST(CANONICAL_HOST)
25
26 rk_SYS_LARGEFILE
27
28 dnl
29 dnl this is needed to run the configure tests against glibc
30 dnl
31 AC_DEFINE([_GNU_SOURCE], 1,
32         [Define to enable extensions on glibc-based systems such as Linux.])
33
34 AC_OBJEXT
35 AC_EXEEXT
36
37 dnl AC_KRB_PROG_YACC
38 AC_PROG_YACC
39 AM_PROG_LEX
40 dnl AC_PROG_RANLIB
41 AC_PROG_AWK
42 AC_KRB_PROG_LN_S
43
44 AC_MIPS_ABI
45 CC="$CC $abi"
46 libdir="$libdir$abilibdirext"
47
48 AC_C___ATTRIBUTE__
49
50 AC_ENABLE_SHARED(no)
51 AC_PROG_LIBTOOL
52
53 rk_WFLAGS(-Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs)
54
55 rk_TEST_PACKAGE(openldap,
56 [#include <lber.h>
57 #include <ldap.h>],
58 [-lldap -llber],,,OPENLDAP)
59
60 AC_ARG_ENABLE(hdb-openldap-module, 
61         AS_HELP_STRING([--enable-hdb-openldap-module],
62                 [if you want support to build openldap hdb as shared object]))
63 if test "$enable_hdb_openldap_module" = yes -a "$with_openldap" = yes; then
64     AC_DEFINE(OPENLDAP_MODULE, 1, [Define if you want support for hdb ldap module])
65 fi
66 AM_CONDITIONAL(OPENLDAP_MODULE, test "$enable_hdb_openldap_module" = yes -a "$with_openldap" = yes)
67
68 AC_ARG_ENABLE(pk-init, 
69         AS_HELP_STRING([--enable-pk-init],
70                 [if you want support to pk-init]))
71 if test "$enable_pk_init" = yes ;then
72         AC_DEFINE([PKINIT], 1, [Define to enable PKINIT.])
73 fi
74
75 rk_TEST_PACKAGE(krb4,[#include <krb.h>],-lkrb,-ldes,/usr/athena, KRB4, krb4-config)
76
77 LIB_kdb=
78 if test "$with_krb4" != "no"; then
79         save_CFLAGS="$CFLAGS"
80         CFLAGS="$CFLAGS $INCLUDE_krb4"
81         save_LIBS="$LIBS"
82         LIBS="$LIB_krb4 $LIBS"
83         EXTRA_LIB45=lib45.a
84         AC_SUBST(EXTRA_LIB45)
85         AC_CACHE_CHECK(for four valued krb_put_int, ac_cv_func_krb_put_int_four,
86                 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <krb.h>]], [[
87                 char tmp[4];
88                 krb_put_int(17, tmp, 4, sizeof(tmp));]])],
89                 [ac_cv_func_krb_put_int_four=yes],
90                 [ac_cv_func_krb_put_int_four=no])
91         ])
92         if test "$ac_cv_func_krb_put_int_four" = yes; then
93                 AC_DEFINE(HAVE_FOUR_VALUED_KRB_PUT_INT, 1,
94                         [define if krb_put_int takes four arguments.])
95         fi
96         AH_BOTTOM([#if defined(HAVE_FOUR_VALUED_KRB_PUT_INT) || !defined(KRB4)
97 #define KRB_PUT_INT(F, T, L, S) krb_put_int((F), (T), (L), (S))
98 #else
99 #define KRB_PUT_INT(F, T, L, S) krb_put_int((F), (T), (S))
100 #endif
101 ])
102         AC_CACHE_CHECK(for KRB_VERIFY_SECURE, ac_cv_func_krb_verify_secure,
103                 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <krb.h>]], [[
104                 int x = KRB_VERIFY_SECURE]])],
105                 [ac_cv_func_krb_verify_secure=yes],
106                 [ac_cv_func_krb_verify_secure=no])
107         ])
108         if test "$ac_cv_func_krb_verify_secure" != yes; then
109                 AC_DEFINE(KRB_VERIFY_SECURE, 1,
110                         [Define to one if your krb.h doesn't])
111                 AC_DEFINE(KRB_VERIFY_SECURE_FAIL, 2,
112                         [Define to two if your krb.h doesn't])
113         fi
114         AC_CACHE_CHECK(for KRB_VERIFY_NOT_SECURE,
115                 ac_cv_func_krb_verify_not_secure,
116                 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <krb.h>]], [[
117                 int x = KRB_VERIFY_NOT_SECURE]])],
118                 [ac_cv_func_krb_verify_not_secure=yes],
119                 [ac_cv_func_krb_verify_not_secure=no])
120         ])
121         if test "$ac_cv_func_krb_verify_not_secure" != yes; then
122                 AC_DEFINE(KRB_VERIFY_NOT_SECURE, 0,
123                         [Define to zero if your krb.h doesn't])
124         fi
125         AC_FIND_FUNC(krb_enable_debug)
126         AC_FIND_FUNC(krb_disable_debug)
127         AC_FIND_FUNC(krb_get_our_ip_for_realm)
128         AC_FIND_FUNC(krb_kdctimeofday)
129         AH_BOTTOM(
130         [#ifndef HAVE_KRB_KDCTIMEOFDAY
131 #define krb_kdctimeofday(X) gettimeofday((X), NULL)
132 #endif])
133         AC_FIND_FUNC(krb_get_kdc_time_diff)
134         AH_BOTTOM(
135         [#ifndef HAVE_KRB_GET_KDC_TIME_DIFF
136 #define krb_get_kdc_time_diff() (0)
137 #endif])
138         AC_CACHE_CHECK([for KRB_SENDAUTH_VERS],
139                 ac_cv_func_krb_sendauth_vers,
140                 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <krb.h>
141                         #include <prot.h>]], [[
142                 char *x = KRB_SENDAUTH_VERS]])],
143                 [ac_cv_func_krb_sendauth_vers=yes],
144                 [ac_cv_func_krb_sendauth_vers=no])
145         ])
146         if test "$ac_cv_func_krb_sendauth_vers" != yes; then
147                 AC_DEFINE(KRB_SENDAUTH_VERS, ["AUTHV0.1"],
148                         [This is the krb4 sendauth version.])
149         fi
150         AC_CACHE_CHECK(for krb_mk_req with const arguments,
151                 ac_cv_func_krb_mk_req_const,
152                 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <krb.h>
153                 int krb_mk_req(KTEXT a, const char *s, const char *i,
154                                const char *r, int32_t checksum)
155                 { return 17; }]], [[]])],
156                 [ac_cv_func_krb_mk_req_const=yes],
157                 [ac_cv_func_krb_mk_req_const=no])
158         ])
159         if test "$ac_cv_func_krb_mk_req_const" = "yes"; then
160                 AC_DEFINE(KRB_MK_REQ_CONST, 1,
161                         [Define if krb_mk_req takes const char *])
162         fi
163
164         LIBS="$save_LIBS"
165         CFLAGS="$save_CFLAGS"
166         LIB_kdb="-lkdb -lkrb"
167 fi
168 AM_CONDITIONAL(KRB4, test "$with_krb4" != "no")
169 AM_CONDITIONAL(KRB5, true)
170 AM_CONDITIONAL(do_roken_rename, true)
171
172 AC_DEFINE(KRB5, 1, [Enable Kerberos 5 support in applications.])dnl
173 AC_SUBST(LIB_kdb)dnl
174
175 KRB_CRYPTO
176
177 KRB_PTHREADS
178
179 AC_ARG_ENABLE(dce, 
180         AS_HELP_STRING([--enable-dce],[if you want support for DCE/DFS PAG's]))
181 if test "$enable_dce" = yes; then
182     AC_DEFINE(DCE, 1, [Define if you want support for DCE/DFS PAG's.])
183 fi
184 AM_CONDITIONAL(DCE, test "$enable_dce" = yes)
185
186 ## XXX quite horrible:
187 if test -f /etc/ibmcxx.cfg; then
188         dpagaix_ldadd=`sed -n '/^xlc_r4/,/^$/p' /etc/ibmcxx.cfg | sed -n -e '/libraries/{;s/^[[^=]]*=\(.*\)/\1/;s/,/ /gp;}'`
189         dpagaix_cflags=`sed -n '/^xlc_r4/,/^$/p' /etc/ibmcxx.cfg | sed -n -e '/options/{;s/^[[^=]]*=\(.*\)/\1/;s/-q[^,]*//;s/,/ /gp;}'`
190         dpagaix_ldflags=
191 else
192         dpagaix_cflags="-D_THREAD_SAFE -D_AIX_PTHREADS_D7 -D_AIX32_THREADS=1 -D_AES_SOURCE -D_AIX41 -I/usr/include/dce"
193         dpagaix_ldadd="-L/usr/lib/threads -ldcelibc_r -ldcepthreads -lpthreads_compat lpthreads -lc_r"
194         dpagaix_ldflags="-Wl,-bI:dfspag.exp"
195 fi
196 AC_SUBST(dpagaix_cflags)
197 AC_SUBST(dpagaix_ldadd)
198 AC_SUBST(dpagaix_ldflags)
199
200 rk_DB
201
202 dnl AC_ROKEN(10,[/usr/heimdal /usr/athena],[lib/roken],[$(top_builddir)/lib/roken/libroken.la],[-I$(top_builddir)/lib/roken -I$(top_srcdir)/lib/roken])
203
204 rk_ROKEN(lib/roken)
205 LIB_roken="\$(top_builddir)/lib/vers/libvers.la $LIB_roken"
206
207 rk_OTP
208
209 AC_CHECK_OSFC2
210
211 AC_ARG_ENABLE(mmap,
212         AS_HELP_STRING([--disable-mmap],[disable use of mmap]))
213 if test "$enable_mmap" = "no"; then
214         AC_DEFINE(NO_MMAP, 1, [Define if you don't want to use mmap.])
215 fi
216
217 AC_ARG_ENABLE(afs-string-to-key,
218         AS_HELP_STRING([--disable-afs-string-to-key],
219         [disable use of weak AFS string-to-key functions]),
220         [], [enable_afs_string_to_key=yes])
221
222 if test "$enable_afs_string_to_key" = "yes"; then
223         AC_DEFINE(ENABLE_AFS_STRING_TO_KEY, 1, [Define if want to use the weak AFS string to key functions.])
224 fi
225
226
227 rk_CHECK_MAN
228
229 rk_TEST_PACKAGE(readline,
230 [#include <stdio.h>
231  #include <readline.h>],-lreadline,,, READLINE)
232
233 rk_TEST_PACKAGE(hesiod,[#include <hesiod.h>],-lhesiod,,, HESIOD)
234
235 KRB_C_BIGENDIAN
236 AC_C_INLINE
237
238 rk_AIX
239 rk_IRIX
240 rk_SUNOS
241
242 KRB_CHECK_X
243
244 AM_CONDITIONAL(HAVE_X, test "$no_x" != yes)
245
246 AC_CHECK_XAU
247
248 dnl AM_C_PROTOTYPES
249
250 dnl Checks for typedefs, structures, and compiler characteristics.
251 AC_C_CONST
252 AC_TYPE_OFF_T
253 AC_CHECK_TYPE_EXTRA(mode_t, unsigned short, [])
254 AC_CHECK_TYPE_EXTRA(sig_atomic_t, int, [#include <signal.h>])
255 AC_HAVE_TYPE([long long])
256 AC_HEADER_TIME
257 AC_STRUCT_TM
258
259 dnl Checks for header files.
260 AC_HEADER_STDC
261
262 AC_CHECK_HEADERS([\
263         arpa/ftp.h                              \
264         arpa/telnet.h                           \
265         bind/bitypes.h                          \
266         bsdsetjmp.h                             \
267         curses.h                                \
268         dlfcn.h                                 \
269         fnmatch.h                               \
270         inttypes.h                              \
271         io.h                                    \
272         libutil.h                               \
273         limits.h                                \
274         maillock.h                              \
275         netgroup.h                              \
276         netinet/in6_machtypes.h                 \
277         netinfo/ni.h                            \
278         pthread.h                               \
279         pty.h                                   \
280         sac.h                                   \
281         sgtty.h                                 \
282         siad.h                                  \
283         signal.h                                \
284         stropts.h                               \
285         strings.h                               \
286         sys/bitypes.h                           \
287         sys/category.h                          \
288         sys/file.h                              \
289         sys/filio.h                             \
290         sys/ioccom.h                            \
291         sys/mman.h                              \
292         sys/pty.h                               \
293         sys/ptyio.h                             \
294         sys/select.h                            \
295         sys/socket.h                            \
296         sys/str_tty.h                           \
297         sys/stream.h                            \
298         sys/stropts.h                           \
299         sys/syscall.h                           \
300         sys/termio.h                            \
301         sys/timeb.h                             \
302         sys/times.h                             \
303         sys/un.h                                \
304         termcap.h                               \
305         termio.h                                \
306         termios.h                               \
307         time.h                                  \
308         tmpdir.h                                \
309         udb.h                                   \
310         util.h                                  \
311         utmp.h                                  \
312         utmpx.h                                 \
313 ])
314
315 dnl On Solaris 8 there's a compilation warning for term.h because
316 dnl it doesn't define `bool'.
317 AC_CHECK_HEADERS(term.h, , , -)
318
319 AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
320 #if HAVE_SYS_SOCKET_H
321 #include <sys/socket.h>
322 #endif])
323
324 AC_CHECK_HEADERS(sys/ptyvar.h, , , [AC_INCLUDES_DEFAULT
325 #if HAVE_SYS_TTY_H
326 #include <sys/tty.h>
327 #endif])
328
329 AC_CHECK_HEADERS(sys/strtty.h, , , [AC_INCLUDES_DEFAULT
330 #if HAVE_TERMIOS_H
331 #include <termios.h>
332 #endif
333 #if HAVE_SYS_STREAM_H
334 #include <sys/stream.h>
335 #endif])
336
337 AC_CHECK_HEADERS(security/pam_modules.h, , , [AC_INCLUDES_DEFAULT
338 #include <security/pam_appl.h>
339 ])
340
341 AC_ARG_ENABLE(netinfo,
342         AS_HELP_STRING([--enable-netinfo],[enable netinfo for configuration lookup]))
343
344 if test "$ac_cv_header_netinfo_ni_h" = yes -a "$enable_netinfo" = yes; then
345        AC_DEFINE(HAVE_NETINFO, 1,
346                [Define if you want to use Netinfo instead of krb5.conf.])
347 fi
348
349 AC_ARG_ENABLE(kcm,
350         AS_HELP_STRING([--enable-kcm],[enable Kerberos Credentials Manager]))
351
352 if test "$ac_cv_header_sys_un_h" = yes -a "$enable_kcm" = yes; then
353        AC_DEFINE(HAVE_KCM, 1,
354                [Define if you want to use the Kerberos Credentials Manager.])
355 fi
356 AM_CONDITIONAL(KCM, test "$enable_kcm" = yes)
357
358 dnl export symbols
359 rk_WIN32_EXPORT(BUILD_KRB5_LIB, KRB5_LIB_FUNCTION)
360 rk_WIN32_EXPORT(BUILD_ROKEN_LIB, ROKEN_LIB_FUNCTION)
361
362 dnl Checks for libraries.
363
364 AC_FIND_FUNC_NO_LIBS(logwtmp, util,[
365 #ifdef HAVE_UTIL_H
366 #include <util.h>
367 #endif
368 ],[0,0,0])
369 AC_FIND_FUNC_NO_LIBS(logout, util,[
370 #ifdef HAVE_UTIL_H
371 #include <util.h>
372 #endif
373 ],[0])
374 AC_FIND_FUNC_NO_LIBS(openpty, util,[
375 #ifdef HAVE_UTIL_H
376 #include <util.h>
377 #endif
378 ],[0,0,0,0,0])
379
380 AC_FIND_FUNC_NO_LIBS(tgetent, termcap ncurses curses,[
381 #ifdef HAVE_TERMCAP_H
382 #include <termcap.h>
383 #endif
384 #ifdef HAVE_CURSES_H
385 #include <curses.h>
386 #endif
387 ],[0,0])
388
389 dnl Checks for library functions.
390
391 AC_CHECK_FUNCS([                                \
392         _getpty                                 \
393         _scrsize                                \
394         fcntl                                   \
395         getpeereid                              \
396         getpeerucred                            \
397         grantpt                                 \
398         mktime                                  \
399         ptsname                                 \
400         rand                                    \
401         revoke                                  \
402         select                                  \
403         setitimer                               \
404         setpcred                                \
405         setpgid                                 \
406         setproctitle                            \
407         setregid                                \
408         setresgid                               \
409         setresuid                               \
410         setreuid                                \
411         setsid                                  \
412         setutent                                \
413         sigaction                               \
414         strstr                                  \
415         timegm                                  \
416         ttyname                                 \
417         ttyslot                                 \
418         umask                                   \
419         unlockpt                                \
420         vhangup                                 \
421         yp_get_default_domain                   \
422 ])
423
424 AC_FUNC_MMAP
425
426 KRB_CAPABILITIES
427
428 AC_CHECK_GETPWNAM_R_POSIX
429
430 dnl detect doors on solaris
431 if test "$enable_pthread_support" != no; then
432    saved_LIBS="$LIBS"
433    LIBS="$LIBS $PTHREADS_LIBS"
434    AC_FIND_FUNC_NO_LIBS(door_create, door)
435    LIBS="$saved_LIBS"
436 fi
437
438 dnl Cray stuff
439 AC_CHECK_FUNCS(getudbnam setlim)
440
441 dnl AC_KRB_FUNC_GETCWD_BROKEN
442
443 dnl
444 dnl Check for fields in struct utmp
445 dnl
446
447 AC_HAVE_STRUCT_FIELD(struct utmp, ut_addr, [#include <utmp.h>])
448 AC_HAVE_STRUCT_FIELD(struct utmp, ut_host, [#include <utmp.h>])
449 AC_HAVE_STRUCT_FIELD(struct utmp, ut_id, [#include <utmp.h>])
450 AC_HAVE_STRUCT_FIELD(struct utmp, ut_pid, [#include <utmp.h>])
451 AC_HAVE_STRUCT_FIELD(struct utmp, ut_type, [#include <utmp.h>])
452 AC_HAVE_STRUCT_FIELD(struct utmp, ut_user, [#include <utmp.h>])
453 AC_HAVE_STRUCT_FIELD(struct utmpx, ut_exit, [#include <utmpx.h>])
454 AC_HAVE_STRUCT_FIELD(struct utmpx, ut_syslen, [#include <utmpx.h>])
455
456 AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, 
457         u_int8_t, u_int16_t, u_int32_t, u_int64_t,
458         uint8_t, uint16_t, uint32_t, uint64_t],,,[
459 #ifdef HAVE_INTTYPES_H
460 #include <inttypes.h>
461 #endif
462 #ifdef HAVE_SYS_TYPES_H
463 #include <sys/types.h>
464 #endif
465 #ifdef HAVE_SYS_BITYPES_H
466 #include <sys/bitypes.h>
467 #endif
468 #ifdef HAVE_BIND_BITYPES_H
469 #include <bind/bitypes.h>
470 #endif
471 #ifdef HAVE_NETINET_IN6_MACHTYPES_H
472 #include <netinet/in6_machtypes.h>
473 #endif
474 ])
475
476 KRB_READLINE
477
478 rk_TELNET
479
480 dnl Some operating systems already have com_err and compile_et
481 CHECK_COMPILE_ET
482
483 rk_AUTH_MODULES([sia afskauthlib])
484
485 rk_DESTDIRS
486
487 AH_BOTTOM([#ifdef ROKEN_RENAME
488 #include "roken_rename.h"
489 #endif])
490
491 AC_CONFIG_FILES(Makefile                \
492         include/Makefile                \
493         include/kadm5/Makefile          \
494         lib/Makefile                    \
495         lib/45/Makefile                 \
496         lib/auth/Makefile               \
497         lib/auth/afskauthlib/Makefile   \
498         lib/auth/pam/Makefile           \
499         lib/auth/sia/Makefile           \
500         lib/asn1/Makefile               \
501         lib/com_err/Makefile            \
502         lib/des/Makefile                \
503         lib/editline/Makefile           \
504         lib/gssapi/Makefile             \
505         lib/hdb/Makefile                \
506         lib/kadm5/Makefile              \
507         lib/kafs/Makefile               \
508         lib/kdfs/Makefile               \
509         lib/krb5/Makefile               \
510         lib/otp/Makefile                \
511         lib/roken/Makefile              \
512         lib/sl/Makefile                 \
513         lib/vers/Makefile               \
514         kuser/Makefile                  \
515         kpasswd/Makefile                \
516         kadmin/Makefile                 \
517         admin/Makefile                  \
518         kcm/Makefile                    \
519         kdc/Makefile                    \
520         appl/Makefile                   \
521         appl/afsutil/Makefile           \
522         appl/ftp/Makefile               \
523         appl/ftp/common/Makefile        \
524         appl/ftp/ftp/Makefile           \
525         appl/ftp/ftpd/Makefile          \
526         appl/kx/Makefile                \
527         appl/login/Makefile             \
528         appl/otp/Makefile               \
529         appl/popper/Makefile            \
530         appl/push/Makefile              \
531         appl/rsh/Makefile               \
532         appl/rcp/Makefile               \
533         appl/su/Makefile                \
534         appl/xnlock/Makefile            \
535         appl/telnet/Makefile            \
536         appl/telnet/libtelnet/Makefile  \
537         appl/telnet/telnet/Makefile     \
538         appl/telnet/telnetd/Makefile    \
539         appl/test/Makefile              \
540         appl/kf/Makefile                \
541         appl/dceutils/Makefile          \
542         doc/Makefile                    \
543         tools/Makefile                  \
544 )
545
546 AC_OUTPUT
547
548 dnl
549 dnl This is the release version name-number[beta]
550 dnl
551
552 cat > include/newversion.h.in <<EOF
553 const char *heimdal_long_version = "@([#])\$Version: $PACKAGE_STRING by @USER@ on @HOST@ ($host) @DATE@ \$";
554 const char *heimdal_version = "AC_PACKAGE_STRING";
555 EOF
556
557 if test -f include/version.h && cmp -s include/newversion.h.in include/version.h.in; then
558         echo "include/version.h is unchanged"
559         rm -f include/newversion.h.in
560 else
561         echo "creating include/version.h"
562         User=${USER-${LOGNAME}}
563         Host=`(hostname || uname -n || echo unknown) 2>/dev/null | sed 1q`
564         Date=`date`
565         mv -f include/newversion.h.in include/version.h.in
566         sed -e "s/@USER@/$User/" -e "s/@HOST@/$Host/" -e "s/@DATE@/$Date/" include/version.h.in > include/version.h
567 fi