bug-gnulib
[Top][All Lists]
Advanced

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

Re: [Bug-gnulib] feature request: argp()


From: Simon Josefsson
Subject: Re: [Bug-gnulib] feature request: argp()
Date: Tue, 10 Jun 2003 22:17:15 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

Bruno Haible <address@hidden> writes:

>> I'm using AM_CONDITIONAL below.
>
> Hmm. I'm under the impression that AM_CONDITIONAL is one of the more
> fragile or heavy features of automake. Can't you use AC_LIBOBJ instead?

AC_LIBOBJ does not seem to support adding *.h.  The ".c" part seems
hard coded.  AC_LIBOBJ does not seem to be designed with multi-file
and *.h replacements in mind.

 - Macro: AC_LIBOBJ (FUNCTION)
     Specify that `FUNCTION.c' must be included in the executables to
     replace a missing or broken implementation of FUNCTION.

     Technically, it adds `FUNCTION.$ac_objext' to the output variable
     `LIBOBJS' and calls `AC_LIBSOURCE' for `FUNCTION.c'.  You should
     not directly change `LIBOBJS', since this is not traceable.

>> While testing this, I noticed that
>> the getopt and xalloc packages (which argp depends on) have the same
>> problem.
>
> getopt has the same problem and uses the ELIDE_CODE macro which even
> supports major, incompatible changes to the API. Given the API change
> policy of glibc I'd suggest to use the same technique here.

OK, then we are back at the following, which will compile the files
unconditionally.  If you think this is the right thing, I'll send a
ELIDE_CODE patch for lib/argp*.c later.

# argp.m4 serial 1
dnl Copyright (C) 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
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.

AC_DEFUN([gl_ARGP],
[
  AC_CHECK_HEADERS(argp.h)
  AC_CHECK_FUNCS(argp_parse)
])

--- argp.~1.1.~ Tue Jun 10 13:29:45 2003
+++ argp        Tue Jun 10 22:01:17 2003
@@ -19,9 +19,11 @@
 Depends-on:
 alloca
 getopt
+strchrnul
+sysexits
 
 configure.ac:
-AC_FUNC_ARGP
+gl_ARGP
 
 Makefile.am:
 lib_SOURCES += argp.h argp-ba.c argp-eexst.c \
@@ -33,4 +35,3 @@
 
 Maintainer:
 Simon Josefsson, glibc
-

>> I also add a new module "sysexits", modeled after "exit",
>> based on libc's sysexits.h that argp need.  Below I also modify
>> argp-eexst.c to handle sysexits.h, I believe the patch is safe within
>> libc too and I will send this patch to the libc maintainers soon.
>
> Is this patch needed at all? Most lib/Makefile's have "-I.", and
> therefore <sysexits.h> vs. "sysexits.h" makes no difference.

Few lib/Makefile add -I- though, and -I. only works for "sysexits.h"
if I'm reading the GCC manual properly:

`-I-'
     Split the include path.  Any directories specified with `-I'
     options before `-I-' are searched only for headers requested with
     `#include "FILE"'; they are not searched for `#include <FILE>'.
     If additional directories are specified with `-I' options after
     the `-I-', those directories are searched for all `#include'
     directives.

> I guess what is needed here is another instance of the fnmatch_.h ->
> fnmatch.h idiom.

That seems more complicated, and I don't understand what the gain is,
would you mind explain?  It appears the argp-eexst.c patch would still
be needed, though, if the above is correct.





reply via email to

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