1 dnl AC_VALIDATE_CACHE_SYSTEM_TYPE[(cmd)]
2 dnl if the cache file is inconsistent with the current host,
3 dnl target and build system types, execute CMD or print a default
5 AC_DEFUN(AC_VALIDATE_CACHE_SYSTEM_TYPE, [
6 AC_REQUIRE([AC_CANONICAL_SYSTEM])
7 AC_MSG_CHECKING([config.cache system type])
8 if { test x"${ac_cv_host_system_type+set}" = x"set" &&
9 test x"$ac_cv_host_system_type" != x"$host"; } ||
10 { test x"${ac_cv_build_system_type+set}" = x"set" &&
11 test x"$ac_cv_build_system_type" != x"$build"; } ||
12 { test x"${ac_cv_target_system_type+set}" = x"set" &&
13 test x"$ac_cv_target_system_type" != x"$target"; }; then
14 AC_MSG_RESULT([different])
16 [AC_MSG_ERROR(["you must remove config.cache and restart configure"])])
20 ac_cv_host_system_type="$host"
21 ac_cv_build_system_type="$build"
22 ac_cv_target_system_type="$target"
26 dnl test whether dirent has a d_off member
27 AC_DEFUN(AC_DIRENT_D_OFF,
28 [AC_CACHE_CHECK([for d_off in dirent], ac_cv_dirent_d_off,
31 #include <sys/types.h>
32 #include <dirent.h>], [struct dirent d; d.d_off;],
33 ac_cv_dirent_d_off=yes, ac_cv_dirent_d_off=no)])
34 if test $ac_cv_dirent_d_off = yes; then
35 AC_DEFINE(HAVE_DIRENT_D_OFF)
40 dnl AC_PROG_CC_FLAG(flag)
41 AC_DEFUN(AC_PROG_CC_FLAG,
42 [AC_CACHE_CHECK(whether ${CC-cc} accepts -$1, ac_cv_prog_cc_$1,
43 [echo 'void f(){}' > conftest.c
44 if test -z "`${CC-cc} -$1 -c conftest.c 2>&1`"; then
52 dnl see if a declaration exists for a function or variable
53 dnl defines HAVE_function_DECL if it exists
54 dnl AC_HAVE_DECL(var, includes)
55 AC_DEFUN(AC_HAVE_DECL,
57 AC_CACHE_CHECK([for $1 declaration],ac_cv_have_$1_decl,[
58 AC_TRY_COMPILE([$2],[int i = (int)$1],
59 ac_cv_have_$1_decl=yes,ac_cv_have_$1_decl=no)])
60 if test x"$ac_cv_have_$1_decl" = x"yes"; then
61 AC_DEFINE([HAVE_]translit([$1], [a-z], [A-Z])[_DECL])
66 dnl check for a function in a library, but don't
67 dnl keep adding the same library to the LIBS variable.
68 dnl AC_LIBTESTFUNC(lib,func)
69 AC_DEFUN(AC_LIBTESTFUNC,
71 *-l$1*) AC_CHECK_FUNCS($2) ;;
72 *) AC_CHECK_LIB($1, $2)
78 dnl Define an AC_DEFINE with ifndef guard.
79 dnl AC_N_DEFINE(VARIABLE [, VALUE])
81 [cat >> confdefs.h <<\EOF
83 [#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1)
89 dnl AC_ADD_INCLUDE(VARIABLE)
90 define(AC_ADD_INCLUDE,
91 [cat >> confdefs.h <<\EOF
96 dnl Copied from libtool.m4
97 AC_DEFUN(AC_PROG_LD_GNU,
98 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
99 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
100 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
101 ac_cv_prog_gnu_ld=yes