Make --with-ldapsam 'go away'. This is now a standard, stable, feature
[kai/samba.git] / source3 / aclocal.m4
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
4 dnl error message.
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])
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
25
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,
29 [AC_TRY_COMPILE([
30 #include <unistd.h>
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)
36 fi
37 ])
38
39
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
45   ac_cv_prog_cc_$1=yes
46 else
47   ac_cv_prog_cc_$1=no
48 fi
49 rm -f conftest*
50 ])])
51
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,
56 [
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])
62  fi
63 ])
64
65
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,
70 [case "$LIBS" in
71   *-l$1*) AC_CHECK_FUNCS($2) ;;
72   *) AC_CHECK_LIB($1, $2) 
73      AC_CHECK_FUNCS($2)
74   ;;
75   esac
76 ])
77
78 dnl Define an AC_DEFINE with ifndef guard.
79 dnl AC_N_DEFINE(VARIABLE [, VALUE])
80 define(AC_N_DEFINE,
81 [cat >> confdefs.h <<\EOF
82 [#ifndef] $1
83 [#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1)
84 [#endif]
85 EOF
86 ])
87
88 dnl Add an #include
89 dnl AC_ADD_INCLUDE(VARIABLE)
90 define(AC_ADD_INCLUDE,
91 [cat >> confdefs.h <<\EOF
92 [#include] $1
93 EOF
94 ])