1 |
dnl Copyright © 2005 William Pitcock, et al. |
2 |
dnl Rights to this code are as documented in doc/pod/license.pod. |
3 |
dnl |
4 |
dnl This file contains autoconf macros used in configure. |
5 |
dnl |
6 |
dnl $Id: atheme-c.m4,v 1.1 2007-07-19 08:24:51 pippijn Exp $ |
7 |
|
8 |
dnl Stolen from hyperion. |
9 |
|
10 |
dnl ERMYTH_C_GCC_TRY_FLAGS(<warnings>,<cachevar>) |
11 |
AC_DEFUN([ERMYTH_C_GCC_TRY_FLAGS],[ |
12 |
AC_MSG_CHECKING([GCC flag(s) $1]) |
13 |
if test "${GCC-no}" = yes |
14 |
then |
15 |
AC_CACHE_VAL($2,[ |
16 |
oldcflags="${CFLAGS-}" |
17 |
CFLAGS="${CFLAGS-} ${CWARNS} $1 -Werror" |
18 |
AC_TRY_COMPILE([ |
19 |
#include <string.h> |
20 |
#include <stdio.h> |
21 |
int main(void); |
22 |
],[ |
23 |
strcmp("a","b"); fprintf(stdout,"test ok\n"); |
24 |
], [$2=yes], [$2=no]) |
25 |
CFLAGS="${oldcflags}"]) |
26 |
if test "x$$2" = xyes; then |
27 |
CWARNS="${CWARNS}$1 " |
28 |
AC_MSG_RESULT(ok) |
29 |
else |
30 |
$2='' |
31 |
AC_MSG_RESULT(no) |
32 |
fi |
33 |
else |
34 |
AC_MSG_RESULT(no, not using GCC) |
35 |
fi |
36 |
]) |