1 autoconf; exec ./configure $@
3 dnl Process this file with autoconf to produce a configure script
5 dnl Embed in generated ./configure script the following CVS info:
6 AC_REVISION($Revision: 1.1.1.11 $)dnl
10 AC_INIT(RT, 3.8.7, [rt-bugs@bestpractical.com])
11 AC_CONFIG_SRCDIR([lib/RT.pm.in])
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
24 dnl Check for programs
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])
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.
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])
50 AC_ARG_WITH(speedycgi,
51 AC_HELP_STRING([--with-speedycgi=/path/to/speedy],
52 [path to your speedycgi binary, if it exists]),
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])
60 dnl Defaults paths for installation
61 AC_PREFIX_DEFAULT([/opt/rt3])
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
71 AC_DEFUN([ACRT_USER_GUESS],
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]) ])
81 AC_DEFUN([ACRT_GROUP_GUESS],
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]) ])
93 AC_ARG_WITH(bin-owner,
94 AC_HELP_STRING([--with-bin-owner=OWNER],
95 [user that will own RT binaries (default root)]),
101 AC_ARG_WITH(libs-owner,
102 AC_HELP_STRING([--with-libs-owner=OWNER],
103 [user that will own RT libraries (default root)]),
109 AC_ARG_WITH(libs-group,
110 AC_HELP_STRING([--with-libs-group=GROUP],
111 [group that will own RT binaries (default bin)]),
118 AC_HELP_STRING([--with-db-type=TYPE],
119 [sort of database RT will use (default: mysql) (mysql, Pg, Oracle and SQLite are valid)]),
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])
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';"
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';"
138 AC_SUBST(DATABASE_ENV_PREF)
142 AC_HELP_STRING([--with-db-host=HOSTNAME],
143 [FQDN of database server (default: localhost)]),
150 AC_HELP_STRING([--with-db-port=PORT],
151 [port on which the database listens on]),
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)]),
161 DB_RT_HOST=localhost)
164 dnl DB_DATABASE_ADMIN
165 if test "$DB_TYPE" = "Pg" ; then
171 AC_HELP_STRING([--with-db-dba=DBA],
172 [name of database administrator (default: root or postgres)]),
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,
183 AC_SUBST(DB_DATABASE)
186 AC_ARG_WITH(db-rt-user,
187 AC_HELP_STRING([--with-db-rt-user=DBUSER],
188 [name of database user (default: rt_user)]),
194 AC_ARG_WITH(db-rt-pass,
195 AC_HELP_STRING([--with-db-rt-pass=PASSWORD],
196 [password for database user (default: rt_pass)]),
202 AC_ARG_WITH(web-user,
203 AC_HELP_STRING([--with-web-user=USER],
204 [user the web server runs as (default: www)]),
206 ACRT_USER_GUESS([www www-data apache httpd nobody],[WEB_USER],[www])
211 AC_ARG_WITH(web-group,
212 AC_HELP_STRING([--with-web-group=GROUP],
213 [group the web server runs as (default: www)]),
215 ACRT_GROUP_GUESS([www www-data apache httpd nogroup nobody],[WEB_GROUP], [www]))
219 AC_ARG_WITH(rt-group,
220 AC_HELP_STRING([--with-rt-group=GROUP],
221 [group to own all files (default: rt)]),
223 ACRT_GROUP_GUESS([rt3 rt $WEB_GROUP],[RTGROUP], [rt]))
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]),
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]) ]
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]),
257 APACHECTL=`which apachectl`)
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
272 AC_SUBST(RT_DEVEL_MODE)
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
286 AC_SUBST(RT_GRAPHVIZ)
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)
292 AC_HELP_STRING([--enable-gd],
293 [Turns on support for RT's GD pie and bar charts]),
295 if test "$RT_GD" = yes; then
303 AC_CHECK_PROG([RT_GPG], [gpg], "yes", "no")
305 AC_HELP_STRING([--enable-gpg],
306 [Turns on GNU Privacy Guard (GPG) support]),
308 if test "$RT_GPG" = yes; then
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.
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})
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})
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})
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})
389 dnl Configure the output files, and generate them.
391 dnl Binaries that should be +x
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
401 sbin/rt-email-dashboards
402 sbin/rt-clean-sessions
405 sbin/rt-email-group-admin
407 bin/mason_handler.fcgi
408 bin/mason_handler.scgi
413 [chmod ug+x $ac_file]
416 dnl All other generated files
421 bin/mason_handler.svc
423 t/data/configs/apache2.2+mod_perl.conf
424 t/data/configs/apache2.2+fastcgi.conf],