changeset 14969:9ac32f9b5582

getopt: Move AC_LIBOBJ invocations to module description. * m4/getopt.m4 (gl_REPLACE_GETOPT): Remove macro. (gl_FUNC_GETOPT): Inline it here. Move AC_LIBOBJ and gl_PREREQ_GETOPT invocations from here... * modules/getopt-gnu (configure.ac): ... to here. * modules/getopt-posix (configure.ac): ... and here. (Depends-on): Update condition.
author Bruno Haible <bruno@clisp.org>
date Sun, 08 May 2011 13:05:47 +0200
parents 87792dbdedee
children 3c854f4a4670
files ChangeLog m4/getopt.m4 modules/getopt-gnu modules/getopt-posix
diffstat 4 files changed, 25 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-05-08  Bruno Haible  <bruno@clisp.org>
+
+	getopt: Move AC_LIBOBJ invocations to module description.
+	* m4/getopt.m4 (gl_REPLACE_GETOPT): Remove macro.
+	(gl_FUNC_GETOPT): Inline it here. Move AC_LIBOBJ and gl_PREREQ_GETOPT
+	invocations from here...
+	* modules/getopt-gnu (configure.ac): ... to here.
+	* modules/getopt-posix (configure.ac): ... and here.
+	(Depends-on): Update condition.
+
 2011-05-08  Bruno Haible  <bruno@clisp.org>
 
 	getopt, argp: Respect rules for use of AC_LIBOBJ.
--- a/m4/getopt.m4
+++ b/m4/getopt.m4
@@ -23,7 +23,10 @@
     [])
   ])
   if test $REPLACE_GETOPT = 1; then
-    gl_REPLACE_GETOPT
+    dnl Arrange for getopt.h to be created.
+    gl_GETOPT_SUBSTITUTE_HEADER
+    dnl Arrange for unistd.h to include getopt.h.
+    GNULIB_UNISTD_H_GETOPT=1
   fi
 ])
 
@@ -37,19 +40,6 @@
   AC_REQUIRE([gl_FUNC_GETOPT_POSIX])
 ])
 
-# Request the gnulib implementation of the getopt functions unconditionally.
-AC_DEFUN([gl_REPLACE_GETOPT],
-[
-  dnl Arrange for getopt.h to be created.
-  gl_GETOPT_SUBSTITUTE_HEADER
-  dnl Arrange for unistd.h to include getopt.h.
-  GNULIB_UNISTD_H_GETOPT=1
-  dnl Arrange to compile the getopt implementation.
-  AC_LIBOBJ([getopt])
-  AC_LIBOBJ([getopt1])
-  gl_PREREQ_GETOPT
-])
-
 # emacs' configure.in uses this.
 AC_DEFUN([gl_GETOPT_IFELSE],
 [
--- a/modules/getopt-gnu
+++ b/modules/getopt-gnu
@@ -9,6 +9,11 @@
 
 configure.ac:
 gl_FUNC_GETOPT_GNU
+if test $REPLACE_GETOPT = 1; then
+  AC_LIBOBJ([getopt])
+  AC_LIBOBJ([getopt1])
+  gl_PREREQ_GETOPT
+fi
 gl_MODULE_INDICATOR_FOR_TESTS([getopt-gnu])
 
 Makefile.am:
--- a/modules/getopt-posix
+++ b/modules/getopt-posix
@@ -13,10 +13,15 @@
 extensions
 include_next
 arg-nonnull
-gettext-h       [test $GNULIB_UNISTD_H_GETOPT = 1]
+gettext-h       [test $REPLACE_GETOPT = 1]
 
 configure.ac:
 gl_FUNC_GETOPT_POSIX
+if test $REPLACE_GETOPT = 1; then
+  AC_LIBOBJ([getopt])
+  AC_LIBOBJ([getopt1])
+  gl_PREREQ_GETOPT
+fi
 
 Makefile.am:
 BUILT_SOURCES += $(GETOPT_H)