| 1 | # aclocal.m4 - package-specific macros for autoconf |
| 2 | # |
| 3 | # This file is |
| 4 | # Copyright (C) 1997-1999 Ian Jackson <ian@davenant.greenend.org.uk> |
| 5 | # |
| 6 | # It is part of adns, which is |
| 7 | # Copyright (C) 1997-1999 Ian Jackson <ian@davenant.greenend.org.uk> |
| 8 | # Copyright (C) 1999 Tony Finch <dot@dotat.at> |
| 9 | # |
| 10 | # This file is part of adns, which is Copyright (C) 1997-1999 Ian Jackson |
| 11 | # |
| 12 | # This program is free software; you can redistribute it and/or modify |
| 13 | # it under the terms of the GNU General Public License as published by |
| 14 | # the Free Software Foundation; either version 2, or (at your option) |
| 15 | # any later version. |
| 16 | # |
| 17 | # This program is distributed in the hope that it will be useful, |
| 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | # GNU General Public License for more details. |
| 21 | # |
| 22 | # You should have received a copy of the GNU General Public License |
| 23 | # along with this program; if not, write to the Free Software Foundation, |
| 24 | # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 25 | |
| 26 | dnl DPKG_CACHED_TRY_COMPILE(<description>,<cachevar>,<include>,<program>,<ifyes>,<ifno>) |
| 27 | define(DPKG_CACHED_TRY_COMPILE,[ |
| 28 | AC_MSG_CHECKING($1) |
| 29 | AC_CACHE_VAL($2,[ |
| 30 | AC_TRY_COMPILE([$3],[$4],[$2=yes],[$2=no]) |
| 31 | ]) |
| 32 | if test "x$$2" = xyes; then |
| 33 | true |
| 34 | $5 |
| 35 | else |
| 36 | true |
| 37 | $6 |
| 38 | fi |
| 39 | ]) |
| 40 | |
| 41 | define(ADNS_C_GCCATTRIB,[ |
| 42 | DPKG_CACHED_TRY_COMPILE(__attribute__((,,)),adns_cv_c_attribute_supported,, |
| 43 | [extern int testfunction(int x) __attribute__((,,))], |
| 44 | AC_MSG_RESULT(yes) |
| 45 | AC_DEFINE(HAVE_GNUC25_ATTRIB) |
| 46 | DPKG_CACHED_TRY_COMPILE(__attribute__((noreturn)),adns_cv_c_attribute_noreturn,, |
| 47 | [extern int testfunction(int x) __attribute__((noreturn))], |
| 48 | AC_MSG_RESULT(yes) |
| 49 | AC_DEFINE(HAVE_GNUC25_NORETURN), |
| 50 | AC_MSG_RESULT(no)) |
| 51 | DPKG_CACHED_TRY_COMPILE(__attribute__((const)),adns_cv_c_attribute_const,, |
| 52 | [extern int testfunction(int x) __attribute__((const))], |
| 53 | AC_MSG_RESULT(yes) |
| 54 | AC_DEFINE(HAVE_GNUC25_CONST), |
| 55 | AC_MSG_RESULT(no)) |
| 56 | DPKG_CACHED_TRY_COMPILE(__attribute__((format...)),adns_cv_attribute_format,, |
| 57 | [extern int testfunction(char *y, ...) __attribute__((format(printf,1,2)))], |
| 58 | AC_MSG_RESULT(yes) |
| 59 | AC_DEFINE(HAVE_GNUC25_PRINTFFORMAT), |
| 60 | AC_MSG_RESULT(no)), |
| 61 | AC_MSG_RESULT(no)) |
| 62 | ]) |
| 63 | |
| 64 | define(ADNS_C_GETFUNC,[ |
| 65 | AC_CHECK_FUNC([$1],,[ |
| 66 | AC_CHECK_LIB([$2],[$1],[$3],[ |
| 67 | AC_MSG_ERROR([cannot find library function $1]) |
| 68 | ]) |
| 69 | ]) |
| 70 | ]) |