dnl AC_VALIDATE_CACHE_SYSTEM_TYPE[(cmd)] dnl if the cache file is inconsistent with the current host, dnl target and build system types, execute CMD or print a default dnl error message. AC_DEFUN(AC_VALIDATE_CACHE_SYSTEM_TYPE, [ AC_REQUIRE([AC_CANONICAL_SYSTEM]) AC_MSG_CHECKING([config.cache system type]) if { test x"${ac_cv_host_system_type+set}" = x"set" && test x"$ac_cv_host_system_type" != x"$host"; } || { test x"${ac_cv_build_system_type+set}" = x"set" && test x"$ac_cv_build_system_type" != x"$build"; } || { test x"${ac_cv_target_system_type+set}" = x"set" && test x"$ac_cv_target_system_type" != x"$target"; }; then AC_MSG_RESULT([different]) ifelse($#, 1, [$1], [AC_MSG_ERROR(["you must remove config.cache and restart configure"])]) else AC_MSG_RESULT([same]) fi ac_cv_host_system_type="$host" ac_cv_build_system_type="$build" ac_cv_target_system_type="$target" ]) dnl test whether dirent has a d_off member AC_DEFUN(AC_DIRENT_D_OFF, [AC_CACHE_CHECK([for d_off in dirent], ac_cv_dirent_d_off, [AC_TRY_COMPILE([ #include #include #include ], [struct dirent d; d.d_off;], ac_cv_dirent_d_off=yes, ac_cv_dirent_d_off=no)]) if test $ac_cv_dirent_d_off = yes; then AC_DEFINE(HAVE_DIRENT_D_OFF) fi ]) dnl AC_PROG_CC_FLAG(flag) AC_DEFUN(AC_PROG_CC_FLAG, [AC_CACHE_CHECK(whether ${CC-cc} accepts -$1, ac_cv_prog_cc_$1, [echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -$1 -c conftest.c 2>&1`"; then ac_cv_prog_cc_$1=yes else ac_cv_prog_cc_$1=no fi rm -f conftest* ])]) dnl see if a declaration exists for a function or variable dnl defines HAVE_function_DECL if it exists dnl AC_HAVE_DECL(var, includes) AC_DEFUN(AC_HAVE_DECL, [ AC_CACHE_CHECK([for $1 declaration],ac_cv_have_$1_decl,[ AC_TRY_COMPILE([$2],[int i = (int)$1], ac_cv_have_$1_decl=yes,ac_cv_have_$1_decl=no)]) if test x"$ac_cv_have_$1_decl" = x"yes"; then AC_DEFINE([HAVE_]translit([$1], [a-z], [A-Z])[_DECL]) fi ]) dnl check for a function in a library, but don't dnl keep adding the same library to the LIBS variable. dnl AC_LIBTESTFUNC(lib,func) AC_DEFUN(AC_LIBTESTFUNC, [case "$LIBS" in *-l$1*) AC_CHECK_FUNCS($2) ;; *) AC_CHECK_LIB($1, $2) AC_CHECK_FUNCS($2) ;; esac ]) dnl Define an AC_DEFINE with ifndef guard. dnl AC_N_DEFINE(VARIABLE [, VALUE]) define(AC_N_DEFINE, [cat >> confdefs.h <<\EOF [#ifndef] $1 [#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1) [#endif] EOF ]) dnl Add an #include dnl AC_ADD_INCLUDE(VARIABLE) define(AC_ADD_INCLUDE, [cat >> confdefs.h <<\EOF [#include] $1 EOF ]) dnl Copied from libtool.m4 AC_DEFUN(AC_PROG_LD_GNU, [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, [# I'd rather use --version here, but apparently some GNU ld's only accept -v. if $LD -v 2>&1 &5; then ac_cv_prog_gnu_ld=yes else ac_cv_prog_gnu_ld=no fi]) ])