2N/A# argp.m4 serial 11
2N/Adnl Copyright (C) 2003-2010 Free Software Foundation, Inc.
2N/Adnl This file is free software; the Free Software Foundation
2N/Adnl gives unlimited permission to copy and/or distribute it,
2N/Adnl with or without modifications, as long as this notice is preserved.
2N/A
2N/AAC_DEFUN([gl_ARGP],
2N/A[
2N/A AC_REQUIRE([AC_C_INLINE])
2N/A AC_REQUIRE([AC_C_RESTRICT])
2N/A AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
2N/A dnl argp-parse.c depends on GNU getopt internals, therefore use GNU getopt
2N/A dnl always.
2N/A gl_REPLACE_GETOPT
2N/A dnl Note: gl_REPLACE_GETOPT does AC_LIBOBJ([getopt]), AC_LIBOBJ([getopt1]).
2N/A
2N/A AC_CHECK_DECL([program_invocation_name],
2N/A [AC_DEFINE([HAVE_DECL_PROGRAM_INVOCATION_NAME], [1],
2N/A [Define if program_invocation_name is declared])],
2N/A [AC_DEFINE([GNULIB_PROGRAM_INVOCATION_NAME], [1],
2N/A [Define to 1 to add extern declaration of program_invocation_name to argp.h])],
2N/A [#include <errno.h>])
2N/A AC_CHECK_DECL([program_invocation_short_name],
2N/A [AC_DEFINE([HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME], [1],
2N/A [Define if program_invocation_short_name is declared])],
2N/A [AC_DEFINE([GNULIB_PROGRAM_INVOCATION_SHORT_NAME], [1],
2N/A [Define to 1 to add extern declaration of program_invocation_short_name to argp.h])],
2N/A [#include <errno.h>])
2N/A
2N/A # Check if program_invocation_name and program_invocation_short_name
2N/A # are defined elsewhere. It is improbable that only one of them will
2N/A # be defined and other not, I prefer to stay on the safe side and to
2N/A # test each one separately.
2N/A AC_MSG_CHECKING([whether program_invocation_name is defined])
2N/A AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <argp.h>]],
2N/A [[program_invocation_name = "test";]])],
2N/A [AC_DEFINE([HAVE_PROGRAM_INVOCATION_NAME], [1],
2N/A [Define if program_invocation_name is defined])
2N/A AC_MSG_RESULT([yes])],
2N/A [AC_MSG_RESULT([no])])
2N/A
2N/A AC_MSG_CHECKING([whether program_invocation_short_name is defined])
2N/A AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <argp.h>]],
2N/A [[program_invocation_short_name = "test";]])],
2N/A [AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1],
2N/A [Define if program_invocation_short_name is defined])
2N/A AC_MSG_RESULT([yes])],
2N/A [AC_MSG_RESULT([no])])
2N/A
2N/A AC_CHECK_DECLS_ONCE([clearerr_unlocked])
2N/A AC_CHECK_DECLS_ONCE([feof_unlocked])
2N/A AC_CHECK_DECLS_ONCE([ferror_unlocked])
2N/A AC_CHECK_DECLS_ONCE([fflush_unlocked])
2N/A AC_CHECK_DECLS_ONCE([fgets_unlocked])
2N/A AC_CHECK_DECLS_ONCE([fputc_unlocked])
2N/A AC_CHECK_DECLS_ONCE([fputs_unlocked])
2N/A AC_CHECK_DECLS_ONCE([fread_unlocked])
2N/A AC_CHECK_DECLS_ONCE([fwrite_unlocked])
2N/A AC_CHECK_DECLS_ONCE([getc_unlocked])
2N/A AC_CHECK_DECLS_ONCE([getchar_unlocked])
2N/A AC_CHECK_DECLS_ONCE([putc_unlocked])
2N/A AC_CHECK_DECLS_ONCE([putchar_unlocked])
2N/A AC_CHECK_FUNCS_ONCE([flockfile funlockfile])
2N/A AC_CHECK_HEADERS_ONCE([features.h linewrap.h])
2N/A])