summaryrefslogtreecommitdiffstats
path: root/gl/m4/getopt.m4
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2023-02-11 07:20:24 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2023-02-11 07:20:24 +0100
commitf867d7b44080fa9716deeff4476275f9a489879f (patch)
treebc964662fc3300dc626fb6d833d8ed5c8f46eca7 /gl/m4/getopt.m4
parent9734c439cba0a02b087e50789e94ec9b07754608 (diff)
parentc07206f2ccc2356aa74bc6813a94c2190017d44e (diff)
downloadmonitoring-plugins-f867d7b.tar.gz
Merge branch 'master' into curlfixes
Diffstat (limited to 'gl/m4/getopt.m4')
-rw-r--r--gl/m4/getopt.m439
1 files changed, 26 insertions, 13 deletions
diff --git a/gl/m4/getopt.m4 b/gl/m4/getopt.m4
index 50f45091..7981a095 100644
--- a/gl/m4/getopt.m4
+++ b/gl/m4/getopt.m4
@@ -1,5 +1,5 @@
1# getopt.m4 serial 44 1# getopt.m4 serial 48
2dnl Copyright (C) 2002-2006, 2008-2013 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2006, 2008-2023 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -21,6 +21,8 @@ AC_DEFUN([gl_FUNC_GETOPT_POSIX],
21 REPLACE_GETOPT=1 21 REPLACE_GETOPT=1
22 fi 22 fi
23 ]) 23 ])
24 GL_GENERATE_GETOPT_H=false
25 GL_GENERATE_GETOPT_CDEFS_H=false
24 if test $REPLACE_GETOPT = 1; then 26 if test $REPLACE_GETOPT = 1; then
25 dnl Arrange for getopt.h to be created. 27 dnl Arrange for getopt.h to be created.
26 gl_GETOPT_SUBSTITUTE_HEADER 28 gl_GETOPT_SUBSTITUTE_HEADER
@@ -32,9 +34,16 @@ AC_DEFUN([gl_FUNC_GETOPT_POSIX],
32# getopt_long_only. 34# getopt_long_only.
33AC_DEFUN([gl_FUNC_GETOPT_GNU], 35AC_DEFUN([gl_FUNC_GETOPT_GNU],
34[ 36[
37 dnl Set the variable gl_getopt_required, so that all invocations of
38 dnl gl_GETOPT_CHECK_HEADERS in the scope of the current configure file
39 dnl will check for getopt with GNU extensions.
40 dnl This means that if one gnulib-tool invocation requests getopt-posix
41 dnl and another gnulib-tool invocation requests getopt-gnu, it is as if
42 dnl both had requested getopt-gnu.
35 m4_divert_text([INIT_PREPARE], [gl_getopt_required=GNU]) 43 m4_divert_text([INIT_PREPARE], [gl_getopt_required=GNU])
36 44
37 AC_REQUIRE([gl_FUNC_GETOPT_POSIX]) 45 dnl No need to invoke gl_FUNC_GETOPT_POSIX here; this is automatically
46 dnl done through the module dependency getopt-gnu -> getopt-posix.
38]) 47])
39 48
40# Determine whether to replace the entire getopt facility. 49# Determine whether to replace the entire getopt facility.
@@ -295,8 +304,10 @@ dnl is ambiguous with environment values that contain newlines.
295 ]])], 304 ]])],
296 [gl_cv_func_getopt_gnu=yes], 305 [gl_cv_func_getopt_gnu=yes],
297 [gl_cv_func_getopt_gnu=no], 306 [gl_cv_func_getopt_gnu=no],
298 [dnl Cross compiling. Assume the worst, even on glibc platforms. 307 [dnl Cross compiling.
299 gl_cv_func_getopt_gnu="guessing no" 308 dnl Assume the worst, even on glibc platforms.
309 dnl But obey --enable-cross-guesses.
310 gl_cv_func_getopt_gnu="$gl_cross_guess_normal"
300 ]) 311 ])
301 case $gl_had_POSIXLY_CORRECT in 312 case $gl_had_POSIXLY_CORRECT in
302 exported) ;; 313 exported) ;;
@@ -354,15 +365,17 @@ dnl is ambiguous with environment values that contain newlines.
354 365
355AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER], 366AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
356[ 367[
357 GETOPT_H=getopt.h 368 AC_CHECK_HEADERS_ONCE([sys/cdefs.h])
369 if test $ac_cv_header_sys_cdefs_h = yes; then
370 HAVE_SYS_CDEFS_H=1
371 else
372 HAVE_SYS_CDEFS_H=0
373 fi
374 AC_SUBST([HAVE_SYS_CDEFS_H])
375
358 AC_DEFINE([__GETOPT_PREFIX], [[rpl_]], 376 AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
359 [Define to rpl_ if the getopt replacement functions and variables 377 [Define to rpl_ if the getopt replacement functions and variables
360 should be used.]) 378 should be used.])
361 AC_SUBST([GETOPT_H]) 379 GL_GENERATE_GETOPT_H=true
362]) 380 GL_GENERATE_GETOPT_CDEFS_H=true
363
364# Prerequisites of lib/getopt*.
365AC_DEFUN([gl_PREREQ_GETOPT],
366[
367 AC_CHECK_DECLS_ONCE([getenv])
368]) 381])