]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
Modularize m4 macros
authorTiziano Müller <tiziano.mueller@stepping-stone.ch>
Wed, 8 Apr 2015 11:29:35 +0000 (13:29 +0200)
committerWayne Davison <wayned@samba.org>
Mon, 27 Apr 2015 00:54:06 +0000 (17:54 -0700)
Split acinclude.m4 into one file per function in m4/

Makefile.in
configure.ac
m4/have_type.m4 [new file with mode: 0644]
m4/socklen_t.m4 [moved from acinclude.m4 with 50% similarity]
m4/validate_cache_system_type.m4 [new file with mode: 0644]

index 5f825527dea8a5f26a6afb570865489057d5a54d..71a86f61e2f2e2b4a3d73e68ca3dfa4cca32f81b 100644 (file)
@@ -143,7 +143,7 @@ gensend: gen
 conf:
        cd $(srcdir) && $(MAKE) -f prepare-source.mak conf
 
-aclocal.m4: acinclude.m4
+aclocal.m4: m4/*.m4
        aclocal
 
 configure.sh config.h.in: configure.ac aclocal.m4
index 5c557a897298b71f0d1fb3b2d1a9c373db231347..2d638fce70e12f577e63d50496a9fa0af606b1f7 100644 (file)
@@ -1,6 +1,8 @@
 dnl Process this file with autoconf to produce a configure script.
 
 AC_INIT()
+
+AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_SRCDIR([byteorder.h])
 AC_CONFIG_HEADER(config.h)
 AC_PREREQ(2.60)
diff --git a/m4/have_type.m4 b/m4/have_type.m4
new file mode 100644 (file)
index 0000000..704ca33
--- /dev/null
@@ -0,0 +1,22 @@
+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
+])
similarity index 50%
rename from acinclude.m4
rename to m4/socklen_t.m4
index cba16298da96efbb950ee58df7fbe1e88bc3c5d2..831820cacfebe4f2cd2514ee34583873b4cb9c78 100644 (file)
@@ -1,27 +1,3 @@
-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 Check for socklen_t: historically on BSD it is an int, and in
 dnl POSIX 1g it is a type of its own, but some platforms use different
 dnl types for the argument to getsockopt, getpeername, etc.  So we
@@ -67,26 +43,3 @@ AC_DEFUN([TYPE_SOCKLEN_T],
       [#include <sys/types.h>
 #include <sys/socket.h>])
 ])
-
-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
-])
diff --git a/m4/validate_cache_system_type.m4 b/m4/validate_cache_system_type.m4
new file mode 100644 (file)
index 0000000..dcb3b54
--- /dev/null
@@ -0,0 +1,23 @@
+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"
+])