Debian Codegraph @

m4/argp.m4

raw
1 # argp.m4
2 # serial 18
3 dnl Copyright (C) 2003-2026 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7 dnl This file is offered as-is, without any warranty.
8
9 AC_DEFUN([gl_ARGP],
10 [
11 AC_REQUIRE([AC_C_INLINE])
12 AC_REQUIRE([AC_C_RESTRICT])
13 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
14
15 AC_CHECK_FUNCS_ONCE([argp_parse])
16 if test $ac_cv_func_argp_parse != no; then
17 dnl Rename argp_parse to another symbol, so that clang's ASAN does not
18 dnl intercept it. See
19 dnl <https://lists.gnu.org/archive/html/bug-gnulib/2023-12/msg00035.html>.
20 AC_DEFINE([argp_parse], [rpl_argp_parse],
21 [Define to the name of argp_parse outside libc.])
22 fi
23
24 AC_CHECK_DECLS([program_invocation_name],
25 [],
26 [AC_DEFINE([GNULIB_PROGRAM_INVOCATION_NAME], [1],
27 [Define to 1 to add extern declaration of program_invocation_name to argp.h])],
28 [[#include <errno.h>]])
29 AC_CHECK_DECLS([program_invocation_short_name],
30 [],
31 [AC_DEFINE([GNULIB_PROGRAM_INVOCATION_SHORT_NAME], [1],
32 [Define to 1 to add extern declaration of program_invocation_short_name to argp.h])],
33 [[#include <errno.h>]])
34
35 # Check if program_invocation_name and program_invocation_short_name
36 # are defined elsewhere. It is improbable that only one of them will
37 # be defined and other not, I prefer to stay on the safe side and to
38 # test each one separately.
39 AC_MSG_CHECKING([whether program_invocation_name is defined])
40 AC_LINK_IFELSE(
41 [AC_LANG_PROGRAM(
42 [[extern char *program_invocation_name;]],
43 [[program_invocation_name = "test";]])],
44 [AC_DEFINE([HAVE_PROGRAM_INVOCATION_NAME], [1],
45 [Define if program_invocation_name is defined])
46 AC_MSG_RESULT([yes])
47 ],
48 [AC_MSG_RESULT([no])])
49
50 AC_MSG_CHECKING([whether program_invocation_short_name is defined])
51 AC_LINK_IFELSE(
52 [AC_LANG_PROGRAM(
53 [[extern char *program_invocation_short_name;]],
54 [[program_invocation_short_name = "test";]])],
55 [AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1],
56 [Define if program_invocation_short_name is defined])
57 AC_MSG_RESULT([yes])
58 ],
59 [AC_MSG_RESULT([no])])
60
61 AC_CHECK_DECLS_ONCE([clearerr_unlocked])
62 AC_CHECK_DECLS_ONCE([feof_unlocked])
63 AC_CHECK_DECLS_ONCE([ferror_unlocked])
64 AC_CHECK_DECLS_ONCE([fflush_unlocked])
65 AC_CHECK_DECLS_ONCE([fgets_unlocked])
66 AC_CHECK_DECLS_ONCE([fputc_unlocked])
67 AC_CHECK_DECLS_ONCE([fputs_unlocked])
68 AC_CHECK_DECLS_ONCE([fread_unlocked])
69 AC_CHECK_DECLS_ONCE([fwrite_unlocked])
70 AC_CHECK_DECLS_ONCE([getc_unlocked])
71 AC_CHECK_DECLS_ONCE([getchar_unlocked])
72 AC_CHECK_DECLS_ONCE([putc_unlocked])
73 AC_CHECK_DECLS_ONCE([putchar_unlocked])
74 AC_CHECK_FUNCS_ONCE([flockfile funlockfile])
75 AC_CHECK_HEADERS_ONCE([features.h linewrap.h])
76 AC_REQUIRE([AC_FUNC_STRERROR_R])
77 ])
78
79 dnl argp-parse.c depends on GNU getopt internals, therefore use GNU getopt
80 dnl always.
81 AC_DEFUN([gl_REPLACE_GETOPT_ALWAYS], [])