OSDN Git Service

chasen-2.4.3-preview3
[chasen-legacy/chasen.git] / configure.in
1 AC_INIT(README)
2 AC_PREREQ(2.59)
3 AM_INIT_AUTOMAKE(chasen, 2.4.3-preview3)
4 AM_CONFIG_HEADER(config.h)
5 AM_MAINTAINER_MODE
6
7 AC_PROG_CC
8 AC_PROG_CXX
9 AM_PROG_LIBTOOL
10 AC_PROG_CPP
11 AC_PROG_INSTALL
12 AC_PROG_LEX
13 AC_PROG_LN_S
14 AC_PROG_MAKE_SET
15
16 # Before making a release, the LTVERSION string should be modified.
17 # The string is of the form C:R:A.
18 # - If interfaces have been changed or added, but binary compatibility has
19 #   been preserved, change to C+1:0:A+1
20 # - If binary compatibility has been broken (eg removed or changed interfaces)
21 #   change to C+1:0:0
22 # - If the interface is the same as the previous version, change to C:R+1:A
23 LTVERSION="2:4:0"
24 AC_SUBST(LTVERSION)
25
26 dnl Checks for programs.
27 AC_ISC_POSIX
28 AC_PROG_INSTALL
29 AC_PROG_MAKE_SET
30
31 dnl Checks for header files.
32 AC_HEADER_STDC
33 AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h sys/param.h unistd.h])
34 AC_CHECK_HEADERS([sys/param.h sys/types.h netinet/in.h])
35 AC_CHECK_HEADERS([io.h windows.h])
36
37 # Checks for typedefs, structures, and compiler characteristics.
38 AC_C_CONST
39 AC_TYPE_OFF_T
40 AC_TYPE_SIZE_T
41
42 # Checks for library functions.
43 AC_FUNC_MALLOC
44 AC_FUNC_MEMCMP
45 AC_FUNC_MMAP
46 AC_FUNC_REALLOC
47 AC_FUNC_VPRINTF
48 AC_CHECK_FUNCS([mblen memset munmap strchr strpbrk strrchr])
49
50 AC_MSG_CHECKING([for darts.h])
51 AC_ARG_WITH(darts,
52     [  --with-darts=[DIR]      specify a path for the header file of Darts],
53     [if test "${with_darts}" = yes; then
54         vi_darts_path="/usr/local/include"
55      else
56         vi_darts_path=${with_darts}
57      fi
58      CXXFLAGS="${CXXFLAGS} -I${vi_darts_path}"
59     ])
60
61 AC_LANG_CPLUSPLUS
62
63 AC_CACHE_VAL(cl_cv_header_darts, [
64 AC_TRY_COMPILE([#include <darts.h>],[;], [cl_cv_header_darts=yes], [
65     AC_MSG_ERROR(no header of Darts. You need to get darts-0.32 or higher from http://chasen.org/~taku/software/darts/.)])])
66 AC_MSG_RESULT($cl_cv_header_darts)
67 AC_CACHE_VAL(cl_cv_header_darts_version, [
68     AC_EGREP_HEADER([DARTS_VERSION \"0.3[23456789]\"],darts.h,cl_cv_header_darts_version=yes,[AC_MSG_ERROR(an old version of darts.h is found. You need to get darts-0.32 or higher from http://chasen.org/~taku/software/darts/.)])])
69
70 AC_MSG_RESULT(checking for darts.h version >= 0.32... $cl_cv_header_darts_version)
71 AC_LANG_C
72
73 AC_ARG_WITH(libiconv,
74     [  --with-libiconv=[DIR]   use libiconv [in DIR]],
75     [if test x"${with_libiconv}" != x ; then
76         ICONV_CFLAGS="-I${with_libiconv}/include"
77         LIBS="$LIBS -L${with_libiconv}/lib"
78         AC_SUBST(ICONV_CFLAGS)
79      fi])
80
81 AC_CHECK_LIB(iconv, iconv, [], [
82         AC_CHECK_HEADER(iconv.h, [], AC_MSG_ERROR([ChaSen needs iconv]))])
83
84 AC_DEFUN(cl_VAR_ICONV_ARG, [
85      for CODE in $2; do
86        if (echo | iconv -f ${CODE} -t 'UTF-8' > iconv_test 2>&1); then
87          vi_iconv_arg_$1=${CODE}; break
88      fi;
89      done
90      rm -f iconv_test
91      if test x"$vi_iconv_arg_$1" = x; then
92          AC_MSG_ERROR($3)
93      fi
94      AC_DEFINE_UNQUOTED(ICONV_$1, "$vi_iconv_arg_$1")
95      ])
96
97 AC_MSG_CHECKING([iconv args])
98 cl_VAR_ICONV_ARG(EUCJP, [EUC-JP EUCJP eucJP], [cannot use EUC-JP with iconv])
99 cl_VAR_ICONV_ARG(SJIS, [SHIFT_JIS SHIFT-JIS SJIS],
100     [cannot use Shift_JIS with iconv])
101 cl_VAR_ICONV_ARG(88591, [ISO-8859-1 ISO_8859-1 8859-1 ISO8859-1],
102     [cannot use ISO-8859-1 with iconv])
103 AC_MSG_RESULT([$vi_iconv_arg_EUCJP $vi_iconv_arg_SJIS $vi_iconv_arg_88591])
104
105 dnl Checks for typedefs, structures, and compiler characteristics.
106 AC_TYPE_OFF_T
107 AC_TYPE_SIZE_T
108
109 dnl Checks for library functions.
110 AC_FUNC_MEMCMP
111 AC_FUNC_MMAP
112
113 case "$host_os" in
114     mingw* | os2*)
115     RCPATH='c:\\\\Program Files\\\\chasen\\\\etc\\\\chasenrc'
116     ;;
117     *)
118     # UNIX like-system
119     RCPATH="$sysconfdir/chasenrc"
120     ;;
121 esac
122 AC_SUBST(RCPATH)
123
124 if test -n "${GCC}"; then
125         CFLAGS="${CFLAGS} -Wall"
126 fi
127
128
129 AC_OUTPUT([ 
130             Makefile 
131             chasen-config
132             chasen/Makefile
133             mkchadic/Makefile
134             doc/Makefile 
135             lib/Makefile
136             tests/Makefile
137             chasen.spec
138           ],
139           [chmod +x chasen-config])
140
141
142 # removed the following entry from AC_OUTPUT
143 #           lib/Makefile.mingw32
144
145 # Local Variables:
146 # mode:shell-script
147 # sh-indentation:4
148 # End: