OSDN Git Service

*** empty log message ***
[chasen-legacy/chasen.git] / configure.in
1 AC_INIT(README)
2 AC_PREREQ(2.61)
3 AM_INIT_AUTOMAKE(chasen, 2.4.0)
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
27 dnl Checks for programs.
28 AC_ISC_POSIX
29 AC_PROG_INSTALL
30 AC_PROG_MAKE_SET
31
32 dnl Checks for header files.
33 AC_HEADER_STDC
34 AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h sys/param.h unistd.h])
35 AC_CHECK_HEADERS([sys/param.h sys/types.h netinet/in.h])
36 AC_CHECK_HEADERS([io.h windows.h])
37
38
39 # Checks for typedefs, structures, and compiler characteristics.
40 AC_C_CONST
41 AC_TYPE_OFF_T
42 AC_TYPE_SIZE_T
43
44 # Checks for library functions.
45 AC_FUNC_MALLOC
46 AC_FUNC_MEMCMP
47 AC_FUNC_MMAP
48 AC_FUNC_REALLOC
49 AC_FUNC_VPRINTF
50 AC_CHECK_FUNCS([mblen memset munmap strchr strpbrk strrchr])
51
52 AC_MSG_CHECKING([for darts.h])
53 AC_ARG_WITH(darts,
54     [  --with-darts=[DIR]      specify a path for the header file of Darts],
55     [if test "${with_darts}" = yes; then
56         vi_darts_path="/usr/local/include"
57      else
58         vi_darts_path=${with_darts}
59      fi
60      CXXFLAGS="${CXXFLAGS} -I${vi_darts_path}"
61     ])
62
63 AC_LANG_CPLUSPLUS
64
65 AC_CACHE_VAL(cl_cv_header_darts, [
66 AC_TRY_COMPILE([#include <darts.h>],[;], [cl_cv_header_darts=yes], [
67     AC_MSG_ERROR(no header of Darts. You need to fetch Darts from http://cl.aist-nara.ac.jp/~taku-ku/software/darts/.)])])
68 AC_MSG_RESULT($cl_cv_header_darts)
69 AC_LANG_C
70
71 AC_ARG_WITH(libiconv,
72     [  --with-libiconv=[DIR]   use libiconv [in DIR]],
73     [if test x"${with_libiconv}" != x ; then
74         ICONV_CFLAGS="-I${with_libiconv}/include"
75         LIBS="$LIBS -L${with_libiconv}/lib"
76         AC_SUBST(ICONV_CFLAGS)
77      fi])
78
79 AC_CHECK_LIB(iconv, iconv, [], [
80         AC_CHECK_HEADER(iconv.h, [], AC_MSG_ERROR([ChaSen needs iconv]))])
81
82 AC_DEFUN(cl_VAR_ICONV_ARG, [
83      for CODE in $2; do
84        if (echo | iconv -f ${CODE} -t 'UTF-8' > iconv_test 2>&1); then
85          vi_iconv_arg_$1=${CODE}; break
86      fi;
87      done
88      rm -f iconv_test
89      if test x"$vi_iconv_arg_$1" = x; then
90          AC_MSG_ERROR($3)
91      fi
92      AC_DEFINE_UNQUOTED(ICONV_$1, "$vi_iconv_arg_$1")
93      ])
94
95 AC_MSG_CHECKING([iconv args])
96 cl_VAR_ICONV_ARG(EUCJP, [EUC-JP EUCJP eucJP], [cannot use EUC-JP with iconv])
97 cl_VAR_ICONV_ARG(SJIS, [SHIFT_JIS SHIFT-JIS SJIS],
98     [cannot use Shift_JIS with iconv])
99 cl_VAR_ICONV_ARG(88591, [ISO-8859-1 ISO_8859-1 8859-1 ISO8859-1],
100     [cannot use ISO-8859-1 with iconv])
101 AC_MSG_RESULT([$vi_iconv_arg_EUCJP $vi_iconv_arg_SJIS $vi_iconv_arg_88591])
102
103 dnl Checks for typedefs, structures, and compiler characteristics.
104 AC_TYPE_OFF_T
105 AC_TYPE_SIZE_T
106
107 dnl Checks for library functions.
108 AC_FUNC_MEMCMP
109 AC_FUNC_MMAP
110
111 case "$host_os" in
112     mingw* | os2*)
113     RCPATH='c:\\\\Program Files\\\\chasen\\\\etc\\\\chasenrc'
114     ;;
115     *)
116     # UNIX like-system
117     RCPATH="$sysconfdir/chasenrc"
118     ;;
119 esac
120 AC_SUBST(RCPATH)
121
122 if test -n "${GCC}"; then
123         CFLAGS="${CFLAGS} -Wall"
124 fi
125
126
127 AC_OUTPUT([ 
128             Makefile 
129             chasen-config
130             chasen/Makefile
131             mkchadic/Makefile
132             doc/Makefile 
133             lib/Makefile
134             tests/Makefile
135             chasen.spec
136           ],
137           [chmod +x chasen-config])
138
139
140 # removed the following entry from AC_OUTPUT
141 #           lib/Makefile.mingw32
142
143 # Local Variables:
144 # mode:shell-script
145 # sh-indentation:4
146 # End: