Statistics
| Revision:

root / configure.in @ 457

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