This repository has been archived by the owner on Oct 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
177 lines (155 loc) · 5.47 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
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
167
168
169
170
171
172
173
174
175
176
177
# Autoconf configuration for Savane.
#
# Copyright (C) 2007 Sylvain Beucler
# Copyright (C) 2014 Assaf Gordon
# Copyright (C) 2022 Ineiev
#
# This file is part of Savane.
#
# Savane is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# Savane is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Based on gettext-0.16.1/gettext-tools/examples/hello-php
# (public domain)
AC_INIT([GNU Savannah],
[3.9],
[savannah-hackers-public@gnu.org], [savane],
[https://savannah.gnu.org/projects/administration])
# We expect to use Bash for our build scripts - it's widespread
# enough, not need to write portable shell in this case, I'd say.
if test -z "$BASH"; then
AC_MSG_ERROR([*** Essential program Bash not found])
fi
SHELL=$BASH
AC_CONFIG_AUX_DIR(autotools)
# For future version of aclocal:
AC_CONFIG_MACRO_DIR(autotools/m4)
AM_INIT_AUTOMAKE([1.11.1])
dnl The installed program must know where to find its message catalogs.
dnl Unfortunately, prefix gets only finally determined at the end of configure.
dnl i.e. otherwise you'll get @localedir@ => ${datarootdir}/locale
dnl (litterally)
if test "X$prefix" = "XNONE"; then
final_prefix="$ac_default_prefix"
else
final_prefix="$prefix"
fi
save_prefix="$prefix"
prefix="$final_prefix"
eval "datarootdir=\"${datarootdir}\""
eval "localedir=\"${datadir}/locale\""
prefix="$save_prefix"
dnl Support for the po directory.
AM_PO_SUBDIRS
if test -z "$MSGFMT" || test "x$MSGFMT" = "x:"; then
AC_MSG_ERROR([msgfmt not found; please install GNU gettext])
fi
AC_PATH_PROG(PERL, perl)
if test -z "$PERL"; then
AC_MSG_ERROR([perl not found])
fi
AC_PATH_PROG(SV_DB_CMD, mysql)
if test -z "$SV_DB_CMD"; then
AC_MSG_ERROR([mysql client not found])
fi
# Look for Apache2 and Mysqlserver, needed for local testing.
AC_PATH_PROG([APACHE2_SERVER_BIN],[apache2],[],
[$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/usr/local/sbin/])
AC_SUBST([APACHE2_SERVER_BIN])
AC_PATH_PROG([MYSQLD_SAFE_BIN],[mysqld_safe],[],
[$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/usr/local/sbin/])
AC_SUBST([MYSQLD_SAFE_BIN])
AC_PATH_PROG([MYSQL_INSTALLDB_BIN],[mysql_install_db],[],
[$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/usr/local/sbin/])
AC_SUBST([MYSQL_INSTALLDB_BIN])
AC_PATH_PROG([MYSQLADMIN_BIN],[mysqladmin],[],
[$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/usr/local/sbin/])
AC_SUBST([MYSQLADMIN_BIN])
AC_PATH_PROG([MYSQL_BIN],[mysql],[],
[$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/usr/local/sbin/])
AC_SUBST([MYSQL_BIN])
AC_PATH_PROG(GIT, git)
AC_ARG_ENABLE([changelog],
[AS_HELP_STRING([--enable-changelog], [update ChangeLog from git logs])],
[], [enable_changelog=no]
)
AS_CASE(["x$GIT"], [x], [], [
AS_IF([test -d "$srcdir/.git"], [
AS_CASE(["x$enable_changelog"], [xyes], [
AS_ECHO(["Updating ChangeLog..."])
sed '1,/^=\{51\}/{/^=\{51\}/p;d}' "$srcdir/ChangeLog" > ChangeLog.git
"$GIT" --git-dir="$srcdir/.git" log --numstat \
| sed "s,[[[:space:]]]*$,," > "$srcdir/ChangeLog"
echo >> "$srcdir/ChangeLog"
cat ChangeLog.git >> "$srcdir/ChangeLog"
rm ChangeLog.git
])
])
])
AC_ARG_WITH([db-name], AS_HELP_STRING([--with-db-name],
[name of the database (default: 'savane')]),
SV_DB_NAME="$withval",
SV_DB_NAME="savane")
AC_ARG_WITH([db-options], AS_HELP_STRING([--with-db-options],
[parameters to give MySQL when initializing the database (default: empty)]),
SV_DB_OPTIONS="$withval")
# Add these vars in the Makefile's:
AC_SUBST(SV_DB_NAME)
AC_SUBST(SV_DB_OPTIONS)
# Apache
# Perl: TODO, see how to autoconfiscate this proPERLy
echo -n "checking for webserver user... "
if test -e "/etc/debian_version"; then
# Debian-based
GUESS_WWW_SERVER_USER="www-data"
GUESS_PERL_INC="/usr/lib/perl5"
elif test -e "/etc/redhat-release"; then
# Fedora- or RedHat-based
GUESS_WWW_SERVER_USER="apache"
GUESS_PERL_INC="/usr/lib/perl5/site_perl"
elif test -e "/etc/gentoo-release"; then
# Gentoo-based
GUESS_WWW_SERVER_USER="apache"
elif test -e "/etc/slackware-version"; then
# Slackware-based"
GUESS_WWW_SERVER_USER="nobody"
fi
echo $GUESS_WWW_SERVER_USER
# TODO: --with-php-uid=... (AC_ARG_ENABLE)
# TODO: ps aux | grep -E 'http|apache' | parse_uid_field...
# TODO: else { echo "Couldn't guess Apache user"; exit 1}
SV_CONF=$sysconfdir/savane
AC_SUBST(SV_CONF)
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([ \
autotools/m4/Makefile \
etc/Makefile \
frontend/Makefile \
frontend/php/images/Makefile \
lib/Makefile \
local/Makefile])
AC_CONFIG_FILES([po/Makefile], [AM_POSTPROCESS_PO_MAKEFILE])
AC_CONFIG_FILES([frontend/php/include/ac_config.php])
AC_OUTPUT
echo
echo "Configuration directory: " `eval echo $SV_CONF`
echo "Guessed HTTPd/PHP user (configuration file permissions): $GUESS_WWW_SERVER_USER"
echo "Database name: $SV_DB_NAME"
if test ! -z "$SV_DB_OPTIONS"; then
echo "Database options: $SV_DB_OPTIONS"
fi
echo
echo "Now you can run:"
echo " make"
echo " make install"
echo "to install the backend scripts, their Savane Perl library,"
echo "and language files for the web interface"