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