This commit was generated by cvs2svn to compensate for changes in r4407,
[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.5 $)dnl
7
8 dnl Setup autoconf
9 AC_PREREQ(2.53)
10 AC_INIT(RT, [3.4.4], [rt-bugs@fsck.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_ARG_VAR([PERL],[Perl interpreter command])
27 AC_PATH_PROG([PERL], [perl], [not found])
28 if test "$PERL" = 'not found'; then
29         AC_MSG_ERROR([cannot use $PACKAGE_NAME without perl])
30 fi
31
32
33 dnl SPEED_BIN
34 AC_ARG_WITH(speedycgi,
35             AC_HELP_STRING([--with-speedycgi=/path/to/speedy],
36                            [path to your speedycgi binary, if it exists]),
37             SPEEDY_BIN=$withval,
38             SPEEDY_BIN=/usr/local/bin/speedy) 
39 AC_SUBST(SPEEDY_BIN)
40
41
42 dnl Defaults paths for installation
43 AC_PREFIX_DEFAULT([/opt/rt3])
44 RT_ENABLE_LAYOUT
45
46
47 # ACRT_USER_EXISTS( users, variable, default )
48 # - users is a list of users [www apache www-docs]
49 #    from highest to lowest priority to high priority (i.e. first match)
50 # - variable is what you set with the result
51 #
52
53 AC_DEFUN([ACRT_USER_GUESS],
54  [ 
55    $2=$3
56    for x in $1; do
57     AC_MSG_CHECKING([if user $x exists]) 
58      AS_IF([ $PERL -e"exit( defined getpwnam('$x') ? 0 : 1)" ],
59            [ AC_MSG_RESULT([found]); $2=$x ; break],
60            [ AC_MSG_RESULT([not found]) ])
61    done
62   ])
63 AC_DEFUN([ACRT_GROUP_GUESS],
64  [ 
65    $2=$3
66    for x in $1; do
67     AC_MSG_CHECKING([if group $x exists]) 
68      AS_IF([ $PERL -e"exit( defined getgrnam('$x') ? 0 : 1)" ],
69            [ AC_MSG_RESULT([found]); $2=$x ; break],
70            [ AC_MSG_RESULT([not found]) ])
71    done
72   ])
73
74 dnl BIN_OWNER
75 AC_ARG_WITH(bin-owner,
76             AC_HELP_STRING([--with-bin-owner=OWNER],
77                            [user that will own RT binaries (default root)]),
78             BIN_OWNER=$withval,
79             BIN_OWNER=root)
80 AC_SUBST(BIN_OWNER)
81
82 dnl LIBS_OWNER
83 AC_ARG_WITH(libs-owner,
84             AC_HELP_STRING([--with-libs-owner=OWNER],
85                            [user that will own RT libraries (default root)]),
86             LIBS_OWNER=$withval,
87             LIBS_OWNER=root)
88 AC_SUBST(LIBS_OWNER)
89
90 dnl LIBS_GROUP
91 AC_ARG_WITH(libs-group,
92             AC_HELP_STRING([--with-libs-group=GROUP],
93                            [group that will own RT binaries (default bin)]),
94             LIBS_GROUP=$withval,
95             LIBS_GROUP=bin)
96 AC_SUBST(LIBS_GROUP)
97
98 dnl DB_TYPE
99 AC_ARG_WITH(db-type,
100             AC_HELP_STRING([--with-db-type=TYPE],
101                            [sort of database RT will use (default: mysql) (mysql, Pg, Oracle, Informix and SQLite are valid)]), 
102             DB_TYPE=$withval,
103             DB_TYPE=mysql)
104 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
105         AC_MSG_ERROR([Only Oracle, Informix, Pg, mysql and SQLite are valid db types])
106 fi
107 AC_SUBST(DB_TYPE)
108
109 dnl DATABASE_ENV_PREF
110 if test "$DB_TYPE" = 'Oracle'; then
111         test "x$ORACLE_HOME" = 'x' && AC_MSG_ERROR([Please declare the ORACLE_HOME environment variable])
112         DATABASE_ENV_PREF="\$ENV{'ORACLE_HOME'} = '$ORACLE_HOME';"
113 fi
114
115 dnl DATABASE_ENV_PREF
116 if test "$DB_TYPE" = 'Sybase'; then
117         test "x$SYBASE" = 'x' && AC_MSG_ERROR([Please declare the SYBASE_HOME environment variable])
118         DATABASE_ENV_PREF="\$ENV{'SYBASE'} = '$SYBASE';"
119 fi
120 AC_SUBST(DATABASE_ENV_PREF)
121
122 dnl DB_HOST
123 AC_ARG_WITH(db-host,
124             AC_HELP_STRING([--with-db-host=HOSTNAME],
125                            [FQDN of database server (default: localhost)]),
126             DB_HOST=$withval,
127             DB_HOST=localhost)
128 AC_SUBST(DB_HOST)
129
130 dnl DB_PORT
131 AC_ARG_WITH(db-port,
132             AC_HELP_STRING([--with-db-port=PORT],
133                            [port on which the database listens on]),
134             DB_PORT=$withval,
135             DB_PORT=)
136 AC_SUBST(DB_PORT)
137
138 dnl DB_RT_HOST
139 AC_ARG_WITH(db-rt-host,
140             AC_HELP_STRING([--with-db-rt-host=HOSTNAME],
141                            [FQDN of RT server which talks to the database server (default: localhost)]),
142             DB_RT_HOST=$withval,
143             DB_RT_HOST=localhost)
144 AC_SUBST(DB_RT_HOST)
145
146 dnl DB_DATABASE_ADMIN
147 AC_ARG_WITH(db-dba,
148             AC_HELP_STRING([--with-db-dba=DBA],
149                            [name of database administrator (default: root)]),
150             DB_DBA=$withval,
151             DB_DBA=root)
152 AC_SUBST(DB_DBA)
153
154 dnl DB_DATABASE
155 AC_ARG_WITH(db-database,
156             AC_HELP_STRING([--with-db-database=DBNAME],
157                            [name of the database to use (default: rt3)]),
158             DB_DATABASE=$withval,
159             DB_DATABASE=rt3)
160 AC_SUBST(DB_DATABASE)
161
162 dnl DB_RT_USER
163 AC_ARG_WITH(db-rt-user,
164             AC_HELP_STRING([--with-db-rt-user=DBUSER],
165                            [name of database user (default: rt_user)]),
166             DB_RT_USER=$withval,
167             DB_RT_USER=rt_user)
168 AC_SUBST(DB_RT_USER)
169
170 dnl DB_RT_PASS
171 AC_ARG_WITH(db-rt-pass,
172             AC_HELP_STRING([--with-db-rt-pass=PASSWORD],
173                            [password for database user (default: rt_pass)]),
174             DB_RT_PASS=$withval,
175             DB_RT_PASS=rt_pass)
176 AC_SUBST(DB_RT_PASS)
177
178 dnl WEB_USER
179 AC_ARG_WITH(web-user,
180             AC_HELP_STRING([--with-web-user=USER],
181                            [user the web server runs as (default: www)]),
182             WEB_USER=$withval,
183             ACRT_USER_GUESS([www www-data apache httpd nobody],[WEB_USER],[www])
184 )
185 AC_SUBST(WEB_USER)
186
187 dnl WEB_GROUP
188 AC_ARG_WITH(web-group,
189             AC_HELP_STRING([--with-web-group=GROUP],
190                            [group the web server runs as (default: www)]),
191             WEB_GROUP=$withval,
192             ACRT_GROUP_GUESS([www www-data apache httpd nogroup nobody],[WEB_GROUP], [www]))
193 AC_SUBST(WEB_GROUP)
194
195 dnl RTGROUP
196 AC_ARG_WITH(rt-group,
197             AC_HELP_STRING([--with-rt-group=GROUP],
198                            [group to own all files (default: rt)]),
199             RTGROUP=$withval,
200             ACRT_GROUP_GUESS([rt3 rt $WEB_GROUP],[RTGROUP], [rt]))
201 AC_SUBST(RTGROUP)
202
203 dnl INSTALL AS ME
204 my_group=$(groups|cut -f1 -d' ')
205 my_user=${USER:-$LOGNAME}
206 AC_ARG_WITH(my-user-group,
207             AC_HELP_STRING([--with-my-user-group],
208                            [set all users and groups to current user/group]),
209             RTGROUP=$my_group
210             BIN_OWNER=$my_user
211             LIBS_OWNER=$my_user
212             LIBS_GROUP=$my_group
213             WEB_USER=$my_user
214             WEB_GROUP=$my_group)
215
216
217
218 dnl Set the value of apachectl
219 AC_ARG_WITH(apachectl,
220             AC_HELP_STRING([--with-apachectl],
221                            [instruct RT where to find your apachectl]),
222
223             APACHECTL=$withval, 
224             APACHECTL=`which apachectl`)
225 AC_SUBST(APACHECTL)
226
227 dnl RT's "maintainer mode"
228 AC_ARG_WITH(devel-mode,
229             AC_HELP_STRING([--with-devel-mode],
230                            [Turn on development aids that might hurt you in production]),
231
232             RT_DEVEL_MODE="1", 
233             RT_DEVEL_MODE="0")
234 AC_SUBST(RT_DEVEL_MODE)
235 dnl This section maps the variable names this script 'natively' generates
236 dnl to their existing names. They should be removed from here as the .in
237 dnl files are changed to use the new names.
238
239 dnl version numbers
240 AC_SUBST(RT_VERSION_MAJOR,              ${rt_version_major})
241 AC_SUBST(RT_VERSION_MINOR,              ${rt_version_minor})
242 AC_SUBST(RT_VERSION_PATCH,              ${rt_version_patch})
243
244 dnl layout paths
245 AC_SUBST([RT_PATH],                     ${exp_prefix})
246 AC_SUBST([RT_DOC_PATH],                 ${exp_manualdir})
247 AC_SUBST([RT_LOCAL_PATH],               ${exp_customdir})
248 AC_SUBST([RT_LIB_PATH],                 ${exp_libdir})
249 AC_SUBST([RT_ETC_PATH],                 ${exp_sysconfdir})
250 AC_SUBST([CONFIG_FILE_PATH],            ${exp_sysconfdir})
251 AC_SUBST([RT_BIN_PATH],                 ${exp_bindir})
252 AC_SUBST([RT_SBIN_PATH],                ${exp_sbindir})
253 AC_SUBST([RT_VAR_PATH],                 ${exp_localstatedir})
254 AC_SUBST([RT_MAN_PATH],                 ${exp_mandir})
255 AC_SUBST([MASON_DATA_PATH],             ${exp_masonstatedir})
256 AC_SUBST([MASON_SESSION_PATH],          ${exp_sessionstatedir})
257 AC_SUBST([MASON_HTML_PATH],             ${exp_htmldir})
258 AC_SUBST([LOCAL_ETC_PATH],              ${exp_custometcdir})
259 AC_SUBST([MASON_LOCAL_HTML_PATH],       ${exp_customhtmldir})
260 AC_SUBST([LOCAL_LEXICON_PATH],          ${exp_customlexdir})
261 AC_SUBST([LOCAL_LIB_PATH],              ${exp_customlibdir})
262 AC_SUBST([DESTDIR],                     ${exp_prefix})
263 AC_SUBST([RT_LOG_PATH],                 ${exp_logfiledir})
264
265 dnl Configure the output files, and generate them.
266
267 dnl Binaries that should be +x
268 AC_CONFIG_FILES([
269                  sbin/rt-dump-database
270                  sbin/rt-setup-database
271                  sbin/rt-test-dependencies
272                  bin/mason_handler.fcgi
273                  bin/mason_handler.scgi
274                  bin/standalone_httpd
275                  bin/rt-crontool
276                  bin/rt-mailgate
277                  bin/rt],
278                 [chmod ug+x $ac_file]
279                )
280
281 dnl All other generated files
282 AC_CONFIG_FILES([
283                  Makefile
284                  etc/RT_Config.pm
285                  lib/RT.pm
286                  bin/mason_handler.svc
287                  bin/webmux.pl],
288                )
289 AC_OUTPUT