-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
112 lines (93 loc) · 3.6 KB
/
configure.ac
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
AC_INIT([mod_redirectionio], [1.0.0], [[email protected]])
AC_CHECK_PROG(WGET, [wget], [yes], [no])
AS_IF(test x$WGET = xno,
AC_MSG_ERROR([wget is required.])
)
AC_CHECK_PROG(TAR, [tar], [yes], [no])
AS_IF(test x$TAR = xno,
AC_MSG_ERROR([tar is required.])
)
dnl Specify --enable-static to compile nginx with static module. By default,
dnl we build a dynamic module.
AC_ARG_ENABLE(static,
AC_HELP_STRING([--enable-static],
[Build static module (not dynamix) [default=no]]),
[static_module=$enableval],
[static_module=no])
AC_ARG_WITH([nginx_version], [AS_HELP_STRING([--with-nginx-version],
[nginx version to use])],
[NGINX_VERSION=$withval], [NGINX_VERSION=])
AS_IF(test x$NGINX_VERSION = x, [
AC_PATH_PROG([NGINX_BIN],[nginx],[])
AS_IF(test x$NGINX_BIN = x,
AC_MSG_ERROR([nginx is required.]), [
NGINX_VERSION=`${NGINX_BIN} -v 2>&1 | grep -o '[[0-9.]]*\$'`
NGINX_CONFIGURE="--with-cc-opt='-Wno-error -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' --with-debug"
NGINX_PREFIX=`${NGINX_BIN} -V 2>&1 | grep -oP '\-\-prefix=([[^\s]]*)'| cut -d "=" -f2`
NGINX_MAKE_TARGET="modules"
]
)
], [
NGINX_CONFIGURE="--with-cc-opt='-Wno-error -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' --with-debug"
NGINX_PREFIX="${ac_abs_confdir}/nginx-${NGINX_VERSION}/work"
NGINX_BIN="./nginx-${NGINX_VERSION}/objs/nginx"
NGINX_MAKE_TARGET="install"
]
)
AC_ARG_WITH([proxy_version], [AS_HELP_STRING([--with-proxy-version],
[proxy version to output])],
[PROXY_VERSION=$withval], [PROXY_VERSION=libnginx-mod-redirectionio:dev])
PATCH_FILES="patches/glibc_bug_fixed.patch"
AC_ARG_ENABLE([debian-header],
AS_HELP_STRING([--enable-debian-header], [Patch nginx source with the debian header patch.]), [
PATCH_FILES="$PATCH_FILES patches/debian-headers.patch"
])
# Dependencies
PKG_PROG_PKG_CONFIG
PKG_INSTALLDIR
PKG_CHECK_MODULES([redirectionio], [libredirectionio >= 0.0.1])
# Checks for programs.
AC_PROG_GREP
# Checks for libs
AC_CHECK_LIB(pthread, pthread_create)
AC_CHECK_LIB([m], [cos])
AC_ARG_VAR([nginx_version], [Nginx version to use])
BUILD_MODULES_DIR="nginx-${NGINX_VERSION}/objs"
PREFIX="${NGINX_PREFIX:-/etc/nginx}"
CFLAGS="$CFLAGS -Wall -g -std=c99 -DPROXY_VERSION=$PROXY_VERSION $redirectionio_CFLAGS"
LIBS="$LIBS $redirectionio_LIBS"
MODULE_DIR=$NGINX_PREFIX/modules
AC_MSG_CHECKING(whether to build Rust code with debugging information)
if test "x$static_module" = "xyes" ; then
ADD_MODULE=--add-module
LOAD_MODULE=
else
ADD_MODULE=--add-dynamic-module
LOAD_MODULE="load_module $MODULE_DIR/ngx_http_redirectionio_module.so;"
fi
AC_SUBST(PREFIX)
AC_SUBST(NGINX_VERSION)
AC_SUBST(NGINX_CONFIGURE)
AC_SUBST(MODULE_DIR)
AC_SUBST(CFLAGS)
AC_SUBST(LIBS)
AC_SUBST(PATCH_FILES)
AC_SUBST(NGINX_BIN)
AC_SUBST(NGINX_PREFIX)
AC_SUBST(BUILD_MODULES_DIR)
AC_SUBST(NGINX_MAKE_TARGET)
AC_SUBST(ADD_MODULE)
AC_SUBST(LOAD_MODULE)
AC_MSG_NOTICE([summary of build options:
Install prefix: ${PREFIX}
NGINX-VERSION: ${NGINX_VERSION}
NGINX-CONFIGURE: ${NGINX_CONFIGURE}
NGINX-PREFIX: ${NGINX_PREFIX}
CFLAGS: ${CFLAGS}
LIBS: ${LIBS}
MODULE_DIR: ${MODULE_DIR}
NGINX_BIN: ${NGINX_BIN}
])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([nginx-test.conf])
AC_OUTPUT