-
Notifications
You must be signed in to change notification settings - Fork 30
/
configure.in
171 lines (148 loc) · 4.62 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.67)
AC_INIT()
AC_CONFIG_SRCDIR([src/ap_mrb_init.h])
AC_CONFIG_HEADER(config.h)
# Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET
# Checks for libraries.
# FIXME: Replace `main' with a function in `-lm':
AC_CHECK_LIB([m], [main])
AC_CHECK_LIB([crypto], [main])
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([string.h unistd.h],,[AC_MSG_ERROR(not found the header file for mod_mruby.)])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
# Checks for library functions.
AC_FUNC_STAT
AC_CHECK_FUNCS([memset putenv strtol])
# Select mruby repos uri
AC_ARG_WITH(mruby, AC_HELP_STRING([--with-mruby=mruby or iij or Git URI],
[name or git uri to the mruby implementation. (default is mruby)]),
[with_mruby="$with_mruby"],
[with_mruby=mruby])
AC_SUBST(MRUBY_REPOS)
case "$with_mruby" in
mruby|yes|'') # mruby/mruby
MRUBY_REPOS=https://github.com/mruby/mruby.git ;;
iij|extend) # iij/mruby
MRUBY_REPOS=https://github.com/iij/mruby.git ;;
*::/*)
MRUBY_REPOS="$with_mruby" ;;
*)
if test -d "$with_mruby" ; then
MRUBY_REPOS="$with_mruby"
else
AC_MSG_ERROR([--with-mruby: [$with_mruby] is not a git uri.])
fi
esac
AS_ECHO(["--with-mruby: [$MRUBY_REPOS] will be used."])
# Checks for rake or ruby
AC_PATH_PROGS(RAKE_PATH, rake1.9.1 rake ruby1.9.1 ruby, no,
$PATH)
case $(basename "$RAKE_PATH") in
ruby*)
RAKE_PATH="$RAKE_PATH ./minirake" ;;
no)
AC_MSG_ERROR([rake and ruby not found.]) ;;
esac
AC_SUBST(RAKE_PATH)
# Checks for apache tools.
AC_ARG_WITH(apxs, AC_HELP_STRING([--with-apxs=FILE],
[pathname to the Apache apxs tool [[apxs]]]),
[APXS_PATH="$with_apxs"])
if test -z "${APXS_PATH}"; then
AC_PATH_PROGS(APXS_PATH, apxs2 apxs, no,
/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/apache/bin:/usr/local/apache2/bin)
fi
if test "$APXS_PATH" = no; then
AC_MSG_ERROR([neither apxs2 or apxs not found.])
fi
AC_ARG_WITH(apachectl, AC_HELP_STRING([--with-apachectl=FILE],
[pathname to the Apache apachectl tool [[apachectl]]]),
[APACHECTL_PATH="$with_apachectl"])
if test -z "${APACHECTL_PATH}"; then
AC_PATH_PROGS(APACHECTL_PATH, apache2ctl apachectl, no,
/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/local/apache/bin:/usr/local/apache2/bin)
fi
if test "$APACHECTL_PATH" = no; then
AC_MSG_ERROR([apache2ctl and apachectl not found.])
fi
APACHE_VERSION=`$APACHECTL_PATH -v | awk "/Server version/ {print $ 3}"`
#NEED_DEFINE_VERSITON="Apache/2.4.*"
case $APACHE_VERSION in
# $NEED_DEFINE_VERSITON)
# AC_DEFINE([__APACHE24__], [1], [apache 2.4 support])
# echo "checking for apache version... $APACHE_VERSION set VERSION_DEF=$VERSION_DEF"
# ;;
*)
echo "checking for apache version... $APACHE_VERSION"
;;
esac
# mruby root
MRUBY_ROOT=./mruby
AC_ARG_WITH(mruby_root, AC_HELP_STRING([--with-mruby-root=DIR],
[pathname to mruby_root [[mruby_root]]]),
[MRUBY_ROOT="$with_mruby_root"])
AC_SUBST(MRUBY_ROOT)
# support mrbgems
ENABLE_GEMS=false
AC_ARG_ENABLE([mrbgems],
[AS_HELP_STRING([--enable-mrbgems],
[mrbgems feature (default is no)])],
[],
[enable_mrbgems=no]
)
AS_IF([test "x$enable_mrbgems" != xno],
[AC_DEFINE([ENABLE_GEMS], [1], [mrbgems support])
ENABLE_GEMS=true
]
)
AC_SUBST(ENABLE_GEMS)
## support redis
#AC_ARG_ENABLE([redis],
# [AS_HELP_STRING([--enable-redis],
# [redis feature (default is no)])],
# [AC_CHECK_HEADERS([hiredis/hiredis.h],,[AC_MSG_ERROR(not found the header file for redis.)])
# AC_CHECK_LIB([hiredis], [main])
# ],
# [enable_redis=no]
#)
#
#AS_IF([test "x$enable_redis" != xno],
# [AC_DEFINE([ENABLE_REDIS], [1], [redis support])
# FEATURE_TARGETS="lib/redis/*.c ${FEATURE_TARGETS}"
# ]
#)
# support hello
AC_ARG_ENABLE([hello],
[AS_HELP_STRING([--enable-hello],
[hello feature (default is no)])],
[],
[enable_hello=no]
)
AS_IF([test "x$enable_hello" != xno],
[AC_DEFINE([ENABLE_HELLO], [1], [hello support])
FEATURE_TARGETS="lib/hello/*.c ${FEATURE_TARGETS}"
]
)
# support load
AC_ARG_ENABLE([load],
[AS_HELP_STRING([--enable-load],
[load feature (default is no)])],
[],
[enable_load=no]
)
AS_IF([test "x$enable_load" != xno],
[AC_DEFINE([ENABLE_LOAD], [1], [getloadavg support])
FEATURE_TARGETS="lib/load/*.c ${FEATURE_TARGETS}"
]
)
WLFLAG="-Wl,'`echo "$LIBS" | sed -e "s/\s\+/ /g"`'"
LDFLAGS="$WLFLAG $LDFLAGS"
AC_SUBST(FEATURE_TARGETS)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT