This commit was generated by cvs2svn to compensate for changes in r8690,
[freeside.git] / rt / configure.ac
1 autoconf; exec ./configure $@
2 dnl
3 dnl Process this file with autoconf to produce a configure script
4 dnl
5 dnl Embed in generated ./configure script the following CVS info:
6 AC_REVISION($Revision: 1.1.1.11 $)dnl
7
8 dnl Setup autoconf
9 AC_PREREQ([2.53])
10 AC_INIT(RT, 3.8.7, [rt-bugs@bestpractical.com])
11 AC_CONFIG_SRCDIR([lib/RT.pm.in])
12
13 dnl Extract RT version number components
14 AC_SUBST([rt_version_major],
15         m4_bregexp(AC_PACKAGE_VERSION,[^\(\w+\)\.\(\w+\)\(\.\(\w+\)\)?],[\1]))
16 AC_SUBST([rt_version_minor],
17         m4_bregexp(AC_PACKAGE_VERSION,[^\(\w+\)\.\(\w+\)\(\.\(\w+\)\)?],[\2]))
18 AC_SUBST([rt_version_patch],
19         m4_bregexp(AC_PACKAGE_VERSION,[^\(\w+\)\.\(\w+\)\(\.\(\w+\)\)?],[\4]))
20 test "x$rt_version_major" = 'x' && rt_version_major=0
21 test "x$rt_version_minor" = 'x' && rt_version_minor=0
22 test "x$rt_version_patch" = 'x' && rt_version_patch=0
23
24 dnl Check for programs
25 AC_PROG_INSTALL
26 AC_PROG_AWK
27 AC_ARG_VAR([PERL],[Perl interpreter command])
28 AC_PATH_PROG([PERL], [perl], [not found])
29 if test "$PERL" = 'not found'; then
30         AC_MSG_ERROR([cannot use $PACKAGE_NAME without perl])
31 fi
32
33
34 dnl WEB_HANDLER
35 AC_ARG_WITH(web-handler,
36     AC_HELP_STRING([--with-web-handler=LIST],
37         [comma separated list of web-handlers RT will be able to use.
38          Default is fastcgi when modperl1, modperl2, fastcgi, standalone
39          and speedycgi are valid. To succefuly run RT you need only one.
40         ]),
41     WEB_HANDLER=$withval,
42     WEB_HANDLER=fastcgi)
43 my_web_handler_test=$($PERL -e 'print "ok" unless grep $_ !~ /^(modperl[12]|fastcgi|speedycgi|standalone)$/i, grep defined && length, split /\s*,\s*/, "$WEB_HANDLER"')
44 if test "$my_web_handler_test" != "ok"; then
45         AC_MSG_ERROR([Only modperl1, modperl2, fastcgi, speedycgi and standalone are valid web-handlers])
46 fi
47 AC_SUBST(WEB_HANDLER)
48
49 dnl SPEED_BIN
50 AC_ARG_WITH(speedycgi,
51             AC_HELP_STRING([--with-speedycgi=/path/to/speedy],
52                            [path to your speedycgi binary, if it exists]),
53             SPEEDY_BIN=$withval,
54             SPEEDY_BIN=/usr/local/bin/speedy) 
55 if test "$WEB_HANDLER" = 'speedycgi' -a ! -x "$SPEEDY_BIN"; then
56         AC_MSG_ERROR([cannot find speedycgi binary])
57 fi
58 AC_SUBST(SPEEDY_BIN)
59
60 dnl Defaults paths for installation
61 AC_PREFIX_DEFAULT([/opt/rt3])
62 RT_ENABLE_LAYOUT
63
64
65 # ACRT_USER_EXISTS( users, variable, default )
66 # - users is a list of users [www apache www-docs]
67 #    from highest to lowest priority to high priority (i.e. first match)
68 # - variable is what you set with the result
69 #
70
71 AC_DEFUN([ACRT_USER_GUESS],
72  [ 
73    $2=$3
74    for x in $1; do
75     AC_MSG_CHECKING([if user $x exists]) 
76      AS_IF([ $PERL -e"exit( defined getpwnam('$x') ? 0 : 1)" ],
77            [ AC_MSG_RESULT([found]); $2=$x ; break],
78            [ AC_MSG_RESULT([not found]) ])
79    done
80   ])
81 AC_DEFUN([ACRT_GROUP_GUESS],
82  [ 
83    $2=$3
84    for x in $1; do
85     AC_MSG_CHECKING([if group $x exists]) 
86      AS_IF([ $PERL -e"exit( defined getgrnam('$x') ? 0 : 1)" ],
87            [ AC_MSG_RESULT([found]); $2=$x ; break],
88            [ AC_MSG_RESULT([not found]) ])
89    done
90   ])
91
92 dnl BIN_OWNER
93 AC_ARG_WITH(bin-owner,
94             AC_HELP_STRING([--with-bin-owner=OWNER],
95                            [user that will own RT binaries (default root)]),
96             BIN_OWNER=$withval,
97             BIN_OWNER=root)
98 AC_SUBST(BIN_OWNER)
99
100 dnl LIBS_OWNER
101 AC_ARG_WITH(libs-owner,
102             AC_HELP_STRING([--with-libs-owner=OWNER],
103                            [user that will own RT libraries (default root)]),
104             LIBS_OWNER=$withval,
105             LIBS_OWNER=root)
106 AC_SUBST(LIBS_OWNER)
107
108 dnl LIBS_GROUP
109 AC_ARG_WITH(libs-group,
110             AC_HELP_STRING([--with-libs-group=GROUP],
111                            [group that will own RT binaries (default bin)]),
112             LIBS_GROUP=$withval,
113             LIBS_GROUP=bin)
114 AC_SUBST(LIBS_GROUP)
115
116 dnl DB_TYPE
117 AC_ARG_WITH(db-type,
118             AC_HELP_STRING([--with-db-type=TYPE],
119                            [sort of database RT will use (default: mysql) (mysql, Pg, Oracle and SQLite are valid)]), 
120             DB_TYPE=$withval,
121             DB_TYPE=mysql)
122 if test "$DB_TYPE" != 'mysql' -a "$DB_TYPE" != 'Pg' -a "$DB_TYPE" != 'SQLite' -a "$DB_TYPE" != 'Oracle' -a "$DB_TYPE" != 'Informix' -a "$DB_TYPE" != 'Sybase' ; then
123         AC_MSG_ERROR([Only Oracle, Pg, mysql and SQLite are valid db types])
124 fi
125 AC_SUBST(DB_TYPE)
126
127 dnl DATABASE_ENV_PREF
128 if test "$DB_TYPE" = 'Oracle'; then
129         test "x$ORACLE_HOME" = 'x' && AC_MSG_ERROR([Please declare the ORACLE_HOME environment variable])
130         DATABASE_ENV_PREF="\$ENV{'ORACLE_HOME'} = '$ORACLE_HOME';"
131 fi
132
133 dnl DATABASE_ENV_PREF
134 if test "$DB_TYPE" = 'Sybase'; then
135         test "x$SYBASE" = 'x' && AC_MSG_ERROR([Please declare the SYBASE_HOME environment variable])
136         DATABASE_ENV_PREF="\$ENV{'SYBASE'} = '$SYBASE';"
137 fi
138 AC_SUBST(DATABASE_ENV_PREF)
139
140 dnl DB_HOST
141 AC_ARG_WITH(db-host,
142             AC_HELP_STRING([--with-db-host=HOSTNAME],
143                            [FQDN of database server (default: localhost)]),
144             DB_HOST=$withval,
145             DB_HOST=localhost)
146 AC_SUBST(DB_HOST)
147
148 dnl DB_PORT
149 AC_ARG_WITH(db-port,
150             AC_HELP_STRING([--with-db-port=PORT],
151                            [port on which the database listens on]),
152             DB_PORT=$withval,
153             DB_PORT=)
154 AC_SUBST(DB_PORT)
155
156 dnl DB_RT_HOST
157 AC_ARG_WITH(db-rt-host,
158             AC_HELP_STRING([--with-db-rt-host=HOSTNAME],
159                            [FQDN of RT server which talks to the database server (default: localhost)]),
160             DB_RT_HOST=$withval,
161             DB_RT_HOST=localhost)
162 AC_SUBST(DB_RT_HOST)
163
164 dnl DB_DATABASE_ADMIN
165 if test "$DB_TYPE" = "Pg" ; then
166         DB_DBA="postgres"
167 else
168         DB_DBA="root"
169 fi
170 AC_ARG_WITH(db-dba,
171             AC_HELP_STRING([--with-db-dba=DBA],
172                            [name of database administrator (default: root or postgres)]),
173             DB_DBA=$withval,
174             DB_DBA="$DB_DBA")
175 AC_SUBST(DB_DBA)
176
177 dnl DB_DATABASE
178 AC_ARG_WITH(db-database,
179             AC_HELP_STRING([--with-db-database=DBNAME],
180                            [name of the database to use (default: rt3)]),
181             DB_DATABASE=$withval,
182             DB_DATABASE=rt3)
183 AC_SUBST(DB_DATABASE)
184
185 dnl DB_RT_USER
186 AC_ARG_WITH(db-rt-user,
187             AC_HELP_STRING([--with-db-rt-user=DBUSER],
188                            [name of database user (default: rt_user)]),
189             DB_RT_USER=$withval,
190             DB_RT_USER=rt_user)
191 AC_SUBST(DB_RT_USER)
192
193 dnl DB_RT_PASS
194 AC_ARG_WITH(db-rt-pass,
195             AC_HELP_STRING([--with-db-rt-pass=PASSWORD],
196                            [password for database user (default: rt_pass)]),
197             DB_RT_PASS=$withval,
198             DB_RT_PASS=rt_pass)
199 AC_SUBST(DB_RT_PASS)
200
201 dnl WEB_USER
202 AC_ARG_WITH(web-user,
203             AC_HELP_STRING([--with-web-user=USER],
204                            [user the web server runs as (default: www)]),
205             WEB_USER=$withval,
206             ACRT_USER_GUESS([www www-data apache httpd nobody],[WEB_USER],[www])
207 )
208 AC_SUBST(WEB_USER)
209
210 dnl WEB_GROUP
211 AC_ARG_WITH(web-group,
212             AC_HELP_STRING([--with-web-group=GROUP],
213                            [group the web server runs as (default: www)]),
214             WEB_GROUP=$withval,
215             ACRT_GROUP_GUESS([www www-data apache httpd nogroup nobody],[WEB_GROUP], [www]))
216 AC_SUBST(WEB_GROUP)
217
218 dnl RTGROUP
219 AC_ARG_WITH(rt-group,
220             AC_HELP_STRING([--with-rt-group=GROUP],
221                            [group to own all files (default: rt)]),
222             RTGROUP=$withval,
223             ACRT_GROUP_GUESS([rt3 rt $WEB_GROUP],[RTGROUP], [rt]))
224 AC_SUBST(RTGROUP)
225
226 dnl INSTALL AS ME
227 # XXX TODO: The command below to figure out the group brokenly relies on
228 # output order (and "id -gn" doesn't work on all platforms).
229 my_group=$(groups|cut -f1 -d' ')
230 my_user=${USER:-$LOGNAME}
231 AC_ARG_WITH(my-user-group,
232             AC_HELP_STRING([--with-my-user-group],
233                            [set all users and groups to current user/group]),
234             RTGROUP=$my_group
235             BIN_OWNER=$my_user
236             LIBS_OWNER=$my_user
237             LIBS_GROUP=$my_group
238             WEB_USER=$my_user
239             WEB_GROUP=$my_group)
240
241 # Test for valid database names
242 AS_IF([ test "$DB_TYPE" = "mysql" ],
243       [ AC_MSG_CHECKING([if database name is valid])
244           AS_IF([ echo $DB_DATABASE | $AWK '/-/ { exit 1 }' ],
245                 [ AC_MSG_RESULT([yes]) ],
246                 [ AC_MSG_ERROR([no.  database name ($DB_DATABASE) contains '-' which is not valid for mysql]) ]
247                )
248       ]
249      )
250
251
252 dnl Set the value of apachectl
253 AC_ARG_WITH(apachectl,
254             AC_HELP_STRING([--with-apachectl],
255                            [instruct RT where to find your apachectl]),
256             APACHECTL=$withval, 
257             APACHECTL=`which apachectl`)
258 AC_SUBST(APACHECTL)
259
260 dnl RT's "maintainer mode"
261 AC_ARG_WITH(devel-mode,[],RT_DEVEL_MODE=$withval,RT_DEVEL_MODE="0")
262 AC_ARG_ENABLE(devel-mode,
263             AC_HELP_STRING([--enable-devel-mode],
264                            [Turn on development aids that might hurt you in production]),
265             RT_DEVEL_MODE=$enableval,
266             RT_DEVEL_MODE=$RT_DEVEL_MODE)
267 if test "$RT_DEVEL_MODE" = yes; then
268         RT_DEVEL_MODE="1"
269 else
270         RT_DEVEL_MODE="0"
271 fi
272 AC_SUBST(RT_DEVEL_MODE)
273
274 dnl RT's GraphViz dependency charts
275 AC_CHECK_LIB([graph],[aginitlib],RT_GRAPHVIZ="1")
276 AC_ARG_WITH(graphviz,[],RT_GRAPHVIZ=$withval)
277 AC_ARG_ENABLE(graphviz,
278             AC_HELP_STRING([--enable-graphviz],
279                            [Turns on support for RT's GraphViz dependency charts]),
280             RT_GRAPHVIZ=$enableval)
281 if test "$RT_GRAPHVIZ" = yes; then
282         RT_GRAPHVIZ="1"
283 else
284         RT_GRAPHVIZ="0"
285 fi
286 AC_SUBST(RT_GRAPHVIZ)
287
288 dnl RT's GD pie and bar charts
289 AC_CHECK_PROG([RT_GD], [gdlib-config], "yes", "no")
290 AC_ARG_WITH(gd,[],RT_GD=$withval)
291 AC_ARG_ENABLE(gd,
292             AC_HELP_STRING([--enable-gd],
293                            [Turns on support for RT's GD pie and bar charts]),
294             RT_GD=$enableval)
295 if test "$RT_GD" = yes; then
296         RT_GD="1"
297 else
298         RT_GD="0"
299 fi
300 AC_SUBST(RT_GD)
301
302 dnl RT's GPG support
303 AC_CHECK_PROG([RT_GPG], [gpg], "yes", "no")
304 AC_ARG_ENABLE(gpg,
305             AC_HELP_STRING([--enable-gpg],
306                            [Turns on GNU Privacy Guard (GPG) support]),
307             RT_GPG=$enableval)
308 if test "$RT_GPG" = yes; then
309         RT_GPG="1"
310 else
311         RT_GPG="0"
312 fi
313 AC_SUBST(RT_GPG)
314
315
316 dnl This section maps the variable names this script 'natively' generates
317 dnl to their existing names. They should be removed from here as the .in
318 dnl files are changed to use the new names.
319
320 dnl version numbers
321 AC_SUBST(RT_VERSION_MAJOR,              ${rt_version_major})
322 AC_SUBST(RT_VERSION_MINOR,              ${rt_version_minor})
323 AC_SUBST(RT_VERSION_PATCH,              ${rt_version_patch})
324
325 dnl layout paths
326 AC_SUBST([RT_PATH],                     ${exp_prefix})
327 AC_SUBST([RT_DOC_PATH],                 ${exp_manualdir})
328 AC_SUBST([RT_LOCAL_PATH],               ${exp_customdir})
329 AC_SUBST([RT_LIB_PATH],                 ${exp_libdir})
330 AC_SUBST([RT_ETC_PATH],                 ${exp_sysconfdir})
331 AC_SUBST([CONFIG_FILE_PATH],            ${exp_sysconfdir})
332 AC_SUBST([RT_BIN_PATH],                 ${exp_bindir})
333 AC_SUBST([RT_SBIN_PATH],                ${exp_sbindir})
334 AC_SUBST([RT_VAR_PATH],                 ${exp_localstatedir})
335 AC_SUBST([RT_MAN_PATH],                 ${exp_mandir})
336 AC_SUBST([RT_PLUGIN_PATH],                      ${exp_plugindir})
337 AC_SUBST([MASON_DATA_PATH],             ${exp_masonstatedir})
338 AC_SUBST([MASON_SESSION_PATH],          ${exp_sessionstatedir})
339 AC_SUBST([MASON_HTML_PATH],             ${exp_htmldir})
340 AC_SUBST([LOCAL_ETC_PATH],              ${exp_custometcdir})
341 AC_SUBST([MASON_LOCAL_HTML_PATH],       ${exp_customhtmldir})
342 AC_SUBST([LOCAL_LEXICON_PATH],          ${exp_customlexdir})
343 AC_SUBST([LOCAL_LIB_PATH],              ${exp_customlibdir})
344 AC_SUBST([RT_LOG_PATH],                 ${exp_logfiledir})
345
346 if test ${exp_sysconfdir} = "etc"; then
347 AC_SUBST([RT_PATH_R],                   ${exp_prefix})
348 AC_SUBST([RT_DOC_PATH_R],                       ${exp_prefix}/${exp_manualdir})
349 AC_SUBST([RT_LOCAL_PATH_R],             ${exp_prefix}/${exp_customdir})
350 AC_SUBST([RT_LIB_PATH_R],                       ${exp_prefix}/${exp_libdir})
351 AC_SUBST([RT_ETC_PATH_R],                       ${exp_prefix}/${exp_sysconfdir})
352 AC_SUBST([CONFIG_FILE_PATH_R],          ${exp_prefix}/${exp_sysconfdir})
353 AC_SUBST([RT_BIN_PATH_R],                       ${exp_prefix}/${exp_bindir})
354 AC_SUBST([RT_SBIN_PATH_R],              ${exp_prefix}/${exp_sbindir})
355 AC_SUBST([RT_VAR_PATH_R],                       ${exp_prefix}/${exp_localstatedir})
356 AC_SUBST([RT_MAN_PATH_R],                       ${exp_prefix}/${exp_mandir})
357 AC_SUBST([RT_PLUGIN_PATH_R],            ${exp_prefix}/${exp_plugindir})
358 AC_SUBST([MASON_DATA_PATH_R],           ${exp_prefix}/${exp_masonstatedir})
359 AC_SUBST([MASON_SESSION_PATH_R],                ${exp_prefix}/${exp_sessionstatedir})
360 AC_SUBST([MASON_HTML_PATH_R],           ${exp_prefix}/${exp_htmldir})
361 AC_SUBST([LOCAL_ETC_PATH_R],            ${exp_prefix}/${exp_custometcdir})
362 AC_SUBST([MASON_LOCAL_HTML_PATH_R],     ${exp_prefix}/${exp_customhtmldir})
363 AC_SUBST([LOCAL_LEXICON_PATH_R],                ${exp_prefix}/${exp_customlexdir})
364 AC_SUBST([LOCAL_LIB_PATH_R],            ${exp_prefix}/${exp_customlibdir})
365 AC_SUBST([RT_LOG_PATH_R],                       ${exp_prefix}/${exp_logfiledir})
366 else
367 AC_SUBST([RT_PATH_R],                   ${exp_prefix})
368 AC_SUBST([RT_DOC_PATH_R],                       ${exp_manualdir})
369 AC_SUBST([RT_LOCAL_PATH_R],             ${exp_customdir})
370 AC_SUBST([RT_LIB_PATH_R],                       ${exp_libdir})
371 AC_SUBST([RT_ETC_PATH_R],                       ${exp_sysconfdir})
372 AC_SUBST([RT_PLUGIN_PATH_R],            ${exp_plugindir})
373 AC_SUBST([CONFIG_FILE_PATH_R],          ${exp_sysconfdir})
374 AC_SUBST([RT_BIN_PATH_R],                       ${exp_bindir})
375 AC_SUBST([RT_SBIN_PATH_R],              ${exp_sbindir})
376 AC_SUBST([RT_VAR_PATH_R],                       ${exp_localstatedir})
377 AC_SUBST([RT_MAN_PATH_R],                       ${exp_mandir})
378 AC_SUBST([MASON_DATA_PATH_R],           ${exp_masonstatedir})
379 AC_SUBST([MASON_SESSION_PATH_R],                ${exp_sessionstatedir})
380 AC_SUBST([MASON_HTML_PATH_R],           ${exp_htmldir})
381 AC_SUBST([LOCAL_ETC_PATH_R],            ${exp_custometcdir})
382 AC_SUBST([MASON_LOCAL_HTML_PATH_R],     ${exp_customhtmldir})
383 AC_SUBST([LOCAL_LEXICON_PATH_R],                ${exp_customlexdir})
384 AC_SUBST([LOCAL_LIB_PATH_R],            ${exp_customlibdir})
385 AC_SUBST([RT_LOG_PATH_R],                       ${exp_logfiledir})
386
387 fi
388
389 dnl Configure the output files, and generate them.
390
391 dnl Binaries that should be +x
392 AC_CONFIG_FILES([
393                  etc/upgrade/3.8-branded-queues-extension
394                  etc/upgrade/3.8-ical-extension
395                  etc/upgrade/split-out-cf-categories
396                  sbin/rt-attributes-viewer
397                  sbin/rt-dump-database
398                  sbin/rt-setup-database
399                  sbin/rt-test-dependencies
400                  sbin/rt-email-digest
401                  sbin/rt-email-dashboards
402                  sbin/rt-clean-sessions
403                  sbin/rt-shredder
404                  sbin/rt-validator
405                  sbin/rt-email-group-admin
406                  sbin/rt-server
407                  bin/mason_handler.fcgi
408                  bin/mason_handler.scgi
409                  bin/standalone_httpd
410                  bin/rt-crontool
411                  bin/rt-mailgate
412                  bin/rt],
413                 [chmod ug+x $ac_file]
414                )
415
416 dnl All other generated files
417 AC_CONFIG_FILES([
418                  Makefile
419                  etc/RT_Config.pm
420                  lib/RT.pm
421                  bin/mason_handler.svc
422                  bin/webmux.pl
423                  t/data/configs/apache2.2+mod_perl.conf
424                  t/data/configs/apache2.2+fastcgi.conf],
425                )
426 AC_OUTPUT