ltargz.m4 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # Portability macros for glibc argz. -*- Autoconf -*-
  2. #
  3. # Copyright (C) 2004-2007, 2011-2015 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 1 ltargz.m4
  10. AC_DEFUN([LT_FUNC_ARGZ], [
  11. AC_CHECK_HEADERS([argz.h], [], [], [AC_INCLUDES_DEFAULT])
  12. AC_CHECK_TYPES([error_t],
  13. [],
  14. [AC_DEFINE([error_t], [int],
  15. [Define to a type to use for 'error_t' if it is not otherwise available.])
  16. AC_DEFINE([__error_t_defined], [1], [Define so that glibc/gnulib argp.h
  17. does not typedef error_t.])],
  18. [#if defined(HAVE_ARGZ_H)
  19. # include <argz.h>
  20. #endif])
  21. LT_ARGZ_H=
  22. AC_CHECK_FUNCS([argz_add argz_append argz_count argz_create_sep argz_insert \
  23. argz_next argz_stringify], [], [LT_ARGZ_H=lt__argz.h; AC_LIBOBJ([lt__argz])])
  24. dnl if have system argz functions, allow forced use of
  25. dnl libltdl-supplied implementation (and default to do so
  26. dnl on "known bad" systems). Could use a runtime check, but
  27. dnl (a) detecting malloc issues is notoriously unreliable
  28. dnl (b) only known system that declares argz functions,
  29. dnl provides them, yet they are broken, is cygwin
  30. dnl releases prior to 16-Mar-2007 (1.5.24 and earlier)
  31. dnl So, it's more straightforward simply to special case
  32. dnl this for known bad systems.
  33. AS_IF([test -z "$LT_ARGZ_H"],
  34. [AC_CACHE_CHECK(
  35. [if argz actually works],
  36. [lt_cv_sys_argz_works],
  37. [[case $host_os in #(
  38. *cygwin*)
  39. lt_cv_sys_argz_works=no
  40. if test no != "$cross_compiling"; then
  41. lt_cv_sys_argz_works="guessing no"
  42. else
  43. lt_sed_extract_leading_digits='s/^\([0-9\.]*\).*/\1/'
  44. save_IFS=$IFS
  45. IFS=-.
  46. set x `uname -r | sed -e "$lt_sed_extract_leading_digits"`
  47. IFS=$save_IFS
  48. lt_os_major=${2-0}
  49. lt_os_minor=${3-0}
  50. lt_os_micro=${4-0}
  51. if test 1 -lt "$lt_os_major" \
  52. || { test 1 -eq "$lt_os_major" \
  53. && { test 5 -lt "$lt_os_minor" \
  54. || { test 5 -eq "$lt_os_minor" \
  55. && test 24 -lt "$lt_os_micro"; }; }; }; then
  56. lt_cv_sys_argz_works=yes
  57. fi
  58. fi
  59. ;; #(
  60. *) lt_cv_sys_argz_works=yes ;;
  61. esac]])
  62. AS_IF([test yes = "$lt_cv_sys_argz_works"],
  63. [AC_DEFINE([HAVE_WORKING_ARGZ], 1,
  64. [This value is set to 1 to indicate that the system argz facility works])],
  65. [LT_ARGZ_H=lt__argz.h
  66. AC_LIBOBJ([lt__argz])])])
  67. AC_SUBST([LT_ARGZ_H])
  68. ])