Statistics
| Revision:

root / configure.in @ 1040

History | View | Annotate | Download (11.3 kB)

1
dnl Process this file with autoconf to produce a configure script.
2
AC_PREREQ(2.50)
3
AC_INIT(src/main.c)
4
PACKAGE=sylpheed
5
6
dnl version number
7
MAJOR_VERSION=2
8
MINOR_VERSION=2
9
MICRO_VERSION=2
10
INTERFACE_AGE=0
11
BINARY_AGE=0
12
EXTRA_VERSION=
13
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
14
15
dnl set $target
16
AC_CANONICAL_SYSTEM
17
18
dnl
19
AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
20
dnl AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
21
dnl AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
22
AC_SUBST(PACKAGE)
23
AC_SUBST(VERSION)
24
25
dnl libtool versioning
26
LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
27
LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
28
LT_REVISION=$INTERFACE_AGE
29
LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
30
AC_SUBST(LT_RELEASE)
31
AC_SUBST(LT_CURRENT)
32
AC_SUBST(LT_REVISION)
33
AC_SUBST(LT_AGE)
34
35
dnl Specify a header configuration file
36
AM_CONFIG_HEADER(config.h)
37
38
AM_MAINTAINER_MODE
39
40
dnl Checks for programs.
41
dnl AC_ARG_PROGRAM
42
AC_PROG_CC
43
AC_ISC_POSIX
44
AM_PROG_CC_STDC
45
AC_PROG_INSTALL
46
AC_PROG_LN_S
47
AC_PROG_MAKE_SET
48
AC_PROG_CPP
49
dnl AC_PROG_RANLIB
50
AM_PROG_LEX
51
AC_PROG_YACC
52
AM_PROG_LIBTOOL
53
54
AC_CHECK_PROG(WINDRES, windres, windres)
55
AM_CONDITIONAL(HAVE_WINDRES, test x"$WINDRES" != x)
56
57
SYLPHEED_ACLOCAL_INCLUDE(ac)
58
59
native_win32=no
60
61
case "$target" in
62
*-darwin*)
63
	CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
64
	;;
65
*-*-mingw*)
66
	native_win32=yes
67
	CFLAGS="$CFLAGS -mms-bitfields -mwindows"
68
	LIBS="$LIBS -lws2_32"
69
	;;
70
esac
71
72
dnl Checks for libraries.
73
AM_PATH_GLIB_2_0(2.4.0,, AC_MSG_ERROR(Test for GLib failed. See the 'INSTALL' for help.))
74
75
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
76
77
AM_PATH_GTK_2_0(2.4.0,, AC_MSG_ERROR(Test for Gtk failed. See the 'INSTALL' for help.))
78
79
dnl --disable-deprecated switch for GTK2 purification
80
AC_ARG_ENABLE(deprecated, [  --disable-deprecated    Disable deprecated GTK functions. ],
81
			  [GTK_CFLAGS="$GTK_CFLAGS -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"], [])
82
83
AC_SUBST(GTK_CFLAGS)
84
AC_SUBST(GTK_LIBS)
85
86
dnl checks for iconv
87
AM_ICONV
88
89
AC_CHECK_FUNCS(bind_textdomain_codeset)
90
91
dnl for gettext
92
ALL_LINGUAS="bg cs da de el es et fr gl hr hu it ja ko lt nl pl pt_BR ro ru sk sl sr sv tr uk vi zh_CN zh_TW"
93
GETTEXT_PACKAGE=sylpheed
94
AC_SUBST(GETTEXT_PACKAGE)
95
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define text domain.])
96
97
AM_GLIB_GNU_GETTEXT
98
dnl AM_GNU_GETTEXT
99
dnl AC_CHECK_FUNC(gettext, AC_CHECK_LIB(intl, gettext))
100
101
if test "x$DATADIRNAME" != "x"; then
102
	localedir='${prefix}/${DATADIRNAME}/locale'
103
else
104
	localedir='${datadir}/locale'
105
fi
106
AC_ARG_WITH(localedir,
107
	[  --with-localedir=DIR    Locale directory],
108
	[localedir="$withval"])
109
AC_SUBST(localedir)
110
111
manualdir='${datadir}/${PACKAGE}/manual'
112
AC_ARG_WITH(manualdir,
113
	[  --with-manualdir=DIR    Manual directory],
114
	[manualdir="$withval"])
115
AC_SUBST(manualdir)
116
117
faqdir='${datadir}/${PACKAGE}/faq'
118
AC_ARG_WITH(faqdir,
119
	[  --with-faqdir=DIR       FAQ directory],
120
	[faqdir="$withval"])
121
AC_SUBST(faqdir)
122
123
dnl GPGME is used to support OpenPGP 
124
AC_ARG_ENABLE(gpgme,
125
	[  --disable-gpgme         Disable GnuPG support using GPGME],
126
	[ac_cv_enable_gpgme=$enableval], [ac_cv_enable_gpgme=yes])
127
AC_MSG_CHECKING([whether to use GPGME])
128
if test $ac_cv_enable_gpgme = yes; then
129
	AC_MSG_RESULT(yes)
130
	AM_PATH_GPGME(0.4.5, AC_DEFINE(USE_GPGME, 1, Define if you use GPGME to support OpenPGP.),
131
		      [use_gpgme=no
132
		       ac_cv_enable_gpgme=no])
133
else
134
	AC_MSG_RESULT(no)
135
fi
136
137
dnl for JPilot support in addressbook
138
dnl no check for libraries; these are dynamically loaded
139
AC_ARG_ENABLE(jpilot,
140
	[  --enable-jpilot         Enable JPilot support [[default=no]]],
141
	[ac_cv_enable_jpilot=$enableval], [ac_cv_enable_jpilot=no])
142
AC_MSG_CHECKING([whether to use JPilot])
143
if test "$ac_cv_enable_jpilot" = yes; then
144
	AC_MSG_RESULT(yes)
145
	AC_CHECK_HEADERS(pi-args.h pi-appinfo.h pi-address.h,
146
			 [ AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ],
147
			 [ ac_cv_enable_jpilot=no ])
148
	if test "$ac_cv_enable_jpilot" = no; then
149
		AC_CHECK_HEADERS(libpisock/pi-args.h libpisock/pi-appinfo.h libpisock/pi-address.h,
150
				 [ ac_cv_enable_jpilot=yes
151
				   AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ])
152
	fi
153
	AC_MSG_CHECKING([whether jpilot is available])
154
	AC_MSG_RESULT($ac_cv_enable_jpilot)
155
156
	if test "$ac_cv_enable_jpilot" = yes; then
157
		LIBS="$LIBS -lpisock"
158
	fi
159
else
160
	AC_MSG_RESULT(no)
161
fi
162
163
dnl for LDAP support in addressbook
164
dnl no check for libraries; dynamically loaded
165
AC_ARG_ENABLE(ldap,
166
	[  --enable-ldap           Enable LDAP support [[default=no]]],
167
	[ac_cv_enable_ldap=$enableval], [ac_cv_enable_ldap=no])
168
AC_MSG_CHECKING([whether to use LDAP])
169
if test "$ac_cv_enable_ldap" = yes; then
170
	AC_MSG_RESULT(yes)
171
172
	dnl check for available libraries, and pull them in
173
	AC_CHECK_LIB(resolv, res_query, LDAP_LIBS="$LDAP_LIBS -lresolv")
174
	AC_CHECK_LIB(socket, bind, LDAP_LIBS="$LDAP_LIBS -lsocket")
175
	AC_CHECK_LIB(nsl, gethostbyaddr, LDAP_LIBS="$LDAP_LIBS -lnsl")
176
	AC_CHECK_LIB(lber, ber_get_tag, LDAP_LIBS="$LDAP_LIBS -llber",,
177
		     $LDAP_LIBS)
178
179
	dnl we need libpthread for sylpheed ldap,  until we find
180
	dnl a better way to handle ldap requests asynchronously...
181
	AC_CHECK_LIB(pthread, pthread_create, LDAP_LIBS="$LDAP_LIBS -lpthread")
182
183
	AC_CHECK_HEADERS(ldap.h lber.h pthread.h,
184
			 [ ac_cv_enable_ldap=yes ],
185
			 [ ac_cv_enable_ldap=no ])
186
187
	if test "$ac_cv_enable_ldap" = yes; then
188
		AC_CHECK_LIB(ldap, ldap_open,
189
			     [ ac_cv_enable_ldap=yes ],
190
			     [ ac_cv_enable_ldap=no ],
191
			     $LDAP_LIBS)
192
	fi
193
194
	AC_MSG_CHECKING([whether ldap library is available])
195
	AC_MSG_RESULT($ac_cv_enable_ldap)
196
197
	if test "$ac_cv_enable_ldap" = yes; then
198
		CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gthread-2.0`"
199
		LDAP_LIBS="$LDAP_LIBS -lldap `$PKG_CONFIG --libs gthread-2.0`"
200
		AC_DEFINE(USE_LDAP, 1, Define if you want LDAP support in addressbook.)
201
		AC_SUBST(LDAP_LIBS)
202
	fi
203
else
204
	AC_MSG_RESULT(no)
205
fi
206
207
dnl Check for OpenSSL
208
AC_ARG_ENABLE(ssl,
209
	[  --disable-ssl           Disable SSL support using OpenSSL],
210
	[ac_cv_enable_ssl=$enableval], [ac_cv_enable_ssl=yes])
211
AC_MSG_CHECKING([whether to use OpenSSL])
212
if test $ac_cv_enable_ssl = yes; then
213
	AC_MSG_RESULT(yes)
214
	dnl First check with pkg-config
215
	PKG_CHECK_MODULES(OPENSSL, openssl, [:], [:])
216
	if test "x$OPENSSL_LIBS" != "x"; then
217
		CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
218
		LIBS="$LIBS $OPENSSL_LIBS"
219
		AC_MSG_CHECKING([if openssl is available])
220
		AC_MSG_RESULT(yes)
221
		AC_DEFINE(USE_SSL, 1, Define if you use OpenSSL to support SSL.)
222
	else
223
		dnl If pkg-config fails, run compile/link test.
224
		AC_MSG_CHECKING([if openssl is available])
225
		if test "$native_win32" = yes; then
226
			LIBS="$LIBS -lssl32 -leay32"
227
		else
228
			LIBS="$LIBS -lssl -lcrypto"
229
		fi
230
		AC_TRY_LINK([
231
#include <openssl/opensslv.h>
232
],		[ return OPENSSL_VERSION_NUMBER; ],
233
		[ AC_MSG_RESULT(yes)
234
		  AC_DEFINE(USE_SSL, 1, Define if you use OpenSSL to support SSL.) ],
235
		[ AC_MSG_RESULT(no)
236
		  LIBS="$ac_save_LIBS"
237
		  ac_cv_enable_ssl=no ])
238
	fi
239
else
240
	AC_MSG_RESULT(no)
241
fi
242
243
dnl Check for X-Face support
244
AC_ARG_ENABLE(compface,
245
	[  --disable-compface      Do not use compface (X-Face)],
246
	[ac_cv_enable_compface=$enableval], [ac_cv_enable_compface=yes])
247
if test "$ac_cv_enable_compface" = yes; then
248
	AC_CHECK_LIB(compface, uncompface,,[ac_cv_enable_compface=no])
249
fi
250
251
dnl Check for GtkSpell support
252
AC_MSG_CHECKING([whether to use GtkSpell])
253
AC_ARG_ENABLE(gtkspell,
254
	[  --disable-gtkspell      Do not use GtkSpell in editor],
255
	[ac_cv_enable_gtkspell=$enableval], [ac_cv_enable_gtkspell=yes])
256
if test "$ac_cv_enable_gtkspell" = yes; then
257
	AC_MSG_RESULT(yes)
258
	AC_MSG_CHECKING([whether GtkSpell is available])
259
	if $PKG_CONFIG gtkspell-2.0 ; then
260
		AC_MSG_RESULT(yes)
261
		CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gtkspell-2.0`"
262
		LIBS="$LIBS `$PKG_CONFIG --libs gtkspell-2.0`"
263
		AC_DEFINE(USE_GTKSPELL, 1, Use GtkSpell in editor)
264
	else
265
		AC_MSG_RESULT(no)
266
		ac_cv_enable_gtkspell=no
267
	fi
268
else
269
	AC_MSG_RESULT(no)		
270
fi
271
272
AC_CHECK_LIB(xpg4, setlocale)
273
274
dnl for GThread support (currently disabled)
275
dnl AC_ARG_ENABLE(threads,
276
dnl	[  --enable-threads        Enable multithread support [[default=no]]],
277
dnl	[use_threads=$enableval], [use_threads=no])
278
279
AC_MSG_CHECKING([whether to use threads])
280
if test x"$use_threads" = xyes ; then
281
	AC_MSG_RESULT(yes)
282
	if test ! -z `$PKG_CONFIG --help 2>&1 |grep 'gthread-2.0'` ; then
283
		CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gthread-2.0`"
284
		LIBS="$LIBS `$PKG_CONFIG --libs gthread-2.0`"
285
		AC_DEFINE(USE_THREADS, 1, Whether to use multithread or not)
286
	else
287
		AC_MSG_ERROR([Sylpheed requires GThread from GLib to use threading.])
288
	fi
289
else
290
	AC_MSG_RESULT(no)
291
fi
292
293
dnl check for IPv6 option
294
AC_ARG_ENABLE(ipv6,
295
	[  --disable-ipv6          Disable IPv6 support],
296
	[ac_cv_enable_ipv6=$enableval], [ac_cv_enable_ipv6=yes])
297
298
dnl automated checks for IPv6 support.
299
AC_MSG_CHECKING([whether to use IPv6])
300
if test x"$ac_cv_enable_ipv6" = xyes; then
301
	AC_MSG_RESULT(yes)
302
	AC_MSG_CHECKING([for IPv6 support])
303
	if test "$native_win32" = yes; then
304
		AC_CACHE_VAL(ac_cv_ipv6,[
305
			AC_TRY_COMPILE([#define INET6
306
					#include <sys/types.h>
307
					#include <winsock2.h>
308
					#include <ws2tcpip.h>],
309
				[int x = IPPROTO_IPV6; struct in6_addr a;],
310
				ac_cv_ipv6=yes, ac_cv_ipv6=no)
311
		])
312
	else
313
		AC_CACHE_VAL(ac_cv_ipv6,[
314
			AC_TRY_COMPILE([#define INET6
315
					#include <sys/types.h>
316
					#include <netinet/in.h>],
317
				[int x = IPPROTO_IPV6; struct in6_addr a;],
318
				ac_cv_ipv6=yes, ac_cv_ipv6=no)
319
		])
320
	fi
321
	AC_MSG_RESULT($ac_cv_ipv6)
322
	if test $ac_cv_ipv6 = yes; then
323
		AC_DEFINE(INET6, 1, Define if you want IPv6 support.)
324
	else
325
		AC_MSG_WARN(*** IPv6 will not be supported ***)
326
		ac_cv_enable_ipv6=no
327
	fi
328
else
329
	AC_MSG_RESULT(no)
330
fi
331
332
dnl Check for d_type member in struct dirent
333
AC_MSG_CHECKING([whether struct dirent has d_type member])
334
AC_CACHE_VAL(ac_cv_dirent_d_type,[
335
	AC_TRY_COMPILE([#include <dirent.h>],
336
		       [struct dirent d; d.d_type = DT_REG;],
337
		       ac_cv_dirent_d_type=yes, ac_cv_dirent_d_type=no)
338
])
339
AC_MSG_RESULT($ac_cv_dirent_d_type)
340
if test $ac_cv_dirent_d_type = yes; then
341
	AC_DEFINE(HAVE_DIRENT_D_TYPE, 1,
342
		  Define if `struct dirent' has `d_type' member.)
343
fi
344
345
346
dnl Checks for header files.
347
AC_HEADER_DIRENT
348
AC_HEADER_STDC
349
AC_HEADER_SYS_WAIT
350
AC_CHECK_HEADERS(fcntl.h sys/file.h unistd.h paths.h \
351
		 sys/param.h sys/utsname.h sys/select.h \
352
		 netdb.h regex.h sys/mman.h)
353
354
dnl Checks for typedefs, structures, and compiler characteristics.
355
AC_C_CONST
356
AC_TYPE_OFF_T
357
AC_TYPE_PID_T
358
AC_TYPE_SIZE_T
359
AC_STRUCT_TM
360
361
AC_SYS_LARGEFILE
362
AC_FUNC_FSEEKO
363
364
GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF, Used to test for a u32 typedef)
365
AC_CHECK_SIZEOF(unsigned short, 2)
366
AC_CHECK_SIZEOF(unsigned int, 4)
367
AC_CHECK_SIZEOF(unsigned long, 4)
368
369
dnl Checks for library functions.
370
AC_FUNC_ALLOCA
371
AC_CHECK_FUNCS(gethostname mkdir mktime socket strstr strchr \
372
	       uname flock lockf inet_aton inet_addr \
373
	       fchmod truncate getuid regcomp mlock)
374
375
AC_OUTPUT([
376
Makefile
377
sylpheed.spec
378
ac/Makefile
379
libsylph/Makefile
380
src/version.h
381
src/Makefile
382
src/icons/Makefile
383
po/Makefile.in
384
faq/Makefile
385
faq/de/Makefile
386
faq/en/Makefile
387
faq/es/Makefile
388
faq/fr/Makefile
389
faq/it/Makefile
390
manual/Makefile
391
manual/en/Makefile
392
manual/ja/Makefile
393
])
394
395
dnl Output the configuration summary
396
echo ""
397
echo "$PACKAGE $VERSION"
398
echo ""
399
echo "GnuPG         : $ac_cv_enable_gpgme"
400
echo "JPilot        : $ac_cv_enable_jpilot"
401
echo "LDAP          : $ac_cv_enable_ldap"
402
echo "OpenSSL       : $ac_cv_enable_ssl"
403
echo "iconv         : $am_cv_func_iconv"
404
echo "compface      : $ac_cv_enable_compface"
405
echo "IPv6          : $ac_cv_enable_ipv6"
406
echo "GtkSpell      : $ac_cv_enable_gtkspell"
407
echo ""
408
echo "The binary will be installed in $prefix/bin"
409
echo ""
410
echo "Configure finished, type 'make' to build."