2
AC_COPYRIGHT([Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
2
AC_COPYRIGHT([Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
3
3
Massachusetts Institute of Technology.
204
205
# don't exclude CFLAGS when linking. *sigh*
205
206
PTHREAD_CFLAGS="-D_REENTRANT -D_THREAD_SAFE -D_POSIX_C_SOURCE=199506L"
209
# On Solaris 10 with gcc 3.4.3, the autoconf archive macro doesn't
210
# get the right result. XXX What about Solaris 9 and earlier?
211
if test "$GCC" = yes ; then
212
PTHREAD_CFLAGS="-D_REENTRANT -pthreads"
208
216
# On Solaris 10 with gcc 3.4.3, the autoconf archive macro doesn't
209
217
# get the right result.
210
218
if test "$GCC" = yes ; then
211
219
PTHREAD_CFLAGS="-D_REENTRANT -pthreads"
221
# On Solaris 10, the thread support is always available in libc.
222
AC_DEFINE(NO_WEAK_PTHREADS,1,[Define if references to pthread routines should be non-weak.])
400
410
AC_REQUIRE([KRB5_SOCKADDR_SA_LEN])dnl
401
411
AC_ARG_ENABLE([ipv6], , AC_MSG_WARN(enable/disable-ipv6 option is deprecated))dnl
405
AC_DEFUN(KRB5_AC_CHECK_TYPE_WITH_HEADERS,[
406
AC_MSG_CHECKING(for type $1)
407
changequote(<<,>>)dnl
408
varname=`echo $1 | sed 's,[ -],_,g'`
410
AC_CACHE_VAL(krb5_cv_$varname,[
411
AC_TRY_COMPILE([$2],[ $1 foo; ], eval krb5_cv_$varname=yes, eval krb5_cv_$varname=no)])
412
eval x="\$krb5_cv_$varname"
414
if eval test "$x" = yes ; then
415
AC_DEFINE_UNQUOTED(HAVE_`echo $varname | tr '[[[a-z]]]' '[[[A-Z]]]'`)
419
AC_DEFUN(KRB5_AC_CHECK_SOCKADDR_STORAGE,[
420
KRB5_AC_CHECK_TYPE_WITH_HEADERS(struct sockaddr_storage, [
421
#ifdef HAVE_SYS_TYPES_H
422
#include <sys/types.h>
424
#include <sys/socket.h>
425
#include <netinet/in.h>
429
AC_DEFUN(KRB5_AC_CHECK_INET6,[
430
AC_REQUIRE([KRB5_AC_CHECK_SOCKADDR_STORAGE])dnl
431
412
AC_MSG_CHECKING(for IPv6 compile-time support)
432
413
AC_CACHE_VAL(krb5_cv_inet6,[
433
414
if test "$ac_cv_func_inet_ntop" != "yes" ; then
519
500
AC_DEFINE_UNQUOTED($ac_tr_file) $2], $3)dnl
523
dnl set $(KRB4) from --with-krb4=value -- WITH_KRB4
527
[ --without-krb4 don't include Kerberos V4 backwards compatibility
528
--with-krb4 use V4 libraries included with V5 (default)
529
--with-krb4=KRB4DIR use preinstalled V4 libraries],
533
if test $withval = no; then
534
AC_MSG_NOTICE(no krb4 support)
540
krb5_cv_build_krb4_libs=no
543
AC_DEFINE([KRB5_KRB4_COMPAT], 1, [Define this if building with krb4 compat])
544
if test $withval = yes; then
545
AC_MSG_NOTICE(enabling built in krb4 support)
546
KRB4_DEPLIB='$(TOPLIBD)/libkrb4$(DEPLIBEXT)'
548
KRB4_INCLUDES='-I$(SRCTOP)/include/kerberosIV -I$(BUILDTOP)/include/kerberosIV'
550
KRB_ERR_H_DEP='$(BUILDTOP)/include/kerberosIV/krb_err.h'
551
krb5_cv_build_krb4_libs=yes
554
AC_MSG_NOTICE(using preinstalled krb4 in $withval)
556
dnl DEPKRB4_LIB="$withval/lib/libkrb.a"
557
KRB4_INCLUDES="-I$withval/include"
558
KRB4_LIBPATH="-L$withval/lib"
560
krb5_cv_build_krb4_libs=no
561
krb5_cv_krb4_libdir="$withval/lib"
564
AC_SUBST(KRB4_INCLUDES)
565
AC_SUBST(KRB4_LIBPATH)
567
AC_SUBST(KRB4_DEPLIB)
568
AC_SUBST(KRB_ERR_H_DEP)
569
dnl We always compile the des425 library
570
DES425_DEPLIB='$(TOPLIBD)/libdes425$(DEPLIBEXT)'
572
AC_SUBST(DES425_DEPLIB)
577
503
AC_DEFUN(KRB5_AC_CHECK_FOR_CFLAGS,[
578
504
AC_BEFORE([$0],[AC_PROG_CC])
505
AC_BEFORE([$0],[AC_PROG_CXX])
579
506
krb5_ac_cflags_set=${CFLAGS+set}
507
krb5_ac_cxxflags_set=${CXXFLAGS+set}
508
krb5_ac_warn_cflags_set=${WARN_CFLAGS+set}
509
krb5_ac_warn_cxxflags_set=${WARN_CXXFLAGS+set}
512
AC_DEFUN(TRY_WARN_CC_FLAG,[dnl
513
cachevar=`echo "krb5_cv_cc_flag_$1" | sed s/[[^a-zA-Z0-9_]]/_/g`
514
AC_CACHE_CHECK([if C compiler supports $1], [$cachevar],
515
[# first try without, then with
516
AC_TRY_COMPILE([], 1;,
517
[old_cflags="$CFLAGS"
519
AC_TRY_COMPILE([], 1;, eval $cachevar=yes, eval $cachevar=no)
520
CFLAGS="$old_cflags"],
521
[AC_MSG_ERROR(compiling simple test program with $CFLAGS failed)])])
522
if eval test '"${'$cachevar'}"' = yes; then
523
WARN_CFLAGS="$WARN_CFLAGS $1"
525
eval flag_supported='${'$cachevar'}'
582
528
AC_DEFUN(WITH_CC,[dnl
583
529
AC_REQUIRE([KRB5_AC_CHECK_FOR_CFLAGS])dnl
584
530
AC_REQUIRE([AC_PROG_CC])dnl
585
krb5_cv_prog_gcc=$ac_cv_c_compiler_gnu
531
AC_REQUIRE([AC_PROG_CXX])dnl
586
532
if test $ac_cv_c_compiler_gnu = yes ; then
596
542
krb5_cv_prog_gnu_ld=yes
599
# maybe add -Waggregate-return, or can we assume that actually works by now?
600
# -Wno-comment used to be used for SunOS system header <sys/stream.h>
545
AC_ARG_WITH([size-optimizations],
546
[ --with-size-optimizations enable a few optimizations to reduce code size
547
possibly at some run-time cost],
550
if test "$withval" = yes; then
551
AC_DEFINE(CONFIG_SMALL,1,[Define to reduce code size even if it means more cpu usage])
601
553
# -Wno-long-long, if needed, for k5-platform.h without inttypes.h etc.
602
extra_gcc_warn_opts="-Wall -Wmissing-prototypes -Wcast-qual \
603
-Wcast-align -Wconversion -Wshadow"
554
extra_gcc_warn_opts="-Wall -Wcast-qual -Wcast-align -Wshadow"
555
# -Wmissing-prototypes
604
556
if test "$GCC" = yes ; then
605
if test "x$krb5_ac_cflags_set" = xset ; then
606
AC_MSG_NOTICE(not adding extra gcc warning flags because CFLAGS was set)
557
# Putting this here means we get -Os after -O2, which works.
558
if test "$with_size_optimizations" = yes && test "x$krb5_ac_cflags_set" != xset; then
559
AC_MSG_NOTICE(adding -Os optimization option)
561
"-g -O2") CFLAGS="-g -Os" ;;
562
"-O2") CFLAGS="-Os" ;;
563
*) CFLAGS="$CFLAGS -Os" ;;
566
if test "x$krb5_ac_warn_cflags_set" = xset ; then
567
AC_MSG_NOTICE(not adding extra gcc warning flags because WARN_CFLAGS was set)
608
569
AC_MSG_NOTICE(adding extra warning flags for gcc)
609
CFLAGS="$CFLAGS $extra_gcc_warn_opts"
570
WARN_CFLAGS="$WARN_CFLAGS $extra_gcc_warn_opts -Wmissing-prototypes"
610
571
if test "`uname -s`" = Darwin ; then
611
572
AC_MSG_NOTICE(skipping pedantic warnings on Darwin)
612
573
elif test "`uname -s`" = Linux ; then
613
574
AC_MSG_NOTICE(skipping pedantic warnings on Linux)
615
CFLAGS="$CFLAGS -pedantic"
576
WARN_CFLAGS="$WARN_CFLAGS -pedantic"
578
if test "$ac_cv_cxx_compiler_gnu" = yes; then
579
if test "x$krb5_ac_warn_cxxflags_set" = xset ; then
580
AC_MSG_NOTICE(not adding extra g++ warnings because WARN_CXXFLAGS was set)
582
AC_MSG_NOTICE(adding extra warning flags for g++)
583
WARN_CXXFLAGS="$WARN_CXXFLAGS $extra_gcc_warn_opts"
586
# Currently, G++ does not support -Wno-format-zero-length.
587
TRY_WARN_CC_FLAG(-Wno-format-zero-length)
588
# Other flags here may not be supported on some versions of
589
# gcc that people want to use.
590
for flag in overflow strict-overflow missing-format-attribute missing-prototypes return-type missing-braces parentheses switch unused-function unused-label unused-variable unused-value unknown-pragmas sign-compare newline-eof ; do
591
TRY_WARN_CC_FLAG(-W$flag)
593
# old-style-definition? generates many, many warnings
595
# Warnings that we'd like to turn into errors on versions of gcc
596
# that support promoting only specific warnings to errors, but
597
# we'll take as warnings on older compilers. (If such a warning
598
# is added after the -Werror=foo feature, you can just put
599
# error=foo in the above list, and skip the test for the
600
# warning-only form.) At least in some versions, -Werror= doesn't
601
# seem to make the conditions actual errors, but still issues
602
# warnings; I guess we'll take what we can get.
604
# We're currently targeting C89+, not C99, so disallow some
606
for flag in declaration-after-statement variadic-macros ; do
607
TRY_WARN_CC_FLAG(-Werror=$flag)
608
if test "$flag_supported" = no; then
609
TRY_WARN_CC_FLAG(-W$flag)
612
# missing-prototypes? maybe someday
618
615
if test "`uname -s`" = Darwin ; then
619
616
# Someday this should be a feature test.
1119
1128
dnl Pull in the necessary stuff to create the libraries.
1121
1130
AC_DEFUN(KRB5_BUILD_LIBRARY,
1122
[KRB5_BUILD_LIBRARY_WITH_DEPS
1123
# null out SHLIB_EXPFLAGS because we lack any dependencies
1127
dnl KRB5_BUILD_LIBRARY_STATIC
1129
dnl Force static library build.
1131
AC_DEFUN(KRB5_AC_FORCE_STATIC,[dnl
1132
AC_BEFORE([$0],[KRB5_LIB_AUX])dnl
1133
krb5_force_static=yes])
1134
AC_DEFUN(KRB5_BUILD_LIBRARY_STATIC,
1135
dnl Use define rather than AC_DEFUN to avoid ordering problems.
1136
[AC_REQUIRE([KRB5_AC_FORCE_STATIC])dnl
1138
# If we're only building static libraries, they're for build-time use only,
1143
dnl KRB5_BUILD_LIBRARY_WITH_DEPS
1145
dnl Like KRB5_BUILD_LIBRARY, but adds in explicit dependencies in the
1146
dnl generated shared library.
1148
AC_DEFUN(KRB5_BUILD_LIBRARY_WITH_DEPS,
1149
1131
[AC_REQUIRE([KRB5_LIB_AUX])dnl
1150
1132
AC_REQUIRE([AC_PROG_LN_S])dnl
1151
1133
AC_REQUIRE([AC_PROG_RANLIB])dnl
1220
1205
AC_DEFUN(KRB5_LIB_AUX,
1221
1206
[AC_REQUIRE([KRB5_LIB_PARAMS])dnl
1223
# Check whether to build static libraries.
1224
dnl AC_HELP_STRING([--enable-static],[build static libraries @<:@disabled for most platforms@:>@])
1225
dnl AC_HELP_STRING([--disable-static],[don't build static libraries])
1226
AC_ARG_ENABLE([static],, ,
1227
[enable_static=$default_static])
1229
if test "$enable_static" = yes; then
1208
AC_ARG_ENABLE([static],,
1209
[if test "$enableval" != no; then
1230
1210
AC_MSG_ERROR([Sorry, static libraries do not work in this release.])
1233
if test "$enable_static" = no && test "$krb5_force_static" != yes; then
1234
AC_MSG_NOTICE([disabling static libraries])
1212
AC_ARG_ENABLE([shared], ,
1213
[if test "$enableval" != yes; then
1214
AC_MSG_ERROR([Sorry, this release builds only shared libraries, cannot disable them.])
1216
AC_ARG_ENABLE([rpath],
1217
AC_HELP_STRING([--disable-rpath],[suppress run path flags in link lines]),
1218
[enable_rpath=$enableval],
1221
if test "x$enable_rpath" != xyes ; then
1222
# Unset the rpath flag values set by shlib.conf
1228
if test "$SHLIBEXT" = ".so-nobuild"; then
1229
AC_MSG_ERROR([Shared libraries are not yet supported on this platform.])
1234
if test "$krb5_force_static" = "yes"; then
1239
1235
LIBLIST='lib$(LIBBASE)$(STLIBEXT)'
1240
1236
LIBLINKS='$(TOPLIBD)/lib$(LIBBASE)$(STLIBEXT)'
1241
1237
OBJLISTS=OBJS.ST
1242
LIBINSTLIST=install-static
1238
# This used to be install-static, but now we only follow this
1239
# path for internal libraries we don't want installed, not for
1240
# configure-time requests for installed static libraries.
1244
1242
# CFLAGS="$CFLAGS -D_KDB5_STATIC_LINK"
1247
# Check whether to build shared libraries.
1248
AC_ARG_ENABLE([shared],
1249
dnl AC_HELP_STRING([--enable-shared],[build shared libraries @<:@enabled for most platforms@:>@])
1250
dnl AC_HELP_STRING([--disable-shared],[don't build shared libraries])
1252
[enable_shared=$default_shared])
1254
if test "$enable_shared" != yes; then
1255
AC_MSG_ERROR([Sorry, this release builds only shared libraries, cannot disable them.])
1258
if test "$enable_shared" = yes; then
1261
AC_MSG_WARN([shared libraries not supported on this architecture])
1263
CC_LINK="$CC_LINK_STATIC"
1266
# set this now because some logic below may reset SHLIBEXT
1268
if test "$krb5_force_static" = "yes"; then
1269
AC_MSG_RESULT([Forcing static libraries.])
1270
# avoid duplicate rules generation for AIX and such
1271
SHLIBEXT=.so-nobuild
1272
SHLIBVEXT=.so.v-nobuild
1273
SHLIBSEXT=.so.s-nobuild
1275
AC_MSG_NOTICE([enabling shared libraries])
1276
# Clear some stuff in case of AIX, etc.
1277
if test "$STLIBEXT" = "$SHLIBEXT" ; then
1284
LIBLIST="$LIBLIST "'lib$(LIBBASE)$(SHLIBEXT)'
1285
LIBLINKS="$LIBLINKS "'$(TOPLIBD)/lib$(LIBBASE)$(SHLIBEXT) $(TOPLIBD)/lib$(LIBBASE)$(SHLIBVEXT)'
1286
case "$SHLIBSEXT" in
1288
LIBINSTLIST="$LIBINSTLIST install-shared"
1291
LIBLIST="$LIBLIST "'lib$(LIBBASE)$(SHLIBSEXT)'
1292
LIBLINKS="$LIBLINKS "'$(TOPLIBD)/lib$(LIBBASE)$(SHLIBSEXT)'
1293
LIBINSTLIST="$LIBINSTLIST install-shlib-soname"
1296
OBJLISTS="$OBJLISTS OBJS.SH"
1298
CC_LINK="$CC_LINK_SHARED"
1303
CC_LINK="$CC_LINK_STATIC"
1244
AC_MSG_RESULT([Forcing static libraries.])
1245
# avoid duplicate rules generation for AIX and such
1304
1246
SHLIBEXT=.so-nobuild
1305
1247
SHLIBVEXT=.so.v-nobuild
1306
1248
SHLIBSEXT=.so.s-nobuild
1250
AC_MSG_NOTICE([using shared libraries])
1309
if test "$build_dynobj" = yes; then
1310
OBJLISTS=`echo $OBJLISTS | sed -e s/OBJS.ST//g -e s/OBJS.SH//g`
1311
OBJLISTS="$OBJLISTS OBJS.SH"
1252
# Clear some stuff in case of AIX, etc.
1253
if test "$STLIBEXT" = "$SHLIBEXT" ; then
1256
case "$SHLIBSEXT" in
1258
SHLIB_HAVE_MINOR_VERS=no
1259
LIBLIST='lib$(LIBBASE)$(SHLIBEXT)'
1260
LIBLINKS='$(TOPLIBD)/lib$(LIBBASE)$(SHLIBEXT) $(TOPLIBD)/lib$(LIBBASE)$(SHLIBVEXT)'
1261
LIBINSTLIST="install-shared"
1264
SHLIB_HAVE_MINOR_VERS=yes
1265
LIBLIST='lib$(LIBBASE)$(SHLIBEXT) lib$(LIBBASE)$(SHLIBSEXT)'
1266
LIBLINKS='$(TOPLIBD)/lib$(LIBBASE)$(SHLIBEXT) $(TOPLIBD)/lib$(LIBBASE)$(SHLIBVEXT) $(TOPLIBD)/lib$(LIBBASE)$(SHLIBSEXT)'
1267
LIBINSTLIST="install-shlib-soname"
1272
CC_LINK="$CC_LINK_SHARED"
1273
CXX_LINK="$CXX_LINK_SHARED"
1274
AC_SUBST(SHLIB_HAVE_MINOR_VERS)
1314
1276
if test -z "$LIBLIST"; then
1315
1277
AC_MSG_ERROR([must enable one of shared or static libraries])