[EMAIL PROTECTED] wrote: > > On Sat, Oct 13, 2001 at 11:24:57AM -0700, Paul Eggert wrote: > > > From: [EMAIL PROTECTED] > > > Date: Sat, 13 Oct 2001 10:22:31 -0700 > > > > > > AC_MSG_CHECKING([whether $CC accepts C99 declarations]) > > > AC_TRY_COMPILE([],[ > > > int x=0; x+=1; int y=0; > > > for (int z=0; z < 2; z++); > > > ],[ > > > AC_MSG_RESULT(yes) > > > ], > > > [ > > > AC_MSG_ERROR([ > > > *** This package requires a C99 compiler.]) > > > ]) > > > > OK, but why bother with that? Just run 'make'. If it fails, your > > compiler doesn't support C99 declarations. I see little need to > > discover that at 'configure'-time. > > At least i can guess the "-std=gnu99" option if CC=gnu .. ?
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 get the idea? :-) > > > Now, if your goal was to find a C compiler tht supported C99 > > declarations, that would be another story. > > Yah, that's my goal. > > > Or if your goal was to define a macro that is nonzero if C99 > > declarations are supported, Autoconf could do that too. But I don't > > think a macro like that would be all that useful in practice: it'd > > just make the code uglier. > > No, that's silly. i'm not going to litter my code with #ifdefs > for old compilers. More realistically, i just want configure to > suggest upgrading gcc if the installed gcc doesn't support C99. > Something like that. > however you will notice that many many compilers out there do not support your style - atleast not now. Your code is not (yet) quite portable but making it portable atleast throughout gcc makes still fine for a good share of computer space. I support what Pauls remark points at but then again, you can use autoconf to detect differences on platforms that have a gcc... and there are surely quite some..:-O cheers, -- guido Edel sei der Mensch, hilfreich und gut GCS/E/S/P C++$++++ ULHS L++w- N++@ d(+-) s+a- r+@>+++ y++ 5++X- (geekcode)