new autoconf

Dave Morrison dave at bnl.gov
Tue Sep 26 16:28:44 CEST 2000


Hi arla-ites,

A new, official release of autoconf (2.50, I think) is supposed to
happen RSN.  That's super and all, if you'll be in for a bit of a rude
surprise if you try and build arla with it.  Doesn't work.  The way
some key autoconf macros work will change and that causes some
problems.  In particular, AC_DEFINE and AC_DEFINE_UNQUOTED have to
have a _literal_ value as their first argument.  One effect of this is
that it blows arla macros like AC_HAVE_TYPES out of the water.  The
way autoheader works will change too, and that causes other problems.

I don't particularly like the autoconf/autoheader changes, but I've
taken a stab anyway at reworking some of arla's autoconf
infrastructure so that it'll survive the new toolset.  I even did it
in a way that allows you to use the old or the new autoconf.  It's not
exactly pretty, but it works (as best I can tell).  First, I bypassed
all the looping macros (AC_HAVE_TYPES, AC_HAVE_LINUX_KERNEL_TYPES).
Then, to make autoheader happy, I had to add comments to configure.in
indicating the symbol that the macro would (possibly) define.  And
those comments can't be dnl'ed, they have to be done using an `ifelse'
idiom so that autoheader will see them.  Like I said, it ain't pretty,
but it works.  I've attached a patch against the current CVS sources.
Any feedback would be very welcome.

Hope this is useful,
Dave


-- 
David Morrison  Brookhaven National Laboratory  phone: 631-344-5840
                Physics Department, Bldg 510 C    fax: 631-344-3253
		          Upton, NY 11973-5000  email: dave at bnl.gov

Index: configure.in
===================================================================
RCS file: /stacken-cvs/arla/configure.in,v
retrieving revision 1.439
diff -u -r1.439 configure.in
--- configure.in	2000/09/25 14:55:33	1.439
+++ configure.in	2000/09/26 14:20:41
@@ -27,6 +27,7 @@
 AC_SUBST(AS)dnl
 
 AC_PROG_CC
+ifdef([AC_PROG_CC_STDC], [AC_PROG_CC_STDC])
 AC_PROG_CC_FLAGS
 AC_PROG_CPP
 AC_PROG_MAKE_SET
@@ -292,8 +293,8 @@
   ;;
 changequote(, )dnl
 freebsd[345]* | freebsdelf[345]*)
-  AC_MSG_RESULT(FreeBSD [345].x)
 changequote([,])dnl
+  AC_MSG_RESULT(FreeBSD [345].x)
   KERNEL_INCLUDE=-I`(cd $srcdir; pwd)`/xfs/bsd
   KERNEL_SRCS='bsd-subr.c'
   KERNEL_HDRS=''
@@ -574,6 +575,7 @@
 		fi
 	fi
 fi
+ifelse(AC_DEFINE(READLINE, 1, [define if you have a function readline]))
 AC_DEFINE(HAVE_READLINE, 1, [define if you have a function readline])dnl
 LIB_readline="$LIB_readline \$(LIB_tgetent)"
 
@@ -864,14 +866,60 @@
 if test "$KRB4_INC_DIR"; then
   CPPFLAGS="-I${KRB4_INC_DIR} $CPPFLAGS"
 fi
-AC_HAVE_TYPES(int8_t int16_t int32_t int64_t)
-AC_HAVE_TYPES(int16 int32)
-AC_HAVE_TYPES(u_int8_t u_int16_t u_int32_t u_int64_t)
-AC_HAVE_TYPES(u_int16 u_int32)
-AC_HAVE_TYPES(bool ssize_t)
-AC_HAVE_TYPES(register_t)
-AC_HAVE_TYPES(intptr_t)
-AC_HAVE_TYPES(off64_t)
+
+dnl ifelse's to fool autoheader into working for us
+
+ifelse(AC_DEFINE(HAVE_INT8_T, 1, [have type int8_t]))
+AC_HAVE_TYPE(int8_t)
+
+ifelse(AC_DEFINE(HAVE_INT16_T, 1, [have type int16_t]))
+AC_HAVE_TYPE(int16_t)
+
+ifelse(AC_DEFINE(HAVE_INT32_T, 1, [have type int32_t]))
+AC_HAVE_TYPE(int32_t)
+
+ifelse(AC_DEFINE(HAVE_INT64_T, 1, [have type int64_t]))
+AC_HAVE_TYPE(int64_t)
+
+ifelse(AC_DEFINE(HAVE_INT16, 1, [have type int16]))
+AC_HAVE_TYPE(int16)
+
+ifelse(AC_DEFINE(HAVE_INT32, 1, [have type int32]))
+AC_HAVE_TYPE(int32)
+
+ifelse(AC_DEFINE(HAVE_U_INT8_T, 1, [have type u_int8_t]))
+AC_HAVE_TYPE(u_int8_t)
+
+ifelse(AC_DEFINE(HAVE_U_INT16_T, 1, [have type u_int16_t]))
+AC_HAVE_TYPE(u_int16_t)
+
+ifelse(AC_DEFINE(HAVE_U_INT32_T, 1, [have type u_int32_t]))
+AC_HAVE_TYPE(u_int32_t)
+
+ifelse(AC_DEFINE(HAVE_U_INT64_T, 1, [have type u_int64_t]))
+AC_HAVE_TYPE(u_int64_t)
+
+ifelse(AC_DEFINE(HAVE_U_INT16, 1, [have type u_int16]))
+AC_HAVE_TYPE(u_int16)
+
+ifelse(AC_DEFINE(HAVE_U_INT32, 1, [have type u_int32]))
+AC_HAVE_TYPE(u_int32)
+
+ifelse(AC_DEFINE(HAVE_BOOL, 1, [have type bool]))
+AC_HAVE_TYPE(bool)
+
+ifelse(AC_DEFINE(HAVE_SSIZE_T, 1, [have type ssize_t]))
+AC_HAVE_TYPE(ssize_t)
+
+ifelse(AC_DEFINE(HAVE_REGISTER_T, 1, [have type register_t]))
+AC_HAVE_TYPE(register_t)
+
+ifelse(AC_DEFINE(HAVE_INTPTR_T, 1, [have type intptr_t]))
+AC_HAVE_TYPE(intptr_t)
+
+ifelse(AC_DEFINE(HAVE_OFF64_T, 1, [have type off64_t]))
+AC_HAVE_TYPE(off64_t)
+
 AC_CHECK_HEADERS(ktypes.h com_err.h et/com_err.h)
 CPPFLAGS="${save_CPPFLAGS}"
 
@@ -887,6 +935,7 @@
 dnl check for old libkafs
 dnl
 
+ifelse(AC_DEFINE(HAVE_KRB_AFSLOG_UID, 1, [define if you have krb_afslog_uid]))
 AC_FIND_FUNC_NO_LIBS2(krb_afslog_uid, "", , , [$KAFS_LIBS $KRB4_LIB_FLAGS])
 
 #
@@ -904,14 +953,147 @@
 #endif],
 hstrerror)
 AC_FUNC_HSTRERROR_CONST
+
+dnl ifelse's to fool autoheader into working for us
+
+ifelse(AC_DEFINE(HAVE_CHOWN, 1, [define if you have chown]))
+AC_BROKEN(chown)
+
+ifelse(AC_DEFINE(HAVE_DAEMON, 1, [define if you have daemon]))
+AC_BROKEN(daemon)
+
+ifelse(AC_DEFINE(HAVE_ERR, 1, [define if you have err]))
+AC_BROKEN(err)
+
+ifelse(AC_DEFINE(HAVE_ERRX, 1, [define if you have errx]))
+AC_BROKEN(errx)
+
+ifelse(AC_DEFINE(HAVE_FCHOWN, 1, [define if you have fchown]))
+AC_BROKEN(fchown)
+
+ifelse(AC_DEFINE(HAVE_FLOCK, 1, [define if you have flock]))
+AC_BROKEN(flock)
+
+ifelse(AC_DEFINE(HAVE_GETCWD, 1, [define if you have getcwd]))
+AC_BROKEN(getcwd)
+
+ifelse(AC_DEFINE(HAVE_GETDTABLESIZE, 1, [define if you have getdtablesize]))
+AC_BROKEN(getdtablesize)
+
+ifelse(AC_DEFINE(HAVE_GETOPT, 1, [define if you have getopt]))
+AC_BROKEN(getopt)
+
+ifelse(AC_DEFINE(HAVE_GETUSERSHELL, 1, [define if you have getusershell]))
+AC_BROKEN(getusershell)
+
+ifelse(AC_DEFINE(HAVE_INET_ATON, 1, [define if you have inet_aton]))
+AC_BROKEN(inet_aton)
+
+ifelse(AC_DEFINE(HAVE_INITGROUPS, 1, [define if you have initgroups]))
+AC_BROKEN(initgroups)
+
+ifelse(AC_DEFINE(HAVE_LSTAT, 1, [define if you have lstat]))
+AC_BROKEN(lstat)
+
+ifelse(AC_DEFINE(HAVE_LOCALTIME_R, 1, [define if you have lstat]))
+AC_BROKEN(localtime_r)
+
+ifelse(AC_DEFINE(HAVE_MEMMOVE, 1, [define if you have memmove]))
+AC_BROKEN(memmove)
 
-AC_BROKEN(chown daemon err errx fchown flock getcwd getdtablesize getopt)
-AC_BROKEN(getusershell inet_aton initgroups lstat localtime_r memmove mkstemp)
-AC_BROKEN(putenv rcmd readv recvmsg sendmsg setegid setenv seteuid)
-AC_BROKEN(strcasecmp strdup strerror strftime strlcat strlcpy strlwr)
-AC_BROKEN(strnlen strsep strsep_copy strptime strtok_r strupr unsetenv)
-AC_BROKEN(verr verrx vsyslog vwarn vwarnx warn warnx writev)
+ifelse(AC_DEFINE(HAVE_MKSTEMP, 1, [define if you have mkstemp]))
+AC_BROKEN(mkstemp)
 
+ifelse(AC_DEFINE(HAVE_PUTENV, 1, [define if you have putenv]))
+AC_BROKEN(putenv)
+
+ifelse(AC_DEFINE(HAVE_RCMD, 1, [define if you have rcmd]))
+AC_BROKEN(rcmd)
+
+ifelse(AC_DEFINE(HAVE_READV, 1, [define if you have readv]))
+AC_BROKEN(readv)
+
+ifelse(AC_DEFINE(HAVE_RECVMSG, 1, [define if you have recvmsg]))
+AC_BROKEN(recvmsg)
+
+ifelse(AC_DEFINE(HAVE_SENDMSG, 1, [define if you have sendmsg]))
+AC_BROKEN(sendmsg)
+
+ifelse(AC_DEFINE(HAVE_SETEGID, 1, [define if you have setegid]))
+AC_BROKEN(setegid)
+
+ifelse(AC_DEFINE(HAVE_SETENV, 1, [define if you have setenv]))
+AC_BROKEN(setenv)
+
+ifelse(AC_DEFINE(HAVE_SETEUID, 1, [define if you have seteuid]))
+AC_BROKEN(seteuid)
+
+ifelse(AC_DEFINE(HAVE_STRCASECMP, 1, [define if you have strcasecmp]))
+AC_BROKEN(strcasecmp)
+
+ifelse(AC_DEFINE(HAVE_STRDUP, 1, [define if you have strdup]))
+AC_BROKEN(strdup)
+
+ifelse(AC_DEFINE(HAVE_STRERROR, 1, [define if you have strerror]))
+AC_BROKEN(strerror)
+
+ifelse(AC_DEFINE(HAVE_STRFTIME, 1, [define if you have strftime]))
+AC_BROKEN(strftime)
+
+ifelse(AC_DEFINE(HAVE_STRLCAT, 1, [define if you have strlcat]))
+AC_BROKEN(strlcat)
+
+ifelse(AC_DEFINE(HAVE_STRLCPY, 1, [define if you have strlcpy]))
+AC_BROKEN(strlcpy)
+
+ifelse(AC_DEFINE(HAVE_STRLWR, 1, [define if you have strlwr]))
+AC_BROKEN(strlwr)
+
+ifelse(AC_DEFINE(HAVE_STRNLEN, 1, [define if you have strnlen]))
+AC_BROKEN(strnlen)
+
+ifelse(AC_DEFINE(HAVE_STRSEP, 1, [define if you have strsep]))
+AC_BROKEN(strsep)
+
+ifelse(AC_DEFINE(HAVE_STRSEP_COPY, 1, [define if you have strsep_copy]))
+AC_BROKEN(strsep_copy)
+
+ifelse(AC_DEFINE(HAVE_STRPTIME, 1, [define if you have strptime]))
+AC_BROKEN(strptime)
+
+ifelse(AC_DEFINE(HAVE_STRTOK_R, 1, [define if you have strtok_r]))
+AC_BROKEN(strtok_r)
+
+ifelse(AC_DEFINE(HAVE_STRUPR, 1, [define if you have strupr]))
+AC_BROKEN(strupr)
+
+ifelse(AC_DEFINE(HAVE_UNSETENV, 1, [define if you have unsetenv]))
+AC_BROKEN(unsetenv)
+
+ifelse(AC_DEFINE(HAVE_VERR, 1, [define if you have verr]))
+AC_BROKEN(verr)
+
+ifelse(AC_DEFINE(HAVE_VERRX, 1, [define if you have verrx]))
+AC_BROKEN(verrx)
+
+ifelse(AC_DEFINE(HAVE_VSYSLOG, 1, [define if you have vsyslog]))
+AC_BROKEN(vsyslog)
+
+ifelse(AC_DEFINE(HAVE_VWARN, 1, [define if you have vwarn]))
+AC_BROKEN(vwarn)
+
+ifelse(AC_DEFINE(HAVE_VWARNX, 1, [define if you have vwarnx]))
+AC_BROKEN(vwarnx)
+
+ifelse(AC_DEFINE(HAVE_WARN, 1, [define if you have warn]))
+AC_BROKEN(warn)
+
+ifelse(AC_DEFINE(HAVE_WARNX, 1, [define if you have warnx]))
+AC_BROKEN(warnx)
+
+ifelse(AC_DEFINE(HAVE_WRITEV, 1, [define if you have writev]))
+AC_BROKEN(writev)
+
 if test "$ac_cv_func_inet_aton" = "yes"; then
 AC_NEED_PROTO([
 #ifdef HAVE_SYS_TYPES_H
@@ -1443,9 +1625,30 @@
 ViceIoctl,
 caddr_t,
 in)
+
+ifelse(AC_DEFINE(HAVE_LINUX_KERNEL_INT8_T, 1, [have linux kernel type int8_t]))
+AC_HAVE_LINUX_KERNEL_TYPE(int8_t)
+
+ifelse(AC_DEFINE(HAVE_LINUX_KERNEL_INT16_T, 1, [have linux kernel type int16_t]))
+AC_HAVE_LINUX_KERNEL_TYPE(int16_t)
+
+ifelse(AC_DEFINE(HAVE_LINUX_KERNEL_INT32_T, 1, [have linux kernel type int32_t]))
+AC_HAVE_LINUX_KERNEL_TYPE(int32_t)
+
+ifelse(AC_DEFINE(HAVE_LINUX_KERNEL_INT64_T, 1, [have linux kernel type int64_t]))
+AC_HAVE_LINUX_KERNEL_TYPE(int64_t)
+
+ifelse(AC_DEFINE(HAVE_LINUX_KERNEL_U_INT8_T, 1, [have linux kernel type u_int8_t]))
+AC_HAVE_LINUX_KERNEL_TYPE(u_int8_t)
+
+ifelse(AC_DEFINE(HAVE_LINUX_KERNEL_U_INT16_T, 1, [have linux kernel type u_int16_t]))
+AC_HAVE_LINUX_KERNEL_TYPE(u_int16_t)
+
+ifelse(AC_DEFINE(HAVE_LINUX_KERNEL_U_INT32_T, 1, [have linux kernel type u_int32_t]))
+AC_HAVE_LINUX_KERNEL_TYPE(u_int32_t)
 
-AC_HAVE_LINUX_KERNEL_TYPES(int8_t int16_t int32_t int64_t)
-AC_HAVE_LINUX_KERNEL_TYPES(u_int8_t u_int16_t u_int32_t u_int64_t)
+ifelse(AC_DEFINE(HAVE_LINUX_KERNEL_U_INT64_T, 1, [have linux kernel type u_int64_t]))
+AC_HAVE_LINUX_KERNEL_TYPE(u_int64_t)
 
 AC_HAVE_KERNEL_STRUCT_FIELD([
 #include <asm/current.h>
Index: cf/check-var.m4
===================================================================
RCS file: /stacken-cvs/arla/cf/check-var.m4,v
retrieving revision 1.1
diff -u -r1.1 check-var.m4
--- cf/check-var.m4	1999/05/15 22:45:24	1.1
+++ cf/check-var.m4	2000/09/26 14:20:42
@@ -10,8 +10,8 @@
 	    ac_cv_var_$2=yes, ac_cv_var_$2=no)
 ])
 define([foo], [HAVE_]translit($2, [a-z], [A-Z]))
-
-AC_MSG_RESULT(`eval echo \\$ac_cv_var_$2`)
+tmp=`eval echo \\$ac_cv_var_$2`
+AC_MSG_RESULT($tmp)
 if test `eval echo \\$ac_cv_var_$2` = yes; then
 	AC_DEFINE_UNQUOTED(foo, 1, [define if you have $2])
 	AC_CHECK_DECLARATION([$1],[$2])
Index: cf/have-linux-kernel-type.m4
===================================================================
RCS file: /stacken-cvs/arla/cf/have-linux-kernel-type.m4,v
retrieving revision 1.2
diff -u -r1.2 have-linux-kernel-type.m4
--- cf/have-linux-kernel-type.m4	1999/12/05 10:33:09	1.2
+++ cf/have-linux-kernel-type.m4	2000/09/26 14:20:42
@@ -6,19 +6,26 @@
 
 dnl AC_HAVE_LINUX_KERNEL_TYPE(type)
 AC_DEFUN(AC_HAVE_LINUX_KERNEL_TYPE, [
-cv=`echo "$1" | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
-AC_MSG_CHECKING(for $i in the linux kernel)
-AC_CACHE_VAL(ac_cv_linux_kernel_type_$cv,
-AC_TRY_COMPILE_KERNEL([
-#define __KERNEL__
+cv=`echo "$1" | sed 'y%./+- %__p__%'`
+AC_MSG_CHECKING(for $1 in the linux kernel)
+AC_CACHE_VAL([ac_cv_linux_kernel_type_$cv],
+AC_TRY_COMPILE_KERNEL(
+[#define __KERNEL__
 #include <linux/types.h>
 ],
 [$1 x;],
 eval "ac_cv_linux_kernel_type_$cv=yes",
 eval "ac_cv_linux_kernel_type_$cv=no"))dnl
-AC_MSG_RESULT(`eval echo \\$ac_cv_linux_kernel_type_$cv`)
+tmp=`eval echo \\$ac_cv_linux_kernel_type_$cv`
+AC_MSG_RESULT($tmp)
 if test `eval echo \\$ac_cv_linux_kernel_type_$cv` = yes; then
-  ac_tr_hdr=HAVE_LINUX_KERNEL_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  ac_tr_hdr=HAVE_LINUX_KERNEL_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz%ABCDEFGHIJKLMNOPQRSTUVWXYZ%'`
+dnl autoheader tricks *sigh*
+define(foo,translit(linux_kernel_$1, [ ], [_]))
+: << END
+@@@funcs="$funcs foo"@@@
+END
+undefine([foo])
   AC_DEFINE_UNQUOTED($ac_tr_hdr, 1)
 fi
 ])
Index: cf/have-type.m4
===================================================================
RCS file: /stacken-cvs/arla/cf/have-type.m4,v
retrieving revision 1.2
diff -u -r1.2 have-type.m4
--- cf/have-type.m4	1999/12/31 03:12:22	1.2
+++ cf/have-type.m4	2000/09/26 14:20:42
@@ -15,12 +15,13 @@
 #include <stddef.h>
 #endif
 $2],
-[$1 foo;],
+[$1 x;],
 eval "ac_cv_type_$cv=yes",
 eval "ac_cv_type_$cv=no"))dnl
-AC_MSG_RESULT(`eval echo \\$ac_cv_type_$cv`)
+tmp=`eval echo \\$ac_cv_type_$cv`
+AC_MSG_RESULT($tmp)
 if test `eval echo \\$ac_cv_type_$cv` = yes; then
-  ac_tr_hdr=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./- %ABCDEFGHIJKLMNOPQRSTUVWXYZ____%'`
+  ac_tr_hdr=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz%ABCDEFGHIJKLMNOPQRSTUVWXYZ%'`
 dnl autoheader tricks *sigh*
 define(foo,translit($1, [ ], [_]))
 : << END





More information about the Arla-drinkers mailing list