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