bug-gnulib
[Top][All Lists]
Advanced

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

[Bug-gnulib] modules, AC_FUNC_MEMCMP and old ANSI C dependencies


From: Bruno Haible
Subject: [Bug-gnulib] modules, AC_FUNC_MEMCMP and old ANSI C dependencies
Date: Wed, 15 Jan 2003 13:54:18 +0100 (CET)

Hi Paul,

In a recent patch, after adding the memcmp optimization to lib/memcoll.c,
you added
  AC_REQUIRE([AC_FUNC_MEMCMP])
to the gl_MEMCOLL macro.

I'd like to take this opportunity to explain more about the modules.

It generally leads to a mess if someone takes a part of a module and not
all of it. In this case, if someone has AC_FUNC_MEMCMP but forgets to
add lib/memcmp.c to his sources, he will get a "make" failure on those
platforms where memcmp() doesn't work. Or if someone has AC_FUNC_MEMCMP
and also lib/memcmp.c but not m4/memcmp.m4 and the jm_FUNC_MEMCMP
call in configure.ac, then lib/memcmp.c will be compiled but will lead
to warnings or errors because not all the prerequisites of lib/memcmp.c
have been executed.

Therefore the right way to say "memcoll depends on memcmp" is to make
a dependency between the modules (i.e. change modules/memcoll). The
gnulib-tool will then add lib/memcmp.c, m4/memcmp.m4 and jm_FUNC_MEMCMP
to every package that uses memcoll.

I'll thus undo this AC_REQUIRE([AC_FUNC_MEMCMP]). Patch appended below.

Now this brings us to the general question of how to deal with the
support for systems lacking ANSI C 89 (memcmp, memset, etc). Up to now I
have _not_ listed these modules as dependencies, on the assumption that
we have arrived in ANSI C land and don't care about extremely ancient
systems. This means that every maintainer who cares about pre-ANSI-C
portability has to determine which of these old substitute module he needs
by hand.
One could also imagine that the gnulib-tool script has an option --pre-ansi-c
which lets it include modules like memcmp, memset etc. in the list when
these ANSI C functions are referenced.

WDYT?

Bruno


diff -r -c3 gnulib-cvs/m4/memcoll.m4 gnulib/m4/memcoll.m4
*** gnulib-cvs/m4/memcoll.m4    2003-01-06 12:42:51.000000000 +0100
--- gnulib/m4/memcoll.m4        2003-01-11 00:09:23.000000000 +0100
***************
*** 1,5 ****
! # memcoll.m4 serial 2
! dnl Copyright (C) 2002 Free Software Foundation, Inc.
  dnl This file is free software, distributed under the terms of the GNU
  dnl General Public License.  As a special exception to the GNU General
  dnl Public License, this file may be distributed as part of a program
--- 1,5 ----
! # memcoll.m4 serial 3
! dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
  dnl This file is free software, distributed under the terms of the GNU
  dnl General Public License.  As a special exception to the GNU General
  dnl Public License, this file may be distributed as part of a program
***************
*** 9,15 ****
  AC_DEFUN([gl_MEMCOLL],
  [
    dnl Prerequisites of lib/memcoll.c.
-   AC_REQUIRE([AC_FUNC_MEMCMP])
    AC_CHECK_HEADERS_ONCE(string.h)
    AC_FUNC_STRCOLL
  ])
--- 9,14 ----




reply via email to

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