OSDN Git Service

* version up.
[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.12.38],[konn@users.sourceforge.jp])
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_ENABLE(memcached-static,  [  --enable-memcached-static use static link. ])
98 AC_ARG_WITH(memcached-header,    [  --with-memcached-header Path of "memcached.h"])
99 AC_ARG_WITH(memcached-lib-dir,   [  --with-memcached-lib-dir Path of "libmemcached.so"])
100 if test "x$enable_memcache_cookie" = "xyes" ; then
101   dnl ======================================
102   dnl use MEMCACHE COOKIE
103   dnl ======================================
104   if test "x${with_memcached_header}" = "x" -o "x${with_memcached_header}" = "xyes" ; then
105     AC_MSG_ERROR([
106 Please specify the --with-memcached-header And, please specify the place of the "memcached.h" header file directory. 
107 ])
108   fi
109   if test "x${with_memcached_lib_dir}" = "x" -o "x${with_memcached_lib_dir}" = "xyes" ; then
110     AC_MSG_ERROR([
111 Please specify the --with-memcached-lib-dir And, please specify the place of libmemcached library directory. 
112 ])
113   fi
114   if test "x$enable_memcached_static" = "xyes" ; then
115     MEMCACHE_COOKIE_DEFS="-DUSE_MEMCACHE_COOKIE -I${with_memcached_header} "
116     MEMCACHE_COOKIE_LIBS=" ${with_memcached_lib_dir}/libmemcached.a "
117   else
118     MEMCACHE_COOKIE_DEFS="-DUSE_MEMCACHE_COOKIE -I${with_memcached_header} "
119     MEMCACHE_COOKIE_LIBS="-L${with_memcached_lib_dir} -lmemcached "
120   fi
121 else
122   dnl ======================================
123   dnl no use MEMCACHE COOKIE
124   dnl ======================================
125   MEMCACHE_COOKIE_DEFS=""
126   MEMCACHE_COOKIE_LIBS=""
127 fi
128 dnl ==================================================
129 dnl
130 dnl SAVE COOKIE to MySQL Mode
131 dnl
132 dnl ==================================================
133 AC_ARG_ENABLE(mysql-cookie, [  --enable-mysql-cookie    Please specify it when you save Cookie in MySQL. ])
134 AC_ARG_WITH(mysql-header,   [  --with-mysql-header=ARG  Path of "mysql.h"])
135 AC_ARG_WITH(mysql-lib-dir,  [  --with-mysql-lib-dir=ARG Path of libmysqlclient])
136 if test "x$enable_mysql_cookie" = "xyes"; then
137   dnl ======================================
138   dnl use MYSQL COOKIE
139   dnl ======================================
140   if test "x$with_mysql_header" = "x" -o "x$with_mysql_header" = "xyes" ; then
141     AC_MSG_ERROR([
142 Please specify the --with-mysql-header And, please specify the place of the "mysql.h" header file. 
143 ])
144   fi
145   if test "x$with_mysql_lib_dir" = "x" -o "x$with_mysql_lib_dir" = "xyes" ; then
146     AC_MSG_ERROR([
147 Please specify the --with-mysql-lib-dir And, please specify the place of mysql library directory. 
148 ])
149   fi
150   MYSQL_COOKIE_DEFS="-DUSE_MYSQL_COOKIE -I${with_mysql_header}"
151   MYSQL_COOKIE_LIBS="-L${with_mysql_lib_dir} -lmysqlclient_r"
152 else
153   dnl ======================================
154   dnl no use MYSQL COOKIE
155   dnl ======================================
156   MYSQL_COOKIE_DEFS=""
157   MYSQL_COOKIE_LIBS=""
158 fi
159
160 dnl ==================================================
161 dnl
162 dnl OpenSSL
163 dnl
164 dnl ==================================================
165 OPENSSL_PATH=""
166 AC_ARG_WITH(openssl,
167   APR_HELP_STRING([--with-openssl=PATH],[Path to OpenSSL (eg. /usr/local/ssl)]),
168 [
169   if test "$withval" = "yes"; then
170     AC_MSG_ERROR([--with-openssl requires a path])
171   else
172     openssl_prefix=$withval
173
174     if test "x$openssl_prefix" != "x" -a ! -d "$openssl_prefix"; then
175       AC_MSG_ERROR('--with-openssl requires a path to a directory')
176     fi
177
178     CPPFLAGS="${CPPFLAGS} -I${openssl_prefix}/include"
179     LDFLAGS="${LDFLAGS} -L${openssl_prefix}/lib"
180     LDFLAGS="${LDFLAGS} -R${openssl_prefix}/lib"
181     OPENSSL_PATH="--with-openssl=${openssl_prefix}"
182   fi
183 ])
184
185 dnl Look for OpenSSL
186 AC_CHECK_HEADER([openssl/opensslv.h], [],
187                 [AC_MSG_ERROR([We require OpenSSL; try --with-openssl])])
188
189 dnl ==================================================
190 dnl
191 dnl dump log for DEBUG
192 dnl
193 dnl ==================================================
194 AC_ARG_ENABLE(dump-log, [  --enable-dump-log   When the log of conversion is output, it specifies it with the output file. ])
195 if test "x$enable_dump_log" = "xyes"; then
196   DDEFS="-DDUMP_LOG=\\\"/tmp/dump.log\\\""
197 else
198     if test "x$enable_dump_log" != "x" ; then
199         DDEFS="-DDUMP_LOG=\\\"${enable_dump_log}\\\""
200     fi
201 fi
202
203
204 if test "x$with_apxs" = "x" ; then
205   AC_PATH_PROG(APXS2, apxs2, no,
206       /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/apache/bin)
207   if test "x$APXS2" = "xno"; then
208     AC_PATH_PROG(APXS, apxs, no,
209       /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/apache/bin)
210     if test "x$APXS" = "xno" ; then
211       AC_MSG_ERROR([apxs not found.])
212     fi
213   else
214     APXS="$APXS2"
215   fi
216 fi
217 if test "x$with_apxs" != "x" ; then
218   APXS=$with_apxs
219 fi 
220
221 AC_PATH_PROG(LIBTOOL, libtool, no,
222     /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
223 if test "x$LIBTOOL" = "xno"; then
224     AC_MSG_ERROR([libtool not found.])
225 fi
226
227
228 AC_PATH_PROG(WAND_CONFIG, Wand-config, no,
229    /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
230 if test "x$WAND_CONFIG" = "xno" ; then
231     AC_MSG_ERROR([wand-config not found.])
232 fi
233
234 if test "x$with_apr_config" = "x" ; then
235   AC_PATH_PROG(APR_CONFIG, apr-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
236   if test "x$APR_CONFIG" = "xno" ; then
237     AC_PATH_PROG(APR_1_CONFIG, apr-1-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
238     if test "x$APR_1_CONFIG" = "xno" ; then
239       AC_MSG_ERROR([apr-config and apr-1-config not found.])
240     else
241       APR_CONFIG="$APR_1_CONFIG"
242     fi
243   fi
244 fi
245 if test "x$with_apr_config" != "x" ; then
246   APR_CONFIG=$with_apr_config
247 fi
248 if test "x$with_apu_config" = "x" ; then
249   AC_PATH_PROG(APU_CONFIG, apu-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
250   if test "x$APU_CONFIG" = "xno" ; then
251     AC_PATH_PROG(APU_1_CONFIG, apu-1-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
252     if test "x$APU_1_CONFIG" = "xno" ; then
253       AC_MSG_ERROR([apu-config and apu-1-config not found.])
254     else
255       APU_CONFIG="$APU_1_CONFIG"
256     fi
257   fi
258 fi
259 if test "x$with_apu_config" != "x" ; then
260   APU_CONFIG=$with_apu_config
261 fi
262
263
264 case $host_os in
265   freebsd*)
266     CFLAGS="${CFLAGS} -I/usr/local/include "
267     ;;
268 esac
269
270 if test "x${with_apache_header}" = "x" ; then
271   with_apache_header=`${APXS} -q includedir`
272 fi
273
274 LIBS="${LIBS} `${WAND_CONFIG} --ldflags` `${WAND_CONFIG} --libs | sed -e s/-ldpstk//` "
275 LIBS="${LIBS} `${APR_CONFIG} --ldflags` `${APR_CONFIG} --libs` "
276 LIBS="${LIBS} `${APU_CONFIG} --ldflags` `${APU_CONFIG} --libs` "
277 LIBS="${LIBS} ${MYSQL_COOKIE_LIBS}"
278 LIBS="${LIBS} ${MEMCACHE_COOKIE_LIBS} "
279 LIBS="${LIBS} -lcrypto -lssl "
280 CFLAGS="${CFLAGS} `${WAND_CONFIG} --cppflags` `${WAND_CONFIG} --cflags`"
281 CFLAGS="${CFLAGS} `${APR_CONFIG} --includes` `${APR_CONFIG} --cflags` `${APR_CONFIG} --cppflags`"
282 CFLAGS="${CFLAGS} `${APU_CONFIG} --includes`"
283 CFLAGS="${CFLAGS} ${MYSQL_COOKIE_DEFS}"
284 CFLAGS="${CFLAGS} ${MEMCACHE_COOKIE_DEFS}"
285 CPPFLAGS="${CPPFLAGS} `${APR_CONFIG} --includes` -I${with_apache_header}"
286 CPPFLAGS="${CPPFLAGS} ${MYSQL_COOKIE_DEFS}"
287 CPPFLAGS="${CPPFLAGS} ${MEMCACHE_COOKIE_DEFS}"
288
289 # Checks for header files.
290 AC_HEADER_STDC
291 AC_CHECK_HEADERS([string.h strings.h unistd.h fcntl.h sys/types.h sys/stat.h sys/mman.h libgen.h])
292 APR_HEADER_DIR="`${APR_CONFIG} --includes | sed -e 's/-I//g' | sed -e 's/ //g'`"
293 AC_CHECK_HEADERS([apr_shm.h apr_global_mutex.h])
294 AC_CHECK_HEADERS([apr.h])
295 AC_CHECK_HEADERS([ap_config.h])
296 #AC_CHECK_HEADERS([ap_regex.h],
297 #  AC_DEFINE([HAVE_AP_REGEX_H], [], [Define to 1 if you have the <ap_regex.h> header file.]),[],
298 #[[
299 ##ifdef HAVE_APR_H
300 ##include "apr.h"
301 ##endif
302 ##ifdef HAVE_AP_CONFIG_H
303 ##include "ap_config.h"
304 ##endif
305 #]])
306 AC_CHECK_HEADERS([ap_regex.h],use_pcre_flag="no",use_pcre_flag="yes",
307 [[#ifdef HAVE_APR_H
308 # include "apr.h"
309 #endif
310 #ifdef HAVE_AP_CONFIG_H
311 # include "ap_config.h"
312 #endif
313 ]])
314 if test "x$use_pcre_flag" = "xyes" ; then
315   if test "x$with_pcre_config" = "x" ; then
316     AC_PATH_PROG(PCRE_CONFIG, pcre-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
317     if test "x$PCRE_CONFIG" = "xno" ; then
318       AC_PATH_PROG(PCRE_1_CONFIG, pcre-1-config, no, /usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin)
319       if test "x$PCRE_1_CONFIG" = "xno" ; then
320         AC_MSG_ERROR([pcre-config and pcre-1-config not found.])
321       else
322         PCRE_CONFIG="$PCRE_1_CONFIG"
323       fi
324     fi
325   fi
326   if test "x$with_pcre_config" != "x" ; then
327     PCRE_CONFIG=$with_pcre_config
328   fi
329   CFLAGS="${CFLAGS} `${PCRE_CONFIG} --cflags`"
330 else
331   AC_DEFINE([HAVE_AP_REGEX_H], [1], [Define to 1 if you have the <ap_regex.h> header file.])
332 fi
333
334 # Checks for typedefs, structures, and compiler characteristics.
335 AC_C_CONST
336
337 # Checks for library functions.
338 AC_FUNC_MALLOC
339 AC_CHECK_FUNCS([open mmap close memset memcpy strcasecmp strncasecmp strstr])
340
341 AC_SUBST(with_apache_header)
342 AC_SUBST(CC)
343 AC_SUBST(QDEFS)
344 AC_SUBST(DDEFS)
345 AC_SUBST(LIBS)
346 AC_SUBST(CFLAGS)
347 AC_SUBST(OPENSSL_PATH)
348
349
350 AC_CONFIG_FILES([Makefile src/Makefile support/centos/mod-chxj.spec])
351 AC_OUTPUT