From: Tiziano Müller Date: Wed, 8 Apr 2015 11:29:35 +0000 (+0200) Subject: Modularize m4 macros X-Git-Tag: v3.1.2pre1~25 X-Git-Url: http://git.samba.org/?p=rsync.git;a=commitdiff_plain;h=066ad8c71918a2888bfb5939117e02eecdcae928 Modularize m4 macros Split acinclude.m4 into one file per function in m4/ --- diff --git a/Makefile.in b/Makefile.in index 5f825527..71a86f61 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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 diff --git a/configure.ac b/configure.ac index 5c557a89..2d638fce 100644 --- a/configure.ac +++ b/configure.ac @@ -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 index 00000000..704ca33b --- /dev/null +++ b/m4/have_type.m4 @@ -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 +]) diff --git a/acinclude.m4 b/m4/socklen_t.m4 similarity index 50% rename from acinclude.m4 rename to m4/socklen_t.m4 index cba16298..831820ca 100644 --- a/acinclude.m4 +++ b/m4/socklen_t.m4 @@ -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 #include ]) ]) - -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 index 00000000..dcb3b547 --- /dev/null +++ b/m4/validate_cache_system_type.m4 @@ -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" +])