Hi!
This is a patch that fixes a problem with the $? shell variable and the
AC_TRY_RUN(PROGRAM, [ACTION-IF-TRUE [, ACTION-IF-FALSE [,
ACTION-IF-CROSS-COMPILING]]]) macro. The ACTION-IF-FALSE shell command
must be run before any 'cat' or 'rm' commands, or $? from the test
program is lost.
diff -ur autoconf-2.13.orig/acgeneral.m4 autoconf-2.13/acgeneral.m4
--- autoconf-2.13.orig/acgeneral.m4 Tue Jan 5 14:27:37 1999
+++ autoconf-2.13/acgeneral.m4 Thu Aug 3 10:20:38 2000
@@ -1828,11 +1828,11 @@
dnl Don't remove the temporary files here, so they can be examined.
ifelse([$2], , :, [$2])
else
+dnl must run any $3 command first or $? is lost
+ifelse([$3], , , [ $3])
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.$ac_ext >&AC_FD_CC
-ifelse([$3], , , [ rm -fr conftest*
- $3
-])dnl
+ifelse([$3], , , [ rm -fr conftest* ])
fi
rm -fr conftest*])
Sample usage:
dnl Test how well snprintf() behaves
AC_MSG_CHECKING([how well snprintf() behaves])
AC_TRY_RUN([int main() {
char buf[3]; int r;
r = snprintf(buf, 3, "123");
return r < 0 ? 1 : r;
}], , snprintf_test=$?, snprintf_test=4)
case "$snprintf_test" in
3)
AC_MSG_RESULT([ok])
AC_DEFINE(SNPRINTF_OK) ;;
2)
AC_MSG_RESULT([half broken])
AC_DEFINE(SNPRINTF_HALFBROKEN) ;;
1)
AC_MSG_RESULT([broken])
AC_DEFINE(SNPRINTF_BROKEN) ;;
*)
AC_MSG_ERROR([can't decide it, exiting!]) ;;
esac
Cheers,
Peter
--
Peter "Luna" Runestig (fd. Altberg), Sweden <[EMAIL PROTECTED]>
PGP Key ID: 0xD07BBE13
Fingerprint: 7B5C 1F48 2997 C061 DE4B 42EA CB99 A35C D07B BE13
Gubben Movitz ler och nickar, / men fr�n Charons m�rka sund
d�dens blund / i dina blickar / b�dar snart din sista stund.
Carl Michael Bellman, Fredmans epistel nr 34