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