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