krb5: don't include plist support unless CoreFoundation is present
[metze/heimdal/wip.git] / configure.ac
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],[7.99.1],[https://github.com/heimdal/heimdal/issues])
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.11])
11 AM_MAINTAINER_MODE
12
13 LT_PREREQ([2.2])
14 LT_INIT([shared static win32-dll])
15
16
17 dnl Checks for programs.
18 AC_PROG_CC
19 AM_PROG_CC_C_O
20 AC_PROG_CPP
21
22 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
23
24 AC_PREFIX_DEFAULT(/usr/heimdal)
25
26 test "$sysconfdir" = '${prefix}/etc' && sysconfdir='/etc'
27 test "$localstatedir" = '${prefix}/var' && localstatedir='/var/heimdal'
28
29 AC_CANONICAL_HOST
30 CANONICAL_HOST=$host
31 AC_SUBST(CANONICAL_HOST)
32
33 rk_SYS_LARGEFILE
34
35 rk_AIX
36 rk_IRIX
37 rk_SUNOS
38
39 dnl
40 dnl this is needed to run the configure tests against glibc
41 dnl
42 AC_DEFINE([_GNU_SOURCE], 1,
43         [Define to enable extensions on glibc-based systems such as Linux.])
44
45 AC_OBJEXT
46 AC_EXEEXT
47
48 dnl
49 dnl this is needed when der-protos.h or der-private.h has to be generated
50 dnl
51 if ! test -f "$srcdir/lib/asn1/der-protos.h" ||
52    ! test -f "$srcdir/lib/asn1/der-private.h"; then
53     AC_KRB_PROG_PERL
54     AC_KRB_PERL_MOD(Getopt::Std)
55     AC_KRB_PERL_MOD(File::Compare)
56     AC_KRB_PERL_MOD(JSON)
57 fi
58
59 dnl AC_KRB_PROG_YACC
60 AC_PROG_YACC
61 AM_PROG_LEX
62 dnl AC_PROG_RANLIB
63 AC_PROG_AWK
64 AC_KRB_PROG_LN_S
65
66 AC_MIPS_ABI
67 CC="$CC $abi"
68 libdir="$libdir$abilibdirext"
69
70 AC_C___ATTRIBUTE__
71
72 AM_CONDITIONAL(ENABLE_SHARED, test "$enable_shared" = "yes")
73 rk_VERSIONSCRIPT
74
75 dnl Code coverage
76 AC_ARG_ENABLE([gcov],
77         AC_HELP_STRING([--enable-gcov], [enable gcov code coverage tool]))
78 AM_CONDITIONAL([ENABLE_GCOV], [test "x$enable_gcov" = xyes])
79
80
81 dnl
82 dnl Helper bits for cross compiling
83 dnl
84
85
86
87 AM_CONDITIONAL(CROSS_COMPILE, test "${cross_compiling}" = yes)
88
89 AC_ARG_WITH(cross-tools,
90         AS_HELP_STRING([--with-cross-tools=dir], [use cross tools in dir]),
91         [if test "$withval" = "yes"; then
92                 AC_MSG_ERROR([Need path to cross tools])
93         fi
94         with_cross_tools="${with_cross_tools}/"
95         ])
96
97 if test "${cross_compiling}" != yes ; then
98
99    ASN1_COMPILE="\$(top_builddir)/lib/asn1/asn1_compile\$(EXEEXT)"
100    SLC="\$(top_builddir)/lib/sl/slc"
101
102    ASN1_COMPILE_DEP="\$(ASN1_COMPILE)"
103    SLC_DEP="\$(SLC)"
104 else
105    ASN1_COMPILE="${with_cross_tools}asn1_compile"
106    SLC="${with_cross_tools}slc"
107
108    ASN1_COMPILE_DEP=
109    SLC_DEP=
110
111    ac_cv_prog_COMPILE_ET=${with_cross_tools}compile_et
112
113 fi
114
115 AC_SUBST([ASN1_COMPILE])
116 AC_SUBST([ASN1_COMPILE_DEP])
117 AC_SUBST([SLC])
118 AC_SUBST([SLC_DEP])
119
120 dnl ---
121
122 AC_DEFINE(HEIM_WEAK_CRYPTO, 1, [Define if you want support for weak crypto])
123
124 rk_TEST_PACKAGE(openldap,
125 [#include <lber.h>
126 #include <ldap.h>],
127 [-lldap -llber],,,OPENLDAP)
128
129 AC_ARG_ENABLE(hdb-openldap-module, 
130         AS_HELP_STRING([--enable-hdb-openldap-module],
131                 [if you want support to build openldap hdb as shared object]))
132 if test "$enable_hdb_openldap_module" = yes -a "$with_openldap" = yes; then
133     AC_DEFINE(OPENLDAP_MODULE, 1, [Define if you want support for hdb ldap module])
134 fi
135 AM_CONDITIONAL(OPENLDAP_MODULE, test "$enable_hdb_openldap_module" = yes -a "$with_openldap" = yes)
136
137 dnl
138 dnl Optional modules, pk-init, digest, kx509
139 dnl
140
141 AC_ARG_ENABLE(pk-init, 
142         AS_HELP_STRING([--disable-pk-init],
143                 [if you want disable to PK-INIT support]))
144 if test "$enable_pk_init" != no ;then
145         AC_DEFINE([PKINIT], 1, [Define to enable PKINIT.])
146 fi
147 AM_CONDITIONAL(PKINIT, test "$enable_pk_init" != no)
148
149 AC_ARG_ENABLE(digest, 
150         AS_HELP_STRING([--disable-digest],
151                 [if you want disable to DIGEST support]))
152 if test "$enable_digest" != no ;then
153         AC_DEFINE([DIGEST], 1, [Define to enable DIGEST.])
154 fi
155
156 AC_ARG_ENABLE(kx509, 
157         AS_HELP_STRING([--disable-kx509],
158                 [if you want disable to kx509 support]))
159 if test "$enable_kx509" != no ;then
160         AC_DEFINE([KX509], 1, [Define to enable kx509.])
161 fi
162
163 dnl Need to test if pkg-config exists
164 PKG_PROG_PKG_CONFIG
165
166 dnl libcap-ng
167 AC_ARG_WITH([capng],
168   AC_HELP_STRING([--with-capng], [use libcap-ng to drop KDC privileges @<:@default=check@:>@]),
169   [],
170   [with_capng=check])
171 if test "$with_capng" != "no"; then
172   PKG_CHECK_MODULES([CAPNG], [libcap-ng >= 0.4.0],
173                     [with_capng=yes],[with_capng=no])
174 fi
175 if test "$with_capng" = "yes"; then
176   AC_DEFINE_UNQUOTED([HAVE_CAPNG], 1, [whether capng is available for privilege reduction])
177 fi
178 AM_CONDITIONAL([HAVE_CAPNG], [test "$with_capng" != "no"])
179 AC_SUBST([CAPNG_CFLAGS])
180 AC_SUBST([CAPNG_LIBS])
181
182 dnl Check for sqlite
183 rk_TEST_PACKAGE(sqlite3,
184 [#include <sqlite3.h>
185 #ifndef SQLITE_OPEN_CREATE
186 #error "old version"
187 #endif],
188 [-lsqlite3],,,SQLITE3)
189
190 if test "X$with_sqlite3" != Xyes ; then
191    INCLUDE_sqlite3="-I\$(top_srcdir)/lib/sqlite"
192    LIB_sqlite3="\$(top_builddir)/lib/sqlite/libheimsqlite.la"
193 fi
194 AM_CONDITIONAL(SQLITE3,  test "X$with_sqlite3" = Xyes)
195
196 AC_DEFINE(HAVE_SQLITE3, 1, [Define if you want support for sqlite in Heimdal.])
197
198 AC_ARG_ENABLE(sqlite-cache, 
199         AS_HELP_STRING([--disable-sqlite-cache],[if you want support for cache in sqlite]))
200 if test "$enable_sqlite_cache" != no; then
201     AC_DEFINE(HAVE_SCC, 1, [Define if you want support for cache in sqlite.])
202 fi
203 AM_CONDITIONAL(have_scc, test "$enable_sqlite_cache" != no)
204
205
206 dnl check for libintl
207 rk_TEST_PACKAGE(libintl,
208 [#include <libintl.h>],
209 [-lintl],,,LIBINTL)
210
211 dnl path where the hdb directory is stored
212 AC_ARG_WITH([hdbdir], 
213         [AS_HELP_STRING([--with-hdbdir],[Default location for KDC database @<:@default=/var/heimdal@:>@])],
214         [],
215         [with_hdbdir=/var/heimdal])
216 DIR_hdbdir="$with_hdbdir"
217 AC_SUBST([DIR_hdbdir])
218
219
220 AM_CONDITIONAL(KRB5, true)
221 AM_CONDITIONAL(do_roken_rename, true)
222
223 AC_DEFINE(SUPPORT_INETD, 1, [Enable use of inetd style startup.])dnl
224
225
226 AC_DEFINE(KRB5, 1, [Enable Kerberos 5 support in applications.])dnl
227 AC_SUBST(LIB_kdb)dnl
228
229 KRB_CRYPTO
230
231 KRB_PTHREADS
232
233 AC_ARG_ENABLE(dce, 
234         AS_HELP_STRING([--enable-dce],[if you want support for DCE/DFS PAG's]))
235 if test "$enable_dce" = yes; then
236     AC_DEFINE(DCE, 1, [Define if you want support for DCE/DFS PAG's.])
237 fi
238 AM_CONDITIONAL(DCE, test "$enable_dce" = yes)
239
240 ## XXX quite horrible:
241 if test -f /etc/ibmcxx.cfg; then
242         dpagaix_ldadd=`sed -n '/^xlc_r4/,/^$/p' /etc/ibmcxx.cfg | sed -n -e '/libraries/{;s/^[[^=]]*=\(.*\)/\1/;s/,/ /gp;}'`
243         dpagaix_cflags=`sed -n '/^xlc_r4/,/^$/p' /etc/ibmcxx.cfg | sed -n -e '/options/{;s/^[[^=]]*=\(.*\)/\1/;s/-q[^,]*//;s/,/ /gp;}'`
244         dpagaix_ldflags=
245 else
246         dpagaix_cflags="-D_THREAD_SAFE -D_AIX_PTHREADS_D7 -D_AIX32_THREADS=1 -D_AES_SOURCE -D_AIX41 -I/usr/include/dce"
247         dpagaix_ldadd="-L/usr/lib/threads -ldcelibc_r -ldcepthreads -lpthreads_compat lpthreads -lc_r"
248         dpagaix_ldflags="-Wl,-bI:dfspag.exp"
249 fi
250 AC_SUBST(dpagaix_cflags)
251 AC_SUBST(dpagaix_ldadd)
252 AC_SUBST(dpagaix_ldflags)
253
254 AC_ARG_ENABLE([afs-support],
255         AS_HELP_STRING([--disable-afs-support],[if you don't want support for AFS]))
256 if test "$enable_afs_support" = no; then
257         AC_DEFINE(NO_AFS, 1, [Define if you don't wan't support for AFS.])
258         NO_AFS="1"
259 fi
260 AC_SUBST(NO_AFS)dnl
261 AM_CONDITIONAL(NO_AFS, test "$enable_afs_support" = no)
262
263 rk_DB
264
265 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])
266
267 rk_ROKEN(lib/roken)
268 LIBADD_roken="$LIB_roken"
269 AC_SUBST(LIBADD_roken)dnl
270 LIB_roken="\$(top_builddir)/lib/vers/libvers.la $LIB_roken"
271
272 rk_OTP
273
274 rk_LIBDISPATCH
275
276 AC_CHECK_OSFC2
277
278 AC_ARG_ENABLE(mmap,
279         AS_HELP_STRING([--disable-mmap],[disable use of mmap]))
280 if test "$enable_mmap" = "no"; then
281         AC_DEFINE(NO_MMAP, 1, [Define if you don't want to use mmap.])
282 fi
283
284 AC_ARG_ENABLE(afs-string-to-key,
285         AS_HELP_STRING([--disable-afs-string-to-key],
286         [disable use of weak AFS string-to-key functions]),
287         [], [enable_afs_string_to_key=yes])
288
289 if test "$enable_afs_string_to_key" = "yes"; then
290         AC_DEFINE(ENABLE_AFS_STRING_TO_KEY, 1, [Define if want to use the weak AFS string to key functions.])
291         ENABLE_AFS_STRING_TO_KEY=1
292 fi
293 AC_SUBST(ENABLE_AFS_STRING_TO_KEY)dnl
294
295
296 rk_CHECK_MAN
297
298 rk_TEST_PACKAGE(readline,
299 [#include <stdio.h>
300 #if defined(HAVE_READLINE_READLINE_H)
301 #include <readline/readline.h>
302 #elif defined(HAVE_READLINE_H)
303 #include <readline.h>
304 #endif
305 ],-lreadline,,, READLINE,, [readline.h readline/readline.h])
306
307 rk_TEST_PACKAGE(libedit,
308 [#include <stdio.h>
309 #if defined(HAVE_READLINE_READLINE_H)
310 #include <readline/readline.h>
311 #elif defined(HAVE_READLINE_H)
312 #include <readline.h>
313 #elif defined(HAVE_EDITLINE_READLINE_H)
314 #include <editline/readline.h>
315 #endif
316 ],-ledit,,, READLINE,, [readline.h readline/readline.h editline/readline.h])
317
318 AC_CONFIG_SUBDIRS([lib/libedit])
319
320 KRB_C_BIGENDIAN
321 AC_C_INLINE
322
323 dnl AM_C_PROTOTYPES
324
325 dnl Checks for typedefs, structures, and compiler characteristics.
326 AC_C_CONST
327 AC_TYPE_OFF_T
328 AC_CHECK_TYPE_EXTRA(mode_t, unsigned short, [])
329 AC_CHECK_TYPE_EXTRA(sig_atomic_t, int, [#include <signal.h>])
330 AC_HAVE_TYPE([long long])
331 AC_HEADER_TIME
332 AC_STRUCT_TM
333
334 dnl Checks for header files.
335 AC_HEADER_STDC
336
337 AC_CHECK_HEADERS([\
338         CommonCrypto/CommonDigest.h             \
339         CommonCrypto/CommonCryptor.h            \
340         arpa/telnet.h                           \
341         bind/bitypes.h                          \
342         bsdsetjmp.h                             \
343         curses.h                                \
344         dlfcn.h                                 \
345         execinfo.h                              \
346         fnmatch.h                               \
347         inttypes.h                              \
348         io.h                                    \
349         libutil.h                               \
350         limits.h                                \
351         maillock.h                              \
352         netgroup.h                              \
353         netinet/in6_machtypes.h                 \
354         pthread.h                               \
355         pty.h                                   \
356         sac.h                                   \
357         sgtty.h                                 \
358         siad.h                                  \
359         signal.h                                \
360         strings.h                               \
361         stropts.h                               \
362         sys/bitypes.h                           \
363         sys/category.h                          \
364         sys/file.h                              \
365         sys/filio.h                             \
366         sys/ioccom.h                            \
367         sys/mman.h                              \
368         sys/param.h                             \
369         sys/pty.h                               \
370         sys/ptyio.h                             \
371         sys/select.h                            \
372         sys/socket.h                            \
373         sys/str_tty.h                           \
374         sys/stream.h                            \
375         sys/stropts.h                           \
376         sys/syscall.h                           \
377         sys/termio.h                            \
378         sys/timeb.h                             \
379         sys/times.h                             \
380         sys/types.h                             \
381         sys/un.h                                \
382         locale.h                                \
383         termcap.h                               \
384         termio.h                                \
385         termios.h                               \
386         time.h                                  \
387         tmpdir.h                                \
388         udb.h                                   \
389         util.h                                  \
390 ])
391
392 dnl On Solaris 8 there's a compilation warning for term.h because
393 dnl it doesn't define `bool'.
394 AC_CHECK_HEADERS(term.h, , , -)
395
396 dnl aix have asl.h (A/IX screen library) that we don't want
397 AC_CHECK_HEADERS(asl.h, , , [
398 #include <asl.h>
399 #ifndef ASL_STRING_EMERG
400 #error ASL_STRING_EMERG missing
401 #endif])
402
403 AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
404 #if HAVE_SYS_SOCKET_H
405 #include <sys/socket.h>
406 #endif])
407
408 AC_CHECK_HEADERS(sys/ptyvar.h, , , [AC_INCLUDES_DEFAULT
409 #if HAVE_SYS_TTY_H
410 #include <sys/tty.h>
411 #endif])
412
413 AC_CHECK_HEADERS(sys/strtty.h, , , [AC_INCLUDES_DEFAULT
414 #if HAVE_TERMIOS_H
415 #include <termios.h>
416 #endif
417 #if HAVE_SYS_STREAM_H
418 #include <sys/stream.h>
419 #endif])
420
421 AC_CHECK_HEADERS(sys/ucred.h, , , [AC_INCLUDES_DEFAULT
422 #if HAVE_SYS_TYPES_H
423 #include <sys/types.h>
424 #endif
425 #if HAVE_SYS_PARAM_H
426 #include <sys/param.h>
427 #endif])
428
429 AC_CHECK_HEADERS(security/pam_modules.h, , , [AC_INCLUDES_DEFAULT
430 #include <security/pam_appl.h>
431 ])
432
433 dnl export symbols
434 rk_WIN32_EXPORT(BUILD_KRB5_LIB, KRB5_LIB)
435 rk_WIN32_EXPORT(BUILD_ROKEN_LIB, ROKEN_LIB)
436 rk_WIN32_EXPORT(BUILD_GSSAPI_LIB, GSSAPI_LIB)
437
438 dnl Checks for libraries.
439
440 AC_FIND_FUNC_NO_LIBS(logwtmp, util,[
441 #ifdef HAVE_UTIL_H
442 #include <util.h>
443 #endif
444 ],[0,0,0])
445 AC_FIND_FUNC_NO_LIBS(logout, util,[
446 #ifdef HAVE_UTIL_H
447 #include <util.h>
448 #endif
449 ],[0])
450 AC_FIND_FUNC_NO_LIBS(openpty, util,[
451 #ifdef HAVE_UTIL_H
452 #include <util.h>
453 #endif
454 ],[0,0,0,0,0])
455
456 AC_FIND_FUNC_NO_LIBS(tgetent, termcap ncurses curses,[
457 #ifdef HAVE_TERMCAP_H
458 #include <termcap.h>
459 #endif
460 #ifdef HAVE_CURSES_H
461 #include <curses.h>
462 #endif
463 ],[0,0])
464
465 dnl Checks for library functions.
466
467 AC_CHECK_FUNCS([                                \
468         _getpty                                 \
469         _scrsize                                \
470         arc4random                              \
471         backtrace                               \
472         fcntl                                   \
473         fork                                    \
474         fseeko                                  \
475         ftello                                  \
476         getpeereid                              \
477         getpeerucred                            \
478         getresgid                               \
479         getresuid                               \
480         grantpt                                 \
481         kill                                    \
482         mktime                                  \
483         ptsname                                 \
484         rand                                    \
485         revoke                                  \
486         select                                  \
487         setitimer                               \
488         setpcred                                \
489         setpgid                                 \
490         setproctitle                            \
491         setregid                                \
492         setresgid                               \
493         setresuid                               \
494         setreuid                                \
495         setsid                                  \
496         setutent                                \
497         sigaction                               \
498         strstr                                  \
499         ttyname                                 \
500         ttyslot                                 \
501         umask                                   \
502         unlockpt                                \
503         vhangup                                 \
504         waitpid                                 \
505         yp_get_default_domain                   \
506 ])
507
508 AC_MSG_CHECKING([checking for __sync_add_and_fetch])
509 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]],
510         [[unsigned int foo, bar; bar = __sync_add_and_fetch(&foo, 1);]])],
511         [ac_rk_have___sync_add_and_fetch=yes], [ac_rk_have___sync_add_and_fetch=no])
512 if test "$ac_rk_have___sync_add_and_fetch" = "yes" ; then
513         AC_DEFINE_UNQUOTED(HAVE___SYNC_ADD_AND_FETCH, 1, [have __sync_add_and_fetch])
514 fi
515 AC_MSG_RESULT($ac_rk_have___sync_add_and_fetch)
516
517 AC_FUNC_MMAP
518
519 KRB_CAPABILITIES
520 rk_DLADDR
521
522 AC_CHECK_GETPWNAM_R_POSIX
523
524 dnl detect doors on solaris
525 if test "$enable_pthread_support" != no; then
526    saved_LIBS="$LIBS"
527    LIBS="$LIBS $PTHREADS_LIBS"
528    AC_FIND_FUNC_NO_LIBS(door_create, door)
529    LIBS="$saved_LIBS"
530 fi
531
532 AC_ARG_ENABLE(kcm,
533         AS_HELP_STRING([--enable-kcm],[enable Kerberos Credentials Manager]),
534 ,[enable_kcm=yes])
535
536 if test "$enable_kcm" = yes ; then
537    if test  "$ac_cv_header_sys_un_h" != yes -a "$ac_cv_funclib_door_create" != yes ; then
538         enable_kcm=no
539    fi
540 fi
541 if test "$enable_kcm" = yes; then
542        AC_DEFINE(HAVE_KCM, 1,
543                [Define if you want to use the Kerberos Credentials Manager.])
544 fi
545 AM_CONDITIONAL(KCM, test "$enable_kcm" = yes)
546
547
548
549 dnl Cray stuff
550 AC_CHECK_FUNCS(getudbnam setlim)
551
552 dnl AC_KRB_FUNC_GETCWD_BROKEN
553
554 AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, 
555         u_int8_t, u_int16_t, u_int32_t, u_int64_t,
556         uint8_t, uint16_t, uint32_t, uint64_t],,,[
557 #ifdef HAVE_INTTYPES_H
558 #include <inttypes.h>
559 #endif
560 #ifdef HAVE_SYS_TYPES_H
561 #include <sys/types.h>
562 #endif
563 #ifdef HAVE_SYS_BITYPES_H
564 #include <sys/bitypes.h>
565 #endif
566 #ifdef HAVE_BIND_BITYPES_H
567 #include <bind/bitypes.h>
568 #endif
569 #ifdef HAVE_NETINET_IN6_MACHTYPES_H
570 #include <netinet/in6_machtypes.h>
571 #endif
572 ])
573
574 rk_FRAMEWORK_SECURITY
575 rk_FRAMEWORK_COREFOUNDATION
576
577 KRB_READLINE
578
579 rk_TELNET
580
581 dnl Some operating systems already have com_err and compile_et
582 CHECK_COMPILE_ET
583
584 rk_AUTH_MODULES([sia afskauthlib])
585
586 rk_DESTDIRS
587
588 rk_WFLAGS([-Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs])
589
590
591 AH_BOTTOM([#ifdef __APPLE__
592 #include <AvailabilityMacros.h>
593 #endif])
594
595 AH_BOTTOM([#ifdef ROKEN_RENAME
596 #include "roken_rename.h"
597 #endif])
598
599 AC_ARG_ENABLE(heimdal-documentation,
600         AS_HELP_STRING([--disable-heimdal-documentation],
601                 [if you want disable to heimdal documentation]))
602 AM_CONDITIONAL(HEIMDAL_DOCUMENTATION, test "$enable_heimdal_documentation" != no)
603
604 AC_CONFIG_FILES(Makefile                \
605         etc/Makefile                    \
606         include/Makefile                \
607         include/gssapi/Makefile         \
608         include/hcrypto/Makefile        \
609         include/kadm5/Makefile          \
610         lib/Makefile                    \
611         lib/base/Makefile                       \
612         lib/asn1/Makefile               \
613         lib/com_err/Makefile            \
614         lib/hcrypto/Makefile            \
615         lib/hx509/Makefile              \
616         lib/gssapi/Makefile             \
617         lib/ntlm/Makefile               \
618         lib/hdb/Makefile                \
619         lib/ipc/Makefile                \
620         lib/kadm5/Makefile              \
621         lib/kafs/Makefile               \
622         lib/kdfs/Makefile               \
623         lib/krb5/Makefile               \
624         lib/otp/Makefile                \
625         lib/roken/Makefile              \
626         lib/sl/Makefile                 \
627         lib/sqlite/Makefile             \
628         lib/vers/Makefile               \
629         lib/wind/Makefile               \
630         po/Makefile                     \
631         kuser/Makefile                  \
632         kpasswd/Makefile                \
633         kadmin/Makefile                 \
634         admin/Makefile                  \
635         kcm/Makefile                    \
636         kdc/Makefile                    \
637         appl/Makefile                   \
638         appl/afsutil/Makefile           \
639         appl/dbutils/Makefile           \
640         appl/gssmask/Makefile           \
641         appl/otp/Makefile               \
642         appl/su/Makefile                \
643         appl/test/Makefile              \
644         appl/kf/Makefile                \
645         appl/dceutils/Makefile          \
646         tests/Makefile                  \
647         tests/bin/Makefile              \
648         tests/can/Makefile              \
649         tests/db/Makefile               \
650         tests/kdc/Makefile              \
651         tests/ldap/Makefile             \
652         tests/gss/Makefile              \
653         tests/java/Makefile             \
654         tests/plugin/Makefile           \
655         packages/Makefile               \
656         packages/mac/Makefile           \
657         doc/Makefile                    \
658         tools/Makefile                  \
659 )
660
661 AC_OUTPUT
662
663 dnl
664 dnl This is the release version name-number[beta]
665 dnl
666
667 if test -d "$srcdir/.git"; then
668     cat > include/newversion.h.in <<EOF
669 #ifndef VERSION_HIDDEN
670 #define VERSION_HIDDEN
671 #endif
672 VERSION_HIDDEN const char *heimdal_long_version = "@([#])\$Version: $PACKAGE_STRING by @USER@ on @HOST@ @BRANCH@ @TAG@ ($host) @COMMIT@ @DATE@ \$";
673 VERSION_HIDDEN const char *heimdal_version = "AC_PACKAGE_STRING";
674 EOF
675 else
676     cat > include/newversion.h.in <<EOF
677 #ifndef VERSION_HIDDEN
678 #define VERSION_HIDDEN
679 #endif
680 VERSION_HIDDEN const char *heimdal_long_version = "@([#])\$Version: $PACKAGE_STRING by @USER@ on @HOST@ ($host) @DATE@ \$";
681 VERSION_HIDDEN const char *heimdal_version = "AC_PACKAGE_STRING";
682 EOF
683 fi
684
685 if test -f include/version.h && cmp -s include/newversion.h.in include/version.h.in; then
686         echo "include/version.h is unchanged"
687         rm -f include/newversion.h.in
688 else
689         echo "creating include/version.h"
690         if test -n "$SOURCE_DATE_EPOCH"; then
691             Date=`
692                   # BSD, OS X
693                   date -u -r "$SOURCE_DATE_EPOCH" "+%Y-%m-%dT%H:%M:%SZ" 2>/dev/null ||
694                   # Linux
695                   date -u -d "@${SOURCE_DATE_EPOCH}" 2>/dev/null ||
696                   # Illumos -- sorry, no -r/-d here
697                   date -u ||
698                   date`
699         else
700             Date=`date -u "+%Y-%m-%dT%H:%M:%SZ"`
701         fi
702         if test -n "$SOURCE_HOST"; then
703             Host=$SOURCE_HOST
704         else
705             Host=`uname -n`
706         fi
707         if test -n "$SOURCE_USER"; then
708             User=$SOURCE_USER
709         else
710             User=${USER:-${LOGNAME:-`id -nu`}}
711         fi
712         if test -d "$srcdir/.git"; then
713             GitCommit=`git rev-parse HEAD`
714             GitBranch=`git rev-parse --abbrev-ref HEAD`
715             if test "x$GitBranch" = master; then
716                 GitDesc=`git describe --all --dirty`
717             else
718                 GitDesc=`git describe --tags --match 'heimdal-*' --dirty`
719             fi
720         else
721             GitCommit='<commit-unknown>'
722             GitBranch='<branch-unknown>'
723             GitDesc='<tag-unknown>'
724         fi
725         mv -f include/newversion.h.in include/version.h.in
726         sed -e "s/@HOST@/$Host/" \
727             -e "s;@USER@;$User;" \
728             -e "s;@DATE@;$Date;" \
729             -e "s;@BRANCH@;$GitBranch;" \
730             -e "s;@TAG@;$GitDesc;" \
731             -e "s;@COMMIT@;$GitCommit;" \
732             include/version.h.in > include/version.h
733 fi