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