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