File: libidn.m4

package info (click to toggle)
inetutils 2%3A2.7-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,684 kB
  • sloc: ansic: 132,371; sh: 12,498; yacc: 1,651; makefile: 725; perl: 72
file content (91 lines) | stat: -rw-r--r-- 2,676 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# libidn.m4 serial 2
dnl Copyright (C) 2013-2025 Free Software Foundation, Inc.
dnl
dnl This file is part of GNU Inetutils.
dnl
dnl GNU Inetutils is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or (at
dnl your option) any later version.
dnl
dnl GNU Inetutils is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
dnl General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program.  If not, see `http://www.gnu.org/licenses/'.

dnl Written by Mats Erik Andersson.

dnl IU_CHECK_LIBIDN([PREFIX],[HEADERLOC])
dnl Search for libidn in standard location and in PREFIX,
dnl if the latter is set and is neither "yes", nor "no".
dnl
dnl First check: $with_idn != no

AC_DEFUN([IU_CHECK_LIBIDN],
[
if test x"$with_idn" != xno \
    && test "$ac_cv_header_locale_h" = yes \
    && test "$ac_cv_func_setlocale" = yes
then
  if test -n "$1" \
      && test x"$1" != xno \
      && test x"$1" != xyes
  then
    INCIDN=-I$1/include
    LIBIDN=-L$1/lib
  fi

  if test -n "$2" \
      && test x"$2" != xyes
  then
    INCIDN=-I$2
  fi

  AC_CHECK_LIB([idn2], [idn2_to_ascii_lz], [have_IDN2=yes], , [$LIBIDN])

  AC_CHECK_LIB([idn], [idna_to_ascii_lz], [have_IDN=yes], , [$LIBIDN])

  if test x"$have_IDN2" = xyes
  then
    LIBIDN="$LIBIDN -lidn2"
  else
    if test x"$have_IDN" = xyes
    then
      LIBIDN="$LIBIDN -lidn"
    else
      INCIDN= LIBIDN=
    fi
  fi

  # Some systems are known to install <idna.h> below
  # '/usr/include/idn'.  The caching performed by
  # AC_CHECK_HEADERS prevents detection of this using
  # repeated call of the macro.  Functional alternative?
  save_CPPFLAGS=$CPPFLAGS
  CPPFLAGS="$CPPFLAGS $INCIDN"

  AC_CHECK_HEADERS([idna.h idn2.h])

  AC_MSG_CHECKING([if GNU libidn is available])
  if test "$ac_cv_lib_idn2_idn2_to_ascii_lz" = yes \
      && test "$ac_cv_header_idn2_h" = yes; then
    AC_DEFINE(HAVE_IDN2, 1, [Define to 1 for use of GNU Libidn2.])
    AC_MSG_RESULT($ac_cv_lib_idn2_idn2_to_ascii_lz)
  else
    if test "$ac_cv_lib_idn_idna_to_ascii_lz" = yes \
	&& test "$ac_cv_header_idna_h" = yes; then
      AC_DEFINE(HAVE_IDN, 1, [Define to 1 for use of GNU Libidn.])
      AC_MSG_RESULT($ac_cv_lib_idn_idna_to_ascii_lz)
    else
      AC_MSG_RESULT([no])
      INCIDN= LIBIDN=
    fi
  fi
  CPPFLAGS=$save_CPPFLAGS
fi
AC_SUBST([LIBIDN])
AC_SUBST([INCIDN])
])# IU_CHECK_LIBIDN