aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
blob: 098f94b17302bc1b1c7acc4c0c5d610d696a8cc6 (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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# This file is part of Savane.                   -*- autoconf -*-
# 
# Copyright (C) 2007  Sylvain Beucler
# Copyright (C) 2015  Sergey Poznyakoff <gray@gnu.org>
# 
# 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/>.

AC_INIT([Savane], [3.1-cleanup+gray])
AC_CONFIG_AUX_DIR(autotools)
# For future version of aclocal:
AC_CONFIG_MACRO_DIR(autotools/m4)
AM_INIT_AUTOMAKE([1.11 gnu tar-ustar])

# 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


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 (literally)
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 AC_SUBST(localedir)

dnl Support for the po directory.
AM_PO_SUBDIRS

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

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)

AC_ARG_VAR([PIDOF], [Pathname of the pidof utility])
AC_PATH_PROG(PIDOF, pidof, [], [/sbin:/usr/sbin:$PATH])

get_http_user() {
    if test -n "$PIDOF"; then
        p=$($PIDOF httpd apache apache2)
        if test -n "$p"; then
	    set -- $(ps p "$p" o user= | sort | uniq | grep -v root)
	    if test $# -eq 1; then
	        echo $1
	    fi
        fi
    fi
}

AC_SUBST([SV_HTTPD_USER])
AC_ARG_WITH([http-user],
     [AS_HELP_STRING([--with-http-name],
                     [name of the user the HTTP server runs as])],
     [if id "$withval" >/dev/null 2>&1; then
          SV_HTTPD_USER=$withval
      else
          AC_MSG_ERROR([no such user: $withval])
      fi],
     [SV_HTTPD_USER=$(get_http_user)
      if test -z "$SV_HTTPD_USER"; then
          if test -e  "/etc/debian_version"; then 
              # Debian-based
              SV_HTTPD_USER="www-data"
          elif test -e "/etc/redhat-release"; then 
              # Fedora- or RedHat-based
              SV_HTTPD_USER="apache"
          elif test -e "/etc/gentoo-release"; then
              # Gentoo-based
              SV_HTTPD_USER="apache"
          elif test -e "/etc/slackware-version"; then
              SV_HTTPD_USER="apache"
	  else
	      AC_MSG_ERROR([failed to guess HTTPD user: please use the --with-http-user option])
          fi
	  # Just to make sure...
	  if ! id "$withval" >/dev/null 2>&1; then
	      AC_MSG_ERROR([failed to guess HTTPD user: please use the --with-http-user option])
	  fi
      fi])


AC_ARG_WITH([savane-conf-dir],
  [AS_HELP_STRING([--with-savane-conf-dir],
                  [name of the Savane configuration directory ('$sysconfdir/savane')])],
  [case "$withval" in
   /*) SV_CONF=$withval;;
   *)  AC_MSG_ERROR([argument to --with-savane-conf-dir must be an absolute pathname])
   esac],
  [SV_CONF='$(sysconfdir)/savane'])
  
AC_SUBST(SV_CONF)

AC_SUBST([SV_SITEADM_GROUP],[siteadmin])
AC_ARG_WITH([admin-group],
  [AS_HELP_STRING([--with-admin-group],
                  [unix group name for the site administration project ($SV_SITEADM_GROUP)])],
  [SV_SITEADM_GROUP=$withval])
  
AC_SUBST([SV_USERS_GROUP],[svusers])
AC_ARG_WITH([users-group],
  [AS_HELP_STRING([--with-users-group],
                  [primary unix group name for Savane users ($SV_USERS_GROUP)])],
  [SV_SITEADM_GROUP=$withval])

AC_SUBST(SV_CROND_TYPE)
AC_ARG_WITH([cron-type],
  [AS_HELP_STRING([--with-cron-type=vixie|dillon],
     [define type of the cron daemon running on this machine])],
  [SV_CROND_TYPE=SV_CROND_TYPE=$withval])

AC_SUBST(SV_CRONTAB_DIR,[/etc/cron.d])
AC_ARG_WITH([system-crontab-directory],
  [AS_HELP_STRING([--with-system-crontab-directory=DIR],
     [install crontabs to DIR, instead of /etc/cron.d])],
  [SV_CRONTAB_DIR=$withval])
  
AC_CONFIG_COMMANDS([status],[
cat <<EOT
*******************************************************************
Configuration completed.

Configuration directory:      $SV_CONF
HTTPD user:                   $SV_HTTPD_USER
Database name:                $SV_DB_NAME
Database options:             $SV_DB_OPTIONS
Administration project group: $SV_SITEADM_GROUP
Savane users group name:      $SV_USERS_GROUP

Now you can run:

  make
  make install
  
to install the backend scripts, their Savane Perl library,
and language files for the web interface.

Finally, run

  make setup

to create the necessary UNIX groups and to create and populate Savane
database.
EOT
],
[SV_CONF=$SV_CONF
SV_HTTPD_USER=$SV_HTTPD_USER
SV_DB_NAME=$SV_DB_NAME
SV_DB_OPTIONS=$SV_DB_OPTIONS
SV_SITEADM_GROUP=$SV_SITEADM_GROUP
SV_USERS_GROUP=$SV_USERS_GROUP])

AC_CONFIG_FILES([Makefile
                 autotools/m4/Makefile
                 backend/Makefile
                 backend/install/Makefile
                 backend/system-specific/Makefile
                 backend/system-specific/darwin/Makefile
                 etc/Makefile
                 frontend/Makefile
                 frontend/php/images/Makefile
                 lib/Makefile
		 lib/Savane/Makefile])
		 
AC_CONFIG_FILES([po/Makefile], [AM_POSTPROCESS_PO_MAKEFILE])

AC_CONFIG_FILES([frontend/php/include/ac_config.php])
AC_CONFIG_FILES([lib/Savane/Version.pm])

AC_OUTPUT

Return to:

Send suggestions and report system problems to the System administrator.