]>
Commit | Line | Data |
---|---|---|
911954df | 1 | dnl DPKG_CACHED_TRY_COMPILE(<description>,<cachevar>,<include>,<program>,<ifyes>,<ifno>) |
b3103ab2 | 2 | AC_DEFUN([DPKG_CACHED_TRY_COMPILE],[ |
911954df ER |
3 | AC_MSG_CHECKING($1) |
4 | AC_CACHE_VAL($2,[ | |
5 | AC_TRY_COMPILE([$3],[$4],[$2=yes],[$2=no]) | |
6 | ]) | |
7 | if test "x$$2" = xyes; then | |
8 | true | |
9 | $5 | |
10 | else | |
11 | true | |
12 | $6 | |
13 | fi | |
14 | ]) | |
15 | ||
16 | dnl DPKG_C_GCC_ATTRIBUTE(<short-label>,<cachevar>,<func-params>,<attribute>,<HAVE>,<desc>,[<true-cmds>],[<false-cmds>]) | |
b3103ab2 | 17 | AC_DEFUN([DPKG_C_GCC_ATTRIBUTE],[ |
911954df ER |
18 | DPKG_CACHED_TRY_COMPILE(__attribute__(($1)),dpkg_cv_c_attribute_$2,, |
19 | [extern int testfunction($3) __attribute__(($4))], | |
20 | AC_MSG_RESULT(yes) | |
21 | AC_DEFINE(HAVE_GNUC25_$5,,$6) | |
22 | $7, | |
23 | AC_MSG_RESULT(no) | |
24 | $8) | |
25 | ]) | |
26 | ||
27 | dnl DPKG_C_GCC_TRY_WARNS(<warnings>,<cachevar>) | |
b3103ab2 | 28 | AC_DEFUN([DPKG_C_GCC_TRY_WARNS],[ |
911954df ER |
29 | AC_MSG_CHECKING([GCC warning flag(s) $1]) |
30 | if test "${GCC-no}" = yes | |
31 | then | |
32 | AC_CACHE_VAL($2,[ | |
33 | if $CC $1 -c /dev/null 2>/dev/null; then | |
34 | $2=yes | |
35 | else | |
36 | $2= | |
37 | fi | |
38 | ]) | |
39 | if test "x$$2" = xyes; then | |
40 | CWARNS="${CWARNS} $1" | |
41 | AC_MSG_RESULT(ok) | |
42 | else | |
43 | AC_MSG_RESULT(no) | |
44 | fi | |
45 | else | |
46 | AC_MSG_RESULT(no, not using GCC) | |
47 | fi | |
48 | ]) | |
49 | dnl DPKG_CACHED_TRY_COMPILE(<description>,<cachevar>,<include>,<program>,<ifyes>,<ifno>) | |
50 | ||
51 | ||
52 | dnl Check if a #define is present in an include file | |
b3103ab2 | 53 | AC_DEFUN([DPKG_CHECK_DEFINE], |
911954df ER |
54 | [AC_CACHE_CHECK(if $1 is defined in $2, |
55 | ac_cv_define_$1, | |
56 | [AC_TRY_COMPILE([ | |
57 | #include <$2> | |
58 | ],[ | |
59 | int i = $1; | |
60 | ], | |
61 | ac_cv_define_$1=yes, | |
62 | ac_cv_define_$1=no) | |
63 | ]) | |
64 | if test "$ac_cv_define_$1" = yes ; then | |
65 | AC_DEFINE(HAVE_$1,,[define if $1 is defined]) | |
66 | fi | |
67 | ]) | |
68 |