add libpinyin.spec.in
[platform/upstream/libpinyin.git] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4
5 AC_PREREQ(2.60)
6 AC_INIT(libpinyin, 0.2.99, alexepico@gmail.com)
7 AM_INIT_AUTOMAKE
8 AC_CONFIG_SRCDIR([config.h.in])
9 AC_CONFIG_HEADER([config.h])
10
11 # Define a string for binary compatibility
12 LIBPINYIN_BINARY_VERSION=0.3
13 AC_SUBST(LIBPINYIN_BINARY_VERSION)
14
15 # Checks for programs.
16 AC_PROG_CXX
17 AC_PROG_CC
18 AC_PROG_CPP
19 AC_PROG_INSTALL
20 AC_PROG_LN_S
21 AC_PROG_MAKE_SET
22
23 AC_GNU_SOURCE
24
25 # Init libtool
26 AC_LIBTOOL_WIN32_DLL
27 AC_LIBTOOL_DLOPEN
28 AC_PROG_LIBTOOL
29 AC_LIB_LTDL
30 AC_SUBST(LIBTOOL_DEPS)
31
32 # libtool option to control which symbols are exported
33 # right now, symbols starting with _ are not exported
34 LIBTOOL_EXPORT_OPTIONS='-export-symbols-regex "^[[^_]].*"'
35 AC_SUBST(LIBTOOL_EXPORT_OPTIONS)
36
37 # Checks for libraries.
38 PKG_CHECK_MODULES(GLIB2, [glib-2.0 >= 2.4.0])
39
40 GLIB2_CPPFLAGS=`$PKG_CONFIG --cflags glib-2.0`
41
42 AC_SUBST(GLIB2_CPPFLAGS)
43
44 GLIB2_LDFLAGS=`$PKG_CONFIG --libs glib-2.0`
45
46 AC_SUBST(GLIB2_LDFLAGS)
47
48 # Checks for header files.
49 AC_HEADER_STDC
50 AC_CHECK_HEADERS([locale.h stdlib.h string.h sys/time.h unistd.h])
51
52 # Checks for typedefs, structures, and compiler characteristics.
53 AC_HEADER_STDBOOL
54 AC_C_CONST
55 AC_C_INLINE
56 AC_TYPE_SIZE_T
57 AC_HEADER_TIME
58
59 # Checks for library functions.
60 AC_FUNC_MALLOC
61 AC_FUNC_MEMCMP
62 AC_FUNC_REALLOC
63 AC_FUNC_STAT
64 AC_CHECK_FUNCS([gettimeofday memmove memset setlocale])
65
66 AC_CHECK_HEADERS([libintl.h string.h])
67
68 AC_CHECK_HEADER([db.h], [], AC_MSG_ERROR([Cannot find Berkeley DB library version 4]))
69
70 AC_SEARCH_LIBS([db_create], [db], [], AC_MSG_ERROR([Cannot find Berkeley DB library version 4]))
71
72
73 AC_CONFIG_FILES([libpinyin.pc
74                  libpinyin.spec
75                  Makefile
76                  data/Makefile
77                  src/Makefile
78                  src/include/Makefile
79                  src/storage/Makefile
80                  src/lookup/Makefile
81                  tests/Makefile
82                  tests/include/Makefile
83                  tests/storage/Makefile
84                  tests/lookup/Makefile
85                  utils/Makefile
86                  utils/storage/Makefile
87                  utils/segment/Makefile
88                  utils/training/Makefile
89 ])
90
91 AC_OUTPUT
92
93 AC_MSG_RESULT([
94 Build options:
95     Version                     $VERSION
96     Install prefix              $prefix
97 ])