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.4 $)dnl
10 AC_INIT(RT, m4_esyscmd([( git describe --tags || cat ./.tag 2> /dev/null || echo "rt-3.9.EXPORTED" )| tr -d "\n"]), [rt-bugs@bestpractical.com])
11 AC_CONFIG_SRCDIR([lib/RT.pm])
13 dnl Save our incant early since $@ gets overwritten by some macros.
14 dnl ${ac_configure_args} is available later, but it's quoted differently
15 dnl and undocumented. See http://www.spinics.net/lists/ac/msg10022.html.
16 AC_SUBST(CONFIGURE_INCANT, "$0 $@")
18 dnl Extract RT version number components
19 AC_SUBST([rt_version_major],
20 m4_bregexp(AC_PACKAGE_VERSION,[^rt-\(\w+\)\.\(\w+\)\.\(.+\)$],[\1]))
21 AC_SUBST([rt_version_minor],
22 m4_bregexp(AC_PACKAGE_VERSION,[^rt-\(\w+\)\.\(\w+\)\.\(.+\)$],[\2]))
23 AC_SUBST([rt_version_patch],
24 m4_bregexp(AC_PACKAGE_VERSION,[^rt-\(\w+\)\.\(\w+\)\.\(.+\)$],[\3]))
25 test "x$rt_version_major" = 'x' && rt_version_major=0
26 test "x$rt_version_minor" = 'x' && rt_version_minor=0
27 test "x$rt_version_patch" = 'x' && rt_version_patch=0
29 dnl Check for programs
31 AC_ARG_VAR([PERL],[Perl interpreter command])
32 AC_PATH_PROG([PERL], [perl], [not found])
33 if test "$PERL" = 'not found'; then
34 AC_MSG_ERROR([cannot use $PACKAGE_NAME without perl])
37 dnl BSD find uses -perm +xxxx, GNU find has deprecated this syntax in favour of
39 AC_MSG_CHECKING([checking version of find])
40 AS_IF([find --version 2>&1 | grep 'GNU'],
42 AC_MSG_RESULT([configuring for GNU find]) ],
44 AC_MSG_RESULT([configuring for BSD find]) ])
49 AC_ARG_WITH(web-handler,
50 AC_HELP_STRING([--with-web-handler=LIST],
51 [comma separated list of web-handlers RT will be able to use.
52 Default is fastcgi. Valid values are modperl1, modperl2, fastcgi and standalone.
53 To successfully run RT you need only one.
57 my_web_handler_test=$($PERL -e 'print "ok" unless grep $_ !~ /^(modperl1|modperl2|fastcgi|standalone)$/i, grep defined && length, split /\s*,\s*/, $ARGV@<:@0@:>@' $WEB_HANDLER)
58 if test "$my_web_handler_test" != "ok"; then
59 AC_MSG_ERROR([Only modperl1, modperl2, fastcgi and standalone are valid web-handlers])
63 dnl Defaults paths for installation
64 AC_PREFIX_DEFAULT([/opt/rt4])
68 # ACRT_USER_EXISTS( users, variable, default )
69 # - users is a list of users [www apache www-docs]
70 # from highest to lowest priority to high priority (i.e. first match)
71 # - variable is what you set with the result
74 AC_DEFUN([ACRT_USER_GUESS],
78 AC_MSG_CHECKING([if user $x exists])
79 AS_IF([ $PERL -e"exit( defined getpwnam('$x') ? 0 : 1)" ],
80 [ AC_MSG_RESULT([found]); $2=$x ; break],
81 [ AC_MSG_RESULT([not found]) ])
84 AC_DEFUN([ACRT_GROUP_GUESS],
88 AC_MSG_CHECKING([if group $x exists])
89 AS_IF([ $PERL -e"exit( defined getgrnam('$x') ? 0 : 1)" ],
90 [ AC_MSG_RESULT([found]); $2=$x ; break],
91 [ AC_MSG_RESULT([not found]) ])
96 AC_ARG_WITH(bin-owner,
97 AC_HELP_STRING([--with-bin-owner=OWNER],
98 [user that will own RT binaries (default root)]),
104 AC_ARG_WITH(libs-owner,
105 AC_HELP_STRING([--with-libs-owner=OWNER],
106 [user that will own RT libraries (default root)]),
112 AC_ARG_WITH(libs-group,
113 AC_HELP_STRING([--with-libs-group=GROUP],
114 [group that will own RT binaries (default bin)]),
121 AC_HELP_STRING([--with-db-type=TYPE],
122 [sort of database RT will use (default: mysql) (mysql, Pg, Oracle and SQLite are valid)]),
125 if test "$DB_TYPE" != 'mysql' -a "$DB_TYPE" != 'Pg' -a "$DB_TYPE" != 'SQLite' -a "$DB_TYPE" != 'Oracle' ; then
126 AC_MSG_ERROR([Only Oracle, Pg, mysql and SQLite are valid db types])
130 dnl DATABASE_ENV_PREF
131 if test "$DB_TYPE" = 'Oracle'; then
132 test "x$ORACLE_HOME" = 'x' && AC_MSG_ERROR([Please declare the ORACLE_HOME environment variable])
133 DATABASE_ENV_PREF="\$ENV{'ORACLE_HOME'} = '$ORACLE_HOME';"
136 AC_SUBST(DATABASE_ENV_PREF)
140 AC_HELP_STRING([--with-db-host=HOSTNAME],
141 [FQDN of database server (default: localhost)]),
148 AC_HELP_STRING([--with-db-port=PORT],
149 [port on which the database listens on]),
155 AC_ARG_WITH(db-rt-host,
156 AC_HELP_STRING([--with-db-rt-host=HOSTNAME],
157 [FQDN of RT server which talks to the database server (default: localhost)]),
159 DB_RT_HOST=localhost)
162 dnl DB_DATABASE_ADMIN
163 if test "$DB_TYPE" = "Pg" ; then
169 AC_HELP_STRING([--with-db-dba=DBA],
170 [name of database administrator (default: root or postgres)]),
176 AC_ARG_WITH(db-database,
177 AC_HELP_STRING([--with-db-database=DBNAME],
178 [name of the database to use (default: rt4)]),
179 DB_DATABASE=$withval,
181 AC_SUBST(DB_DATABASE)
184 AC_ARG_WITH(db-rt-user,
185 AC_HELP_STRING([--with-db-rt-user=DBUSER],
186 [name of database user (default: rt_user)]),
192 AC_ARG_WITH(db-rt-pass,
193 AC_HELP_STRING([--with-db-rt-pass=PASSWORD],
194 [password for database user (default: rt_pass)]),
200 AC_ARG_WITH(web-user,
201 AC_HELP_STRING([--with-web-user=USER],
202 [user the web server runs as (default: www)]),
204 ACRT_USER_GUESS([www www-data apache httpd nobody],[WEB_USER],[www])
209 AC_ARG_WITH(web-group,
210 AC_HELP_STRING([--with-web-group=GROUP],
211 [group the web server runs as (default: www)]),
213 ACRT_GROUP_GUESS([www www-data apache httpd nogroup nobody],[WEB_GROUP], [www]))
217 AC_ARG_WITH(rt-group,
218 AC_HELP_STRING([--with-rt-group=GROUP],
219 [group to own all files (default: rt)]),
221 ACRT_GROUP_GUESS([rt3 rt $WEB_GROUP],[RTGROUP], [rt]))
225 my_group=$($PERL -MPOSIX=getgid -le 'print scalar getgrgid getgid')
226 my_user=${USER:-$LOGNAME}
227 AC_ARG_WITH(my-user-group,
228 AC_HELP_STRING([--with-my-user-group],
229 [set all users and groups to current user/group]),
237 # Test for valid database names
238 AC_MSG_CHECKING([if database name is set])
239 AS_IF([ echo $DB_DATABASE | $PERL -e 'exit(1) unless <> =~ /\S/' ],
240 [ AC_MSG_RESULT([yes]) ],
241 [ AC_MSG_ERROR([no. database name is not set]) ]
244 dnl Dependencies for testing and developing RT
245 AC_ARG_WITH(developer,[],RT_DEVELOPER=$withval,RT_DEVELOPER="0")
246 AC_ARG_ENABLE(developer,
247 AC_HELP_STRING([--enable-developer],
248 [Add dependencies needed for testing and developing RT]),
249 RT_DEVELOPER=$enableval,
250 RT_DEVELOPER=$RT_DEVELOPER)
251 if test "$RT_DEVELOPER" = yes; then
256 AC_SUBST(RT_DEVELOPER)
258 dnl RT's GraphViz dependency charts
259 AC_CHECK_PROG([RT_GRAPHVIZ], [dot], "yes", "no")
260 AC_ARG_WITH(graphviz,[],RT_GRAPHVIZ=$withval)
261 AC_ARG_ENABLE(graphviz,
262 AC_HELP_STRING([--enable-graphviz],
263 [Turns on support for RT's GraphViz dependency charts]),
264 RT_GRAPHVIZ=$enableval)
265 if test "$RT_GRAPHVIZ" = yes; then
270 AC_SUBST(RT_GRAPHVIZ)
272 dnl RT's GD pie and bar charts
273 AC_CHECK_PROG([RT_GD], [gdlib-config], "yes", "no")
274 AC_ARG_WITH(gd,[],RT_GD=$withval)
276 AC_HELP_STRING([--enable-gd],
277 [Turns on support for RT's GD pie and bar charts]),
279 if test "$RT_GD" = yes; then
287 AC_CHECK_PROG([RT_GPG_DEPS], [gpg], "yes", "no")
288 if test "$RT_GPG_DEPS" = yes; then
294 AC_HELP_STRING([--enable-gpg],
295 [Turns on GNU Privacy Guard (GPG) support]),
297 if test "$RT_GPG" = yes; then
301 if test "$RT_GPG" = no; then
308 AC_SUBST(RT_GPG_DEPS)
312 dnl RT's SMIME support
313 AC_CHECK_PROG([RT_SMIME_DEPS], [openssl], "yes", "no")
314 if test "$RT_SMIME_DEPS" = yes; then
320 AC_HELP_STRING([--enable-smime],
321 [Turns on Secure MIME (SMIME) support]),
323 if test "$RT_SMIME" = yes; then
327 if test "$RT_SMIME" = no; then
334 AC_SUBST(RT_SMIME_DEPS)
338 dnl This section maps the variable names this script 'natively' generates
339 dnl to their existing names. They should be removed from here as the .in
340 dnl files are changed to use the new names.
343 AC_SUBST(RT_VERSION_MAJOR, ${rt_version_major})
344 AC_SUBST(RT_VERSION_MINOR, ${rt_version_minor})
345 AC_SUBST(RT_VERSION_PATCH, ${rt_version_patch})
348 AC_SUBST([RT_PATH], ${exp_prefix})
349 AC_SUBST([RT_DOC_PATH], ${exp_manualdir})
350 AC_SUBST([RT_LOCAL_PATH], ${exp_customdir})
351 AC_SUBST([RT_LIB_PATH], ${exp_libdir})
352 AC_SUBST([RT_LEXICON_PATH], ${exp_lexdir})
353 AC_SUBST([RT_STATIC_PATH], ${exp_staticdir})
354 AC_SUBST([RT_ETC_PATH], ${exp_sysconfdir})
355 AC_SUBST([CONFIG_FILE_PATH], ${exp_sysconfdir})
356 AC_SUBST([RT_BIN_PATH], ${exp_bindir})
357 AC_SUBST([RT_SBIN_PATH], ${exp_sbindir})
358 AC_SUBST([RT_VAR_PATH], ${exp_localstatedir})
359 AC_SUBST([RT_MAN_PATH], ${exp_mandir})
360 AC_SUBST([RT_FONT_PATH], ${exp_fontdir})
361 AC_SUBST([RT_PLUGIN_PATH], ${exp_plugindir})
362 AC_SUBST([MASON_DATA_PATH], ${exp_masonstatedir})
363 AC_SUBST([MASON_SESSION_PATH], ${exp_sessionstatedir})
364 AC_SUBST([MASON_HTML_PATH], ${exp_htmldir})
365 AC_SUBST([LOCAL_ETC_PATH], ${exp_custometcdir})
366 AC_SUBST([MASON_LOCAL_HTML_PATH], ${exp_customhtmldir})
367 AC_SUBST([LOCAL_LEXICON_PATH], ${exp_customlexdir})
368 AC_SUBST([LOCAL_STATIC_PATH], ${exp_customstaticdir})
369 AC_SUBST([LOCAL_LIB_PATH], ${exp_customlibdir})
370 AC_SUBST([LOCAL_PLUGIN_PATH], ${exp_customplugindir})
371 AC_SUBST([RT_LOG_PATH], ${exp_logfiledir})
373 if test ${exp_sysconfdir} = "etc" -o ${exp_sysconfdir} = "etc/rt"; then
374 AC_SUBST([RT_PATH_R], ${exp_prefix})
375 AC_SUBST([RT_DOC_PATH_R], ${exp_prefix}/${exp_manualdir})
376 AC_SUBST([RT_LOCAL_PATH_R], ${exp_prefix}/${exp_customdir})
377 AC_SUBST([RT_LIB_PATH_R], ${exp_prefix}/${exp_libdir})
378 AC_SUBST([RT_ETC_PATH_R], ${exp_prefix}/${exp_sysconfdir})
379 AC_SUBST([CONFIG_FILE_PATH_R], ${exp_prefix}/${exp_sysconfdir})
380 AC_SUBST([RT_BIN_PATH_R], ${exp_prefix}/${exp_bindir})
381 AC_SUBST([RT_SBIN_PATH_R], ${exp_prefix}/${exp_sbindir})
382 AC_SUBST([RT_VAR_PATH_R], ${exp_prefix}/${exp_localstatedir})
383 AC_SUBST([RT_MAN_PATH_R], ${exp_prefix}/${exp_mandir})
384 AC_SUBST([RT_FONT_PATH_R], ${exp_prefix}/${exp_fontdir})
385 AC_SUBST([RT_LEXICON_PATH_R], ${exp_prefix}/${exp_lexdir})
386 AC_SUBST([RT_STATIC_PATH_R], ${exp_prefix}/${exp_staticdir})
387 AC_SUBST([RT_PLUGIN_PATH_R], ${exp_prefix}/${exp_plugindir})
388 AC_SUBST([MASON_DATA_PATH_R], ${exp_prefix}/${exp_masonstatedir})
389 AC_SUBST([MASON_SESSION_PATH_R], ${exp_prefix}/${exp_sessionstatedir})
390 AC_SUBST([MASON_HTML_PATH_R], ${exp_prefix}/${exp_htmldir})
391 AC_SUBST([LOCAL_ETC_PATH_R], ${exp_prefix}/${exp_custometcdir})
392 AC_SUBST([MASON_LOCAL_HTML_PATH_R], ${exp_prefix}/${exp_customhtmldir})
393 AC_SUBST([LOCAL_LEXICON_PATH_R], ${exp_prefix}/${exp_customlexdir})
394 AC_SUBST([LOCAL_STATIC_PATH_R], ${exp_prefix}/${exp_customstaticdir})
395 AC_SUBST([LOCAL_LIB_PATH_R], ${exp_prefix}/${exp_customlibdir})
396 AC_SUBST([LOCAL_PLUGIN_PATH_R], ${exp_prefix}/${exp_customplugindir})
397 AC_SUBST([RT_LOG_PATH_R], ${exp_prefix}/${exp_logfiledir})
399 AC_SUBST([RT_PATH_R], ${exp_prefix})
400 AC_SUBST([RT_DOC_PATH_R], ${exp_manualdir})
401 AC_SUBST([RT_LOCAL_PATH_R], ${exp_customdir})
402 AC_SUBST([RT_LIB_PATH_R], ${exp_libdir})
403 AC_SUBST([RT_LEXICON_PATH_R], ${exp_lexdir})
404 AC_SUBST([RT_STATIC_PATH_R], ${exp_staticdir})
405 AC_SUBST([RT_ETC_PATH_R], ${exp_sysconfdir})
406 AC_SUBST([RT_PLUGIN_PATH_R], ${exp_plugindir})
407 AC_SUBST([CONFIG_FILE_PATH_R], ${exp_sysconfdir})
408 AC_SUBST([RT_BIN_PATH_R], ${exp_bindir})
409 AC_SUBST([RT_SBIN_PATH_R], ${exp_sbindir})
410 AC_SUBST([RT_VAR_PATH_R], ${exp_localstatedir})
411 AC_SUBST([RT_MAN_PATH_R], ${exp_mandir})
412 AC_SUBST([RT_FONT_PATH_R], ${exp_fontdir})
413 AC_SUBST([MASON_DATA_PATH_R], ${exp_masonstatedir})
414 AC_SUBST([MASON_SESSION_PATH_R], ${exp_sessionstatedir})
415 AC_SUBST([MASON_HTML_PATH_R], ${exp_htmldir})
416 AC_SUBST([LOCAL_ETC_PATH_R], ${exp_custometcdir})
417 AC_SUBST([MASON_LOCAL_HTML_PATH_R], ${exp_customhtmldir})
418 AC_SUBST([LOCAL_LEXICON_PATH_R], ${exp_customlexdir})
419 AC_SUBST([LOCAL_STATIC_PATH_R], ${exp_customstaticdir})
420 AC_SUBST([LOCAL_PLUGIN_PATH_R], ${exp_customplugindir})
421 AC_SUBST([LOCAL_LIB_PATH_R], ${exp_customlibdir})
422 AC_SUBST([RT_LOG_PATH_R], ${exp_logfiledir})
426 dnl Configure the output files, and generate them.
428 dnl Binaries that should be +x
430 etc/upgrade/3.8-ical-extension
431 etc/upgrade/4.0-customfield-checkbox-extension
432 etc/upgrade/generate-rtaddressregexp
433 etc/upgrade/sanity-check-stylesheets
434 etc/upgrade/shrink-cgm-table
435 etc/upgrade/shrink-transactions-table
436 etc/upgrade/split-out-cf-categories
437 etc/upgrade/switch-templates-to
438 etc/upgrade/time-worked-history
439 etc/upgrade/upgrade-articles
440 etc/upgrade/vulnerable-passwords
441 sbin/rt-attributes-viewer
442 sbin/rt-session-viewer
443 sbin/rt-preferences-viewer
444 sbin/rt-session-viewer
445 sbin/rt-dump-metadata
446 sbin/rt-setup-database
447 sbin/rt-test-dependencies
449 sbin/rt-email-dashboards
450 sbin/rt-clean-sessions
453 sbin/rt-validate-aliases
454 sbin/rt-email-group-admin
457 sbin/standalone_httpd
458 sbin/rt-setup-fulltext-index
459 sbin/rt-fulltext-indexer
465 [chmod ug+x $ac_file]
468 dnl All other generated files
473 t/data/configs/apache2.2+mod_perl.conf
474 t/data/configs/apache2.2+fastcgi.conf
475 t/data/configs/apache2.4+mod_perl.conf
476 t/data/configs/apache2.4+fastcgi.conf],