1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
|
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.65])
# Update CMakeLists.txt if version is changed.
AC_INIT([libchewing],[0.4.0],[chewing-devel@googlegroups.com])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR([src/chewingio.c])
AC_CONFIG_MACRO_DIR([m4])
AC_SUBST(PACKAGE_VERSION)
# libtool versioning for libchewing
# Update CMakeLists.txt if one of MAJOR/MINOR/REVISION is updated.
#
# We use major/minor/revision instead of current/revision/age format here is due
# to buggy behavior in libtool in BSD family. See the following link for detail
# information.
#
# https://lists.gnu.org/archive/html/bug-libtool/2011-05/msg00007.html
#
# The following link shows versioning policies in FreeBSD for your reference.
#
# http://www.freebsd.org/doc/en/books/developers-handbook/policies-shlib.html
# increment if the interface has incompatible update (changes, removals).
LIBCHEWING_MAJOR=3
# increment if the inteface has compatible update (additions).
# Set to 0 if MAJOR is increased.
LIBCHEWING_MINOR=2
# increment any time the source changes
# Set to 0 if MAJOR or MINOR is increased.
LIBCHEWING_REVISION=0
AC_SUBST(LIBCHEWING_MAJOR)
AC_SUBST(LIBCHEWING_MINOR)
AC_SUBST(LIBCHEWING_REVISION)
# Define a string for the earliest version that this release has
# binary compatibility with. This is used for module locations.
#
# Update CMakeFiles.txt if LIBCHEWING_BINARY_VERSION is changed.
LIBCHEWING_BINARY_VERSION=1.0.0
AC_SUBST(LIBCHEWING_BINARY_VERSION)
AC_DEFINE_UNQUOTED(LIBCHEWING_BINARY_VERSION,
"$LIBCHEWING_BINARY_VERSION", [The binary version of libchewing.])
AC_DEFINE_UNQUOTED(LIBCHEWING_VERSION,
"$PACKAGE_VERSION", [The release version of libchewing.])
# Init automake stuff
AM_INIT_AUTOMAKE
AM_SILENT_RULES([yes])
AC_CONFIG_HEADERS([include/config.h])
# Init libtool
LT_INIT([win32-dll])
# libtool option to control which symbols are exported
# right now, symbols starting with _ are not exported
AC_SUBST(LIBTOOL_EXPORT_OPTIONS, ['-export-symbols-regex "^[[^_]].*"'])
# Checks for programs.
AC_PROG_CC
AC_PROG_CC_C99
AM_PROG_CC_C_O
AC_LANG(C)
AC_C_BIGENDIAN
# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([strtok_r asprintf])
# options
AC_ARG_WITH([sqlite3],
AS_HELP_STRING([--with-sqlite3], [Use sqlite3 to store userphrase @<:@default=yes@:>@]),
[],
[with_sqlite3=yes])
AM_CONDITIONAL([WITH_SQLITE3], [test x"$with_sqlite3" == x"yes"])
AC_ARG_WITH([internal-sqlite3],
AS_HELP_STRING([--with-internal-sqlite3], [Use internal sqlite3 instead of system-wide @<:@default=no@:>@]),
[],
[with_internal_sqlite3=no])
AM_CONDITIONAL([WITH_INTERNAL_SQLITE3], [test x"$with_internal_sqlite3" == x"yes"])
# for sqlite
AS_IF([test x"$with_sqlite3" == x"yes"], [
AC_DEFINE([WITH_SQLITE3], [1], [Use sqlite3 to store userphrase])
AS_IF([test x"$with_internal_sqlite3" == x"no"],
[
AC_SEARCH_LIBS([sqlite3_open], [sqlite3],
[AS_IF([test x$ac_cv_search_sqlite3_open != x"none required"],
[AM_LDFLAGS="$AM_LDFLAGS $ac_cv_search_sqlite3_open"])],
[AC_MSG_ERROR([unable to find the sqlite3() function])])
],
[
AC_SEARCH_LIBS([dlopen], [dl dld],
[AS_IF([test x$ac_cv_search_dlopen != x"none required"],
[AM_LDFLAGS="$AM_LDFLAGS $ac_cv_search_dlopen"])],
[AC_MSG_ERROR([unable to find the dlopen() function])])
AX_PTHREAD([
AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
AM_LDFLAGS="$AM_LDFLAGS $PTHREAD_LIBS"
], [AC_MSG_ERROR([cannot find pthread])])
])
])
# plat_mmap_posix
AC_FUNC_MMAP
# chewing-utf8-util.h
AC_TYPE_SIZE_T
# chewing-private.h
AC_C_INLINE
AC_TYPE_UINT16_T
CC_FOR_BUILD=${CC_FOR_BUILD-${CC}}
AC_SUBST(CC_FOR_BUILD)
# Default CFLAGS
AM_CFLAGS="$AM_CFLAGS -Wall $CFLAGS"
# Add '_GNU_SOURCE' for asprintf
AS_IF([test x$ac_cv_func_asprintf == xyes],
[DEFAULT_CPPFLAGS="$DEFAULT_CPPFLAGS -D_GNU_SOURCE"])
AX_WITH_CURSES
AM_CONDITIONAL([ENABLE_TEXT_UI], [test x$ax_cv_ncursesw = "xyes"])
# Options
dnl Enable gcov for coverage test
AC_ARG_ENABLE([gcov],
[AS_HELP_STRING([--enable-gcov], [Turn on gcov support @<:@default=no@:>@])],
[AS_CASE([${enableval}], [yes], [ENABLE_GCOV="true"], [ENABLE_GCOV="false"])],
[ENABLE_GCOV="false"])
AS_IF([test x$ENABLE_GCOV = x"true"], [AM_CFLAGS="$AM_CFLAGS --coverage"])
dnl Adds -fvisibility=hidden to CFLAGS if running with gcc 4 or greater.
AC_MSG_CHECKING([whether the compiler supports GCC Visibility])
dnl Check for gcc4 or greater
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
void
#if defined(__GNUC__) && (__GNUC__ >= 4)
foo () {};
#endif
]], [[]])],[
has_visibility=yes
AM_CFLAGS="$AM_CFLAGS -fvisibility=hidden"
],[
has_visibility=no
])
AC_MSG_RESULT($has_visibility)
# Platform-dependent
dnl What kind of system are we using?
case $host_os in
win*|mingw*)
SYSTEM=windows
;;
cygwin*)
SYSTEM=unix
;;
*)
SYSTEM=unix
;;
esac
case $SYSTEM in
win)
AC_DEFINE(UNDER_WINDOWS, 1,
[Runtime is under Win32 environment])
;;
unix)
AC_DEFINE(UNDER_POSIX, 1,
[Runtime is under POSIX environment])
;;
esac
AC_SUBST(AM_CFLAGS)
AC_SUBST(AM_LDFLAGS)
AC_SUBST(DEFAULT_CPPFLAGS)
AC_CONFIG_LINKS([
data/pinyin.tab:data/pinyin.tab
data/swkb.dat:data/swkb.dat
data/symbols.dat:data/symbols.dat
test/stresstest.py:test/stresstest.py
])
AC_CONFIG_FILES([
Makefile
chewing.pc
data/Makefile
doc/Makefile
libchewing.spec
src/Makefile
src/common/Makefile
src/porting_layer/Makefile
src/porting_layer/src/Makefile
src/tools/Makefile
test/Makefile
])
AC_OUTPUT
AC_MSG_RESULT([
Build options:
Build OS $build_os
Host OS $host_os
Version $PACKAGE_VERSION
Install prefix $prefix
Enable gcov $ENABLE_GCOV
With sqlite3 $with_sqlite3
With internal sqlite3 $with_internal_sqlite3
Build TextUI sample $ax_cv_ncursesw
Default CFLAGS $AM_CFLAGS
Default CPPFLAGS $DEFAULT_CPPFLAGS
Default LDFLAGS $AM_LDFLAGS
])
|