Skip to content

Commit 30de645

Browse files
committed
rewrite configure stuff to use $sbindir and $sysconfdir correctly
(with a lot of help from Jani)
1 parent e9a3e9b commit 30de645

File tree

5 files changed

+25
-57
lines changed

5 files changed

+25
-57
lines changed

sapi/fpm/Makefile.frag

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ $(builddir)/fpm/fpm_conf.lo: $(builddir)/../../main/build-defs.h
88
install-build: install-fpm
99

1010
install-fpm: install-sapi
11-
@echo "Installing PHP FPM binary: $(INSTALL_ROOT)$(bindir)/"
12-
@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
11+
@echo "Installing PHP FPM binary: $(INSTALL_ROOT)$(sbindir)/"
12+
@$(mkinstalldirs) $(INSTALL_ROOT)$(sbindir)
1313
@$(mkinstalldirs) $(INSTALL_ROOT)$(php_fpm_pid_dir)
1414
@$(mkinstalldirs) $(INSTALL_ROOT)$(php_fpm_log_dir)
15-
@$(INSTALL) -m 0755 $(SAPI_FPM_PATH) $(INSTALL_ROO)$(bindir)/$(program_prefix)php-fpm$(program_suffix)$(EXEEXT)
15+
@$(INSTALL) -m 0755 $(SAPI_FPM_PATH) $(INSTALL_ROO)$(sbindir)/$(program_prefix)php-fpm$(program_suffix)$(EXEEXT)
1616

17-
@echo "Installing PHP FPM config: $(INSTALL_ROOT)$(php_fpm_conf_dir)/" && \
18-
$(mkinstalldirs) $(INSTALL_ROOT)$(php_fpm_conf_dir) || :
17+
@echo "Installing PHP FPM config: $(INSTALL_ROOT)$(sysconfdir)/" && \
18+
$(mkinstalldirs) $(INSTALL_ROOT)$(sysconfdir) || :
1919

20-
@$(INSTALL_DATA) sapi/fpm/php-fpm.conf $(INSTALL_ROOT)$(php_fpm_conf_dir)/php-fpm.conf.default || :
20+
@$(INSTALL_DATA) sapi/fpm/php-fpm.conf $(INSTALL_ROOT)$(sysconfdir)/php-fpm.conf.default || :
2121

2222
@echo "Installing PHP FPM man page: $(INSTALL_ROOT)$(mandir)/man1/"
2323
@$(mkinstalldirs) $(INSTALL_ROOT)$(mandir)/man1

sapi/fpm/config.m4

Lines changed: 8 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ LD_LIBRARY_PATH_SAVED="$LD_LIBRARY_PATH"
6060
6161
# Set our flags if we are checking a specific directory.
6262
if test -n "$ac_libevent_path" ; then
63-
LIBEVENT_CPPFLAGS="-I$ac_libevent_path/include"
64-
LIBEVENT_LDFLAGS="-L$ac_libevent_path/lib"
65-
LD_LIBRARY_PATH="$ac_libevent_path/lib:$LD_LIBRARY_PATH"
63+
LIBEVENT_CPPFLAGS="-I$ac_libevent_path/include"
64+
LIBEVENT_LDFLAGS="-L$ac_libevent_path/lib"
65+
LD_LIBRARY_PATH="$ac_libevent_path/lib:$LD_LIBRARY_PATH"
6666
else
67-
LIBEVENT_CPPFLAGS=""
68-
LIBEVENT_LDFLAGS=""
67+
LIBEVENT_CPPFLAGS=""
68+
LIBEVENT_LDFLAGS=""
6969
fi
7070
7171
# Required flag for libevent.
@@ -173,7 +173,7 @@ if test "$PHP_LIBEVENT_DIR" != "no"; then
173173
if test "$PHP_LIBEVENT_DIR" != "yes" && test "$PHP_LIBEVENT_DIR" != "/usr/local"; then
174174
dnl don't try to be too smart, check only $PHP_LIBEVENT_DIR if specified
175175
ac_libevent_path=$PHP_LIBEVENT_DIR
176-
AC_LIB_EVENT_DO_CHECK
176+
AC_LIB_EVENT_DO_CHECK
177177
if test "$success" = "no"; then
178178
AC_MSG_ERROR([Could not find libevent >= $WANT_LIBEVENT_VERSION in $PHP_LIBEVENT_DIR])
179179
fi
@@ -196,7 +196,7 @@ if test "$PHP_LIBEVENT_DIR" != "no"; then
196196
ac_have_libevent=yes
197197
AC_DEFINE(HAVE_LIBEVENT, 1, [define if libevent is available])
198198
fi
199-
199+
200200
LIBEVENT_LIBS="-levent"
201201
202202
if test -n "$ac_libevent_path"; then
@@ -509,9 +509,6 @@ dnl }}}
509509
dnl configure options {{{
510510
AC_DEFUN([AC_FPM_ARGS],
511511
[
512-
PHP_ARG_WITH(fpm-conf,,
513-
[ --with-fpm-conf[=PATH] Set the path for php-fpm configuration file. (default: \$sysconfdir/php-fpm.conf)], yes, no)
514-
515512
PHP_ARG_WITH(fpm-log,,
516513
[ --with-fpm-log[=PATH] Set the path for php-fpm log file. (default: /var/log/php-fpm.log)], yes, no)
517514
@@ -528,36 +525,6 @@ AC_DEFUN([AC_FPM_ARGS],
528525

529526
AC_DEFUN([AC_FPM_VARS],
530527
[
531-
if test -z "$PHP_FPM_CONF" -o "$PHP_FPM_CONF" = "yes" -o "$PHP_FPM_CONF" = "no"; then
532-
php_fpm_conf_path=""
533-
else
534-
php_fpm_conf_path="$PHP_FPM_CONF"
535-
fi
536-
537-
if test -z "$prefix" -o "$prefix" = "NONE"; then
538-
prefix="/usr/local"
539-
fi
540-
541-
if test -z "$exec_prefix" -o "$exec_prefix" = "NONE"; then
542-
exec_prefix=`eval echo "$prefix"`
543-
fi
544-
545-
php_fpm_bin_path=`eval echo "$bindir"`
546-
php_fpm_bin_path="$php_fpm_bin_path/php-fpm"
547-
548-
if test -z "$php_fpm_conf_path"; then
549-
php_fpm_conf_path=`eval echo "$sysconfdir"`
550-
php_fpm_conf_path="$php_fpm_conf_path/php-fpm.conf"
551-
fi
552-
553-
if test -d "$php_fpm_conf_path"; then
554-
php_fpm_conf_dir="$php_fpm_conf"
555-
php_fpm_conf="$php_fpm_conf/php-fpm.conf"
556-
else
557-
php_fpm_conf_dir=`dirname $php_fpm_conf_path`
558-
php_fpm_conf=`basename $php_fpm_conf_path`
559-
fi
560-
561528
if test -z "$PHP_FPM_LOG" -o "$PHP_FPM_LOG" = "yes" -o "$PHP_FPM_LOG" = "no"; then
562529
php_fpm_log_path="/var/log/php-fpm.log"
563530
else
@@ -586,18 +553,13 @@ AC_DEFUN([AC_FPM_VARS],
586553
587554
588555
PHP_SUBST_OLD(fpm_version)
589-
PHP_SUBST_OLD(php_fpm_conf_dir)
590-
PHP_SUBST_OLD(php_fpm_conf_path)
591-
PHP_SUBST_OLD(php_fpm_bin_path)
592556
PHP_SUBST_OLD(php_fpm_log_path)
593557
PHP_SUBST_OLD(php_fpm_pid_path)
594558
PHP_SUBST_OLD(php_fpm_log_dir)
595559
PHP_SUBST_OLD(php_fpm_pid_dir)
596560
PHP_SUBST_OLD(php_fpm_user)
597561
PHP_SUBST_OLD(php_fpm_group)
598562
599-
AC_DEFINE_UNQUOTED(PHP_FPM_CONF_DIR, "$php_fpm_conf_dir", [fpm conf file dir])
600-
AC_DEFINE_UNQUOTED(PHP_FPM_CONF_PATH, "$php_fpm_conf_path", [fpm conf file path])
601563
AC_DEFINE_UNQUOTED(PHP_FPM_VERSION, "$fpm_version", [fpm version])
602564
AC_DEFINE_UNQUOTED(PHP_FPM_LOG_PATH, "$php_fpm_log_path", [fpm log file path])
603565
AC_DEFINE_UNQUOTED(PHP_FPM_PID_PATH, "$php_fpm_pid_path", [fpm pid file path])
@@ -673,6 +635,7 @@ if test "$PHP_FPM" != "no"; then
673635
fpm/xml_config.c \
674636
fpm/zlog.c \
675637
"
638+
676639
PHP_SELECT_SAPI(fpm, program, $PHP_FPM_FILES $PHP_FPM_TRACE_FILES, $PHP_FPM_CFLAGS, '$(SAPI_FPM_PATH)')
677640

678641
case $host_alias in

sapi/fpm/fpm/fpm_conf.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "xml_config.h"
3030
#include "zlog.h"
3131

32-
3332
struct fpm_global_config_s fpm_global_config;
3433

3534
static void *fpm_global_config_ptr() /* {{{ */
@@ -551,11 +550,13 @@ int fpm_conf_init_main() /* {{{ */
551550
}
552551

553552
if (filename == NULL) {
554-
filename = PHP_FPM_CONF_PATH;
553+
spprintf(&filename, 0, "%s/php-fpm.conf", PHP_SYSCONFDIR);
554+
err = xml_conf_load_file(filename);
555+
efree(filename);
556+
} else {
557+
err = xml_conf_load_file(filename);
555558
}
556559

557-
err = xml_conf_load_file(filename);
558-
559560
if (err) {
560561
zlog(ZLOG_STUFF, ZLOG_ERROR, "failed to load configuration file: %s", err);
561562
return -1;

sapi/fpm/fpm/fpm_php.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <TSRM.h>
99

10+
#include "php.h"
1011
#include "build-defs.h" /* for PHP_ defines */
1112

1213
struct fpm_worker_pool_s;

sapi/fpm/init.d.php-fpm.in

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
# Description: starts the PHP FastCGI Process Manager daemon
1111
### END INIT INFO
1212

13-
php_fpm_BIN=@php_fpm_bin_path@
14-
php_fpm_CONF=@php_fpm_conf_path@
13+
prefix=@prefix@
14+
exec_prefix=@exec_prefix@
15+
16+
php_fpm_BIN=@sbindir@/php-fpm
17+
php_fpm_CONF=@sysconfdir@/php-fpm.conf
1518
php_fpm_PID=@php_fpm_pid_path@
1619

1720

0 commit comments

Comments
 (0)