Statistics
| Revision:

root / configure.in @ 485

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=1
9
MICRO_VERSION=0
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
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
	LIBS="$LIBS -lws2_32"
63
	;;
64
esac
65

    
66
dnl Checks for libraries.
67
AM_PATH_GLIB_2_0(2.4.0,, AC_MSG_ERROR(Test for GLib failed. See the 'INSTALL' for help.))
68

    
69
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
70

    
71
AM_PATH_GTK_2_0(2.4.0,, AC_MSG_ERROR(Test for Gtk failed. See the 'INSTALL' for help.))
72

    
73
dnl --disable-deprecated switch for GTK2 purification
74
AC_ARG_ENABLE(deprecated, [  --disable-deprecated    Disable deprecated GTK functions. ],
75
			  [GTK_CFLAGS="$GTK_CFLAGS -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"], [])
76

    
77
AC_SUBST(GTK_CFLAGS)
78
AC_SUBST(GTK_LIBS)
79

    
80
dnl checks for iconv
81
AM_ICONV
82

    
83
AC_CHECK_FUNCS(bind_textdomain_codeset)
84

    
85
dnl for gettext
86
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"
87
GETTEXT_PACKAGE=sylpheed
88
AC_SUBST(GETTEXT_PACKAGE)
89
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define text domain.])
90

    
91
AM_GLIB_GNU_GETTEXT
92
dnl AM_GNU_GETTEXT
93
dnl AC_CHECK_FUNC(gettext, AC_CHECK_LIB(intl, gettext))
94
localedir='${prefix}/${DATADIRNAME}/locale'
95
AC_SUBST(localedir)
96

    
97
manualdir='${prefix}/${DATADIRNAME}/${PACKAGE}/manual'
98
AC_SUBST(manualdir)
99
faqdir='${prefix}/${DATADIRNAME}/${PACKAGE}/faq'
100
AC_SUBST(faqdir)
101

    
102
dnl GPGME is used to support OpenPGP 
103
AC_ARG_ENABLE(gpgme,
104
	[  --disable-gpgme         Disable GnuPG support using GPGME],
105
	[ac_cv_enable_gpgme=$enableval], [ac_cv_enable_gpgme=yes])
106
AC_MSG_CHECKING([whether to use GPGME])
107
if test $ac_cv_enable_gpgme = yes; then
108
	AC_MSG_RESULT(yes)
109
	AM_PATH_GPGME(0.4.5, AC_DEFINE(USE_GPGME, 1, Define if you use GPGME to support OpenPGP.),
110
		      [use_gpgme=no
111
		       ac_cv_enable_gpgme=no])
112
else
113
	AC_MSG_RESULT(no)
114
fi
115

    
116
dnl for JPilot support in addressbook
117
dnl no check for libraries; these are dynamically loaded
118
AC_ARG_ENABLE(jpilot,
119
	[  --enable-jpilot         Enable JPilot support [[default=no]]],
120
	[ac_cv_enable_jpilot=$enableval], [ac_cv_enable_jpilot=no])
121
AC_MSG_CHECKING([whether to use JPilot])
122
if test "$ac_cv_enable_jpilot" = yes; then
123
	AC_MSG_RESULT(yes)
124
	AC_CHECK_HEADERS(pi-args.h pi-appinfo.h pi-address.h,
125
			 [ AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ],
126
			 [ ac_cv_enable_jpilot=no ])
127
	if test "$ac_cv_enable_jpilot" = no; then
128
		AC_CHECK_HEADERS(libpisock/pi-args.h libpisock/pi-appinfo.h libpisock/pi-address.h,
129
				 [ ac_cv_enable_jpilot=yes
130
				   AC_DEFINE(USE_JPILOT, 1, Define if you want JPilot support in addressbook.) ])
131
	fi
132
	AC_MSG_CHECKING([whether jpilot is available])
133
	AC_MSG_RESULT($ac_cv_enable_jpilot)
134

    
135
	if test "$ac_cv_enable_jpilot" = yes; then
136
		LIBS="$LIBS -lpisock"
137
	fi
138
else
139
	AC_MSG_RESULT(no)
140
fi
141

    
142
dnl for LDAP support in addressbook
143
dnl no check for libraries; dynamically loaded
144
AC_ARG_ENABLE(ldap,
145
	[  --enable-ldap           Enable LDAP support [[default=no]]],
146
	[ac_cv_enable_ldap=$enableval], [ac_cv_enable_ldap=no])
147
AC_MSG_CHECKING([whether to use LDAP])
148
if test "$ac_cv_enable_ldap" = yes; then
149
	AC_MSG_RESULT(yes)
150

    
151
	dnl check for available libraries, and pull them in
152
	AC_CHECK_LIB(resolv, res_query, LDAP_LIBS="$LDAP_LIBS -lresolv")
153
	AC_CHECK_LIB(socket, bind, LDAP_LIBS="$LDAP_LIBS -lsocket")
154
	AC_CHECK_LIB(nsl, gethostbyaddr, LDAP_LIBS="$LDAP_LIBS -lnsl")
155
	AC_CHECK_LIB(lber, ber_get_tag, LDAP_LIBS="$LDAP_LIBS -llber",,
156
		     $LDAP_LIBS)
157

    
158
	dnl we need libpthread for sylpheed ldap,  until we find
159
	dnl a better way to handle ldap requests asynchronously...
160
	AC_CHECK_LIB(pthread, pthread_create, LDAP_LIBS="$LDAP_LIBS -lpthread")
161

    
162
	AC_CHECK_HEADERS(ldap.h lber.h pthread.h,
163
			 [ ac_cv_enable_ldap=yes ],
164
			 [ ac_cv_enable_ldap=no ])
165

    
166
	if test "$ac_cv_enable_ldap" = yes; then
167
		AC_CHECK_LIB(ldap, ldap_open,
168
			     [ ac_cv_enable_ldap=yes ],
169
			     [ ac_cv_enable_ldap=no ],
170
			     $LDAP_LIBS)
171
	fi
172

    
173
	AC_MSG_CHECKING([whether ldap library is available])
174
	AC_MSG_RESULT($ac_cv_enable_ldap)
175

    
176
	if test "$ac_cv_enable_ldap" = yes; then
177
		CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gthread-2.0`"
178
		LDAP_LIBS="$LDAP_LIBS -lldap `$PKG_CONFIG --libs gthread-2.0`"
179
		AC_DEFINE(USE_LDAP, 1, Define if you want LDAP support in addressbook.)
180
		AC_SUBST(LDAP_LIBS)
181
	fi
182
else
183
	AC_MSG_RESULT(no)
184
fi
185

    
186
dnl Check for OpenSSL
187
AC_ARG_ENABLE(ssl,
188
	[  --disable-ssl           Disable SSL support using OpenSSL],
189
	[ac_cv_enable_ssl=$enableval], [ac_cv_enable_ssl=yes])
190
AC_MSG_CHECKING([whether to use OpenSSL])
191
if test $ac_cv_enable_ssl = yes; then
192
	AC_MSG_RESULT(yes)
193
	dnl First check with pkg-config
194
	PKG_CHECK_MODULES(OPENSSL, openssl, [:], [:])
195
	if test "x$OPENSSL_LIBS" != "x"; then
196
		CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
197
		LIBS="$LIBS $OPENSSL_LIBS"
198
		AC_MSG_CHECKING([if openssl is available])
199
		AC_MSG_RESULT(yes)
200
		AC_DEFINE(USE_SSL, 1, Define if you use OpenSSL to support SSL.)
201
	else
202
		dnl If pkg-config fails, run compile/link test.
203
		AC_MSG_CHECKING([if openssl is available])
204
		LIBS="$LIBS -lssl -lcrypto"
205
		AC_TRY_LINK([
206
#include <openssl/opensslv.h>
207
],		[ return OPENSSL_VERSION_NUMBER; ],
208
		[ AC_MSG_RESULT(yes)
209
		  AC_DEFINE(USE_SSL, 1, Define if you use OpenSSL to support SSL.) ],
210
		[ AC_MSG_RESULT(no)
211
		  LIBS="$ac_save_LIBS"
212
		  ac_cv_enable_ssl=no ])
213
	fi
214
else
215
	AC_MSG_RESULT(no)
216
fi
217

    
218
dnl Check for X-Face support
219
AC_ARG_ENABLE(compface,
220
	[  --disable-compface      Do not use compface (X-Face)],
221
	[ac_cv_enable_compface=$enableval], [ac_cv_enable_compface=yes])
222
if test "$ac_cv_enable_compface" = yes; then
223
	AC_CHECK_LIB(compface, uncompface,,[ac_cv_enable_compface=no])
224
fi
225

    
226
AC_CHECK_LIB(xpg4, setlocale)
227

    
228
dnl for GThread support (currently disabled)
229
dnl AC_ARG_ENABLE(threads,
230
dnl	[  --enable-threads        Enable multithread support [[default=no]]],
231
dnl	[use_threads=$enableval], [use_threads=no])
232

    
233
AC_MSG_CHECKING([whether to use threads])
234
if test x"$use_threads" = xyes ; then
235
	AC_MSG_RESULT(yes)
236
	if test ! -z `$PKG_CONFIG --help 2>&1 |grep 'gthread-2.0'` ; then
237
		CFLAGS="$CFLAGS `$PKG_CONFIG --cflags gthread-2.0`"
238
		LIBS="$LIBS `$PKG_CONFIG --libs gthread-2.0`"
239
		AC_DEFINE(USE_THREADS, 1, Whether to use multithread or not)
240
	else
241
		AC_MSG_ERROR([Sylpheed requires GThread from GLib to use threading.])
242
	fi
243
else
244
	AC_MSG_RESULT(no)
245
fi
246

    
247
dnl check for IPv6 option
248
AC_ARG_ENABLE(ipv6,
249
	[  --disable-ipv6          Disable IPv6 support],
250
	[ac_cv_enable_ipv6=$enableval], [ac_cv_enable_ipv6=yes])
251

    
252
dnl automated checks for IPv6 support.
253
AC_MSG_CHECKING([whether to use IPv6])
254
if test x"$ac_cv_enable_ipv6" = xyes; then
255
	AC_MSG_RESULT(yes)
256
	AC_MSG_CHECKING([for IPv6 support])
257
	AC_CACHE_VAL(ac_cv_ipv6,[
258
		AC_TRY_COMPILE([#define INET6
259
				#include <sys/types.h>
260
				#include <netinet/in.h>],
261
			[int x = IPPROTO_IPV6; struct in6_addr a;],
262
			ac_cv_ipv6=yes, ac_cv_ipv6=no)
263
	])
264
	AC_MSG_RESULT($ac_cv_ipv6)
265
	if test $ac_cv_ipv6 = yes; then
266
		AC_DEFINE(INET6, 1, Define if you want IPv6 support.)
267
	else
268
		AC_MSG_WARN(*** IPv6 will not be supported ***)
269
		ac_cv_enable_ipv6=no
270
	fi
271
else
272
	AC_MSG_RESULT(no)
273
fi
274

    
275
dnl Check for d_type member in struct dirent
276
AC_MSG_CHECKING([whether struct dirent has d_type member])
277
AC_CACHE_VAL(ac_cv_dirent_d_type,[
278
	AC_TRY_COMPILE([#include <dirent.h>],
279
		       [struct dirent d; d.d_type = DT_REG;],
280
		       ac_cv_dirent_d_type=yes, ac_cv_dirent_d_type=no)
281
])
282
AC_MSG_RESULT($ac_cv_dirent_d_type)
283
if test $ac_cv_dirent_d_type = yes; then
284
	AC_DEFINE(HAVE_DIRENT_D_TYPE, 1,
285
		  Define if `struct dirent' has `d_type' member.)
286
fi
287

    
288

    
289
dnl Checks for header files.
290
AC_HEADER_DIRENT
291
AC_HEADER_STDC
292
AC_HEADER_SYS_WAIT
293
AC_CHECK_HEADERS(fcntl.h sys/file.h unistd.h paths.h \
294
		 sys/param.h sys/utsname.h sys/select.h \
295
		 wchar.h wctype.h \
296
		 netdb.h regex.h)
297

    
298
dnl Checks for typedefs, structures, and compiler characteristics.
299
AC_C_CONST
300
AC_TYPE_OFF_T
301
AC_TYPE_PID_T
302
AC_TYPE_SIZE_T
303
AC_STRUCT_TM
304

    
305
AC_SYS_LARGEFILE
306
AC_FUNC_FSEEKO
307

    
308
dnl AC_CHECK_TYPE(wint_t, unsigned int) does not work because wint_t
309
dnl may be defined only in wchar.h (this happens with gcc-2.96).
310
dnl So we need to use this extended macro.
311
SYLPHEED_CHECK_TYPE(wint_t, unsigned int,
312
[
313
#if HAVE_WCHAR_H
314
#include <wchar.h>
315
#endif
316
], Define to `unsigned int' if <stddef.h> or <wchar.h> doesn't define.)
317

    
318
GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF, Used to test for a u32 typedef)
319
AC_CHECK_SIZEOF(unsigned short, 2)
320
AC_CHECK_SIZEOF(unsigned int, 4)
321
AC_CHECK_SIZEOF(unsigned long, 4)
322

    
323
dnl Checks for library functions.
324
AC_FUNC_ALLOCA
325
AC_CHECK_FUNCS(gethostname mkdir mktime socket strstr strchr \
326
	       wcsstr wcswcs iswalnum iswspace towlower \
327
	       wcslen wcscpy wcsncpy \
328
	       uname flock lockf inet_aton inet_addr \
329
	       fchmod mkstemp truncate getuid regcomp)
330

    
331
AC_OUTPUT([
332
Makefile
333
sylpheed.spec
334
ac/Makefile
335
po/Makefile.in
336
src/version.h
337
src/Makefile
338
src/pixmaps/Makefile
339
faq/Makefile
340
faq/de/Makefile
341
faq/en/Makefile
342
faq/es/Makefile
343
faq/fr/Makefile
344
faq/it/Makefile
345
manual/Makefile
346
manual/en/Makefile
347
manual/ja/Makefile
348
])
349

    
350
dnl Output the configuration summary
351
echo ""
352
echo "$PACKAGE $VERSION"
353
echo ""
354
echo "GnuPG         : $ac_cv_enable_gpgme"
355
echo "JPilot        : $ac_cv_enable_jpilot"
356
echo "LDAP          : $ac_cv_enable_ldap"
357
echo "OpenSSL       : $ac_cv_enable_ssl"
358
echo "iconv         : $am_cv_func_iconv"
359
echo "compface      : $ac_cv_enable_compface"
360
echo "IPv6          : $ac_cv_enable_ipv6"
361
echo ""
362
echo "The binary will be installed in $prefix/bin"
363
echo ""
364
echo "Configure finished, type 'make' to build."