Statistics
| Revision:

root / configure.in @ 469

History | View | Annotate | Download (10.2 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=0
9
MICRO_VERSION=0
10
INTERFACE_AGE=0
11
BINARY_AGE=0
12
EXTRA_VERSION=+svn
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
SYLPHEED_ACLOCAL_INCLUDE(ac)
55
56
case "$target" in
57
*-darwin*)
58
	CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
59
	;;
60
*-*-mingw*)
61
	CFLAGS="$CFLAGS -mms-bitfields"
62
	;;
63
esac
64
65
dnl Checks for libraries.
66
AM_PATH_GLIB_2_0(2.4.0,, AC_MSG_ERROR(Test for GLib failed. See the 'INSTALL' for help.))
67
68
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
69
70
AM_PATH_GTK_2_0(2.4.0,, AC_MSG_ERROR(Test for Gtk failed. See the 'INSTALL' for help.))
71
72
dnl --disable-deprecated switch for GTK2 purification
73
AC_ARG_ENABLE(deprecated, [  --disable-deprecated    Disable deprecated GTK functions. ],
74
			  [GTK_CFLAGS="$GTK_CFLAGS -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"], [])
75
76
AC_SUBST(GTK_CFLAGS)
77
AC_SUBST(GTK_LIBS)
78
79
dnl checks for iconv
80
AM_ICONV
81
82
AC_CHECK_FUNCS(bind_textdomain_codeset)
83
84
dnl for gettext
85
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 zh_CN zh_TW.Big5"
86
GETTEXT_PACKAGE=sylpheed
87
AC_SUBST(GETTEXT_PACKAGE)
88
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define text domain.])
89
90
AM_GLIB_GNU_GETTEXT
91
dnl AM_GNU_GETTEXT
92
dnl AC_CHECK_FUNC(gettext, AC_CHECK_LIB(intl, gettext))
93
localedir='${prefix}/${DATADIRNAME}/locale'
94
AC_SUBST(localedir)
95
96
manualdir='${prefix}/${DATADIRNAME}/${PACKAGE}/manual'
97
AC_SUBST(manualdir)
98
faqdir='${prefix}/${DATADIRNAME}/${PACKAGE}/faq'
99
AC_SUBST(faqdir)
100
101
dnl GPGME is used to support OpenPGP 
102
AC_ARG_ENABLE(gpgme,
103
	[  --disable-gpgme         Disable GnuPG support using GPGME],
104
	[ac_cv_enable_gpgme=$enableval], [ac_cv_enable_gpgme=yes])
105
AC_MSG_CHECKING([whether to use GPGME])
106
if test $ac_cv_enable_gpgme = yes; then
107
	AC_MSG_RESULT(yes)
108
	AM_PATH_GPGME(0.4.5, AC_DEFINE(USE_GPGME, 1, Define if you use GPGME to support OpenPGP.),
109
		      [use_gpgme=no
110
		       ac_cv_enable_gpgme=no])
111
else
112
	AC_MSG_RESULT(no)
113
fi
114
115
dnl for JPilot support in addressbook
116
dnl no check for libraries; these are dynamically loaded
117
AC_ARG_ENABLE(jpilot,
118
	[  --enable-jpilot         Enable JPilot support [[default=no]]],
119
	[ac_cv_enable_jpilot=$enableval], [ac_cv_enable_jpilot=no])
120
AC_MSG_CHECKING([whether to use JPilot])
121
if test "$ac_cv_enable_jpilot" = yes; then
122
	AC_MSG_RESULT(yes)
123
	AC_CHECK_HEADERS(pi-args.h pi-appinfo.h pi-address.h,
124
			 [ AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ],
125
			 [ ac_cv_enable_jpilot=no ])
126
	if test "$ac_cv_enable_jpilot" = no; then
127
		AC_CHECK_HEADERS(libpisock/pi-args.h libpisock/pi-appinfo.h libpisock/pi-address.h,
128
				 [ ac_cv_enable_jpilot=yes
129
				   AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ])
130
	fi
131
	AC_MSG_CHECKING([whether jpilot is available])
132
	AC_MSG_RESULT($ac_cv_enable_jpilot)
133
134
	if test "$ac_cv_enable_jpilot" = yes; then
135
		LIBS="$LIBS -lpisock"
136
	fi
137
else
138
	AC_MSG_RESULT(no)
139
fi
140
141
dnl for LDAP support in addressbook
142
dnl no check for libraries; dynamically loaded
143
AC_ARG_ENABLE(ldap,
144
	[  --enable-ldap           Enable LDAP support [[default=no]]],
145
	[ac_cv_enable_ldap=$enableval], [ac_cv_enable_ldap=no])
146
AC_MSG_CHECKING([whether to use LDAP])
147
if test "$ac_cv_enable_ldap" = yes; then
148
	AC_MSG_RESULT(yes)
149
150
	dnl check for available libraries, and pull them in
151
	AC_CHECK_LIB(resolv, res_query, LDAP_LIBS="$LDAP_LIBS -lresolv")
152
	AC_CHECK_LIB(socket, bind, LDAP_LIBS="$LDAP_LIBS -lsocket")
153
	AC_CHECK_LIB(nsl, gethostbyaddr, LDAP_LIBS="$LDAP_LIBS -lnsl")
154
	AC_CHECK_LIB(lber, ber_get_tag, LDAP_LIBS="$LDAP_LIBS -llber",,
155
		     $LDAP_LIBS)
156
157
	dnl we need libpthread for sylpheed ldap,  until we find
158
	dnl a better way to handle ldap requests asynchronously...
159
	AC_CHECK_LIB(pthread, pthread_create, LDAP_LIBS="$LDAP_LIBS -lpthread")
160
161
	AC_CHECK_HEADERS(ldap.h lber.h pthread.h,
162
			 [ ac_cv_enable_ldap=yes ],
163
			 [ ac_cv_enable_ldap=no ])
164
165
	if test "$ac_cv_enable_ldap" = yes; then
166
		AC_CHECK_LIB(ldap, ldap_open,
167
			     [ ac_cv_enable_ldap=yes ],
168
			     [ ac_cv_enable_ldap=no ],
169
			     $LDAP_LIBS)
170
	fi
171
172
	AC_MSG_CHECKING([whether ldap library is available])
173
	AC_MSG_RESULT($ac_cv_enable_ldap)
174
175
	if test "$ac_cv_enable_ldap" = yes; then
176
		CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gthread-2.0`"
177
		LDAP_LIBS="$LDAP_LIBS -lldap `$PKG_CONFIG --libs gthread-2.0`"
178
		AC_DEFINE(USE_LDAP, 1, Define if you want LDAP support in addressbook.)
179
		AC_SUBST(LDAP_LIBS)
180
	fi
181
else
182
	AC_MSG_RESULT(no)
183
fi
184
185
dnl Check for OpenSSL
186
AC_ARG_ENABLE(ssl,
187
	[  --disable-ssl           Disable SSL support using OpenSSL],
188
	[ac_cv_enable_ssl=$enableval], [ac_cv_enable_ssl=yes])
189
AC_MSG_CHECKING([whether to use OpenSSL])
190
if test $ac_cv_enable_ssl = yes; then
191
	AC_MSG_RESULT(yes)
192
	dnl First check with pkg-config
193
	PKG_CHECK_MODULES(OPENSSL, openssl, [:], [:])
194
	if test "x$OPENSSL_LIBS" != "x"; then
195
		CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
196
		LIBS="$LIBS $OPENSSL_LIBS"
197
		AC_MSG_CHECKING([if openssl is available])
198
		AC_MSG_RESULT(yes)
199
		AC_DEFINE(USE_SSL, 1, Define if you use OpenSSL to support SSL.)
200
	else
201
		dnl If pkg-config fails, run compile/link test.
202
		AC_MSG_CHECKING([if openssl is available])
203
		LIBS="$LIBS -lssl -lcrypto"
204
		AC_TRY_LINK([
205
#include <openssl/opensslv.h>
206
],		[ return OPENSSL_VERSION_NUMBER; ],
207
		[ AC_MSG_RESULT(yes)
208
		  AC_DEFINE(USE_SSL, 1, Define if you use OpenSSL to support SSL.) ],
209
		[ AC_MSG_RESULT(no)
210
		  LIBS="$ac_save_LIBS"
211
		  ac_cv_enable_ssl=no ])
212
	fi
213
else
214
	AC_MSG_RESULT(no)
215
fi
216
217
dnl Check for X-Face support
218
AC_ARG_ENABLE(compface,
219
	[  --disable-compface      Do not use compface (X-Face)],
220
	[ac_cv_enable_compface=$enableval], [ac_cv_enable_compface=yes])
221
if test "$ac_cv_enable_compface" = yes; then
222
	AC_CHECK_LIB(compface, uncompface,,[ac_cv_enable_compface=no])
223
fi
224
225
AC_CHECK_LIB(xpg4, setlocale)
226
227
dnl for GThread support (currently disabled)
228
dnl AC_ARG_ENABLE(threads,
229
dnl	[  --enable-threads        Enable multithread support [[default=no]]],
230
dnl	[use_threads=$enableval], [use_threads=no])
231
232
AC_MSG_CHECKING([whether to use threads])
233
if test x"$use_threads" = xyes ; then
234
	AC_MSG_RESULT(yes)
235
	if test ! -z `$PKG_CONFIG --help 2>&1 |grep 'gthread-2.0'` ; then
236
		CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gthread-2.0`"
237
		LIBS="$LIBS `$PKG_CONFIG --libs gthread-2.0`"
238
		AC_DEFINE(USE_THREADS, 1, Whether to use multithread or not)
239
	else
240
		AC_MSG_ERROR([Sylpheed requires GThread from GLib to use threading.])
241
	fi
242
else
243
	AC_MSG_RESULT(no)
244
fi
245
246
dnl check for IPv6 option
247
AC_ARG_ENABLE(ipv6,
248
	[  --disable-ipv6          Disable IPv6 support],
249
	[ac_cv_enable_ipv6=$enableval], [ac_cv_enable_ipv6=yes])
250
251
dnl automated checks for IPv6 support.
252
AC_MSG_CHECKING([whether to use IPv6])
253
if test x"$ac_cv_enable_ipv6" = xyes; then
254
	AC_MSG_RESULT(yes)
255
	AC_MSG_CHECKING([for IPv6 support])
256
	AC_CACHE_VAL(ac_cv_ipv6,[
257
		AC_TRY_COMPILE([#define INET6
258
				#include <sys/types.h>
259
				#include <netinet/in.h>],
260
			[int x = IPPROTO_IPV6; struct in6_addr a;],
261
			ac_cv_ipv6=yes, ac_cv_ipv6=no)
262
	])
263
	AC_MSG_RESULT($ac_cv_ipv6)
264
	if test $ac_cv_ipv6 = yes; then
265
		AC_DEFINE(INET6, 1, Define if you want IPv6 support.)
266
	else
267
		AC_MSG_WARN(*** IPv6 will not be supported ***)
268
		ac_cv_enable_ipv6=no
269
	fi
270
else
271
	AC_MSG_RESULT(no)
272
fi
273
274
dnl Check for d_type member in struct dirent
275
AC_MSG_CHECKING([whether struct dirent has d_type member])
276
AC_CACHE_VAL(ac_cv_dirent_d_type,[
277
	AC_TRY_COMPILE([#include <dirent.h>],
278
		       [struct dirent d; d.d_type = DT_REG;],
279
		       ac_cv_dirent_d_type=yes, ac_cv_dirent_d_type=no)
280
])
281
AC_MSG_RESULT($ac_cv_dirent_d_type)
282
if test $ac_cv_dirent_d_type = yes; then
283
	AC_DEFINE(HAVE_DIRENT_D_TYPE, 1,
284
		  Define if `struct dirent' has `d_type' member.)
285
fi
286
287
288
dnl Checks for header files.
289
AC_HEADER_DIRENT
290
AC_HEADER_STDC
291
AC_HEADER_SYS_WAIT
292
AC_CHECK_HEADERS(fcntl.h sys/file.h unistd.h paths.h \
293
		 sys/param.h sys/utsname.h sys/select.h \
294
		 wchar.h wctype.h \
295
		 netdb.h)
296
297
dnl Checks for typedefs, structures, and compiler characteristics.
298
AC_C_CONST
299
AC_TYPE_OFF_T
300
AC_TYPE_PID_T
301
AC_TYPE_SIZE_T
302
AC_STRUCT_TM
303
304
AC_SYS_LARGEFILE
305
AC_FUNC_FSEEKO
306
307
dnl AC_CHECK_TYPE(wint_t, unsigned int) does not work because wint_t
308
dnl may be defined only in wchar.h (this happens with gcc-2.96).
309
dnl So we need to use this extended macro.
310
SYLPHEED_CHECK_TYPE(wint_t, unsigned int,
311
[
312
#if HAVE_WCHAR_H
313
#include <wchar.h>
314
#endif
315
], Define to `unsigned int' if <stddef.h> or <wchar.h> doesn't define.)
316
317
GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF, Used to test for a u32 typedef)
318
AC_CHECK_SIZEOF(unsigned short, 2)
319
AC_CHECK_SIZEOF(unsigned int, 4)
320
AC_CHECK_SIZEOF(unsigned long, 4)
321
322
dnl Checks for library functions.
323
AC_FUNC_ALLOCA
324
AC_CHECK_FUNCS(gethostname mkdir mktime socket strstr strchr \
325
	       wcsstr wcswcs iswalnum iswspace towlower \
326
	       wcslen wcscpy wcsncpy \
327
	       uname flock lockf inet_aton inet_addr \
328
	       fchmod mkstemp truncate getuid)
329
330
AC_OUTPUT([
331
Makefile
332
sylpheed.spec
333
ac/Makefile
334
po/Makefile.in
335
src/version.h
336
src/Makefile
337
src/pixmaps/Makefile
338
faq/Makefile
339
faq/de/Makefile
340
faq/en/Makefile
341
faq/es/Makefile
342
faq/fr/Makefile
343
faq/it/Makefile
344
manual/Makefile
345
manual/en/Makefile
346
manual/ja/Makefile
347
])
348
349
dnl Output the configuration summary
350
echo ""
351
echo "$PACKAGE $VERSION"
352
echo ""
353
echo "GnuPG         : $ac_cv_enable_gpgme"
354
echo "JPilot        : $ac_cv_enable_jpilot"
355
echo "LDAP          : $ac_cv_enable_ldap"
356
echo "OpenSSL       : $ac_cv_enable_ssl"
357
echo "iconv         : $am_cv_func_iconv"
358
echo "compface      : $ac_cv_enable_compface"
359
echo "IPv6          : $ac_cv_enable_ipv6"
360
echo ""
361
echo "The binary will be installed in $prefix/bin"
362
echo ""
363
echo "Configure finished, type 'make' to build."