bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: speed up test-stat-time


From: Jim Meyering
Subject: Re: speed up test-stat-time
Date: Tue, 13 Oct 2009 09:23:07 +0200

Paolo Bonzini wrote:
>>   configure.ac:
>> +AC_CHECK_FUNCS([usleep])
>
> AC_CHECK_FUNCS_ONCE is better maybe?

Definitely.
In fact, there should be no uses of AC_CHECK_FUNCS in modules/* files.
Of course, there *could* be justification if someone requires
that a function check be conditional, but if there's enough logic,
then you can argue it belongs in a .m4 file and not in the
module file's configure.ac section.  So far there are none.

Bruno, Paolo, your names are on pipe-filter-?i.
Ok to change those?

Note the new Makefile rule, to help enforce this.

>From 0f24cad045453ba041791cadec388080a798a285 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 13 Oct 2009 09:15:52 +0200
Subject: [PATCH] use AC_CHECK_FUNCS_ONCE, not AC_CHECK_FUNCS in modules/*

* modules/pipe-filter-gi: Use AC_CHECK_FUNCS_ONCE, not AC_CHECK_FUNCS.
* modules/pipe-filter-ii: Likewise.
* modules/sys_socket-tests: Likewise.
* modules/tsearch-tests: Likewise.
* Makefile (sc_prefer_ac_check_funcs_once): New rule.
(check): Depend on it.
---
 ChangeLog                |   10 ++++++++++
 Makefile                 |    7 ++++++-
 modules/pipe-filter-gi   |    2 +-
 modules/pipe-filter-ii   |    2 +-
 modules/sys_socket-tests |    2 +-
 modules/tsearch-tests    |    2 +-
 6 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5e09738..1c48c1b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2009-10-13  Jim Meyering  <address@hidden>
+
+       use AC_CHECK_FUNCS_ONCE, not AC_CHECK_FUNCS in modules/*
+       * modules/pipe-filter-gi: Use AC_CHECK_FUNCS_ONCE, not AC_CHECK_FUNCS.
+       * modules/pipe-filter-ii: Likewise.
+       * modules/sys_socket-tests: Likewise.
+       * modules/tsearch-tests: Likewise.
+       * Makefile (sc_prefer_ac_check_funcs_once): New rule.
+       (check): Depend on it.
+
 2009-10-12  Eric Blake  <address@hidden>

        utimens-tests: port to NFS file systems
diff --git a/Makefile b/Makefile
index acdb23d..c178205 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,12 @@ info html dvi pdf:
        cd doc && $(MAKE) $@ && $(MAKE) mostlyclean

 # Perform some platform independent checks on the gnulib code.
-check:
+check: sc_prefer_ac_check_funcs_once
+
+sc_prefer_ac_check_funcs_once:
+       git grep -w -l AC_CHECK_FUNCS modules && \
+         { echo use AC_CHECK_FUNCS_ONCE, not AC_CHECK_FUNCS in modules/ 1>&2; \
+           exit 1; } || :

 # Regenerate some files that are stored in the repository.
 regen: MODULES.html
diff --git a/modules/pipe-filter-gi b/modules/pipe-filter-gi
index 3e0e117..95ab27a 100644
--- a/modules/pipe-filter-gi
+++ b/modules/pipe-filter-gi
@@ -19,7 +19,7 @@ unistd

 configure.ac:
 AC_REQUIRE([AC_C_INLINE])
-AC_CHECK_FUNCS([select])
+AC_CHECK_FUNCS_ONCE([select])

 Makefile.am:
 lib_SOURCES += pipe-filter-gi.c
diff --git a/modules/pipe-filter-ii b/modules/pipe-filter-ii
index 2c05aa1..6ae2801 100644
--- a/modules/pipe-filter-ii
+++ b/modules/pipe-filter-ii
@@ -19,7 +19,7 @@ unistd

 configure.ac:
 AC_REQUIRE([AC_C_INLINE])
-AC_CHECK_FUNCS([select])
+AC_CHECK_FUNCS_ONCE([select])

 Makefile.am:
 lib_SOURCES += pipe-filter-ii.c
diff --git a/modules/sys_socket-tests b/modules/sys_socket-tests
index bce231e..b0d44ab 100644
--- a/modules/sys_socket-tests
+++ b/modules/sys_socket-tests
@@ -4,7 +4,7 @@ tests/test-sys_socket.c
 Depends-on:

 configure.ac:
-AC_CHECK_FUNCS([shutdown])
+AC_CHECK_FUNCS_ONCE([shutdown])

 Makefile.am:
 TESTS += test-sys_socket
diff --git a/modules/tsearch-tests b/modules/tsearch-tests
index 4f1f72f..b038c6a 100644
--- a/modules/tsearch-tests
+++ b/modules/tsearch-tests
@@ -15,7 +15,7 @@ AC_TRY_LINK([
    double x;],
   [x = log (x);], , [TEST_TSEARCH_LIBM=-lm])
 AC_SUBST([TEST_TSEARCH_LIBM])
-AC_CHECK_FUNCS([initstate])
+AC_CHECK_FUNCS_ONCE([initstate])

 Makefile.am:
 TESTS += test-tsearch.sh
--
1.6.5.195.geae9




reply via email to

[Prev in Thread] Current Thread [Next in Thread]