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