On Sat, Oct 13, 2001 at 09:07:54PM +0200, Guido Draheim wrote: > make a macro (after AC_PROG_CC) that includes a check like > TESTC99DECLARATIONS > if notOK and test $GCC = yes :: > save_CFLAGS="$CFLAGS" > CFLAGS="$CFLAGS -std=gnu99" > TESTC99DECLARATIONS > if stillnotOK :: > CFLAGS=save_CFLAGS ; echo BAD (or bail out) > else > echo "OK (with -std=gnu99)" > fi > else > echo BAD (or bail out) > fi
Is this stylistically acceptable? define(TEST_C99_DECL, AC_TRY_COMPILE([],[ int x=0; x+=1; int y=0; for (int z=0; z < 2; z++); ],[C99=yes],[C99=no])) AC_MSG_CHECKING([whether $CC accepts C99 declarations]) TEST_C99_DECL if test $C99 = no -a $GCC = yes; then save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -std=gnu99" TEST_C99_DECL if test $C99 = no; then CFLAGS="$save_CFLAGS" else C99_COMMENT=', with -std=gnu99' fi fi if test $C99 = yes; then echo "yes$C99_COMMENT" else AC_MSG_RESULT(no) AC_MSG_ERROR([ *** This package requires a C compiler with C99 support. Please *** consider trying a recent release of GCC.]) ] fi fi -- Victory to the Divine Mother!! http://sahajayoga.org