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.7 $)dnl
10 AC_INIT(RT, [3.6.4], [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(speedycgi,
36 AC_HELP_STRING([--with-speedycgi=/path/to/speedy],
37 [path to your speedycgi binary, if it exists]),
39 SPEEDY_BIN=/usr/local/bin/speedy)
43 dnl Defaults paths for installation
44 AC_PREFIX_DEFAULT([/opt/rt3])
48 # ACRT_USER_EXISTS( users, variable, default )
49 # - users is a list of users [www apache www-docs]
50 # from highest to lowest priority to high priority (i.e. first match)
51 # - variable is what you set with the result
54 AC_DEFUN([ACRT_USER_GUESS],
58 AC_MSG_CHECKING([if user $x exists])
59 AS_IF([ $PERL -e"exit( defined getpwnam('$x') ? 0 : 1)" ],
60 [ AC_MSG_RESULT([found]); $2=$x ; break],
61 [ AC_MSG_RESULT([not found]) ])
64 AC_DEFUN([ACRT_GROUP_GUESS],
68 AC_MSG_CHECKING([if group $x exists])
69 AS_IF([ $PERL -e"exit( defined getgrnam('$x') ? 0 : 1)" ],
70 [ AC_MSG_RESULT([found]); $2=$x ; break],
71 [ AC_MSG_RESULT([not found]) ])
76 AC_ARG_WITH(bin-owner,
77 AC_HELP_STRING([--with-bin-owner=OWNER],
78 [user that will own RT binaries (default root)]),
84 AC_ARG_WITH(libs-owner,
85 AC_HELP_STRING([--with-libs-owner=OWNER],
86 [user that will own RT libraries (default root)]),
92 AC_ARG_WITH(libs-group,
93 AC_HELP_STRING([--with-libs-group=GROUP],
94 [group that will own RT binaries (default bin)]),
101 AC_HELP_STRING([--with-db-type=TYPE],
102 [sort of database RT will use (default: mysql) (mysql, Pg, Oracle, Informix and SQLite are valid)]),
105 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
106 AC_MSG_ERROR([Only Oracle, Informix, Pg, mysql and SQLite are valid db types])
110 dnl DATABASE_ENV_PREF
111 if test "$DB_TYPE" = 'Oracle'; then
112 test "x$ORACLE_HOME" = 'x' && AC_MSG_ERROR([Please declare the ORACLE_HOME environment variable])
113 DATABASE_ENV_PREF="\$ENV{'ORACLE_HOME'} = '$ORACLE_HOME';"
116 dnl DATABASE_ENV_PREF
117 if test "$DB_TYPE" = 'Sybase'; then
118 test "x$SYBASE" = 'x' && AC_MSG_ERROR([Please declare the SYBASE_HOME environment variable])
119 DATABASE_ENV_PREF="\$ENV{'SYBASE'} = '$SYBASE';"
121 AC_SUBST(DATABASE_ENV_PREF)
125 AC_HELP_STRING([--with-db-host=HOSTNAME],
126 [FQDN of database server (default: localhost)]),
133 AC_HELP_STRING([--with-db-port=PORT],
134 [port on which the database listens on]),
140 AC_ARG_WITH(db-rt-host,
141 AC_HELP_STRING([--with-db-rt-host=HOSTNAME],
142 [FQDN of RT server which talks to the database server (default: localhost)]),
144 DB_RT_HOST=localhost)
147 dnl DB_DATABASE_ADMIN
149 AC_HELP_STRING([--with-db-dba=DBA],
150 [name of database administrator (default: root)]),
156 AC_ARG_WITH(db-database,
157 AC_HELP_STRING([--with-db-database=DBNAME],
158 [name of the database to use (default: rt3)]),
159 DB_DATABASE=$withval,
161 AC_SUBST(DB_DATABASE)
164 AC_ARG_WITH(db-rt-user,
165 AC_HELP_STRING([--with-db-rt-user=DBUSER],
166 [name of database user (default: rt_user)]),
172 AC_ARG_WITH(db-rt-pass,
173 AC_HELP_STRING([--with-db-rt-pass=PASSWORD],
174 [password for database user (default: rt_pass)]),
180 AC_ARG_WITH(web-user,
181 AC_HELP_STRING([--with-web-user=USER],
182 [user the web server runs as (default: www)]),
184 ACRT_USER_GUESS([www www-data apache httpd nobody],[WEB_USER],[www])
189 AC_ARG_WITH(web-group,
190 AC_HELP_STRING([--with-web-group=GROUP],
191 [group the web server runs as (default: www)]),
193 ACRT_GROUP_GUESS([www www-data apache httpd nogroup nobody],[WEB_GROUP], [www]))
197 AC_ARG_WITH(rt-group,
198 AC_HELP_STRING([--with-rt-group=GROUP],
199 [group to own all files (default: rt)]),
201 ACRT_GROUP_GUESS([rt3 rt $WEB_GROUP],[RTGROUP], [rt]))
205 # XXX TODO: The command below to figure out the group brokenly relies on
206 # output order (and "id -gn" doesn't work on all platforms).
207 my_group=$(groups|cut -f1 -d' ')
208 my_user=${USER:-$LOGNAME}
209 AC_ARG_WITH(my-user-group,
210 AC_HELP_STRING([--with-my-user-group],
211 [set all users and groups to current user/group]),
219 # Test for valid database names
220 AS_IF([ test "$DB_TYPE" == "mysql" ],
221 [ AC_MSG_CHECKING([if database name is valid])
222 AS_IF([ echo $DB_DATABASE | $AWK '/-/ { exit 1 }' ],
223 [ AC_MSG_RESULT([yes]) ],
224 [ AC_MSG_ERROR([no. database name ($DB_DATABASE) contains '-' which is not valid for mysql]) ]
230 dnl Set the value of apachectl
231 AC_ARG_WITH(apachectl,
232 AC_HELP_STRING([--with-apachectl],
233 [instruct RT where to find your apachectl]),
236 APACHECTL=`which apachectl`)
239 dnl RT's standalone pure perl server
240 AC_ARG_WITH(devel-mode,
241 AC_HELP_STRING([--with-standalone],
242 [Install modules for pure perl standalone server]),
246 AC_SUBST(RT_STANDALONE)
248 dnl RT's "maintainer mode"
249 AC_ARG_WITH(devel-mode,
250 AC_HELP_STRING([--with-devel-mode],
251 [Turn on development aids that might hurt you in production]),
255 AC_SUBST(RT_DEVEL_MODE)
256 dnl This section maps the variable names this script 'natively' generates
257 dnl to their existing names. They should be removed from here as the .in
258 dnl files are changed to use the new names.
261 AC_SUBST(RT_VERSION_MAJOR, ${rt_version_major})
262 AC_SUBST(RT_VERSION_MINOR, ${rt_version_minor})
263 AC_SUBST(RT_VERSION_PATCH, ${rt_version_patch})
266 AC_SUBST([RT_PATH], ${exp_prefix})
267 AC_SUBST([RT_DOC_PATH], ${exp_manualdir})
268 AC_SUBST([RT_LOCAL_PATH], ${exp_customdir})
269 AC_SUBST([RT_LIB_PATH], ${exp_libdir})
270 AC_SUBST([RT_ETC_PATH], ${exp_sysconfdir})
271 AC_SUBST([CONFIG_FILE_PATH], ${exp_sysconfdir})
272 AC_SUBST([RT_BIN_PATH], ${exp_bindir})
273 AC_SUBST([RT_SBIN_PATH], ${exp_sbindir})
274 AC_SUBST([RT_VAR_PATH], ${exp_localstatedir})
275 AC_SUBST([RT_MAN_PATH], ${exp_mandir})
276 AC_SUBST([MASON_DATA_PATH], ${exp_masonstatedir})
277 AC_SUBST([MASON_SESSION_PATH], ${exp_sessionstatedir})
278 AC_SUBST([MASON_HTML_PATH], ${exp_htmldir})
279 AC_SUBST([LOCAL_ETC_PATH], ${exp_custometcdir})
280 AC_SUBST([MASON_LOCAL_HTML_PATH], ${exp_customhtmldir})
281 AC_SUBST([LOCAL_LEXICON_PATH], ${exp_customlexdir})
282 AC_SUBST([LOCAL_LIB_PATH], ${exp_customlibdir})
283 AC_SUBST([DESTDIR], ${exp_prefix})
284 AC_SUBST([RT_LOG_PATH], ${exp_logfiledir})
286 dnl Configure the output files, and generate them.
288 dnl Binaries that should be +x
290 sbin/rt-dump-database
291 sbin/rt-setup-database
292 sbin/rt-test-dependencies
293 bin/mason_handler.fcgi
294 bin/mason_handler.scgi
299 [chmod ug+x $ac_file]
302 dnl All other generated files
307 bin/mason_handler.svc