summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4')
-rw-r--r--m4/getopt.m49
-rw-r--r--m4/gnulib-comp.m43
2 files changed, 12 insertions, 0 deletions
diff --git a/m4/getopt.m4 b/m4/getopt.m4
index ac3b38e385e..3ebc7b7edf5 100644
--- a/m4/getopt.m4
+++ b/m4/getopt.m4
@@ -32,7 +32,16 @@ AC_DEFUN([gl_FUNC_GETOPT_POSIX],
# getopt_long_only.
AC_DEFUN([gl_FUNC_GETOPT_GNU],
[
+ dnl Set the variable gl_getopt_required, so that all invocations of
+ dnl gl_GETOPT_CHECK_HEADERS in the scope of the current configure file
+ dnl will check for getopt with GNU extensions.
+ dnl This means that if one gnulib-tool invocation requests getopt-posix
+ dnl and another gnulib-tool invocation requests getopt-gnu, it is as if
+ dnl both had requested getopt-gnu.
m4_divert_text([INIT_PREPARE], [gl_getopt_required=GNU])
+
+ dnl No need to invoke gl_FUNC_GETOPT_POSIX here; this is automatically
+ dnl done through the module dependency getopt-gnu -> getopt-posix.
])
# Determine whether to replace the entire getopt facility.
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index bfac944ea05..030304d6777 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -259,6 +259,9 @@ AC_DEFUN([gl_INIT],
fi
gl_STDLIB_MODULE_INDICATOR([getloadavg])
gl_FUNC_GETOPT_GNU
+ dnl Because of the way gl_FUNC_GETOPT_GNU is implemented (the gl_getopt_required
+ dnl mechanism), there is no need to do any AC_LIBOBJ or AC_SUBST here; they are
+ dnl done in the getopt-posix module.
gl_FUNC_GETOPT_POSIX
if test $REPLACE_GETOPT = 1; then
AC_LIBOBJ([getopt])