absolute-header.m4 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # absolute-header.m4 serial 6
  2. dnl Copyright (C) 2006 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. dnl From Derek Price.
  7. # gl_ABSOLUTE_HEADER(HEADER1 HEADER2 ...)
  8. # ---------------------------------------
  9. # Find the absolute name of a header file, assuming the header exists.
  10. # If the header were sys/inttypes.h, this macro would define
  11. # ABSOLUTE_SYS_INTTYPES_H to the `""' quoted absolute name of sys/inttypes.h
  12. # in config.h
  13. # (e.g. `#define ABSOLUTE_SYS_INTTYPES_H "///usr/include/sys/inttypes.h"').
  14. # The three "///" are to pacify Sun C 5.8, which otherwise would say
  15. # "warning: #include of /usr/include/... may be non-portable".
  16. # Use `""', not `<>', so that the /// cannot be confused with a C99 comment.
  17. AC_DEFUN([gl_ABSOLUTE_HEADER],
  18. [AC_LANG_PREPROC_REQUIRE()dnl
  19. AC_FOREACH([gl_HEADER_NAME], [$1],
  20. [AS_VAR_PUSHDEF([gl_absolute_header],
  21. [gl_cv_absolute_]m4_quote(m4_defn([gl_HEADER_NAME])))dnl
  22. AC_CACHE_CHECK([absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>],
  23. m4_quote(m4_defn([gl_absolute_header])),
  24. [AS_VAR_PUSHDEF([ac_header_exists],
  25. [ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME])))dnl
  26. AC_CHECK_HEADERS_ONCE(m4_quote(m4_defn([gl_HEADER_NAME])))dnl
  27. if test AS_VAR_GET(ac_header_exists) = yes; then
  28. AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]])])
  29. dnl eval is necessary to expand ac_cpp.
  30. dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
  31. AS_VAR_SET(gl_absolute_header,
  32. [`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
  33. sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1#;s#^/[^/]#//&#;p;q;}'`])
  34. fi
  35. AS_VAR_POPDEF([ac_header_exists])dnl
  36. ])dnl
  37. AC_DEFINE_UNQUOTED(AS_TR_CPP([ABSOLUTE_]m4_quote(m4_defn([gl_HEADER_NAME]))),
  38. ["AS_VAR_GET(gl_absolute_header)"],
  39. [Define this to an absolute name of <]m4_quote(m4_defn([gl_HEADER_NAME]))[>.])
  40. AS_VAR_POPDEF([gl_absolute_header])dnl
  41. ])dnl
  42. ])# gl_ABSOLUTE_HEADER