Imported Upstream version 0.2.6
[platform/upstream/libdatrie.git] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ(2.59)
5 AC_INIT(libdatrie, 0.2.6, thep@linux.thai.net)
6 AC_CONFIG_SRCDIR([datrie/trie.h])
7 AC_CONFIG_HEADER([config.h])
8 AC_CONFIG_MACRO_DIR([m4])
9
10 AM_INIT_AUTOMAKE(dist-xz no-dist-gzip)
11
12 # Library versioning
13 # Library code modified:                    REVISION++
14 # Interfaces added:              CURRENT++  REVISION=0  AGE++
15 # Interfaces changed/removed:    CURRENT++  REVISION=0  AGE=0
16 LT_CURRENT=3
17 LT_REVISION=0
18 LT_AGE=2
19 AC_SUBST(LT_CURRENT)
20 AC_SUBST(LT_REVISION)
21 AC_SUBST(LT_AGE)
22
23 # Checks for programs.
24 AC_PROG_CC
25 AC_PROG_INSTALL
26 AC_PROG_MAKE_SET
27 AC_LIBTOOL_WIN32_DLL
28 AC_PROG_LIBTOOL
29
30 # Whether linker support --version-script option
31 echo '{global:hello; local:*;};' > conftest.ver
32 AC_LIBTOOL_LINKER_OPTION(
33   [whether linker supports -version-script],
34   datrie_cv_have_version_script,
35   [-Wl,-version-script -Wl,conftest.ver])
36
37 AM_CONDITIONAL(LD_HAS_VERSION_SCRIPT,
38                test "$datrie_cv_have_version_script" = "yes")
39
40 # Checks for libraries.
41
42 #
43 # Checks for iconv
44 #
45 found_iconv=no
46 # Check in the C library first
47 AC_CHECK_FUNC(iconv_open, [with_libiconv=no; found_iconv=yes])
48 # Check if we have GNU libiconv
49 if test $found_iconv = "no"; then
50   AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes])
51 fi
52 # Check if we have a iconv in -liconv, possibly from vendor
53 if test $found_iconv = "no"; then
54   AC_CHECK_LIB(iconv, iconv_open, [with_libiconv=native; found_iconv=yes])
55 fi
56 if test $found_iconv = "no"; then
57   AC_MSG_ERROR([*** No usable iconv() implementation found])
58 fi
59
60 case $with_libiconv in
61   gnu|native)
62     ICONV_LIBS="-liconv"
63     ;;
64 esac
65 AC_SUBST(ICONV_LIBS)
66
67 #
68 # Checks for locale_charset() and nl_langinfo(CODESET)
69 #
70 AC_CHECK_LIB(iconv, locale_charset,
71              [have_locale_charset=yes], [have_locale_charset=no])
72 if test x$have_locale_charset = xyes; then
73   AC_DEFINE(HAVE_LOCALE_CHARSET,1,[Have locale_charset()])
74 fi
75 AC_CACHE_CHECK(
76   [for nl_langinfo (CODESET)], datrie_cv_langinfo_codeset,
77   [AC_TRY_COMPILE([#include <langinfo.h>],
78     [char *codeset = nl_langinfo (CODESET);],
79     [datrie_cv_langinfo_codeset=yes],
80     [datrie_cv_langinfo_codeset=no])]
81 )
82 if test x$datrie_cv_langinfo_codeset = xyes; then
83   AC_DEFINE(HAVE_LANGINFO_CODESET,1,[Have nl_langinfo (CODESET)])
84 fi
85 if test x$have_locale_charset = xno && test x$datrie_cv_langinfo_codeset = xno
86 then
87   AC_MSG_ERROR([*** No locale_charset() nor nl_langinfo(CODESET) found.
88 Please consider installing GNU libiconv.])
89 fi
90
91
92 # Checks for header files.
93 AC_HEADER_STDC
94 AC_CHECK_HEADERS([limits.h stdlib.h stdio.h string.h])
95
96 # Checks for typedefs, structures, and compiler characteristics.
97 AC_C_CONST
98 AC_TYPE_SIZE_T
99
100 dnl Disable doc generation with doxygen option
101 AC_ARG_ENABLE(doxygen-doc,
102               [AC_HELP_STRING([--disable-doxygen-doc],
103                               [disable document generation with doxygen])],
104               , enable_doxygen_doc="yes")
105
106 if test "x$enable_doxygen_doc" = "xyes"; then
107   AC_CHECK_PROG(DOXYGEN,doxygen,doxygen,no)
108   if test "x$DOXYGEN" = "xno"; then
109     enable_doxygen_doc="no"
110   fi
111 fi
112
113 dnl where to install the doxygen-generated HTML doc
114 AC_ARG_WITH(html-docdir,
115             [AC_HELP_STRING([--with-html-docdir=DIR],
116                             [where to install the doxyten-generated HTML doc [PREFIX/share/doc/datrie/html]])],
117             [htmldocdir="$withval"], [htmldocdir=\$\{prefix\}/share/doc/datrie/html])
118 AC_SUBST(htmldocdir)
119
120 AM_CONDITIONAL(ENABLE_DOXYGEN_DOC,test "x$enable_doxygen_doc" = "xyes")
121
122 # Checks for library functions.
123 AC_FUNC_MALLOC
124
125 AC_CONFIG_FILES([Makefile
126                  datrie-0.2.pc
127                  datrie/Makefile
128                  tools/Makefile
129                  man/Makefile
130                  doc/Makefile
131                  doc/Doxyfile])
132 AC_OUTPUT