Upgrade to gettext 0.10.38.
[gedcom-parse.git] / acinclude.m4
1 dnl $Id$
2 dnl $Name$
3
4 dnl From codeset.m4 (in libcharset):
5 #serial 2
6
7 dnl From Bruno Haible.
8
9 AC_DEFUN(jm_LANGINFO_CODESET,
10 [
11   AC_CHECK_HEADERS(langinfo.h)
12   AC_CHECK_FUNCS(nl_langinfo)
13
14   AC_CACHE_CHECK([for nl_langinfo and CODESET], jm_cv_langinfo_codeset,
15     [AC_TRY_LINK([#include <langinfo.h>],
16       [char* cs = nl_langinfo(CODESET);],
17       jm_cv_langinfo_codeset=yes,
18       jm_cv_langinfo_codeset=no)
19     ])
20   if test $jm_cv_langinfo_codeset = yes; then
21     AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
22       [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
23   fi
24 ])
25
26 dnl From glibc21.m4 (in libcharset):
27 #serial 2
28
29 # Test for the GNU C Library, version 2.1 or newer.
30 # From Bruno Haible.
31
32 AC_DEFUN(jm_GLIBC21,
33   [
34     AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
35       ac_cv_gnu_library_2_1,
36       [AC_EGREP_CPP([Lucky GNU user],
37         [
38 #include <features.h>
39 #ifdef __GNU_LIBRARY__
40  #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
41   Lucky GNU user
42  #endif
43 #endif
44         ],
45         ac_cv_gnu_library_2_1=yes,
46         ac_cv_gnu_library_2_1=no)
47       ]
48     )
49     AC_SUBST(GLIBC21)
50     GLIBC21="$ac_cv_gnu_library_2_1"
51   ]
52 )
53
54 dnl Own functions
55 dnl AC_GLIBC_ICONV()
56 dnl Checks whether iconv is coming from glibc, defines USE_GLIBC_ICONV if so
57 dnl The variable $is_glibc_iconv contains yes or no
58 AC_DEFUN(AC_GLIBC_ICONV, [
59   AC_CACHE_CHECK(for the GNU C Library iconv implementation, is_glibc_iconv, [
60     AC_EGREP_CPP(yes,
61     [
62 #include <iconv.h>
63 #ifdef __GLIBC__
64 yes
65 #endif
66     ], is_glibc_iconv=yes, is_glibc_iconv=no)
67   ])
68   if test "$is_glibc_iconv" = yes; then
69     AC_DEFINE(USE_GLIBC_ICONV,1,
70       [Define if the GNU implementation of iconv in glibc is used])
71   fi
72 ])
73
74 dnl AC_LIBICONV_HAS_ANSEL()
75 dnl Checks whether libiconv has ANSEL support
76 dnl The variable $is_ansel_supported contains yes or no
77 AC_DEFUN(AC_LIBICONV_HAS_ANSEL, [
78   AC_CACHE_CHECK(for ANSEL support in libiconv, is_ansel_supported, [
79     my_save_LIBS="$LIBS"
80     LIBS="$LIBS $LIBICONV"
81     AC_TRY_RUN([
82 #include <iconv.h>
83 int main() {
84   iconv_t cd = iconv_open("UTF-8","ANSEL");
85   return (cd == (iconv_t)-1);
86 }
87     ],
88     is_ansel_supported=yes,
89     is_ansel_supported=no,
90     is_ansel_supported=no)
91     LIBS="$my_save_LIBS"
92   ])
93 ])