From: Bruno Haible Date: Sun, 8 May 2011 11:00:10 +0000 (+0200) Subject: getopt, argp: Respect rules for use of AC_LIBOBJ. X-Git-Tag: v0.1~2558 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=633556d650a5ea282f2515f3b6b13780eeef8792;p=gnulib.git getopt, argp: Respect rules for use of AC_LIBOBJ. * m4/argp.m4 (gl_ARGP): Don't invoke gl_REPLACE_GETOPT. (gl_REPLACE_GETOPT_ALWAYS): New macro. * m4/getopt.m4 (gl_FUNC_GETOPT_POSIX): Test whether gl_REPLACE_GETOPT_ALWAYS is defined. Set REPLACE_GETOPT. --- diff --git a/ChangeLog b/ChangeLog index c742d4491..5db6ffe3e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2011-05-08 Bruno Haible + getopt, argp: Respect rules for use of AC_LIBOBJ. + * m4/argp.m4 (gl_ARGP): Don't invoke gl_REPLACE_GETOPT. + (gl_REPLACE_GETOPT_ALWAYS): New macro. + * m4/getopt.m4 (gl_FUNC_GETOPT_POSIX): Test whether + gl_REPLACE_GETOPT_ALWAYS is defined. Set REPLACE_GETOPT. + +2011-05-08 Bruno Haible + getlogin_r: Move AC_LIBOBJ invocations to module description. * m4/getlogin_r.m4 (gl_FUNC_GETLOGIN_R): Move AC_LIBOBJ and gl_PREREQ_GETLOGIN_R invocations from here... diff --git a/m4/argp.m4 b/m4/argp.m4 index c274dd109..4e3940a65 100644 --- a/m4/argp.m4 +++ b/m4/argp.m4 @@ -1,4 +1,4 @@ -# argp.m4 serial 11 +# argp.m4 serial 12 dnl Copyright (C) 2003-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,10 +9,6 @@ AC_DEFUN([gl_ARGP], AC_REQUIRE([AC_C_INLINE]) AC_REQUIRE([AC_C_RESTRICT]) AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - dnl argp-parse.c depends on GNU getopt internals, therefore use GNU getopt - dnl always. - gl_REPLACE_GETOPT - dnl Note: gl_REPLACE_GETOPT does AC_LIBOBJ([getopt]), AC_LIBOBJ([getopt1]). AC_CHECK_DECL([program_invocation_name], [AC_DEFINE([HAVE_DECL_PROGRAM_INVOCATION_NAME], [1], @@ -63,3 +59,7 @@ AC_DEFUN([gl_ARGP], AC_CHECK_FUNCS_ONCE([flockfile funlockfile]) AC_CHECK_HEADERS_ONCE([features.h linewrap.h]) ]) + +dnl argp-parse.c depends on GNU getopt internals, therefore use GNU getopt +dnl always. +AC_DEFUN([gl_REPLACE_GETOPT_ALWAYS], []) diff --git a/m4/getopt.m4 b/m4/getopt.m4 index 035a530df..4ad52fd54 100644 --- a/m4/getopt.m4 +++ b/m4/getopt.m4 @@ -1,4 +1,4 @@ -# getopt.m4 serial 34 +# getopt.m4 serial 35 dnl Copyright (C) 2002-2006, 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,10 +9,22 @@ AC_DEFUN([gl_FUNC_GETOPT_POSIX], [ m4_divert_text([DEFAULTS], [gl_getopt_required=POSIX]) AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) - gl_GETOPT_IFELSE([ + dnl Other modules can request the gnulib implementation of the getopt + dnl functions unconditionally, by defining gl_REPLACE_GETOPT_ALWAYS. + dnl argp.m4 does this. + m4_ifdef([gl_REPLACE_GETOPT_ALWAYS], [ + gl_GETOPT_IFELSE([], []) + REPLACE_GETOPT=1 + ], [ + REPLACE_GETOPT=0 + gl_GETOPT_IFELSE([ + REPLACE_GETOPT=1 + ], + []) + ]) + if test $REPLACE_GETOPT = 1; then gl_REPLACE_GETOPT - ], - []) + fi ]) # Request a POSIX compliant getopt function with GNU extensions (such as @@ -26,7 +38,6 @@ AC_DEFUN([gl_FUNC_GETOPT_GNU], ]) # Request the gnulib implementation of the getopt functions unconditionally. -# argp.m4 uses this. AC_DEFUN([gl_REPLACE_GETOPT], [ dnl Arrange for getopt.h to be created.