1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
dnl Moved from configure.in, modified to use AC_DEFUN
dnl -- Tom Lees <tom@lpsg.demon.co.uk>
dnl DPKG_CACHED_TRY_COMPILE(<description>,<cachevar>,<include>,<program>,<ifyes>,<ifno>)
AC_DEFUN(DPKG_CACHED_TRY_COMPILE,[
AC_MSG_CHECKING($1)
AC_CACHE_VAL($2,[
AC_TRY_COMPILE([$3],[$4],[$2=yes],[$2=no])
])
if test "x$$2" = xyes; then
true
$5
else
true
$6
fi
])
dnl DPKG_C_GCC_TRY_WARNS(<warnings>,<cachevar>)
AC_DEFUN(DPKG_C_GCC_TRY_WARNS,[
AC_MSG_CHECKING([GCC warning flag(s) $1])
if test "${GCC-no}" = yes
then
AC_CACHE_VAL($2,[
oldcflags="${CFLAGS-}"
CFLAGS="${CFLAGS-} ${CWARNS} $1 -Werror"
AC_TRY_COMPILE([
#include <string.h>
#include <stdio.h>
],[
strcmp("a","b"); fprintf(stdout,"test ok\n");
], [$2=yes], [$2=no])
CFLAGS="${oldcflags}"])
if test "x$$2" = xyes; then
CWARNS="${CWARNS} $1"
AC_MSG_RESULT(ok)
else
$2=''
AC_MSG_RESULT(no)
fi
else
AC_MSG_RESULT(no, not using GCC)
fi
])
|