File: configure.ac

package info (click to toggle)
request-tracker3.6 3.6.1-4+etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 9,028 kB
  • ctags: 1,371
  • sloc: perl: 27,270; sh: 671; makefile: 327
file content (301 lines) | stat: -rwxr-xr-x 9,480 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
autoconf; exec ./configure $@
dnl
dnl Process this file with autoconf to produce a configure script
dnl
dnl Embed in generated ./configure script the following CVS info:
AC_REVISION($Revision: 5497 $)dnl

dnl Setup autoconf
AC_PREREQ(2.53)
AC_INIT(RT, [3.6.1], [rt-bugs@bestpractical.com])
AC_CONFIG_SRCDIR([lib/RT.pm.in])

dnl Extract RT version number components
AC_SUBST([rt_version_major],
	m4_bregexp(AC_PACKAGE_VERSION,[^\(\w+\)\.\(\w+\)\(\.\(\w+\)\)?],[\1]))
AC_SUBST([rt_version_minor],
	m4_bregexp(AC_PACKAGE_VERSION,[^\(\w+\)\.\(\w+\)\(\.\(\w+\)\)?],[\2]))
AC_SUBST([rt_version_patch],
	m4_bregexp(AC_PACKAGE_VERSION,[^\(\w+\)\.\(\w+\)\(\.\(\w+\)\)?],[\4]))
test "x$rt_version_major" = 'x' && rt_version_major=0
test "x$rt_version_minor" = 'x' && rt_version_minor=0
test "x$rt_version_patch" = 'x' && rt_version_patch=0

dnl Check for programs
AC_PROG_INSTALL
AC_PROG_AWK
AC_ARG_VAR([PERL],[Perl interpreter command])
AC_PATH_PROG([PERL], [perl], [not found])
if test "$PERL" = 'not found'; then
	AC_MSG_ERROR([cannot use $PACKAGE_NAME without perl])
fi


dnl SPEED_BIN
AC_ARG_WITH(speedycgi,
	    AC_HELP_STRING([--with-speedycgi=/path/to/speedy],
	    		   [path to your speedycgi binary, if it exists]),
            SPEEDY_BIN=$withval,
            SPEEDY_BIN=/usr/local/bin/speedy) 
AC_SUBST(SPEEDY_BIN)


dnl Defaults paths for installation
AC_PREFIX_DEFAULT([/opt/rt3])
RT_ENABLE_LAYOUT


# ACRT_USER_EXISTS( users, variable, default )
# - users is a list of users [www apache www-docs]
#    from highest to lowest priority to high priority (i.e. first match)
# - variable is what you set with the result
#

AC_DEFUN([ACRT_USER_GUESS],
 [ 
   $2=$3
   for x in $1; do
    AC_MSG_CHECKING([if user $x exists]) 
     AS_IF([ $PERL -e"exit( defined getpwnam('$x') ? 0 : 1)" ],
           [ AC_MSG_RESULT([found]); $2=$x ; break],
           [ AC_MSG_RESULT([not found]) ])
   done
  ])
AC_DEFUN([ACRT_GROUP_GUESS],
 [ 
   $2=$3
   for x in $1; do
    AC_MSG_CHECKING([if group $x exists]) 
     AS_IF([ $PERL -e"exit( defined getgrnam('$x') ? 0 : 1)" ],
           [ AC_MSG_RESULT([found]); $2=$x ; break],
           [ AC_MSG_RESULT([not found]) ])
   done
  ])

dnl BIN_OWNER
AC_ARG_WITH(bin-owner,
	    AC_HELP_STRING([--with-bin-owner=OWNER],
	    		   [user that will own RT binaries (default root)]),
            BIN_OWNER=$withval,
            BIN_OWNER=root)
AC_SUBST(BIN_OWNER)

dnl LIBS_OWNER
AC_ARG_WITH(libs-owner,
	    AC_HELP_STRING([--with-libs-owner=OWNER],
	    		   [user that will own RT libraries (default root)]),
            LIBS_OWNER=$withval,
            LIBS_OWNER=root)
AC_SUBST(LIBS_OWNER)

dnl LIBS_GROUP
AC_ARG_WITH(libs-group,
	    AC_HELP_STRING([--with-libs-group=GROUP],
	    		   [group that will own RT binaries (default bin)]),
            LIBS_GROUP=$withval,
            LIBS_GROUP=bin)
AC_SUBST(LIBS_GROUP)

dnl DB_TYPE
AC_ARG_WITH(db-type,
	    AC_HELP_STRING([--with-db-type=TYPE],
	    		   [sort of database RT will use (default: mysql) (mysql, Pg, Oracle, Informix and SQLite are valid)]), 
            DB_TYPE=$withval,
            DB_TYPE=mysql)
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
	AC_MSG_ERROR([Only Oracle, Informix, Pg, mysql and SQLite are valid db types])
fi
AC_SUBST(DB_TYPE)

dnl DATABASE_ENV_PREF
if test "$DB_TYPE" = 'Oracle'; then
	test "x$ORACLE_HOME" = 'x' && AC_MSG_ERROR([Please declare the ORACLE_HOME environment variable])
	DATABASE_ENV_PREF="\$ENV{'ORACLE_HOME'} = '$ORACLE_HOME';"
fi

dnl DATABASE_ENV_PREF
if test "$DB_TYPE" = 'Sybase'; then
	test "x$SYBASE" = 'x' && AC_MSG_ERROR([Please declare the SYBASE_HOME environment variable])
	DATABASE_ENV_PREF="\$ENV{'SYBASE'} = '$SYBASE';"
fi
AC_SUBST(DATABASE_ENV_PREF)

dnl DB_HOST
AC_ARG_WITH(db-host,
	    AC_HELP_STRING([--with-db-host=HOSTNAME],
	    		   [FQDN of database server (default: localhost)]),
            DB_HOST=$withval,
            DB_HOST=localhost)
AC_SUBST(DB_HOST)

dnl DB_PORT
AC_ARG_WITH(db-port,
	    AC_HELP_STRING([--with-db-port=PORT],
	    		   [port on which the database listens on]),
            DB_PORT=$withval,
            DB_PORT=)
AC_SUBST(DB_PORT)

dnl DB_RT_HOST
AC_ARG_WITH(db-rt-host,
	    AC_HELP_STRING([--with-db-rt-host=HOSTNAME],
	    		   [FQDN of RT server which talks to the database server (default: localhost)]),
            DB_RT_HOST=$withval,
            DB_RT_HOST=localhost)
AC_SUBST(DB_RT_HOST)

dnl DB_DATABASE_ADMIN
AC_ARG_WITH(db-dba,
	    AC_HELP_STRING([--with-db-dba=DBA],
	    		   [name of database administrator (default: root)]),
            DB_DBA=$withval,
            DB_DBA=root)
AC_SUBST(DB_DBA)

dnl DB_DATABASE
AC_ARG_WITH(db-database,
	    AC_HELP_STRING([--with-db-database=DBNAME],
	    		   [name of the database to use (default: rt3)]),
            DB_DATABASE=$withval,
            DB_DATABASE=rt3)
AC_SUBST(DB_DATABASE)

dnl DB_RT_USER
AC_ARG_WITH(db-rt-user,
	    AC_HELP_STRING([--with-db-rt-user=DBUSER],
	    		   [name of database user (default: rt_user)]),
            DB_RT_USER=$withval,
            DB_RT_USER=rt_user)
AC_SUBST(DB_RT_USER)

dnl DB_RT_PASS
AC_ARG_WITH(db-rt-pass,
	    AC_HELP_STRING([--with-db-rt-pass=PASSWORD],
	    		   [password for database user (default: rt_pass)]),
            DB_RT_PASS=$withval,
            DB_RT_PASS=rt_pass)
AC_SUBST(DB_RT_PASS)

dnl WEB_USER
AC_ARG_WITH(web-user,
	    AC_HELP_STRING([--with-web-user=USER],
	    		   [user the web server runs as (default: www)]),
            WEB_USER=$withval,
            ACRT_USER_GUESS([www www-data apache httpd nobody],[WEB_USER],[www])
)
AC_SUBST(WEB_USER)

dnl WEB_GROUP
AC_ARG_WITH(web-group,
	    AC_HELP_STRING([--with-web-group=GROUP],
		           [group the web server runs as (default: www)]),
            WEB_GROUP=$withval,
            ACRT_GROUP_GUESS([www www-data apache httpd nogroup nobody],[WEB_GROUP], [www]))
AC_SUBST(WEB_GROUP)

dnl RTGROUP
AC_ARG_WITH(rt-group,
	    AC_HELP_STRING([--with-rt-group=GROUP],
	    		   [group to own all files (default: rt)]),
            RTGROUP=$withval,
            ACRT_GROUP_GUESS([rt3 rt $WEB_GROUP],[RTGROUP], [rt]))
AC_SUBST(RTGROUP)

dnl INSTALL AS ME
# XXX TODO: The command below to figure out the group brokenly relies on
# output order (and "id -gn" doesn't work on all platforms).
my_group=$(groups|cut -f1 -d' ')
my_user=${USER:-$LOGNAME}
AC_ARG_WITH(my-user-group,
            AC_HELP_STRING([--with-my-user-group],
                           [set all users and groups to current user/group]),
            RTGROUP=$my_group
            BIN_OWNER=$my_user
            LIBS_OWNER=$my_user
            LIBS_GROUP=$my_group
            WEB_USER=$my_user
            WEB_GROUP=$my_group)

# Test for valid database names
AS_IF([ test "$DB_TYPE" == "mysql" ],
      [ AC_MSG_CHECKING([if database name is valid])
          AS_IF([ echo $DB_DATABASE | $AWK '/-/ { exit 1 }' ],
                [ AC_MSG_RESULT([yes]) ],
                [ AC_MSG_ERROR([no.  database name ($DB_DATABASE) contains '-' which is not valid for mysql]) ]
               )
      ]
     )


dnl Set the value of apachectl
AC_ARG_WITH(apachectl,
            AC_HELP_STRING([--with-apachectl],
                           [instruct RT where to find your apachectl]),

            APACHECTL=$withval, 
            APACHECTL=`which apachectl`)
AC_SUBST(APACHECTL)

dnl RT's "maintainer mode"
AC_ARG_WITH(devel-mode,
            AC_HELP_STRING([--with-devel-mode],
                           [Turn on development aids that might hurt you in production]),

            RT_DEVEL_MODE="1", 
            RT_DEVEL_MODE="0")
AC_SUBST(RT_DEVEL_MODE)
dnl This section maps the variable names this script 'natively' generates
dnl to their existing names. They should be removed from here as the .in
dnl files are changed to use the new names.

dnl version numbers
AC_SUBST(RT_VERSION_MAJOR,		${rt_version_major})
AC_SUBST(RT_VERSION_MINOR,		${rt_version_minor})
AC_SUBST(RT_VERSION_PATCH,		${rt_version_patch})

dnl layout paths
AC_SUBST([RT_PATH],			${exp_prefix})
AC_SUBST([RT_DOC_PATH],			${exp_manualdir})
AC_SUBST([RT_LOCAL_PATH],		${exp_customdir})
AC_SUBST([RT_LIB_PATH],			${exp_libdir})
AC_SUBST([RT_ETC_PATH],			${exp_sysconfdir})
AC_SUBST([CONFIG_FILE_PATH],		${exp_sysconfdir})
AC_SUBST([RT_BIN_PATH],			${exp_bindir})
AC_SUBST([RT_SBIN_PATH],		${exp_sbindir})
AC_SUBST([RT_VAR_PATH],			${exp_localstatedir})
AC_SUBST([RT_MAN_PATH],			${exp_mandir})
AC_SUBST([MASON_DATA_PATH],		${exp_masonstatedir})
AC_SUBST([MASON_SESSION_PATH],		${exp_sessionstatedir})
AC_SUBST([MASON_HTML_PATH],		${exp_htmldir})
AC_SUBST([LOCAL_ETC_PATH],		${exp_custometcdir})
AC_SUBST([MASON_LOCAL_HTML_PATH],	${exp_customhtmldir})
AC_SUBST([LOCAL_LEXICON_PATH],		${exp_customlexdir})
AC_SUBST([LOCAL_LIB_PATH],		${exp_customlibdir})
AC_SUBST([DESTDIR],			${exp_prefix})
AC_SUBST([RT_LOG_PATH],			${exp_logfiledir})

dnl Configure the output files, and generate them.

dnl Binaries that should be +x
AC_CONFIG_FILES([
		 sbin/rt-dump-database
		 sbin/rt-setup-database
		 sbin/rt-test-dependencies
 		 bin/mason_handler.fcgi
 		 bin/mason_handler.scgi
 		 bin/standalone_httpd
 		 bin/rt-crontool
 		 bin/rt-mailgate
		 bin/rt],
		[chmod ug+x $ac_file]
               )

dnl All other generated files
AC_CONFIG_FILES([
		 Makefile
		 etc/RT_Config.pm
		 lib/RT.pm
 		 bin/mason_handler.svc
		 bin/webmux.pl],
               )
AC_OUTPUT