argz.m4 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # Portability macros for glibc argz. -*- Autoconf -*-
  2. #
  3. # Copyright (C) 2004-2017 Free Software Foundation, Inc.
  4. # Written by Gary V. Vaughan <gary@gnu.org>
  5. #
  6. # This file is free software; the Free Software Foundation gives
  7. # unlimited permission to copy and/or distribute it, with or without
  8. # modifications, as long as this notice is preserved.
  9. # serial 11 argz.m4
  10. AC_DEFUN([gl_FUNC_ARGZ],
  11. [gl_PREREQ_ARGZ
  12. AC_REQUIRE([AC_C_RESTRICT])
  13. AC_CHECK_HEADERS([argz.h], [], [], [AC_INCLUDES_DEFAULT])
  14. AC_CHECK_TYPES([error_t],
  15. [],
  16. [AC_DEFINE([error_t], [int],
  17. [Define to a type to use for 'error_t' if it is not otherwise available.])
  18. AC_DEFINE([__error_t_defined], [1], [Define so that glibc/gnulib argp.h
  19. does not typedef error_t.])],
  20. [#if defined(HAVE_ARGZ_H)
  21. # include <argz.h>
  22. #endif])
  23. ARGZ_H=
  24. AC_CHECK_FUNC([argz_replace], [], [ARGZ_H=argz.h])
  25. dnl if have system argz functions, allow forced use of
  26. dnl libltdl-supplied implementation (and default to do so
  27. dnl on "known bad" systems). Could use a runtime check, but
  28. dnl (a) detecting malloc issues is notoriously unreliable
  29. dnl (b) only known system that declares argz functions,
  30. dnl provides them, yet they are broken, is cygwin
  31. dnl releases prior to 5-May-2007 (1.5.24 and earlier)
  32. dnl So, it's more straightforward simply to special case
  33. dnl this for known bad systems.
  34. AS_IF([test -z "$ARGZ_H"],
  35. [AC_CACHE_CHECK(
  36. [if argz actually works],
  37. [lt_cv_sys_argz_works],
  38. [[case $host_os in #(
  39. *cygwin*)
  40. lt_cv_sys_argz_works=no
  41. if test "$cross_compiling" != no; then
  42. lt_cv_sys_argz_works="guessing no"
  43. else
  44. lt_sed_extract_leading_digits='s/^\([0-9\.]*\).*/\1/'
  45. save_IFS=$IFS
  46. IFS=-.
  47. set x `uname -r | sed -e "$lt_sed_extract_leading_digits"`
  48. IFS=$save_IFS
  49. lt_os_major=${2-0}
  50. lt_os_minor=${3-0}
  51. lt_os_micro=${4-0}
  52. if test "$lt_os_major" -gt 1 \
  53. || { test "$lt_os_major" -eq 1 \
  54. && { test "$lt_os_minor" -gt 5 \
  55. || { test "$lt_os_minor" -eq 5 \
  56. && test "$lt_os_micro" -gt 24; }; }; }; then
  57. lt_cv_sys_argz_works=yes
  58. fi
  59. fi
  60. ;; #(
  61. *) lt_cv_sys_argz_works=yes ;;
  62. esac]])
  63. AS_IF([test "$lt_cv_sys_argz_works" = yes],
  64. [AC_DEFINE([HAVE_WORKING_ARGZ], [1],
  65. [This value is set to 1 to indicate that the system argz facility works])],
  66. [ARGZ_H=argz.h])])
  67. AC_SUBST([ARGZ_H])
  68. AM_CONDITIONAL([GL_GENERATE_ARGZ_H], [test -n "$ARGZ_H"])
  69. ])
  70. # Prerequisites of lib/argz.c.
  71. AC_DEFUN([gl_PREREQ_ARGZ], [:])