[PATCH 6 of 8] Added new run-time prefix option for configure files
Per Olav Høydahl Ohme
phoydahl at cisco.com
Fri Jul 18 12:05:52 UTC 2014
# HG changeset patch
# User Per Olav Hoydahl Ohme <phoydahl at cisco.com>
# Date 1405683324 -7200
# Fri Jul 18 13:35:24 2014 +0200
# Node ID 0d4f62e2c8115cb0d8b372fcabe7e8582a54d299
# Parent fae8ad3d60a2e4ffeac836eb4c05cf29f39c0824
Added new run-time prefix option for configure files.
Needed in case configure files are relocated after build.
diff -r fae8ad3d60a2 -r 0d4f62e2c811 auto/configure
--- a/auto/configure Fri Jul 18 13:35:24 2014 +0200
+++ b/auto/configure Fri Jul 18 13:35:24 2014 +0200
@@ -79,6 +79,9 @@
if [ ".$NGX_CONF_PREFIX" != "." ]; then
have=NGX_CONF_PREFIX value="\"$NGX_CONF_PREFIX/\"" . auto/define
fi
+if [ "$NGX_RT_CONF_PREFIX" ]; then
+ have=NGX_RT_CONF_PREFIX value="\"$NGX_RT_CONF_PREFIX\"" . auto/define
+fi
have=NGX_SBIN_PATH value="\"$NGX_SBIN_PATH\"" . auto/define
have=NGX_CONF_PATH value="\"$NGX_CONF_PATH\"" . auto/define
diff -r fae8ad3d60a2 -r 0d4f62e2c811 auto/options
--- a/auto/options Fri Jul 18 13:35:24 2014 +0200
+++ b/auto/options Fri Jul 18 13:35:24 2014 +0200
@@ -9,6 +9,7 @@
NGX_SBIN_PATH=
NGX_CONF_PREFIX=
NGX_CONF_PATH=
+NGX_RT_CONF_PREFIX=
NGX_ERROR_LOG_PATH=
NGX_PID_PATH=
NGX_LOCK_PATH=
@@ -182,6 +183,7 @@
--prefix=*) NGX_PREFIX="$value" ;;
--sbin-path=*) NGX_SBIN_PATH="$value" ;;
--conf-path=*) NGX_CONF_PATH="$value" ;;
+ --rt-conf-prefix=*) NGX_RT_CONF_PREFIX="$value";;
--error-log-path=*) NGX_ERROR_LOG_PATH="$value";;
--pid-path=*) NGX_PID_PATH="$value" ;;
--lock-path=*) NGX_LOCK_PATH="$value" ;;
@@ -365,6 +367,7 @@
worker processes
--crossbuild=PLATFORM set target platform for crossbuild
+ --rt-conf-prefix=PATH set run-time prefix for configure files
--build=NAME set build name
--builddir=DIR set build directory
diff -r fae8ad3d60a2 -r 0d4f62e2c811 src/core/ngx_conf_file.c
--- a/src/core/ngx_conf_file.c Fri Jul 18 13:35:24 2014 +0200
+++ b/src/core/ngx_conf_file.c Fri Jul 18 13:35:24 2014 +0200
@@ -120,6 +120,18 @@
/* open configuration file */
+#ifdef NGX_RT_CONF_PREFIX
+ char rt_prefixed_data[512];
+ snprintf(rt_prefixed_data, 512, "%s%s", NGX_RT_CONF_PREFIX,
+ filename->data);
+ fd = ngx_open_file(rt_prefixed_data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
+ if (fd == NGX_INVALID_FILE) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
+ ngx_open_file_n " \"%s\" failed",
+ rt_prefixed_data);
+ return NGX_CONF_ERROR;
+ }
+#else
fd = ngx_open_file(filename->data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
if (fd == NGX_INVALID_FILE) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
@@ -127,6 +139,7 @@
filename->data);
return NGX_CONF_ERROR;
}
+#endif
prev = cf->conf_file;
More information about the nginx-devel
mailing list