1dnl AC_VALIDATE_CACHE_SYSTEM_TYPE[(cmd)] 2dnl if the cache file is inconsistent with the current host, 3dnl target and build system types, execute CMD or print a default 4dnl error message. 5AC_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]) 15 ifelse($#, 1, [$1], 16 [AC_MSG_ERROR(["you must remove config.cache and restart configure"])]) 17 else 18 AC_MSG_RESULT([same]) 19 fi 20 ac_cv_host_system_type="$host" 21 ac_cv_build_system_type="$build" 22 ac_cv_target_system_type="$target" 23]) 24 25dnl based on Automake's maintainer mode 26AC_DEFUN(SAMBA_MAINTAINER_MODE,[ 27 AC_ARG_ENABLE(maintainer-mode, 28 [ --enable-maintainer-mode enable some make rules for maintainers], 29 maint_mode=$enableval, maint_mode=no) 30 if test x"$maint_mode" = x"yes"; then MAINT=; else MAINT='#'; fi 31 AC_SUBST(MAINT) 32 AC_PATH_PROG(AUTOCONF, autoconf, autoconf) 33 AC_SUBST(AUTOCONF) 34 AC_PATH_PROG(AUTOHEADER, autoheader, autoheader) 35 AC_SUBST(AUTOHEADER) 36]) 37 38 39dnl test whether dirent has a d_off member 40AC_DEFUN(AC_DIRENT_D_OFF, 41[AC_CACHE_CHECK([for d_off in dirent], ac_cv_dirent_d_off, 42[AC_TRY_COMPILE([ 43#include <unistd.h> 44#include <sys/types.h> 45#include <dirent.h>], [struct dirent d; d.d_off;], 46ac_cv_dirent_d_off=yes, ac_cv_dirent_d_off=no)]) 47if test $ac_cv_dirent_d_off = yes; then 48 AC_DEFINE(HAVE_DIRENT_D_OFF) 49fi 50]) 51 52 53dnl AC_PROG_CC_FLAG(flag) 54AC_DEFUN(AC_PROG_CC_FLAG, 55[AC_CACHE_CHECK(whether ${CC-cc} accepts -$1, ac_cv_prog_cc_$1, 56[echo 'void f(){}' > conftest.c 57if test -z "`${CC-cc} -$1 -c conftest.c 2>&1`"; then 58 ac_cv_prog_cc_$1=yes 59else 60 ac_cv_prog_cc_$1=no 61fi 62rm -f conftest* 63])]) 64 65dnl check for a function in a library, but don't 66dnl keep adding the same library to the LIBS variable. 67dnl AC_LIBTESTFUNC(lib,func) 68AC_DEFUN(AC_LIBTESTFUNC, 69[case "$LIBS" in 70 *-l$1*) AC_CHECK_FUNCS($2) ;; 71 *) AC_CHECK_LIB($1, $2) 72 AC_CHECK_FUNCS($2) 73 ;; 74 esac 75]) 76 77dnl Define an AC_DEFINE with ifndef guard. 78dnl AC_N_DEFINE(VARIABLE [, VALUE]) 79define(AC_N_DEFINE, 80[cat >> confdefs.h <<\EOF 81[#ifndef] $1 82[#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1) 83[#endif] 84EOF 85]) 86 87dnl Add an #include 88dnl AC_ADD_INCLUDE(VARIABLE) 89define(AC_ADD_INCLUDE, 90[cat >> confdefs.h <<\EOF 91[#include] $1 92EOF 93]) 94