summaryrefslogtreecommitdiffabout
path: root/configure.ac
blob: ef66b300395cb8bb55ebb00f21d53aece17eec9d (plain)
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
AC_INIT([sitecing-showcase], [0.0.1], [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: