summaryrefslogtreecommitdiffstats
path: root/ctdb/lib/replace/libreplace_macros.m4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-01-05 17:41:01 +1100
committerAndrew Tridgell <tridge@samba.org>2008-01-05 17:41:01 +1100
commit370779a1bb0218f31d02f0976e143d4b5d84b3d4 (patch)
treefd466f27d5334c23eff9dbb61c304e014e868ae9 /ctdb/lib/replace/libreplace_macros.m4
parent67d2b14d908498b28bf19febc958cbf5f91cc1ec (diff)
downloadsamba-370779a1bb0218f31d02f0976e143d4b5d84b3d4.tar.gz
samba-370779a1bb0218f31d02f0976e143d4b5d84b3d4.tar.xz
samba-370779a1bb0218f31d02f0976e143d4b5d84b3d4.zip
update from Samba4
(This used to be ctdb commit 298118c41bd33acd1a34a35a71a28451a45390c5)
Diffstat (limited to 'ctdb/lib/replace/libreplace_macros.m4')
-rw-r--r--ctdb/lib/replace/libreplace_macros.m457
1 files changed, 36 insertions, 21 deletions
diff --git a/ctdb/lib/replace/libreplace_macros.m4 b/ctdb/lib/replace/libreplace_macros.m4
index f262b9b6eb0..1856eacf66e 100644
--- a/ctdb/lib/replace/libreplace_macros.m4
+++ b/ctdb/lib/replace/libreplace_macros.m4
@@ -87,19 +87,6 @@ fi
rm -f conftest*
])])
-AC_DEFUN([AC_EXTENSION_FLAG],
-[
- cat >>confdefs.h <<\EOF
-#ifndef $1
-# define $1 1
-#endif
-EOF
-AH_VERBATIM([$1], [#ifndef $1
-# define $1 1
-#endif])
-])
-
-
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)
@@ -248,11 +235,18 @@ m4_define([AH_CHECK_FUNC_EXT],
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]
+AC_DEFUN([AC_N_DEFINE],
+[
+AH_VERBATIM([$1], [
+#ifndef $1
+# undef $1
+#endif
+])
+
+ cat >>confdefs.h <<\EOF
+#ifndef $1
+[#define] $1 m4_if($#, 1, 1, [$2])
+#endif
EOF
])
@@ -291,14 +285,14 @@ dnl check if the prototype in the header matches the given one
dnl AC_VERIFY_C_PROTOTYPE(prototype,functionbody,[IF-TRUE].[IF-FALSE],[extraheaders])
AC_DEFUN(AC_VERIFY_C_PROTOTYPE,
[AC_CACHE_CHECK([for prototype $1], AS_TR_SH([ac_cv_c_prototype_$1]),
- AC_COMPILE_IFELSE([
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
AC_INCLUDES_DEFAULT
$5
$1
{
$2
}
- ],[
+ ])],[
AS_TR_SH([ac_cv_c_prototype_$1])=yes
],[
AS_TR_SH([ac_cv_c_prototype_$1])=no
@@ -314,4 +308,25 @@ AC_DEFUN(LIBREPLACE_PROVIDE_HEADER,
)
])
-
+dnl AC_HAVE_TYPE(TYPE,INCLUDES)
+AC_DEFUN([AC_HAVE_TYPE], [
+AC_REQUIRE([AC_HEADER_STDC])
+cv=`echo "$1" | sed 'y%./+- %__p__%'`
+AC_MSG_CHECKING(for $1)
+AC_CACHE_VAL([ac_cv_type_$cv],
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+AC_INCLUDES_DEFAULT
+$2]],
+[[$1 foo;]])],
+[eval "ac_cv_type_$cv=yes"],
+[eval "ac_cv_type_$cv=no"]))dnl
+ac_foo=`eval echo \\$ac_cv_type_$cv`
+AC_MSG_RESULT($ac_foo)
+if test "$ac_foo" = yes; then
+ ac_tr_hdr=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./- %ABCDEFGHIJKLMNOPQRSTUVWXYZ____%'`
+if false; then
+ AC_CHECK_TYPES($1)
+fi
+ AC_DEFINE_UNQUOTED($ac_tr_hdr, 1, [Define if you have type `$1'])
+fi
+])