-rw-r--r-- | configure.ac | 166 |
1 files changed, 166 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..dc1beb3 --- a/dev/null +++ b/configure.ac @@ -0,0 +1,166 @@ +AC_INIT([sitecing-showcase], [0.0], [sitecing-bugs@klever.net]) +AC_CONFIG_SRCDIR([htdocs/index.chtml]) +AC_CONFIG_AUX_DIR([aux]) +AC_CONFIG_HEADER([include/acconfig.h]) +AM_INIT_AUTOMAKE([dist-bzip2]) + +AC_PATH_PROG([XSLTPROC],[xsltproc],[true]) + +PKG_CHECK_MODULES([SITECING],[sitecing],,[ + AC_MSG_ERROR([site-C-ing not found. get it at http://kin.klever.net/sitecing/]) +]) +sitecing_prefix="$(${PKG_CONFIG} --variable=prefix sitecing)" +sitecing_bindir="$(${PKG_CONFIG} --variable=bindir sitecing)" +AC_MSG_CHECKING([for sitecing-fastcgi binary]) +sitecing_fastcgi="${sitecing_bindir}/sitecing-fastcgi" +if test -x "${sitecing_fastcgi}" ; then + AC_MSG_RESULT([found ${sitecing_fastcgi}]) +else + AC_MSG_RESULT([not found]) + AC_MSG_ERROR([broken site-C-ing install detected]) +fi +AC_MSG_CHECKING([for sitecing-build binary]) +sitecing_build="${sitecing_bindir}/sitecing-build" +if test -x "${sitecing_build}" ; then + AC_MSG_RESULT([found ${sitecing_build}]) +else + AC_MSG_RESULT([not found]) + AC_MSG_ERROR([broken site-C-ing install detected]) +fi +AC_SUBST([sitecing_prefix]) +AC_SUBST([sitecing_bindir]) +AC_SUBST([sitecing_fastcgi]) +AC_SUBST([sitecing_build]) + +config_sitecing="config.sitecing" +rm -f "${config_sitecing}" +SC_BUILD_CONF([${config_sitecing}],[CPPFLAGS],[${SITECING_CFLAGS}]) +SC_BUILD_CONF([${config_sitecing}],[LDFLAGS],[${SITECING_LIBS}]) +AC_SUBST_FILE([config_sitecing]) + +SC_WEB_ROOT([web_src_root],[web_run_root]) +SC_USER([sitecing_user]) + +AC_DEFINE_UNQUOTED([WEB_ROOT],["${web_src_root}"],[the site root]) +AC_DEFINE_UNQUOTED([WEB_SRC_ROOT],["${web_src_root}"],[the site root]) +AC_DEFINE_UNQUOTED([WEB_RUN_ROOT],["${web_run_root}"],[the site root]) + +v_hostname="$(hostname)" +AC_MSG_CHECKING([for virtual host name]) +AC_ARG_WITH([vhostname], + AC_HELP_STRING([--with-vhostname=virtual-host-name],[set the apache ServerName of VirtualHost]), + [ + v_hostname="${withval}" + ] +) +AC_MSG_RESULT([${v_hostname}]) +AC_SUBST([v_hostname]) + +HAVE_DUDKI="false" +WANT_DUDKI="true" +AC_ARG_ENABLE([dudki], + AC_HELP_STRING([--disable-dudki],[disable the use of dudki! to restart daemon]), + [ + test "${enableval}" = "no" && WANT_DUDKI="false" + ] +) +if ${WANT_DUDKI} ; then + AC_PATH_PROG([DUDKI],[dudki],[false],[${PATH}:/usr/local/sbin:/usr/sbin]) + test "${DUDKI}" = "false" || HAVE_DUDKI="true" +fi +AM_CONDITIONAL([HAVE_DUDKI],[${HAVE_DUDKI}]) + +dudki_id=sitecing-showcase +AC_ARG_WITH([dudki-id], + AC_HELP_STRING([--with-dudki-id],[specify dudki process id]), + [ + dudki_id="${withval}" + ] +) +AC_SUBST([dudki_id]) + +APACHE_RESTART_CMD="false" +AC_ARG_WITH([apache-restart-cmd], + AC_HELP_STRING([--with-apache-restart-cmd=command],[use the specified command to restart apache]), + [ + test "${withval}" = "no" || APACHE_RESTART_CMD="${withval}" + ] +) +if test "${APACHE_RESTART_CMD}" = "false" ; then + AC_PATH_PROG([APACHECTL],[apachectl],[false],[${PATH}:/usr/sbin:/usr/local/sbin]) + if test "${APACHECTL}" != "false" ; then + APACHE_RESTART_CMD="sudo ${APACHECTL} graceful" + else + AC_PATH_PROG([APACHE2CTL],[apache2ctl],[false],[${PATH}:/usr/sbin:/usr/local/sbin]) + if test "${APACHE2CTL}" != "false" ; then + APACHE_RESTART_CMD="sudo ${APACHE2CTL} graceful" + else + for i_s in /etc/init.d/apache /etc/init.d/apache2 ; do + AC_MSG_CHECKING([for ${i_s}]) + if test -x ${i_s} ; then + AC_MSG_RESULT([found]) + APACHE_RESTART_CMD="sudo ${i_s} restart" + break + fi + AC_MSG_RESULT([not found]) + done + fi + fi +fi +if test "${APACHE_RESTART_CMD}" = "false" ; then + AC_MSG_NOTICE([couldn't figure out how to restart apache. use --with-apache-restart-cmd]) +fi +AC_SUBST([APACHE_RESTART_CMD]) + + +AC_MSG_CHECKING([if we are in the development environment]) +do_devel="false" +AC_ARG_ENABLE([development], + AC_HELP_STRING([--enable-development],[enable build for development environment]), + [ + if test "${enableval}" = "yes" ; then + do_devel="true" + fi + ] +) +build_on_demand="off" +exception_handler="/handlers/exception_prod" +if ${do_devel} ; then + AC_MSG_RESULT([yes]) + build_on_demand="on" + exception_handler="/handlers/exception_dev" + AC_DEFINE([_DEVELOPMENT],,[define if development environment]) +else + AC_MSG_RESULT([no]) +fi +AC_SUBST([build_on_demand]) +AC_SUBST([exception_handler]) + +DISTCHECKING="false" +AC_ARG_ENABLE([distcheck],,[ + DISTCHECKING="true" +]) +AM_CONDITIONAL([DISTCHECKING],[${DISTCHECKING}]) + +AC_CONFIG_FILES([ + Makefile + conf/httpd.conf conf/sitecing.conf conf/dudki.conf + bin/run bin/build +]) +AC_CONFIG_COMMANDS([logs/stamp],[touch logs/stamp]) +AC_CONFIG_COMMANDS([fastcgi-bin/stamp],[touch fastcgi-bin/stamp]) +AC_CONFIG_COMMANDS([run/stamp],[touch run/stamp]) +AC_OUTPUT + +echo +echo === +echo "virtual host name:" "${v_hostname}" +echo "project src root: " "${web_src_root}" +echo "project run root: " "${web_run_root}" +echo "sitecing user: " "${sitecing_user}" +echo "dudki id: " "${dudki_id}" +echo "development: " "${do_devel}" +echo "site-C-ing prefix:" "${sitecing_prefix}" +echo === +echo +dnl vim:set ft=m4: |