OSDN Git Service

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