File: configure.ac

package info (click to toggle)
webcit 7.37-dfsg-7
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 6,972 kB
  • ctags: 2,344
  • sloc: ansic: 23,301; sh: 3,618; makefile: 239
file content (463 lines) | stat: -rw-r--r-- 11,592 bytes parent folder | download
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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
dnl Process this file with autoconf to produce a configure script.
dnl $Id: configure.ac 6394 2008-06-19 03:34:13Z ajc $
AC_INIT([WebCit], [7.37], [http://www.citadel.org/])


AC_SUBST(PROG_SUBDIRS)
AC_DEFINE(PROG_SUBDIRS, [], [Program dirs])
AC_CANONICAL_HOST
AC_PROG_INSTALL
missing_dir=`cd $ac_aux_dir && pwd`
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)

dnl Make sure we see all GNU and Solaris extensions.
AC_GNU_SOURCE

AC_CHECK_PROG(SED, sed, sed, no)
AC_PREFIX_DEFAULT(/usr/local/webcit)
if test "$prefix" = NONE; then
	AC_DEFINE_UNQUOTED(WEBCITDIR, "$ac_default_prefix", [define this to the Citadel home directory])
	ssl_dir="$ac_default_prefix/keys"
else
	AC_DEFINE_UNQUOTED(WEBCITDIR, "$prefix", [define this to the Citadel home directory])
	ssl_dir="$prefix/keys"
fi

AC_ARG_WITH(with_zlib,    [  --with-zlib             use zlib compression if present])
AC_ARG_WITH(ssl,
	[  --with-ssl=PATH         Specify path to OpenSSL installation ],
	[
		if test "x$withval" != "xno" ; then
			tryssldir=$withval
		fi
	]
)
dnl Set some system-specific variables which are OK to set before compiler
dnl checks:
PTHREAD_DEFS=-D_REENTRANT
case "$host" in
	dnl Tru64 Unix requires we use -pthread instead of linking the threads
	dnl libraries directly, and we can't build threaded programs with gcc
	dnl due to header file problems.
	alpha*-dec-osf*)
		test -z "$CC" && CC=cc
		LIBS=-pthread
	;;
	dnl FreeBSD is similar:
	*-*-freebsd*)
		LIBS=-pthread
		PTHREAD_DEFS=-D_THREAD_SAFE
	;;
	*-*-solaris*)
		PTHREAD_DEFS='-D_REENTRANT -D_PTHREADS'
	;;
esac
AC_SUBST(PTHREAD_DEFS)

dnl Checks for programs.
AC_PROG_CC

dnl Configure compiler flags for GCC
if test "$GCC" = yes; then
	case "$host" in
		*-*-solaris*)
			CFLAGS="$CFLAGS -Wall -Wno-char-subscripts"
		;;
		*)
			CFLAGS="$CFLAGS -Wall"
		;;
	esac
fi

# missing_dir=`cd $ac_aux_dir && pwd`
# AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)

dnl Checks for libraries.
if test "$LIBS" != -pthread; then
	AC_CHECK_LIB(pthread, pthread_create)
	AC_CHECK_LIB(pthreads, pthread_create)
fi
AC_SEARCH_LIBS(gethostbyname, nsl)
AC_SEARCH_LIBS(connect, socket)

dnl Checks for header files.
AC_HEADER_STDC
dnl AC_HEADER_SYS_WAIT




dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
dnl AC_HEADER_TIME

dnl Checks for library functions.
AC_TYPE_SIGNAL
dnl AC_FUNC_VPRINTF
AC_REPLACE_FUNCS(snprintf)
AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h iconv.h)


dnl Here is the check for a libc integrated iconv
AC_ARG_ENABLE(iconv,
	[  --disable-iconv         do not use iconv charset conversion],
	ok_iconv=no, ok_iconv=yes)

AC_MSG_CHECKING(Checking to see if your system supports iconv)
AC_TRY_RUN([
 	#include <iconv.h>
 	main() {
 		iconv_t ic = (iconv_t)(-1) ;
 		ic = iconv_open("UTF-8", "us-ascii");
 		iconv_close(ic);
 		exit(0);
 	}
 ],
		[
		  ok_iconv=yes
		  AC_MSG_RESULT([yes])
		],
		[ 
		  ok_iconv=no
		  AC_MSG_RESULT([no])
		]
)

dnl Check for iconv in external libiconv
if test "$ok_iconv" = no; then
	AC_MSG_CHECKING(Checking for an external libiconv)
	OLD_LDFLAGS="$LDFLAGS"
	LDFLAGS="$LDFLAGS -liconv"
	AC_TRY_RUN([
			#include <iconv.h>
			main() {
				iconv_t ic = (iconv_t)(-1) ;
				ic = iconv_open("UTF-8", "us-ascii");
				iconv_close(ic);
			}
		],
			[
			  ok_iconv=yes
			  AC_MSG_RESULT([yes])
			],
			[ 
			  ok_iconv=no
			  LDFLAGS="$OLD_LDFLAGS"
			  AC_MSG_RESULT([no])
			]
		)
fi	
if test "$ok_iconv" != "no"; then
	AC_MSG_RESULT(WebCit will be built with character set conversion.)
	AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
else
	AC_MSG_RESULT(WebCit will be built without character set conversion.)
fi

AC_CHECK_LIB(intl, libintl_bindtextdomain, [LDFLAGS="$LDFLAGS -lintl"])

dnl Check for libcitadel
AC_CHECK_HEADER(libcitadel.h,
	[AC_CHECK_LIB(citadel, libcitadel_version_string,
		[
			LIBS="-lcitadel $LIBS"
		],
		[
			AC_MSG_ERROR(libcitadel was not found or is not usable.  Please install libcitadel.)
		]
	,
	)],
	[
		AC_MSG_ERROR(libcitadel.h was not found or is not usable.  Please install libcitadel.)
	]
)


dnl Checks for the libical iCalendar library.
AC_CHECK_HEADER(ical.h,
	[AC_CHECK_LIB(ical, icalcomponent_new,
		[
			LIBS="-lical $LIBS"
		],
		[
			AC_MSG_ERROR(libical was not found and is required.  More info: http://www.citadel.org/doku.php/installation:start)
		]
	,
	)],
	[
		AC_MSG_ERROR(ical.h was not found and is required.  More info: http://www.citadel.org/doku.php/installation:start)
	]
)


dnl Checks for the zlib compression library.
if test "x$with_zlib" != xno ; then
        AC_CHECK_HEADERS(zlib.h,
                [AC_CHECK_LIB(z, zlibVersion,
                        [ok_zlib=yes],,
        )])
fi

if test "x$ok_zlib" = xyes ; then
        LIBS="-lz $LIBS"
        AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
fi


# The big search for OpenSSL
if test "$with_ssl" != "no"; then
	saved_LIBS="$LIBS"
	saved_LDFLAGS="$LDFLAGS"
	saved_CFLAGS="$CFLAGS"
	if test "x$prefix" != "xNONE"; then
		tryssldir="$tryssldir $prefix"
	fi
	AC_CACHE_CHECK([for OpenSSL], ac_cv_openssldir, [
		for ssldir in $tryssldir "" /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
			CFLAGS="$saved_CFLAGS"
			LDFLAGS="$saved_LDFLAGS"
			LIBS="$saved_LIBS -lssl -lcrypto"
	
			# Skip directories if they don't exist
			if test ! -z "$ssldir" -a ! -d "$ssldir" ; then
				continue;
			fi
			if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then
				# Try to use $ssldir/lib if it exists, otherwise
				# $ssldir
				if test -d "$ssldir/lib" ; then
					LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
					if test ! -z "$need_dash_r" ; then
						LDFLAGS="-R$ssldir/lib $LDFLAGS"
					fi
				else
					LDFLAGS="-L$ssldir $saved_LDFLAGS"
					if test ! -z "$need_dash_r" ; then
						LDFLAGS="-R$ssldir $LDFLAGS"
					fi
				fi
				# Try to use $ssldir/include if it exists, otherwise
				# $ssldir
				if test -d "$ssldir/include" ; then
					CFLAGS="-I$ssldir/include $saved_CFLAGS"
				else
					CFLAGS="-I$ssldir $saved_CFLAGS"
				fi
			fi
	
			# Basic test to check for compatible version and correct linking
			# *does not* test for RSA - that comes later.
			AC_TRY_RUN(
				[
	#include <string.h>
	#include <openssl/rand.h>
	int main(void)
	{
		char a[2048];
		memset(a, 0, sizeof(a));
		RAND_add(a, sizeof(a), sizeof(a));
		return(RAND_status() <= 0);
	}
				],
				[
					found_crypto=1
					break;
				], []
			)
	
			if test ! -z "$found_crypto" ; then
				break;
			fi
		done
	
		if test -z "$ssldir" ; then
			ssldir="(system)"
		fi
	
		if test ! -z "$found_crypto" ; then
			ac_cv_openssldir=$ssldir
		else
			ac_cv_openssldir="no"
		fi
	])
	LIBS="$saved_LIBS"
	LDFLAGS="$saved_LDFLAGS"
	CFLAGS="$saved_CFLAGS"
	
	if test "x$ac_cv_openssldir" != "xno" ; then
		AC_DEFINE(HAVE_OPENSSL,[],[whethe we have openssl])
		LIBS="-lssl -lcrypto $LIBS"
		dnl Need to recover ssldir - test above runs in subshell
		ssldir=$ac_cv_openssldir
		if test ! -z "$ssldir" -a "x$ssldir" != "x/usr" -a "x$ssldir" != "x(system)"; then
			# Try to use $ssldir/lib if it exists, otherwise
			# $ssldir
			if test -d "$ssldir/lib" ; then
				LDFLAGS="-L$ssldir/lib $saved_LDFLAGS"
				if test ! -z "$need_dash_r" ; then
					LDFLAGS="-R$ssldir/lib $LDFLAGS"
				fi
			else
				LDFLAGS="-L$ssldir $saved_LDFLAGS"
				if test ! -z "$need_dash_r" ; then
					LDFLAGS="-R$ssldir $LDFLAGS"
				fi
			fi
			# Try to use $ssldir/include if it exists, otherwise
			# $ssldir
			if test -d "$ssldir/include" ; then
				CFLAGS="-I$ssldir/include $saved_CFLAGS"
			else
				CFLAGS="-I$ssldir $saved_CFLAGS"
			fi
		fi
	fi
fi
dnl Checks for the SSLdir
dnl this is a bit different than the rest, 
dnl because of the citadel used to have a keys/ subdir.
AC_ARG_WITH(ssldir, 
		    [  --with-ssldir          directory to store the ssl certificates under],
			[ if test "x$withval" != "xno" ; then
					      
						  ssl_dir="$withval"
			  fi
			AC_SUBST(MAKE_SSL_DIR)
			]
)
AC_DEFINE_UNQUOTED(SSL_DIR, "$ssl_dir", [were should we put our keys?])




AC_CHECK_FUNCS(strftime_l uselocale gettext)

if test "$ok_nls" != "no"; then
	AC_CHECK_PROG(ok_xgettext, xgettext, yes, no)
	ok_nls=$ok_xgettext
fi

if test "$ok_nls" != "no"; then
	AC_CHECK_PROG(ok_msgmerge, msgmerge, yes, no)
	ok_nls=$ok_msgmerge
fi

if test "$ok_nls" != "no"; then
	AC_CHECK_PROG(ok_msgfmt, msgfmt, yes, no)
	ok_nls=$ok_msgfmt
fi

if test "$ok_nls" != "no"; then
	AC_MSG_RESULT(WebCit will be built with national language support.)
	AC_DEFINE(ENABLE_NLS, [], [whether we have NLS support])
	PROG_SUBDIRS="$PROG_SUBDIRS po"
else
	AC_MSG_RESULT(WebCit will be built without national language support.)
fi

AC_SUBST(SETUP_LIBS)

dnl disable backtrace if we don't want it.
AC_ARG_WITH(gprof, 
		    [  --with-gprof          enable profiling],
			[ if test "x$withval" != "xno" ; then
			     CFLAGS="$CFLAGS  -pg "
			     LDFLAGS="$LDFLAGS  -pg "
			  fi
			]
)

dnl disable backtrace if we don't want it.
AC_ARG_WITH(backtrace, 
		    [  --with-backtrace          enable backtrace dumps in the syslog],
			[ if test "x$withval" != "xno" ; then
			     CFLAGS="$CFLAGS  -rdynamic "
			     LDFLAGS="$LDFLAGS  -rdynamic "
                             AC_CHECK_FUNCS(backtrace)
			  fi
			]
)

if test "$prefix" = NONE; then
   	datadir=$ac_default_prefix
	localedir=$ac_default_prefix
	wwwdir=$ac_default_prefix
	rundir=$ac_default_prefix
	editordir=$ac_default_prefix/tiny_mce
else
	localedir=$prefix
	wwwdir=$prefix
	datadir=$prefix
	rundir=$prefix
	editordir=$prefix/tiny_mce
fi

dnl where to put the locale files
AC_ARG_WITH(localedir, 
		    [  --with-localedir          directory to put the locale files to],
			[ if test "x$withval" != "xno" ; then
			    localedir=$withval
			  fi
			]
)
AC_DEFINE_UNQUOTED(LOCALEDIR, "$localedir",[where to find our pot files])
LOCALEDIR=$localedir
AC_SUBST(LOCALEDIR)

dnl Checks where to put our templates
AC_ARG_WITH(wwwdir, 
		    [  --with-wwwdir             directory to put our templates],
			[ if test "x$withval" != "xno" ; then
				wwwdir=$withval
			  fi
			]
)
AC_DEFINE_UNQUOTED(WWWDIR, "$wwwdir", [where to find our templates and pics])
WWWDIR=$wwwdir
AC_SUBST(WWWDIR)


dnl Checks for the run-dir for the sockets
AC_ARG_WITH(rundir, 
			[  --with-rundir           directory to place runtime files (UDS) to?],
			[ if test "x$withval" != "xno" ; then
					    AC_DEFINE(HAVE_RUN_DIR, [], [should we put our non volatile files elsewhere?])
						
						rundir=$withval
						AC_SUBST(MAKE_RUN_DIR)
			  fi
			]
)
AC_DEFINE_UNQUOTED(RUNDIR, "$rundir", [define, where the config should go in unix style])

dnl Checks for the Datadir
AC_ARG_WITH(datadir, 
		    [  --with-datadir          directory to store the databases under],
			[ if test "x$withval" != "xno" ; then
					      datadir=$withval
			  fi
			]
)
AC_DEFINE_UNQUOTED(DATADIR, "$datadir",[define, if the user suplied a data-directory to use.])

dnl Checks where to put our editor
AC_ARG_WITH(editordir, 
		    [  --with-editordir             directory to put our editor],
			[ if test "x$withval" != "xno" ; then
				editordir=$withval
			  fi
			]
)
AC_DEFINE_UNQUOTED(EDITORDIR, "$editordir", [where to find our mail editor])

AC_CONFIG_HEADER(sysdep.h)
AC_OUTPUT(Makefile po/Makefile )

echo ------------------------------------------------------------------------
echo 'zlib compression:                ' $ok_zlib
echo 'Character set conversion support:' $ok_iconv
echo 'National language support:       ' $ok_nls
echo