summaryrefslogtreecommitdiff
path: root/m4/getopt.m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-06-15 15:27:54 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-06-15 15:27:54 -0700
commit8aeb5be96aa28c4770299a54758a8fb339993a97 (patch)
treedbf3821be90ab7a043a6552aa9b838a6259677e4 /m4/getopt.m4
parent4bba86e6210a74326e843a8fdc8409127105e1fe (diff)
downloademacs-8aeb5be96aa28c4770299a54758a8fb339993a97.tar.gz
Merge from gnulib: lib/gnulib.mk, m4/*.m4.
Diffstat (limited to 'm4/getopt.m4')
-rw-r--r--m4/getopt.m439
1 files changed, 20 insertions, 19 deletions
diff --git a/m4/getopt.m4 b/m4/getopt.m4
index 035a530df2d..4d8450ff907 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,25 @@ AC_DEFUN([gl_FUNC_GETOPT_POSIX],
[
m4_divert_text([DEFAULTS], [gl_getopt_required=POSIX])
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
- gl_GETOPT_IFELSE([
- gl_REPLACE_GETOPT
- ],
- [])
+ 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
+ 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
])
# Request a POSIX compliant getopt function with GNU extensions (such as
@@ -25,20 +40,6 @@ AC_DEFUN([gl_FUNC_GETOPT_GNU],
AC_REQUIRE([gl_FUNC_GETOPT_POSIX])
])
-# 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.
- 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],
[