dnscrypto-proxy: Update to release 1.3.0
[tomato.git] / release / src / router / dnscrypt / libltdl / m4 / argz.m4
blobd1f4ec5b121e807815cdaf3c028383b658fb8217
1 # Portability macros for glibc argz.                    -*- Autoconf -*-
3 #   Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
4 #   Written by Gary V. Vaughan <gary@gnu.org>
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.
10 # serial 5 argz.m4
12 AC_DEFUN([gl_FUNC_ARGZ],
13 [gl_PREREQ_ARGZ
15 AC_CHECK_HEADERS([argz.h], [], [], [AC_INCLUDES_DEFAULT])
17 AC_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])
27 ARGZ_H=
28 AC_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])])
31 dnl if have system argz functions, allow forced use of
32 dnl libltdl-supplied implementation (and default to do so
33 dnl on "known bad" systems). Could use a runtime check, but
34 dnl (a) detecting malloc issues is notoriously unreliable
35 dnl (b) only known system that declares argz functions,
36 dnl     provides them, yet they are broken, is cygwin
37 dnl     releases prior to 16-Mar-2007 (1.5.24 and earlier)
38 dnl So, it's more straightforward simply to special case
39 dnl this for known bad systems.
40 AS_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])])])
75 AC_SUBST([ARGZ_H])
78 # Prerequisites of lib/argz.c.
79 AC_DEFUN([gl_PREREQ_ARGZ], [:])