argp.m4 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # argp.m4 serial 14
  2. dnl Copyright (C) 2003-2013 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. AC_DEFUN([gl_ARGP],
  7. [
  8. AC_REQUIRE([AC_C_INLINE])
  9. AC_REQUIRE([AC_C_RESTRICT])
  10. AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
  11. AC_CHECK_DECLS([program_invocation_name], [],
  12. [AC_DEFINE([GNULIB_PROGRAM_INVOCATION_NAME], [1],
  13. [Define to 1 to add extern declaration of program_invocation_name to argp.h])],
  14. [[#include <errno.h>]])
  15. AC_CHECK_DECLS([program_invocation_short_name], [],
  16. [AC_DEFINE([GNULIB_PROGRAM_INVOCATION_SHORT_NAME], [1],
  17. [Define to 1 to add extern declaration of program_invocation_short_name to argp.h])],
  18. [[#include <errno.h>]])
  19. # Check if program_invocation_name and program_invocation_short_name
  20. # are defined elsewhere. It is improbable that only one of them will
  21. # be defined and other not, I prefer to stay on the safe side and to
  22. # test each one separately.
  23. AC_MSG_CHECKING([whether program_invocation_name is defined])
  24. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <argp.h>]],
  25. [[program_invocation_name = "test";]])],
  26. [AC_DEFINE([HAVE_PROGRAM_INVOCATION_NAME], [1],
  27. [Define if program_invocation_name is defined])
  28. AC_MSG_RESULT([yes])],
  29. [AC_MSG_RESULT([no])])
  30. AC_MSG_CHECKING([whether program_invocation_short_name is defined])
  31. AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <argp.h>]],
  32. [[program_invocation_short_name = "test";]])],
  33. [AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1],
  34. [Define if program_invocation_short_name is defined])
  35. AC_MSG_RESULT([yes])],
  36. [AC_MSG_RESULT([no])])
  37. AC_CHECK_DECLS_ONCE([clearerr_unlocked])
  38. AC_CHECK_DECLS_ONCE([feof_unlocked])
  39. AC_CHECK_DECLS_ONCE([ferror_unlocked])
  40. AC_CHECK_DECLS_ONCE([fflush_unlocked])
  41. AC_CHECK_DECLS_ONCE([fgets_unlocked])
  42. AC_CHECK_DECLS_ONCE([fputc_unlocked])
  43. AC_CHECK_DECLS_ONCE([fputs_unlocked])
  44. AC_CHECK_DECLS_ONCE([fread_unlocked])
  45. AC_CHECK_DECLS_ONCE([fwrite_unlocked])
  46. AC_CHECK_DECLS_ONCE([getc_unlocked])
  47. AC_CHECK_DECLS_ONCE([getchar_unlocked])
  48. AC_CHECK_DECLS_ONCE([putc_unlocked])
  49. AC_CHECK_DECLS_ONCE([putchar_unlocked])
  50. AC_CHECK_FUNCS_ONCE([flockfile funlockfile])
  51. AC_CHECK_HEADERS_ONCE([features.h linewrap.h])
  52. ])
  53. dnl argp-parse.c depends on GNU getopt internals, therefore use GNU getopt
  54. dnl always.
  55. AC_DEFUN([gl_REPLACE_GETOPT_ALWAYS], [])