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