OSDN Git Service

* update
[modchxj/mod_chxj.git] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3 AC_INIT([mod_chxj],[0.11.14-1])
4 AC_PREREQ(2.59)
5 AC_CONFIG_SRCDIR([src/mod_chxj.c])
6 AC_CANONICAL_TARGET
7 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
8 AM_CONFIG_HEADER(include/config.h)
9
10
11 # Checks for programs.
12 AC_PROG_CC
13 AC_PROG_INSTALL
14
15
16 AM_PROG_LIBTOOL
17 AC_SUBST(LIBTOOL_DEPS)
18
19
20 # Checks for libraries.
21 AC_CHECK_LIB([apr-1],  [main])
22
23 AC_ARG_WITH(apache-header, [  --with-apache-header=ARG The directory with the header file of apache2.0 is specified. ]) 
24 if test "x$with_apache_header" = "xyes"; then
25     AC_MSG_ERROR([
26 Please specify the --with-apache-header option. And, please specify the place of the header file. 
27
28 ])
29 fi
30
31 dnl ==================================================
32 dnl
33 dnl apxs
34 dnl
35 dnl ==================================================
36 AC_ARG_WITH(apxs, [  --with-apxs=ARG Path of apxs program file.])
37 if test "x$with_apxs" = "x" ; then
38   APXS=""
39 fi
40 if test "x$with_apxs" = "xyes" ; then
41     AC_MSG_ERROR([
42 Please specify the --with-apxs option. And, please specify the place of the apxs program. 
43 ])
44 fi
45
46 dnl ==================================================
47 dnl
48 dnl apr-config
49 dnl
50 dnl ==================================================
51 AC_ARG_WITH(apr-config, [  --with-apr-config=ARG  Path of apr-config program file.])
52 if test "x$with_apr_config" = "xyes" ; then
53     AC_MSG_ERROR([
54 Please specify the --with-apr-config option. And, please specify the place of the apr-config program. 
55 ])
56 fi
57
58 dnl ==================================================
59 dnl
60 dnl apu-config
61 dnl
62 dnl ==================================================
63 AC_ARG_WITH(apu-config, [  --with-apu-config=ARG  Path of apu-config program file.])
64 if test "x$with_apu_config" = "xyes" ; then
65     AC_MSG_ERROR([
66 Please specify the --with-apu-config option. And, please specify the place of the apu-config program. 
67 ])
68 fi
69
70 AC_ARG_WITH(pcre-config, [  --with-pcre-config=ARG  Path of pcre-config program file.])
71 if test "x$with_pcre_config" = "xyes" ; then
72     AC_MSG_ERROR([
73 Please specify the --with-pcre-config option. And, please specify the place of the pcre-config program.
74 ])
75 fi
76
77 dnl ==================================================
78 dnl
79 dnl filename in img tag convertion.
80 dnl
81 dnl ==================================================
82 AC_ARG_ENABLE(img-conv-f, [  --enable-img-conv-f      Please specify it when you change the file name of the image being written in the 
83 source by the automatic operation.])
84 if test "x$enable_img_conv_f" = "xyes"; then
85   QDEFS=""
86 else
87   QDEFS="-DIMG_NOT_CONVERT_FILENAME"
88 fi
89
90
91 dnl ==================================================
92 dnl
93 dnl SAVE COOKIE to memcached Mode
94 dnl
95 dnl ==================================================
96 AC_ARG_ENABLE(memcache-cookie, [  --enable-memcache-cookie Please specify it when you save Cookie in memcached. ])
97 AC_ARG_WITH(apr-memcache-header,   [  --with-apr-memcache-header Path of "apr_memcache.h"])
98 AC_ARG_WITH(apr-memcache-lib-dir,   [  --with-apr-memcache-lib-dir Path of "libapr_memcache.so"])
99 if test "x$enable_memcache_cookie" = "xyes" ; then
100   dnl ======================================
101   dnl use MEMCACHE COOKIE
102   dnl ======================================
103   if test "x$with_apr_memcache_header" = "x" -o "x$with_apr_memcache_header" = "xyes" ; then
104     AC_MSG_ERROR([
105 Please specify the --with-apr-memcache-header And, please specify the place of the "apr_memcache.h" header file directory. 
106 ])
107   fi
108   if test "x$with_apr_memcache_lib_dir" = "x" -o "x$with_apr_memcache_lib_dir" = "xyes" ; then
109     AC_MSG_ERROR([
110 Please specify the --with-apr-memcache-lib-dir And, please specify the place of apr-memcache library directory. 
111 ])
112   fi
113   MEMCACHE_COOKIE_DEFS="-DUSE_MEMCACHE_COOKIE -I${with_apr_memcache_header}"
114   MEMCACHE_COOKIE_LIBS="-L${with_apr_memcache_lib_dir} -lapr_memcache"
115 else
116   dnl ======================================
117   dnl no use MEMCACHE COOKIE
118   dnl ======================================
119   MEMCACHE_COOKIE_DEFS=""
120   MEMCACHE_COOKIE_LIBS=""
121 fi
122 dnl ==================================================
123 dnl
124 dnl SAVE COOKIE to MySQL Mode
125 dnl
126 dnl ==================================================
127 AC_ARG_ENABLE(mysql-cookie, [  --enable-mysql-cookie    Please specify it when you save Cookie in MySQL. ])
128 AC_ARG_WITH(mysql-header,   [  --with-mysql-header=ARG  Path of "mysql.h"])
129 AC_ARG_WITH(mysql-lib-dir,  [  --with-mysql-lib-dir=ARG Path of libmysqlclient])
130 if test "x$enable_mysql_cookie" = "xyes"; then
131   dnl ======================================
132   dnl use MYSQL COOKIE
133   dnl ======================================
134   if test "x$with_mysql_header" = "x" -o "x$with_mysql_header" = "xyes" ; then
135     AC_MSG_ERROR([
136 Please specify the --with-mysql-header And, please specify the place of the "mysql.h" header file. 
137 ])
138   fi
139   if test "x$with_mysql_lib_dir" = "x" -o "x$with_mysql_lib_dir" = "xyes" ; then
140     AC_MSG_ERROR([
141 Please specify the --with-mysql-lib-dir And, please specify the place of mysql library directory. 
142 ])
143   fi
144   MYSQL_COOKIE_DEFS="-DUSE_MYSQL_COOKIE -I${with_mysql_header}"
145   MYSQL_COOKIE_LIBS="-L${with_mysql_lib_dir} -lmysqlclient_r"
146 else
147   dnl ======================================
148   dnl no use MYSQL COOKIE
149   dnl ======================================
150   MYSQL_COOKIE_DEFS=""
151   MYSQL_COOKIE_LIBS=""
152 fi
153
154 dnl ==================================================
155 dnl
156 dnl dump log for DEBUG
157 dnl
158 dnl ==================================================
159 AC_ARG_ENABLE(dump-log, [  --enable-dump-log   When the log of conversion is output, it specifies it with the output file. ])
160 if test "x$enable_dump_log" = "xyes"; then
161   DDEFS="-DDUMP_LOG=\\\"/tmp/dump.log\\\""
162 else
163     if test "x$enable_dump_log" != "x" ; then
164         DDEFS="-DDUMP_LOG=\\\"${enable_dump_log}\\\""
165     fi
166 fi
167
168
169 if test "x$with_apxs" = "x" ; then
170   AC_PATH_PROG(APXS2, apxs2, no,
171       /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/apache/bin)
172   if test "x$APXS2" = "xno"; then
173     AC_PATH_PROG(APXS, apxs, no,
174       /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/apache/bin)
175     if test "x$APXS" = "xno" ; then
176       AC_MSG_ERROR([apxs not found.])
177     fi
178   else
179     APXS="$APXS2"
180   fi
181 fi
182 if test "x$with_apxs" != "x" ; then
183   APXS=$with_apxs
184 fi 
185
186 AC_PATH_PROG(LIBTOOL, libtool, no,
187     /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
188 if test "x$LIBTOOL" = "xno"; then
189     AC_MSG_ERROR([libtool not found.])
190 fi
191
192
193 AC_PATH_PROG(WAND_CONFIG, Wand-config, no,
194    /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
195 if test "x$WAND_CONFIG" = "xno" ; then
196     AC_MSG_ERROR([wand-config not found.])
197 fi
198
199 if test "x$with_apr_config" = "x" ; then
200   AC_PATH_PROG(APR_CONFIG, apr-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
201   if test "x$APR_CONFIG" = "xno" ; then
202     AC_PATH_PROG(APR_1_CONFIG, apr-1-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
203     if test "x$APR_1_CONFIG" = "xno" ; then
204       AC_MSG_ERROR([apr-config and apr-1-config not found.])
205     else
206       APR_CONFIG="$APR_1_CONFIG"
207     fi
208   fi
209 fi
210 if test "x$with_apr_config" != "x" ; then
211   APR_CONFIG=$with_apr_config
212 fi
213 if test "x$with_apu_config" = "x" ; then
214   AC_PATH_PROG(APU_CONFIG, apu-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
215   if test "x$APU_CONFIG" = "xno" ; then
216     AC_PATH_PROG(APU_1_CONFIG, apu-1-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
217     if test "x$APU_1_CONFIG" = "xno" ; then
218       AC_MSG_ERROR([apu-config and apu-1-config not found.])
219     else
220       APU_CONFIG="$APU_1_CONFIG"
221     fi
222   fi
223 fi
224 if test "x$with_apu_config" != "x" ; then
225   APU_CONFIG=$with_apu_config
226 fi
227
228
229 case $host_os in
230   freebsd*)
231     CFLAGS="${CFLAGS} -I/usr/local/include "
232     ;;
233 esac
234
235 if test "x${with_apache_header}" = "x" ; then
236   with_apache_header=`${APXS} -q includedir`
237 fi
238
239 LIBS="${LIBS} `${WAND_CONFIG} --ldflags` `${WAND_CONFIG} --libs | sed -e s/-ldpstk//` "
240 LIBS="${LIBS} `${APR_CONFIG} --ldflags` `${APR_CONFIG} --libs` "
241 LIBS="${LIBS} `${APU_CONFIG} --ldflags` `${APU_CONFIG} --libs` "
242 LIBS="${LIBS} ${MYSQL_COOKIE_LIBS}"
243 LIBS="${LIBS} ${MEMCACHE_COOKIE_LIBS}"
244 CFLAGS="${CFLAGS} `${WAND_CONFIG} --cppflags` `${WAND_CONFIG} --cflags`"
245 CFLAGS="${CFLAGS} `${APR_CONFIG} --includes` `${APR_CONFIG} --cflags` `${APR_CONFIG} --cppflags`"
246 CFLAGS="${CFLAGS} `${APU_CONFIG} --includes`"
247 CFLAGS="${CFLAGS} ${MYSQL_COOKIE_DEFS}"
248 CFLAGS="${CFLAGS} ${MEMCACHE_COOKIE_DEFS}"
249 CPPFLAGS="${CPPFLAGS} `${APR_CONFIG} --includes` -I${with_apache_header}"
250 CPPFLAGS="${CPPFLAGS} ${MYSQL_COOKIE_DEFS}"
251 CPPFLAGS="${CPPFLAGS} ${MEMCACHE_COOKIE_DEFS}"
252
253 # Checks for header files.
254 AC_HEADER_STDC
255 AC_CHECK_HEADERS([string.h strings.h unistd.h fcntl.h sys/types.h sys/stat.h sys/mman.h libgen.h])
256 APR_HEADER_DIR="`${APR_CONFIG} --includes | sed -e 's/-I//g' | sed -e 's/ //g'`"
257 AC_CHECK_HEADERS([apr_shm.h apr_global_mutex.h])
258 AC_CHECK_HEADERS([apr.h])
259 AC_CHECK_HEADERS([ap_config.h])
260 #AC_CHECK_HEADERS([ap_regex.h],
261 #  AC_DEFINE([HAVE_AP_REGEX_H], [], [Define to 1 if you have the <ap_regex.h> header file.]),[],
262 #[[
263 ##ifdef HAVE_APR_H
264 ##include "apr.h"
265 ##endif
266 ##ifdef HAVE_AP_CONFIG_H
267 ##include "ap_config.h"
268 ##endif
269 #]])
270 AC_CHECK_HEADERS([ap_regex.h],use_pcre_flag="no",use_pcre_flag="yes")
271 if test "x$use_pcre_flag" = "xyes" ; then
272   if test "x$with_pcre_config" = "x" ; then
273     AC_PATH_PROG(PCRE_CONFIG, pcre-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
274     if test "x$PCRE_CONFIG" = "xno" ; then
275       AC_PATH_PROG(PCRE_1_CONFIG, pcre-1-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
276       if test "x$PCRE_1_CONFIG" = "xno" ; then
277         AC_MSG_ERROR([pcre-config and pcre-1-config not found.])
278       else
279         PCRE_CONFIG="$PCRE_1_CONFIG"
280       fi
281     fi
282   fi
283   if test "x$with_pcre_config" != "x" ; then
284     PCRE_CONFIG=$with_pcre_config
285   fi
286   CFLAGS="${CFLAGS} `${PCRE_CONFIG} --cflags`"
287 else
288   AC_DEFINE([HAVE_AP_REGEX_H], [1], [Define to 1 if you have the <ap_regex.h> header file.])
289 fi
290
291 # Checks for typedefs, structures, and compiler characteristics.
292 AC_C_CONST
293
294 # Checks for library functions.
295 AC_FUNC_MALLOC
296 AC_CHECK_FUNCS([open mmap close memset memcpy strcasecmp strncasecmp strstr])
297
298 AC_SUBST(with_apache_header)
299 AC_SUBST(CC)
300 AC_SUBST(QDEFS)
301 AC_SUBST(DDEFS)
302 AC_SUBST(LIBS)
303 AC_SUBST(CFLAGS)
304
305
306 AC_CONFIG_FILES([Makefile src/Makefile])
307 AC_OUTPUT