[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
AC_PROG_CC_C99
From: |
Roger Leigh |
Subject: |
AC_PROG_CC_C99 |
Date: |
Wed, 01 Dec 2004 14:44:41 +0000 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.3 (gnu/linux) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
A new version of the proposed AC_PROG_CC_C99 macro follows. It has
the following changes:
1. It puts the compiler into "C99 + extensions" mode in preference to
"strict C99" mode, but will try both.
2. I added AIX CC support (but can't test it myself).
Regards,
Roger
# AC_PROG_CC_C99
# ----------------
# If the C compiler in not in ISO C99 C mode by default, try to add an
# option to output variable @code{CC} to make it so. This macro tries
# various options that select ISO C99 C on some system or another. It
# considers the compiler to be in ISO C99 C mode if it handles mixed
# code and declarations, _Bool, inline and restrict.
AC_DEFUN([AC_PROG_CC_C99],
[AC_MSG_CHECKING([for $CC option to accept ISO C99 C])
AC_CACHE_VAL(ac_cv_prog_cc_c99,
[ac_cv_prog_cc_c99=no
ac_save_CC=$CC
AC_LANG_CONFTEST([AC_LANG_PROGRAM(
[[#include <stdbool.h>
static inline int
test(const char *restrict text)
{
int i = 0;
// Iterate through items via the restricted pointer
// and see if C++-style comments work.
while (*(text+i) != '\0')
++i;
return 0;
}]],
[[_Bool success = false;
if (test("String literal") != 0)
success = true;
char *restrict newvar = "Another string";]])])
# Try
# GCC -std=gnu99 -std=c99 -std=iso9899:1999
# AIX -qlanglvl=extc99 -qlanglvl=stdc99
for ac_arg in "" -std=gnu99 -std=c99 -std=iso9899:1999 -qlanglvl=extc99
-qlanglvl=stdc99
do
CC="$ac_save_CC $ac_arg"
_AC_COMPILE_IFELSE([],
[ac_cv_prog_cc_c99=$ac_arg
break])
done
rm -f conftest.$ac_ext conftest.$ac_objext
CC=$ac_save_CC
])
case "x$ac_cv_prog_cc_c99" in
x|xno)
AC_MSG_RESULT([none needed]) ;;
*)
AC_MSG_RESULT([$ac_cv_prog_cc_c99])
CC="$CC $ac_cv_prog_cc_c99" ;;
esac
])# _AC_PROG_CC_C99
- --
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
Debian GNU/Linux http://www.debian.org/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>
iD8DBQFBrdjRVcFcaSW/uEgRAnH8AJ9mmKMb4z9jSXFnVxeQZ0caofbuFACghim/
AkDaM+D3KpDI+PN9pfccWes=
=8T7B
-----END PGP SIGNATURE-----
- AC_PROG_CC_C99,
Roger Leigh <=
- Re: AC_PROG_CC_C99, Ralf Wildenhues, 2004/12/01
- Re: AC_PROG_CC_C99, Bob Friesenhahn, 2004/12/01
- Re: AC_PROG_CC_C99, Steven G. Johnson, 2004/12/01
- Re: AC_PROG_CC_C99, Paul Eggert, 2004/12/01
- Re: AC_PROG_CC_C99, Roger Leigh, 2004/12/01
- Re: AC_PROG_CC_C99, Ralf Wildenhues, 2004/12/02
- Re: AC_PROG_CC_C99, Kevin P. Fleming, 2004/12/02
- Re: AC_PROG_CC_C99, Paul Eggert, 2004/12/02
- Re: AC_PROG_CC_C99, Kevin P. Fleming, 2004/12/02
- Re: AC_PROG_CC_C99, Bob Friesenhahn, 2004/12/02