From ed2f0ed6032ff04539ec5dd281f4db4657e73f18 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Wed, 13 Mar 1996 04:55:41 +0000 Subject: [PATCH] * aclocal.m4 (V5_MAKE_SHARED_LIB): If the cache variables for selecting shared v. archive library support haven't been set, complain, instead of generating a broken Makefile. (WITH_CC): Default to value from cache, if available. If it differs from name supplied on command line, complain. When not using a value from the cache, verify that it's a working compiler before proceeding. At end, use AC_PROG_CC to see if it's gcc we're using. (SubdirLibraryRule): Make DONE depend on Makefile.in, so it doesn't keep getting regenerated in the case of no object files. (CHECK_WAIT_TYPE): Make sure that union wait is acceptable to WEXITSTATUS if that macro is defined. Permit a single configure.in to build multiple makefiles, e.g., when a subtree contains a program that must be considered a single package, and might as well get configured that way. (The Cygnus tree handles xdm this way.) Should be more efficient. * aclocal.m4 (V5_SET_TOPDIR): Don't substitute BUILDTOP, SRCTOP. (CONFIG_RULES): In makefile dependencies, use $(thisconfigdir). (V5_AC_OUTPUT_MAKEFILE): If arguments are given, treat as directories and build pre/Makefile/post in each. Set thisconfigdir, SRCTOP, BUILDTOP separately in each directory. Tweak Makefile dependencies appropriately. Permit compilation on hpux, where stdarg.h exists, but the use of "..." in new-style definitions does not work. (Needs changes to configure.in files.) * aclocal.m4 (AC_HEADER_STDARG): New macro. Try compiling some sources with variadic functions; set HAVE_STDARG_H or HAVE_VARARGS_H, or bomb. * acconfig.h (HAVE_STDARG_H, HAVE_VARARGS_H): Undef. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7616 dc483132-0cff-0310-8789-dd5450dbe970 --- src/ChangeLog | 27 +++++++++ src/acconfig.h | 2 + src/aclocal.m4 | 160 ++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 169 insertions(+), 20 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 2cbf69186..c98e4dc95 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,30 @@ +Tue Mar 12 18:04:32 1996 Ken Raeburn + + * aclocal.m4 (V5_MAKE_SHARED_LIB): If the cache variables for + selecting shared v. archive library support haven't been set, + complain, instead of generating a broken Makefile. + (WITH_CC): Default to value from cache, if available. If it + differs from name supplied on command line, complain. When not + using a value from the cache, verify that it's a working compiler + before proceeding. At end, use AC_PROG_CC to see if it's gcc + we're using. + (SubdirLibraryRule): Make DONE depend on Makefile.in, so it + doesn't keep getting regenerated in the case of no object files. + (CHECK_WAIT_TYPE): Make sure that union wait is acceptable to + WEXITSTATUS if that macro is defined. + + * aclocal.m4 (V5_SET_TOPDIR): Don't substitute BUILDTOP, SRCTOP. + (CONFIG_RULES): In makefile dependencies, use $(thisconfigdir). + (V5_AC_OUTPUT_MAKEFILE): If arguments are given, treat as + directories and build pre/Makefile/post in each. Set + thisconfigdir, SRCTOP, BUILDTOP separately in each directory. + Tweak Makefile dependencies appropriately. + + * aclocal.m4 (AC_HEADER_STDARG): New macro. Try compiling some + sources with variadic functions; set HAVE_STDARG_H or + HAVE_VARARGS_H, or bomb. + * acconfig.h (HAVE_STDARG_H, HAVE_VARARGS_H): Undef. + Wed Feb 28 00:00:55 1996 Theodore Y. Ts'o * Makefile.in: Modify windows build procedure to include the diff --git a/src/acconfig.h b/src/acconfig.h index 8495f43cd..efdcaa494 100644 --- a/src/acconfig.h +++ b/src/acconfig.h @@ -27,6 +27,8 @@ #undef KRB5_USE_INET #undef ODBM +#undef HAVE_STDARG_H +#undef HAVE_VARARGS_H /* Define if MIT Project Athena default configuration should be used */ #undef KRB5_ATHENA_COMPAT diff --git a/src/aclocal.m4 b/src/aclocal.m4 index f894827a9..57d1c8c51 100644 --- a/src/aclocal.m4 +++ b/src/aclocal.m4 @@ -41,8 +41,6 @@ if test -d "$srcdir/$ac_config_fragdir"; then else AC_MSG_ERROR([can not find config/ directory in $ac_reltopdir]) fi -AC_SUBST(BUILDTOP)dnl -AC_SUBST(SRCTOP)dnl ])dnl dnl dnl Does configure need to be run in immediate subdirectories of this @@ -159,12 +157,17 @@ SHELL=/bin/sh Makefiles:: Makefile -Makefile: $(srcdir)/Makefile.in config.status $(SRCTOP)/config/pre.in $(SRCTOP)/config/post.in - $(SHELL) config.status -config.status: $(srcdir)/configure - $(SHELL) config.status --recheck -$(srcdir)/configure: $(srcdir)/configure.in $(SRCTOP)/aclocal.m4 - cd $(srcdir); $(SHELL) $(SRCTOP)/util/autoconf/autoconf --localdir=$(BUILDTOP) --macrodir=$(BUILDTOP)/util/autoconf +Makefile: $(srcdir)/Makefile.in $(thisconfigdir)/config.status \ + $(SRCTOP)/config/pre.in $(SRCTOP)/config/post.in + cd $(thisconfigdir) && $(SHELL) config.status +$(thisconfigdir)/config.status: $(srcdir)/$(thisconfigdir)/configure + cd $(thisconfigdir) && $(SHELL) config.status --recheck +$(srcdir)/$(thisconfigdir)/configure: $(srcdir)/$(thisconfigdir)/configure.in \ + $(SRCTOP)/aclocal.m4 + cd $(srcdir)/$(thisconfigdir) && \ + $(SHELL) $(SRCTOP)/util/autoconf/autoconf \ + --localdir=$(BUILDTOP) \ + --macrodir=$(BUILDTOP)/util/autoconf ] AC_POP_MAKEFILE()dnl ])dnl @@ -259,7 +262,11 @@ define(CHECK_WAIT_TYPE,[ AC_MSG_CHECKING([for union wait]) AC_CACHE_VAL(krb5_cv_struct_wait, [AC_TRY_COMPILE( -[#include ], [union wait i;], +[#include ], [union wait i; +#ifdef WEXITSTATUS + WEXITSTATUS (i); +#endif +], krb5_cv_struct_wait=yes, krb5_cv_struct_wait=no)]) AC_MSG_RESULT($krb5_cv_struct_wait) if test $krb5_cv_struct_wait = no; then @@ -382,12 +389,26 @@ dnl set $(CC) from --with-cc=value dnl define(WITH_CC,[ AC_ARG_WITH([cc], -[ --with-cc=COMPILER select compiler to use], -AC_MSG_RESULT(CC=$withval) -CC=$withval, -if test -z "$CC" ; then CC=cc; fi -[AC_MSG_RESULT(CC defaults to $CC)])dnl -AC_SUBST([CC])])dnl +[ --with-cc=COMPILER select compiler to use]) +AC_MSG_CHECKING(for C compiler) +if test "$with_cc" != ""; then + if test "$ac_cv_prog_cc" != "" && test "$ac_cv_prog_cc" != "$with_cc"; then + AC_MSG_ERROR(Specified compiler doesn't match cached compiler name; + remove cache and try again.) + else + CC="$with_cc" + fi +fi +AC_CACHE_VAL(ac_cv_prog_cc,[dnl + test -z "$CC" && CC=cc + AC_TRY_LINK([#include ],[printf("hi\n");], , + AC_MSG_ERROR(Can't find a working compiler.)) + ac_cv_prog_cc="$CC" +]) +CC="$ac_cv_prog_cc" +AC_MSG_RESULT($CC) +AC_PROG_CC +])dnl dnl dnl set $(LD) from --with-linker=value dnl @@ -482,7 +503,7 @@ AC_PUSH_MAKEFILE()dnl all-unix:: DONE -DONE:: $1 +DONE:: $1 $(srcdir)/Makefile.in @if test x'$1' = x && test -r [$]@; then :;\ else \ (set -x; echo $1 > [$]@) \ @@ -591,15 +612,30 @@ dnl dnl V5_OUTPUT_MAKEFILE dnl define(V5_AC_OUTPUT_MAKEFILE, -[AC_OUTPUT(pre.out:[$]ac_prepend Makefile.out:Makefile.in post.out:[$]ac_postpend, -[cat pre.out Makefile.out post.out > Makefile +[ifelse($1, , ac_v5_makefile_dirs=., ac_v5_makefile_dirs="$1") +dnl OPTIMIZE THIS FOR COMMON CASE!! +filelist="" +for x in $ac_v5_makefile_dirs; do + filelist="$filelist $x/Makefile.tmp:$x/Makefile.in $x/pre.tmp:$ac_prepend $x/post.tmp:$ac_postpend" +done +AC_OUTPUT($filelist, +[EOF +ac_reltopdir=`echo $ac_reltopdir | sed \ + -e 's,^\(\./\)*,,g' \ + -e 's,/\(\./\)*,/,g' \ + -e 's,/\.$,,g' \ + ` +test "$ac_reltopdir" = "" && ac_reltopdir=. +cat >> $CONFIG_STATUS <> append.out cat - append.out >> $CONFIG_STATUS <<\EOF -cat >> Makefile <<\CEOF +cat >> append.tmp <<\CEOF # # rules appended by configure @@ -608,8 +644,43 @@ rm append.out dnl now back to regular config.status generation cat >> $CONFIG_STATUS <<\EOF CEOF +for d in $ac_v5_makefile_dirs; do + # If CONFIG_FILES was set from Makefile, skip unprocessed directories. + if test -r $d/Makefile.tmp; then +changequote(,)dnl + x=`echo $d/ | sed \ + -e 's,//*$,/,' \ + -e 's,^\(\./\)*,,g' \ + -e 's,/\(\./\)*,/,g' \ + -e 's,/\./$,/,g' \ + -e 's,^\./$,,' \ + -e 's,[^/]*/,../,g' \ + ` +changequote([,])dnl + test "$x" = "" && x=./ + case $srcdir in + /*) s=$ac_given_srcdir/$ac_reltopdir ;; + *) s=$x$ac_given_srcdir/$ac_reltopdir ;; + esac + s=`echo $s | sed \ + -e 's,//*$,/,' \ + -e 's,^\(\./\)*,,g' \ + -e 's,/\(\./\)*,/,g' \ + -e 's,^\./$,,' \ + -e 's,/\.$,,g' \ + ` + test "$s" = "" && s=. + echo creating $d/Makefile + cat - $d/pre.tmp $d/Makefile.tmp $d/post.tmp append.tmp > $d/Makefile < MakeFile -rm pre.out Makefile.out post.out + fi +done +rm append.tmp ], CONF_FRAGDIR=$srcdir/${ac_config_fragdir} )])dnl dnl @@ -872,6 +943,10 @@ fi AC_SUBST(SHLIB_LIBDIRS) HOST_TYPE=$krb5_cv_host AC_SUBST(HOST_TYPE) +if test "$krb5_cv_shlibs_ext" = ""; then + AC_MSG_ERROR(Library building info can't be determined by this lame configure +script; try reconfiguring again from the top of the tree.) +fi SHEXT=$krb5_cv_shlibs_ext AC_SUBST(SHEXT) STEXT=$krb5_cv_noshlibs_ext @@ -1124,3 +1199,48 @@ fi dnl *never* set NARROW_PROTOTYPES ])dnl dnl +dnl Check if stdarg or varargs is available *and compiles*; prefer stdarg. +dnl (This was sent to djm for incorporation into autoconf 3/12/1996. KR) +dnl +AC_DEFUN(AC_HEADER_STDARG, [ + +AC_MSG_CHECKING([for stdarg.h]) +AC_CACHE_VAL(ac_cv_header_stdarg_h, +[AC_TRY_COMPILE([#include ], [ + } /* ac_try_compile will have started a function body */ + int aoeu (char *format, ...) { + va_list v; + int i; + va_start (v, format); + i = va_arg (v, int); + va_end (v); +],ac_cv_header_stdarg_h=yes,ac_cv_header_stdarg_h=no)])dnl +AC_MSG_RESULT($ac_cv_header_stdarg_h) +if test $ac_cv_header_stdarg_h = yes; then + AC_DEFINE(HAVE_STDARG_H) +else + +AC_MSG_CHECKING([for varargs.h]) +AC_CACHE_VAL(ac_cv_header_varargs_h, +[AC_TRY_COMPILE([#include ],[ + } /* ac_try_compile will have started a function body */ + int aoeu (va_alist) va_dcl { + va_list v; + int i; + va_start (v); + i = va_arg (v, int); + va_end (v); +],ac_cv_header_varargs_h=yes,ac_cv_header_varargs_h=no)])dnl +AC_MSG_RESULT($ac_cv_header_varargs_h) +if test $ac_cv_header_varargs_h = yes; then + AC_DEFINE(HAVE_VARARGS_H) +else + AC_MSG_ERROR(Neither stdarg nor varargs compile?) +fi + +fi dnl stdarg test failure + +])dnl +dnl +dnl +dnl -- 2.26.2