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