1 # 2 # CDDL HEADER START 3 # 4 # The contents of this file are subject to the terms of the 5 # Common Development and Distribution License (the "License"). 6 # You may not use this file except in compliance with the License. 7 # 8 # You can obtain a copy of the license at sunpinyin/OPENSOLARIS.LICENSE 9 # or http://www.opensolaris.org/os/licensing. 10 # See the License for the specific language governing permissions 11 # and limitations under the License. 12 # 13 # When distributing Covered Code, include this CDDL HEADER in each 14 # file and include the License file at sunpinyin/OPENSOLARIS.LICENSE. 15 # If applicable, add the following below this CDDL HEADER, with the 16 # fields enclosed by brackets "[]" replaced with your own identifying 17 # information: Portions Copyright [yyyy] [name of copyright owner] 18 # 19 # CDDL HEADER END 20 # 21 # Copyright 2007 Sun Microsystems, Inc. All rights reserved. 22 # Use is subject to license terms. 23 # 24 # Process this file with autoconf to produce a configure script. 25 AC_INIT(sunpinyin, 1.0) 26 AC_CANONICAL_SYSTEM() 27 AC_PREFIX_DEFAULT([/usr]) 28 AC_CONFIG_SRCDIR(src/lattice_states.cpp) 29 AM_CONFIG_HEADER(config.h) 30 31 GETTEXT_PACKAGE=sunpinyin 32 AC_SUBST(GETTEXT_PACKAGE) 33 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [The gettext domain]) 34 35 dnl Init gettext 36 ALL_LINGUAS="zh_CN" 37 AM_GLIB_GNU_GETTEXT 38 39 LTLIBINTL= 40 AC_SUBST(LTLIBINTL) 41 42 AC_LANG(C++) 43 44 dnl AC_C_BIGENDIAN defines WORDS_BIGENDIAN if it is true by default 45 AC_C_BIGENDIAN 46 AC_C_BIGENDIAN([my_host_endian=be],[my_host_endian=le],[ 47 AC_MSG_ERROR([Cannot determine endianness])]) 48 49 case "${host_os}" in 50 *linux*) 51 my_host_os=linux 52 my_ld_flag="" 53 ;; 54 *solaris*) 55 my_host_os=solaris 56 my_ld_flag="-L/usr/lib -R/usr/lib -lm -norunpath" 57 ;; 58 *darwin*) 59 my_host_os=mac 60 my_ld_flag="" 61 ;; 62 *beos*|*haiku*) 63 my_host_os=beos 64 my_ld_flag="" 65 ;; 66 esac 67 68 AC_LINK_FILES(data/lm_sc.t3g.${my_host_endian}, data/lm_sc.t3g) 69 AC_LINK_FILES(data/pydict_sc.bin.${my_host_endian}, data/pydict_sc.bin) 70 AC_LINK_FILES(src/config/${my_host_os}.h, src/host_os.h) 71 72 MY_HOST_OS="${my_host_os}" 73 AC_SUBST(MY_HOST_OS) 74 75 MY_INC_FLAG="${my_inc_flag}" 76 AC_SUBST(MY_INC_FLAG) 77 78 79 dnl----------------------------------------------------------------------- 80 dnl --enable-debug 81 dnl----------------------------------------------------------------------- 82 AC_ARG_ENABLE([debug], 83 AC_HELP_STRING([--enable-debug], [compile in debug mode (default no) ]), 84 [DEBUGMODE="${enableval}"], 85 [DEBUGMODE="no"]) 86 87 if test "X$DEBUGMODE" = "Xyes" ; then 88 AC_DEFINE(DEBUG, 1, [Define if you want to make for debugging.]) 89 fi 90 91 AC_ARG_WITH([sunpinyin-datadir], 92 AC_HELP_STRING([--with-sunpinyin-datadir=PATH], 93 [specify the directory where the lexicon data is installed]), 94 [SUNPINYIN_DATADIR="${withval}"], 95 [SUNPINYIN_DATADIR=""]) 96 AC_SUBST(SUNPINYIN_DATADIR) 97 98 AC_ARG_ENABLE([cle], 99 AC_HELP_STRING([--enable-cle], [compile as cle IME (default=auto), multiple wrappers could be compiled together ]), 100 [ENABLE_CLE="${enableval}"], 101 [ENABLE_CLE="auto"]) 102 if test "X${ENABLE_CLE}" = "Xauto" ; then 103 case "${host_os}" in 104 *beos*|*haiku*) 105 ENABLE_CLE="no" 106 ;; 107 *) 108 ENABLE_CLE="yes" 109 ;; 110 esac 111 fi 112 AM_CONDITIONAL(WRAPPER_CLE, [test "X${ENABLE_CLE}" = "Xyes"]) 113 114 AC_ARG_ENABLE([gtkstandalone], 115 AC_HELP_STRING([--enable-gtkstandalone], [compile standalone gtk program for demo/debug(default=no) ]), 116 [ENABLE_GTKSTANDALONE="${enableval}"], 117 [ENABLE_GTKSTANDALONE="no"]) 118 AM_CONDITIONAL(WRAPPER_GTK_STANDALONE, [test "X${ENABLE_GTKSTANDALONE}" = "Xyes"]) 119 120 AC_ARG_ENABLE([scim], 121 AC_HELP_STRING([--enable-scim], [compile as scim (default=no) ]), 122 [ENABLE_SCIM="${enableval}"], 123 [ENABLE_SCIM="no"]) 124 125 if test "X${ENABLE_SCIM}" = "Xyes" ; then 126 # Check SCIM 127 SCIM_VERSION=1.4.0 128 AC_SUBST(SCIM_VERSION) 129 PKG_CHECK_MODULES(SCIM,[scim >= $SCIM_VERSION]) 130 131 # Check if we should build setup module 132 PKG_CHECK_MODULES(SCIM_GTKUTILS,[scim-gtkutils >= $SCIM_VERSION], 133 [SCIM_HAS_GTKUTILS=yes], 134 [SCIM_HAS_GTKUTILS=no]) 135 136 # Set paths 137 SCIM_ICONDIR=`$PKG_CONFIG --variable=icondir scim` 138 SCIM_MODULEDIR=`$PKG_CONFIG --variable=moduledir scim` 139 SCIM_DATADIR=`$PKG_CONFIG --variable=scimdatadir scim` 140 SCIM_SUNPINYIN_DATADIR=$SCIM_DATADIR/sunpinyin 141 AC_SUBST(SCIM_ICONDIR) 142 AC_SUBST(SCIM_MODULEDIR) 143 AC_SUBST(SCIM_DATADIR) 144 AC_SUBST(SCIM_SUNPINYIN_DATADIR) 145 fi 146 AM_CONDITIONAL(WRAPPER_SCIM, [test "X${ENABLE_SCIM}" = "Xyes"]) 147 148 AM_CONDITIONAL(SCIM_BUILD_SETUP, [test "X$SCIM_HAS_GTKUTILS" = "Xyes"]) 149 150 dnl override the default setting of DATADIRs 151 if test "x$SUNPINYIN_DATADIR" != "x" ; then 152 SCIM_SUNPINYIN_DATADIR="$SUNPINYIN_DATADIR" 153 CLE_SUNPINYIN_DATADIR="$SUNPINYIN_DATADIR" 154 AC_SUBST(SCIM_SUNPINYIN_DATADIR) 155 AC_SUBST(CLE_SUNPINYIN_DATADIR) 156 fi 157 158 AM_CONDITIONAL(OVERRIDE_DEFAULT_PINYINDATADIR, [test "x${SUNPINYIN_DATADIR}" != "x"]) 159 160 AC_ARG_ENABLE([bestandalone], 161 AC_HELP_STRING([--enable-bestandalone], [compile standalone program by BeAPI for demo/debug(default=no) ]), 162 [ENABLE_BE_STANDALONE="${enableval}"], 163 [ENABLE_BE_STANDALONE="no"]) 164 if test "x${ENABLE_BE_STANDALONE}" = "xyes" ; then 165 if test "$my_host_os" != "beos" ; then 166 AC_CHECK_TOOL(LITE_BEAPI_CONFIG, lite-beapi-config) 167 if test "x$ac_ct_LITE_BEAPI_CONFIG" != "x" ; then 168 LITE_BEAPI_CFLAGS=`$LITE_BEAPI_CONFIG --cflags` 169 LITE_BEAPI_LIBS=`$LITE_BEAPI_CONFIG --libs` 170 AC_SUBST(LITE_BEAPI_CFLAGS) 171 AC_SUBST(LITE_BEAPI_LIBS) 172 else 173 ENABLE_BE_STANDALONE="no" 174 fi 175 fi 176 fi 177 AM_CONDITIONAL(HAVE_LITE_BEAPI, [test "x$ac_ct_LITE_BEAPI_CONFIG" != "x"]) 178 AM_CONDITIONAL(WRAPPER_BE_STANDALONE, [test "X${ENABLE_BE_STANDALONE}" = "Xyes"]) 179 180 181 AC_ARG_ENABLE([becjk-module], 182 AC_HELP_STRING([--enable-becjk-module], [compile as module for BeCJK (default=auto) ]), 183 [ENABLE_BECJK_MODULE="${enableval}"], 184 [ENABLE_BECJK_MODULE="auto"]) 185 if test "X${ENABLE_BECJK_MODULE}" = "Xauto" || test "X${ENABLE_BECJK_MODULE}" = "Xyes"; then 186 AC_CHECK_HEADER(becjk/BeCJKInputModule.h) 187 if test "x$ac_cv_header_becjk_BeCJKInputModule_h" != "xyes" ; then 188 if test "x${ENABLE_BECJK_MODULE}" = "xyes" ; then 189 AC_MSG_ERROR([ 190 *** You do not have development kit of BeCJK on your computer. 191 *** You can get development kit of BeCJK by downloading following package. 192 *** http://etkxx.gro.clinux.org/beos/BeCJK-1.0-devel-20080124.zip 193 *** or 194 *** http://etkxx.gro.clinux.org/beos/BeCJK-1.0-src-20080124.zip]) 195 fi 196 else 197 ENABLE_BECJK_MODULE="yes" 198 fi 199 fi 200 AM_CONDITIONAL(WRAPPER_BECJK_MODULE, [test "X${ENABLE_BECJK_MODULE}" = "Xyes"]) 201 202 203 AM_CONDITIONAL(WRAPPER_BEOS, [test "X${ENABLE_BE_STANDALONE}" = "Xyes" || test "X${ENABLE_BECJK_MODULE}" = "Xyes"]) 204 205 206 AM_INIT_AUTOMAKE 207 208 # Check for programs 209 AC_PROG_CC 210 AC_PROG_CXX 211 AC_PROG_INSTALL 212 AC_PROG_LIBTOOL 213 214 # Checks for libraries. 215 216 # Checks for header files. 217 AC_PATH_X 218 AC_HEADER_STDC 219 AC_CHECK_HEADERS(assert.h iconv.h fcntl.h locale.h stdlib.h string.h unistd.h libintl.h sys/mman.h) 220 221 # Checks for typedefs, structures, and compiler characteristics. 222 AC_C_CONST 223 AC_C_INLINE 224 AC_TYPE_SIZE_T 225 226 # Checks for library functions. 227 AC_FUNC_MMAP 228 AC_CHECK_FUNCS(memset munmap setlocale strdup log2 exp2) 229 230 have_iconv=no 231 AC_MSG_CHECKING(for iconv) 232 for iconv_lib in none iconv ; do 233 save_LIBS="$LIBS" 234 if test "$iconv_lib" != "none" ; then 235 LIBS="$LIBS -l$iconv_lib" 236 fi 237 AC_TRY_LINK( 238 [#include <iconv.h>], 239 [iconv_t ic = iconv_open("UTF-16", "UTF-8")], 240 have_iconv=yes, 241 have_iconv=no) 242 LIBS="$save_LIBS" 243 if test $have_iconv = yes; then 244 AC_DEFINE(HAVE_ICONV_H, 1, [Define if you have the 'iconv.h'.]) 245 if test "$iconv_lib" != "none" ; then 246 LIBS="$LIBS -l$iconv_lib" 247 fi 248 break 249 fi 250 done 251 AC_MSG_RESULT($have_iconv) 252 253 if test "x$gt_cv_have_gettext" != "xyes" ; then 254 USE_NLS=no 255 fi 256 AC_SUBST(USE_NLS) 257 258 AC_CONFIG_FILES([Makefile 259 iiim/Makefile 260 iiim/cle/Makefile 261 wrapper/Makefile 262 wrapper/cle/Makefile 263 wrapper/gtk_standalone/Makefile 264 wrapper/scim/Makefile 265 wrapper/beos/Makefile 266 data/Makefile 267 po/Makefile.in]) 268 AC_OUTPUT 269 270