bug-gnulib
[Top][All Lists]
Advanced

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

speed up 'configure' by removing HAVE_RAW_DECL_*


From: Paul Eggert
Subject: speed up 'configure' by removing HAVE_RAW_DECL_*
Date: Sat, 22 Jan 2011 18:08:50 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7

Emacs's src/config.in has about three dozen instances of something
like this:

  /* Define to 1 if chown is declared even after undefining macros. */
  #undef HAVE_RAW_DECL_CHOWN

along with machinery in 'configure' to run a compiler to test for each
symbol.  I want to omit these from Emacs, not only to make 'configure'
run faster, but also to make gnulib more acceptable for the Emacs
maintainers who read config.in by hand.  (These symbols are needed
only for the GNULIB_POSIXCHECK feature, which I expect is not likely
to be used much for Emacs.)

To do this, one way to would be to follow the example of
gl_ASSERT_NO_GNULIB_TESTS, and add a macro
gl_ASSERT_NO_GNULIB_POSIXCHECK that says "we don't want support for
GNULIB_POSIXCHECK", as follows:

   diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
   index c4f41f1..05a66f3 100644
   --- a/m4/gnulib-common.m4
   +++ b/m4/gnulib-common.m4
   @@ -102,6 +102,16 @@ AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS],
        [Define to 1 when the gnulib module $1 should be tested.])
    ])

   +# gl_ASSERT_NO_GNULIB_POSIXCHECK
   +# asserts that there will never be a need to #define GNULIB_POSIXCHECK.
   +# and thereby enables an optimization of configure and config.h.
   +# Used by Emacs.
   +AC_DEFUN([gl_ASSERT_NO_GNULIB_POSIXCHECK],
   +[
   +  dnl Override gl_WARN_ON_USE_PREPARE.
   +  AC_DEFUN([gl_WARN_ON_USE_PREPARE], [])
   +])
   +
    # gl_ASSERT_NO_GNULIB_TESTS
    # asserts that there will be no gnulib tests in the scope of the 
configure.ac
    # and thereby enables an optimization of config.h.

Emacs could then use this new macro.

Another possibility would be to remove all the HAVE_RAW_DECL_*
symbols, and remove gl_WARN_ON_USE_PREPARE entirely, and replace all
.h code that looks like this:

  #elif defined GNULIB_POSIXCHECK
  # undef chown
  # if HAVE_RAW_DECL_CHOWN
  _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
                   "doesn't treat a uid or gid of -1 on some systems - "
                   "use gnulib module chown for portability");
  # endif
  #endif

with code that omits the HAVE_RAW_DECL_* check:

  #elif defined GNULIB_POSIXCHECK
  # undef chown
  _GL_WARN_ON_USE (chown, "chown fails to follow symlinks on some systems and "
                   "doesn't treat a uid or gid of -1 on some systems - "
                   "use gnulib module chown for portability");
  #endif

The latter approach would speed up 'configure' for all packages, not
just Emacs.  Another advantage of the latter approach is that it would
still let Emacs developers try GNULIB_POSIXCHECK if they're brave
enough to do that.  The only downside that I see is that when
GNULIB_POSIXCHECK is in effect, then on platforms
that lack chown the latter approach will have compilations succeed
(with warnings) and later links will fail (because chown is missing),
rather than have compilations fail right away.  In practice, though,
surely this relatively minor downside is less important than the
upside of speeding up 'configure' for everybody.

The above analysis suggest that the latter approach is better.
I'd appreciate a review of it, along with any further suggestions
for improvement.



reply via email to

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