clean better
[heimdal.git] / configure.in
blobb6c0c88e0187925e2b34e0227d9dbd643ec3b471
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.3.0pre1],[heimdal-bugs@h5l.org])
6 AC_CONFIG_SRCDIR([kuser/kinit.c])
7 AC_CONFIG_HEADERS(include/config.h)
8 AC_CONFIG_MACRO_DIR([cf])
10 AM_INIT_AUTOMAKE([foreign 1.10])
11 AM_MAINTAINER_MODE
13 dnl Checks for programs.
14 AC_PROG_CC
15 AM_PROG_CC_C_O
16 AC_PROG_CPP
18 AC_PREFIX_DEFAULT(/usr/heimdal)
20 test "$sysconfdir" = '${prefix}/etc' && sysconfdir='/etc'
21 test "$localstatedir" = '${prefix}/var' && localstatedir='/var/heimdal'
23 AC_CANONICAL_HOST
24 CANONICAL_HOST=$host
25 AC_SUBST(CANONICAL_HOST)
27 dnl Hints for autobuild
28 AB_INIT
30 rk_SYS_LARGEFILE
32 rk_AIX
33 rk_IRIX
34 rk_SUNOS
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.])
42 AC_OBJEXT
43 AC_EXEEXT
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
52 AC_MIPS_ABI
53 CC="$CC $abi"
54 libdir="$libdir$abilibdirext"
56 AC_C___ATTRIBUTE__
58 LT_PREREQ([2.2])
59 LT_INIT([shared static win32-dll])
61 AM_CONDITIONAL(ENABLE_SHARED, test "$enable_shared" = "yes")
62 rk_VERSIONSCRIPT
64 rk_TEST_PACKAGE(openldap,
65 [#include <lber.h>
66 #include <ldap.h>],
67 [-lldap -llber],,,OPENLDAP)
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])
75 AM_CONDITIONAL(OPENLDAP_MODULE, test "$enable_hdb_openldap_module" = yes -a "$with_openldap" = yes)
77 dnl
78 dnl Optional modules, pk-init, digest, kx509
79 dnl
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.])
87 AM_CONDITIONAL(PKINIT, test "$enable_pk_init" != no)
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.])
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.])
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.])
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)
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"
123 AM_CONDITIONAL(SQLITE3,  test "X$with_sqlite3" = Xyes)
125 dnl check for libintl
126 rk_TEST_PACKAGE(libintl,
127 [#include <libintl.h>],
128 [-lintl],,,LIBINTL)
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])
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)
145 AM_CONDITIONAL(KRB5, true)
146 AM_CONDITIONAL(do_roken_rename, true)
148 AC_DEFINE(KRB5, 1, [Enable Kerberos 5 support in applications.])dnl
149 AC_SUBST(LIB_kdb)dnl
151 KRB_CRYPTO
153 KRB_PTHREADS
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.])
160 AM_CONDITIONAL(DCE, test "$enable_dce" = yes)
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"
172 AC_SUBST(dpagaix_cflags)
173 AC_SUBST(dpagaix_ldadd)
174 AC_SUBST(dpagaix_ldflags)
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.])
182 rk_DB
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])
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"
191 rk_OTP
193 AC_CHECK_OSFC2
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.])
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])
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.])
211 rk_CHECK_MAN
213 rk_TEST_PACKAGE(readline,
214 [#include <stdio.h>
215  #include <readline.h>],-lreadline,,, READLINE)
217 rk_TEST_PACKAGE(hesiod,[#include <hesiod.h>],-lhesiod,,, HESIOD)
219 KRB_C_BIGENDIAN
220 AC_C_INLINE
222 KRB_CHECK_X
224 AM_CONDITIONAL(HAVE_X, test "$no_x" != yes)
226 AC_CHECK_XAU
228 dnl AM_C_PROTOTYPES
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
239 dnl Checks for header files.
240 AC_HEADER_STDC
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         pthread.h                               \
258         pty.h                                   \
259         sac.h                                   \
260         sgtty.h                                 \
261         siad.h                                  \
262         signal.h                                \
263         strings.h                               \
264         stropts.h                               \
265         sys/bitypes.h                           \
266         sys/category.h                          \
267         sys/file.h                              \
268         sys/filio.h                             \
269         sys/ioccom.h                            \
270         sys/mman.h                              \
271         sys/param.h                             \
272         sys/pty.h                               \
273         sys/ptyio.h                             \
274         sys/select.h                            \
275         sys/socket.h                            \
276         sys/str_tty.h                           \
277         sys/stream.h                            \
278         sys/stropts.h                           \
279         sys/syscall.h                           \
280         sys/termio.h                            \
281         sys/timeb.h                             \
282         sys/times.h                             \
283         sys/types.h                             \
284         sys/un.h                                \
285         locale.h                                \
286         termcap.h                               \
287         termio.h                                \
288         termios.h                               \
289         time.h                                  \
290         tmpdir.h                                \
291         udb.h                                   \
292         util.h                                  \
293         utmp.h                                  \
294         utmpx.h                                 \
297 dnl On Solaris 8 there's a compilation warning for term.h because
298 dnl it doesn't define `bool'.
299 AC_CHECK_HEADERS(term.h, , , -)
301 dnl aix have asl.h (A/IX screen library) that we don't want
302 AC_CHECK_HEADERS(asl.h, , , [
303 #include <asl.h>
304 #ifndef ASL_STRING_EMERG
305 #error ASL_STRING_EMERG missing
306 #endif])
308 AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
309 #if HAVE_SYS_SOCKET_H
310 #include <sys/socket.h>
311 #endif])
313 AC_CHECK_HEADERS(sys/ptyvar.h, , , [AC_INCLUDES_DEFAULT
314 #if HAVE_SYS_TTY_H
315 #include <sys/tty.h>
316 #endif])
318 AC_CHECK_HEADERS(sys/strtty.h, , , [AC_INCLUDES_DEFAULT
319 #if HAVE_TERMIOS_H
320 #include <termios.h>
321 #endif
322 #if HAVE_SYS_STREAM_H
323 #include <sys/stream.h>
324 #endif])
326 AC_CHECK_HEADERS(sys/ucred.h, , , [AC_INCLUDES_DEFAULT
327 #if HAVE_SYS_TYPES_H
328 #include <sys/types.h>
329 #endif
330 #if HAVE_SYS_PARAM_H
331 #include <sys/param.h>
332 #endif])
334 AC_CHECK_HEADERS(security/pam_modules.h, , , [AC_INCLUDES_DEFAULT
335 #include <security/pam_appl.h>
338 dnl export symbols
339 rk_WIN32_EXPORT(BUILD_KRB5_LIB, KRB5_LIB)
340 rk_WIN32_EXPORT(BUILD_ROKEN_LIB, ROKEN_LIB)
341 rk_WIN32_EXPORT(BUILD_GSSAPI_LIB, GSSAPI_LIB)
343 dnl Checks for libraries.
345 AC_FIND_FUNC_NO_LIBS(logwtmp, util,[
346 #ifdef HAVE_UTIL_H
347 #include <util.h>
348 #endif
349 ],[0,0,0])
350 AC_FIND_FUNC_NO_LIBS(logout, util,[
351 #ifdef HAVE_UTIL_H
352 #include <util.h>
353 #endif
354 ],[0])
355 AC_FIND_FUNC_NO_LIBS(openpty, util,[
356 #ifdef HAVE_UTIL_H
357 #include <util.h>
358 #endif
359 ],[0,0,0,0,0])
361 AC_FIND_FUNC_NO_LIBS(tgetent, termcap ncurses curses,[
362 #ifdef HAVE_TERMCAP_H
363 #include <termcap.h>
364 #endif
365 #ifdef HAVE_CURSES_H
366 #include <curses.h>
367 #endif
368 ],[0,0])
370 dnl Checks for library functions.
372 AC_CHECK_FUNCS([                                \
373         _getpty                                 \
374         _scrsize                                \
375         arc4random                              \
376         fcntl                                   \
377         getpeereid                              \
378         getpeerucred                            \
379         grantpt                                 \
380         mktime                                  \
381         ptsname                                 \
382         rand                                    \
383         revoke                                  \
384         select                                  \
385         setitimer                               \
386         setpcred                                \
387         setpgid                                 \
388         setproctitle                            \
389         setregid                                \
390         setresgid                               \
391         setresuid                               \
392         setreuid                                \
393         setsid                                  \
394         setutent                                \
395         sigaction                               \
396         strstr                                  \
397         ttyname                                 \
398         ttyslot                                 \
399         umask                                   \
400         unlockpt                                \
401         vhangup                                 \
402         yp_get_default_domain                   \
405 AC_FUNC_MMAP
407 KRB_CAPABILITIES
409 AC_CHECK_GETPWNAM_R_POSIX
411 dnl detect doors on solaris
412 if test "$enable_pthread_support" != no; then
413    saved_LIBS="$LIBS"
414    LIBS="$LIBS $PTHREADS_LIBS"
415    AC_FIND_FUNC_NO_LIBS(door_create, door)
416    LIBS="$saved_LIBS"
419 AC_ARG_ENABLE(kcm,
420         AS_HELP_STRING([--enable-kcm],[enable Kerberos Credentials Manager]),
421 ,[enable_kcm=yes])
423 if test "$enable_kcm" = yes ; then
424    if test  "$ac_cv_header_sys_un_h" != yes -a "$ac_cv_funclib_door_create" != yes ; then
425         enable_kcm=no
426    fi
428 if test "$enable_kcm" = yes; then
429        AC_DEFINE(HAVE_KCM, 1,
430                [Define if you want to use the Kerberos Credentials Manager.])
432 AM_CONDITIONAL(KCM, test "$enable_kcm" = yes)
436 dnl Cray stuff
437 AC_CHECK_FUNCS(getudbnam setlim)
439 dnl AC_KRB_FUNC_GETCWD_BROKEN
442 dnl Check for fields in struct utmp
445 AC_HAVE_STRUCT_FIELD(struct utmp, ut_addr, [#include <utmp.h>])
446 AC_HAVE_STRUCT_FIELD(struct utmp, ut_host, [#include <utmp.h>])
447 AC_HAVE_STRUCT_FIELD(struct utmp, ut_id, [#include <utmp.h>])
448 AC_HAVE_STRUCT_FIELD(struct utmp, ut_pid, [#include <utmp.h>])
449 AC_HAVE_STRUCT_FIELD(struct utmp, ut_type, [#include <utmp.h>])
450 AC_HAVE_STRUCT_FIELD(struct utmp, ut_user, [#include <utmp.h>])
451 AC_HAVE_STRUCT_FIELD(struct utmpx, ut_exit, [#include <utmpx.h>])
452 AC_HAVE_STRUCT_FIELD(struct utmpx, ut_syslen, [#include <utmpx.h>])
454 AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, 
455         u_int8_t, u_int16_t, u_int32_t, u_int64_t,
456         uint8_t, uint16_t, uint32_t, uint64_t],,,[
457 #ifdef HAVE_INTTYPES_H
458 #include <inttypes.h>
459 #endif
460 #ifdef HAVE_SYS_TYPES_H
461 #include <sys/types.h>
462 #endif
463 #ifdef HAVE_SYS_BITYPES_H
464 #include <sys/bitypes.h>
465 #endif
466 #ifdef HAVE_BIND_BITYPES_H
467 #include <bind/bitypes.h>
468 #endif
469 #ifdef HAVE_NETINET_IN6_MACHTYPES_H
470 #include <netinet/in6_machtypes.h>
471 #endif
474 rk_FRAMEWORK_SECURITY
476 KRB_READLINE
478 rk_TELNET
480 dnl Some operating systems already have com_err and compile_et
481 CHECK_COMPILE_ET
483 rk_AUTH_MODULES([sia afskauthlib])
485 rk_DESTDIRS
487 rk_WFLAGS([-Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs])
490 AH_BOTTOM([#ifdef ROKEN_RENAME
491 #include "roken_rename.h"
492 #endif])
494 AC_CONFIG_FILES(Makefile                \
495         etc/Makefile                    \
496         include/Makefile                \
497         include/gssapi/Makefile         \
498         include/hcrypto/Makefile        \
499         include/kadm5/Makefile          \
500         lib/Makefile                    \
501         lib/45/Makefile                 \
502         lib/auth/Makefile               \
503         lib/auth/afskauthlib/Makefile   \
504         lib/auth/pam/Makefile           \
505         lib/auth/sia/Makefile           \
506         lib/asn1/Makefile               \
507         lib/com_err/Makefile            \
508         lib/hcrypto/Makefile            \
509         lib/editline/Makefile           \
510         lib/hx509/Makefile              \
511         lib/gssapi/Makefile             \
512         lib/ntlm/Makefile               \
513         lib/hdb/Makefile                \
514         lib/kadm5/Makefile              \
515         lib/kafs/Makefile               \
516         lib/kdfs/Makefile               \
517         lib/krb5/Makefile               \
518         lib/otp/Makefile                \
519         lib/roken/Makefile              \
520         lib/sl/Makefile                 \
521         lib/sqlite/Makefile             \
522         lib/vers/Makefile               \
523         lib/wind/Makefile               \
524         po/Makefile                     \
525         kuser/Makefile                  \
526         kpasswd/Makefile                \
527         kadmin/Makefile                 \
528         admin/Makefile                  \
529         kcm/Makefile                    \
530         kdc/Makefile                    \
531         appl/Makefile                   \
532         appl/afsutil/Makefile           \
533         appl/ftp/Makefile               \
534         appl/ftp/common/Makefile        \
535         appl/ftp/ftp/Makefile           \
536         appl/ftp/ftpd/Makefile          \
537         appl/gssmask/Makefile           \
538         appl/kx/Makefile                \
539         appl/login/Makefile             \
540         appl/otp/Makefile               \
541         appl/popper/Makefile            \
542         appl/push/Makefile              \
543         appl/rsh/Makefile               \
544         appl/rcp/Makefile               \
545         appl/su/Makefile                \
546         appl/xnlock/Makefile            \
547         appl/telnet/Makefile            \
548         appl/telnet/libtelnet/Makefile  \
549         appl/telnet/telnet/Makefile     \
550         appl/telnet/telnetd/Makefile    \
551         appl/test/Makefile              \
552         appl/kf/Makefile                \
553         appl/dceutils/Makefile          \
554         tests/Makefile                  \
555         tests/can/Makefile              \
556         tests/db/Makefile               \
557         tests/kdc/Makefile              \
558         tests/ldap/Makefile             \
559         tests/gss/Makefile              \
560         tests/java/Makefile             \
561         tests/plugin/Makefile           \
562         packages/Makefile               \
563         packages/mac/Makefile           \
564         doc/Makefile                    \
565         tools/Makefile                  \
568 AC_OUTPUT
571 dnl This is the release version name-number[beta]
574 cat > include/newversion.h.in <<EOF
575 const char *heimdal_long_version = "@([#])\$Version: $PACKAGE_STRING by @USER@ on @HOST@ ($host) @DATE@ \$";
576 const char *heimdal_version = "AC_PACKAGE_STRING";
579 if test -f include/version.h && cmp -s include/newversion.h.in include/version.h.in; then
580         echo "include/version.h is unchanged"
581         rm -f include/newversion.h.in
582 else
583         echo "creating include/version.h"
584         User=${USER-${LOGNAME}}
585         Host=`(hostname || uname -n || echo unknown) 2>/dev/null | sed 1q`
586         Date=`date`
587         mv -f include/newversion.h.in include/version.h.in
588         sed -e "s/@USER@/$User/" -e "s/@HOST@/$Host/" -e "s/@DATE@/$Date/" include/version.h.in > include/version.h