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