summaryrefslogtreecommitdiff
path: root/configure.in
blob: 98d0edee13fe4afd6013b43fa363a36a960bcb21 (plain)
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
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
AC_PREREQ(2.56)
AC_INIT(vte, [0.16.0],
        [http://bugzilla.gnome.org/enter_bug.cgi?product=vte])
AC_CONFIG_SRCDIR([src/vte.c])
AM_INIT_AUTOMAKE(1.6)
AM_CONFIG_HEADER([config.h])

AC_ISC_POSIX
AC_PROG_CC
AC_STDC_HEADERS
AM_PROG_CC_STDC
AM_MAINTAINER_MODE

AM_PROG_LIBTOOL
IT_PROG_INTLTOOL([0.35.0])

GETTEXT_PACKAGE=vte
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",
                   [Package translatable messages domain name.])
AM_GLIB_GNU_GETTEXT
AC_CHECK_DECLS(bind_textdomain_codeset,,,[#include "libintl.h"])


################################################################################
# Platform checks
################################################################################

AC_MSG_CHECKING([for a win32 platform])
platform_win32=no
case "$host" in
	*-*-mingw*|*-*-cygwin*)
		platform_win32=yes
		;;
esac
AC_MSG_RESULT([$platform_win32])
AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")

os_win32=no
if test "x$platform_win32" = "xyes"; then
	AC_MSG_CHECKING([for native win32])
	case "$host" in
		*-*-mingw*)
			os_win32=yes
			;;
	esac
	AC_MSG_RESULT([$os_win32])
fi
AM_CONDITIONAL(OS_WIN32, test "x$os_win32" = "xyes")


if test "x$platform_win32" != "xyes"; then
	LIBTOOL_EXPORT_OPTIONS=
else
	LIBTOOL_EXPORT_OPTIONS='-no-undefined'
fi
AC_SUBST([LIBTOOL_EXPORT_OPTIONS])
LIBTOOL_FLAGS='-as-needed'
AC_SUBST([LIBTOOL_FLAGS])


################################################################################
# Compilation
################################################################################

# Save the names of these other libraries.
OTHERCFLAGS="$X_CFLAGS"
AC_SUBST(OTHERCFLAGS)
OTHERLIBS="$LIBS"
AC_SUBST(OTHERLIBS)

dnl Use lots of warning flags with with gcc and compatible compilers
dnl Copied from cairo
AC_DEFUN([VTE_CC_TRY_FLAG], [
  AC_MSG_CHECKING([whether $CC supports $1])

  vte_save_CFLAGS="$CFLAGS"
  CFLAGS="$CFLAGS $1"

  AC_COMPILE_IFELSE([ ], [vte_cc_flag=yes], [vte_cc_flag=no])
  CFLAGS="$vte_save_CFLAGS"

  if test "x$vte_cc_flag" = "xyes"; then
    ifelse([$2], , :, [$2])
  else
    ifelse([$3], , :, [$3])
  fi
  AC_MSG_RESULT([$vte_cc_flag])
])
AC_DEFUN([VTE_LD_TRY_FLAG], [
  AC_MSG_CHECKING([whether $CC supports $1 when linking])

  vte_save_LDFLAGS="$LDFLAGS"
  LDFLAGS="$LDFLAGS $1"

  AC_LINK_IFELSE([int main(void) {return 0;}],
		[vte_ld_flag=yes], [vte_ld_flag=no])
  LDFLAGS="$vte_save_LDFLAGS"

  if test "x$vte_ld_flag" = "xyes"; then
    ifelse([$2], , :, [$2])
  else
    ifelse([$3], , :, [$3])
  fi
  AC_MSG_RESULT([$vte_ld_flag])
])


dnl Note: if you change the following variable, the cache is automatically
dnl skipped and all flags rechecked.  So there's no need to do anything
dnl else.  If for any reason you need to force a recheck, just change
dnl MAYBE_WARN in an ignorable way (like adding whitespace)

MAYBE_WARN="-Wall -Wextra \
-Wsign-compare -Werror-implicit-function-declaration \
-Wpointer-arith -Wwrite-strings -Wstrict-prototypes \
-Waggregate-return -Wcast-align -Wimplicit -Wuninitialised \
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs \
-Wpacked -Wmissing-format-attribute -Wshadow \
-Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \
-Wdeclaration-after-statement -Wold-style-definition \
-Wno-missing-field-initializers -Wno-unused-parameter \
-fno-common"

dnl Other flags you may wish to try: -Wswitch-enum 


# invalidate cached value if MAYBE_WARN has changed
if test "x$vte_cv_warn_maybe" != "x$MAYBE_WARN"; then
	unset vte_cv_warn_cflags
fi
AC_CACHE_CHECK([for supported warning flags], vte_cv_warn_cflags, [
	echo
	WARN_CFLAGS=""

	# Some warning options are not supported by all versions of
	# gcc, so test all desired options against the current
	# compiler.
	#
	# Note that there are some order dependencies
	# here. Specifically, an option that disables a warning will
	# have no net effect if a later option then enables that
	# warnings, (perhaps implicitly). So we put some grouped
	# options (-Wall and -Wextra) up front and the -Wno options
	# last.

	for W in $MAYBE_WARN; do
		VTE_CC_TRY_FLAG([$W], [WARN_CFLAGS="$WARN_CFLAGS $W"])
	done

	vte_cv_warn_cflags=$WARN_CFLAGS
	vte_cv_warn_maybe=$MAYBE_WARN

	AC_MSG_CHECKING([which warning flags were supported])])
WARN_CFLAGS=$vte_cv_warn_cflags
AC_SUBST(WARN_CFLAGS)
CFLAGS="$CFLAGS $WARN_CFLAGS"

PYTHON_LDFLAGS=""
for W in "-Wl,--warn-unresolved-symbols"; do
	VTE_LD_TRY_FLAG([$W], [PYTHON_LDFLAGS="$PYTHON_LDFLAGS $W"])
done
AC_SUBST(PYTHON_LDFLAGS)

# Enable debugging messages and additional run-time checks.
AC_ARG_ENABLE(debugging,
	      [AS_HELP_STRING([--enable-debugging],
			      [enable extra debugging checks and logging messages]
			      )],
	      DEBUG=$enableval, DEBUG=no)
if test "x$DEBUG" != "xno" ; then
	AC_MSG_RESULT([enabling debug checks and messages])
	AC_DEFINE(VTE_DEBUG,1,[Enable debugging messages.])
fi



################################################################################
# Core
################################################################################


# On some OSs, AC_PATH_XTRA doesn't work right(?), so let the user specify
# X_PRE_LIBS and X_EXTRA_LIBS to add even more libraries, and add -lX11 to
# the list of libraries for grins.
AC_PATH_XTRA([X11], [X11/Xlib.h], [XFlush(NULL)])
if test "$have_x" = yes ; then
	if test -d "$x_includes" ; then
		X_CFLAGS="-I$x_includes $X_CFLAGS"
	elif test -d "$ac_x_includes" ; then
		X_CFLAGS="-I$ac_x_includes $X_CFLAGS"
	fi
	X_LIBS="$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
	if test -d "$ac_x_libraries" ; then
		X_LIBS="-L$x_libraries $X_LIBS"
	elif test -d "$ac_x_libraries" ; then
		X_LIBS="-L$ac_x_libraries $X_LIBS"
	fi
fi
AC_SUBST([X_CFLAGS X_LIBS])



# Use all available features under glibc, and disable accidental use of
# deprecated functionality.
AC_EGREP_CPP(glibc,
		[
		 #include <stdio.h>
		 #ifdef __GLIBC__
		 glibc
		 #endif
		],
		AC_DEFINE(_GNU_SOURCE,1,[Use all glibc features.]))

case $host in
*-*-solaris*)
	AC_DEFINE(_XOPEN_SOURCE_EXTENDED,1,[Needed to get declarations for msg_control and msg_controllen on Solaris])
	AC_DEFINE(_XOPEN_SOURCE,1,[Needed to get declarations for msg_control and msg_controllen on Solaris])
	AC_DEFINE(__EXTENSIONS__,1,[Needed to get declarations for msg_control and msg_controllen on Solaris])
	;;
esac


AC_DEFINE(GDK_MULTIHEAD_SAFE,1,[Force use of GDK's multihead-safe APIs.])
PKG_CHECK_MODULES(GLIB,glib-2.0 > 2.9.0)
PKG_CHECK_MODULES(GOBJECT,[glib-2.0 gobject-2.0])
PKG_CHECK_MODULES(GTK,[glib-2.0 gobject-2.0 gtk+-2.0 >= 2.6.0])

wantedmodules="glib-2.0 gobject-2.0 gtk+-2.0 fontconfig"

AC_ARG_WITH(pcre,
	AS_HELP_STRING([--with-pcre], 
		       [enable use of Perl Compatible Regular Expressions, *warning* this may break your existing regular expressions]),
	use_pcre=$withval, use_pcre=no)
if test "x$use_pcre" != "xno"; then
	PKG_CHECK_MODULES(PCRE, [libpcre], [
		AC_DEFINE(USE_PCRE, 1, [Enable use of PCRE])
		use_pcre="yes"
	],[ 
		if test "x$use_pcre" = "xyes"; then
			AC_MSG_ERROR([PCRE not found])
		else
			use_pcre="no - not found"
		fi
	])
fi

AC_ARG_ENABLE(deprecation,
	      [AS_HELP_STRING([--enable-deprecation],
			      [prohibit VTE from using deprecated GLib/Pango/GDK/GTK+ features])
	      ],
	      usedeprecation=$enableval, usedeprecation=no)
if test "x$usedeprecation" = "xyes" ; then
	AC_DEFINE(G_DISABLE_DEPRECATED, 1, [Disable deprecated GLib features.])
	AC_DEFINE(GDK_DISABLE_DEPRECATED, 1, [Disable deprecated GDK features.])
	AC_DEFINE(GDK_PIXBUF_DISABLE_DEPRECATED, 1, [Disable deprecated gdk-pixbuf features.])
	AC_DEFINE(GTK_DISABLE_DEPRECATED, 1, [Disable deprecated GTK+ features.])
	AC_DEFINE(PANGO_DISABLE_DEPRECATED, 1, [Disable deprecated Pango features.])
fi

# Let the user specify the default terminal emulation.
AC_ARG_WITH(default-emulation,
AS_HELP_STRING(--with-default-emulation=xterm,default terminal type to be emulated),
emulation=$withval,emulation=xterm)
AC_DEFINE_UNQUOTED(VTE_DEFAULT_EMULATION,"$emulation",[The default terminal type to be emulated.])
VTE_DEFAULT_EMULATION=$emulation
AC_SUBST(VTE_DEFAULT_EMULATION)

# Miscellaneous definitions.
AC_DEFINE(VTE_UTF8_BPC,6,[Maximum number of bytes used per UTF-8 character.])
AC_DEFINE(VTE_INVALID_SOURCE,(guint)-1,[A number which can never be a valid source ID.])
AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE",[Package name.])

# Check for headers.
AC_CHECK_HEADERS(sys/select.h sys/syslimits.h sys/termios.h sys/un.h sys/wait.h stropts.h termios.h wchar.h)
AC_HEADER_TIOCGWINSZ

# Check for PTY handling functions.
AC_CHECK_FUNCS([cfmakeraw fork setsid setpgid getpgid getpt grantpt unlockpt ptsname ptsname_r tcgetattr tcsetattr])

# Pull in the right libraries for various functions which might not be
# bundled into an exploded libc.
AC_CHECK_FUNC(socket,[have_socket=1],AC_CHECK_LIB(socket,socket,[have_socket=1; LIBS="$LIBS -lsocket"]))
AC_CHECK_FUNC(socketpair,[have_socketpair=1],AC_CHECK_LIB(socket,socketpair,[have_socketpair=1; LIBS="$LIBS -lsocket"]))
AC_CHECK_FUNC(recvmsg,[have_recvmsg=1],AC_CHECK_LIB(socket,recvmsg,[have_recvmsg=1; LIBS="$LIBS -lsocket -lnsl"]))
if test x$have_socket = x1 ; then
	AC_DEFINE(HAVE_SOCKET,1,[Define if you have the socket function.])
fi
if test x$have_socketpair = x1 ; then
	AC_DEFINE(HAVE_SOCKETPAIR,1,[Define if you have the socketpair function.])
fi
if test x$have_recvmsg = x1 ; then
	AC_DEFINE(HAVE_RECVMSG,1,[Define if you have the recvmsg function.])
fi
AC_CHECK_FUNC(floor,,AC_CHECK_LIB(m,floor,LIBS=["$LIBS -lm"]))

# Look for ncurses or curses or termcap.
AC_CHECK_HEADER(ncurses.h,[AC_CHECK_HEADER(term.h,[AC_CHECK_LIB(ncurses,tgetent,[LIBS="-lncurses $LIBS";AC_DEFINE(HAVE_NCURSES,1,[Define if you have ncurses.h and libncurses])])])])
if test x$ac_cv_lib_ncurses_tgetent != xyes ; then
	AC_CHECK_HEADER(ncurses/curses.h,[AC_CHECK_HEADER(ncurses/term.h,[AC_CHECK_LIB(ncurses,tgetent,[LIBS="-lncurses $LIBS";AC_DEFINE(HAVE_NCURSES_CURSES,1,[Define if you have ncurses/curses.h and libncurses])])])])
	if test x$ac_cv_lib_ncurses_tgetent != xyes ; then
		AC_CHECK_HEADER(curses.h,[AC_CHECK_HEADER(term.h,[AC_CHECK_LIB(curses,tgetent,[LIBS="-lcurses $LIBS";AC_DEFINE(HAVE_CURSES,1,[Define if you have curses.h and libcurses])])])])
		if test x$ac_cv_lib_curses_tgetent != xyes ; then
			AC_CHECK_HEADER(termcap.h,[AC_CHECK_LIB(termcap,tgetent,[LIBS="-ltermcap $LIBS";AC_DEFINE(HAVE_TERMCAP,1,[Define if you have termcap.h and libtermcap])])])
			if test x$ac_cv_header_termcap_h != xyes ; then
				AC_MSG_ERROR([You must have at least one of ncurses, curses, or libtermcap installed to build vte.])
			fi
		fi
	fi
fi


################################################################################
# Backends
################################################################################

# Use Xft2 if Pango has Xft2 support and it isn't disabled.
if test "x$have_x" = "xyes" ; then
	AC_ARG_WITH(xft2,
		    [AS_HELP_STRING([--with-xft2],
				    [enable drawing using Xft2])
		    ], with_xft2=$withval, with_xft2=yes)
	if test "x$with_xft2" = "xyes" ; then
		PKG_CHECK_EXISTS([pangoxft >= 1.1.0], [
			AC_DEFINE(HAVE_XFT2,1,[Whether we have Xft2])
			wantedmodules="xft >= 2.0 $wantedmodules pangoxft >= 1.1.0"
			],[
			AC_MSG_WARN([Xft2 not detected])
			with_xft2="no - not detected"
			])
	fi
else
	with_xft2="no - missing X Window System"
fi
AM_CONDITIONAL(BUILD_XFT, test "x$with_xft2" = "xyes")

# Use PangoX if we have it and it isn't disabled.
if test "x$usedeprecation" != "xyes" ; then
	if test "x$have_x" = "xyes" ; then
		AC_ARG_WITH(pangox,
			    [AS_HELP_STRING([--with-pangox],
					    [enable drawing using PangoX])
			    ], with_pangox=$withval, with_pangox=yes)
		if test "x$with_pangox" = "xyes" ; then
			PKG_CHECK_EXISTS(pangox, [
				AC_DEFINE(HAVE_PANGOX, 1, 
					  [Whether we have PangoX])
				wantedmodules="$wantedmodules pangox"
				],[
				AC_MSG_WARN([PangoX not detected])
				with_pangox="no - not detected"
				])
		fi
	else
		with_pangox="no - missing X Window System"
	fi
else
	with_pangox="no - deprecated"
fi
AM_CONDITIONAL(BUILD_PANGOX, test "x$with_pangox" = "xyes")

# Use glX if we have it and it isn't disabled.
if test "$have_x" = yes ; then
	AC_ARG_WITH(glX,[AS_HELP_STRING(--with-glX,enable drawing using glX)],with_glx=$withval,with_glx=no)
	if test $with_glx = yes ; then
		have_gl=0
		have_libgl=0
		AC_CHECK_HEADERS(GL/glx.h)
		if test $ac_cv_header_GL_glx_h = yes ; then
			AC_CHECK_FUNC(glXQueryExtension,[have_gl=1],AC_CHECK_LIB(GL,glXQueryExtension,[have_gl=1;have_libgl=1]))
		fi
		if test $have_gl = 1 ; then
			AC_DEFINE(HAVE_GL,1,[Whether we have GL and glX.])
		fi
		if test $have_libgl = 1 ; then
			LIBS="-lGL $LIBS"
		fi
	fi
fi

# Search for the required modules.
PKG_CHECK_MODULES(VTE,[$wantedmodules])
NEEDEDPACKAGES="$wantedmodules"
AC_SUBST(NEEDEDPACKAGES)

# Check for various optional functions within those modules
save_CFLAGS="$CFLAGS"
save_LIBS="$LIBS"
CFLAGS="$CFLAGS $VTE_CFLAGS"
LIBS="$VTE_LIBS $LIBS"
# Workaround a broken fontconfig-dev on Edgy
AC_COMPILE_IFELSE([
#include <fontconfig/fontconfig.h>
int main(void)
{
	FcStrFree (FcNameUnparse (0));
	return 0;
}
], [AC_CHECK_FUNCS([FcNameUnparse FcStrFree])],)
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"

# Require Freetype2. First see if there is suitable pkgconfig file...
PKG_CHECK_EXISTS(freetype2 >= 6.1.0,
		 [PKG_CHECK_MODULES(FT2, freetype2)], [
	# We use our local copy of the macro because packages of
	# freetype's development files don't always include the proper macro.
	VTE_CHECK_FT2(6.1.0,,
		      [AC_MSG_ERROR([You must have freetype 2.0.2 or later to build vte.])])])

# Temporarily pull in the Freetype cflags and libs for checking what's
# available in this version.
savecflags="$CFLAGS"
CFLAGS="$CFLAGS $FT2_CFLAGS"
savecppflags="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $FT2_CFLAGS"
if test -d "$ac_x_includes" ; then
	CFLAGS="$CFLAGS -I$ac_x_includes"
	CPPFLAGS="$CPPFLAGS -I$ac_x_includes"
fi
AC_CHECK_HEADERS(ft2build.h)
if test x$ac_cv_header_ft2build_h != xyes ; then
	AC_MSG_ERROR([You must have freetype 2.0.2 or later to build vte.])
fi

AC_CHECK_DECL(ft_render_mode_mono,[AC_DEFINE(HAVE_DECL_ft_render_mode_mono,1,Define if your freetype2 installation defines ft_render_mode_mono.)],,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])

AC_CHECK_DECL(FT_RENDER_MODE_MONO,[AC_DEFINE(HAVE_DECL_FT_RENDER_MODE_MONO,1,Define if your freetype2 installation defines FT_RENDER_MODE_MONO.)],,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])

AC_CHECK_DECLS(FT_LOAD_NO_HINTING,,,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])

AC_CHECK_DECLS(FT_RENDER_MODE_LIGHT,,,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])

AC_CHECK_DECLS(FT_RENDER_MODE_NORMAL,,,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])

AC_CHECK_DECL(FT_PIXEL_MODE_MONO,[AC_DEFINE(HAVE_DECL_FT_PIXEL_MODE_MONO,1,Define if your freetype2 build declares FT_PIXEL_MODE_MONO.)],,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])
AC_CHECK_DECL(ft_pixel_mode_mono,[AC_DEFINE(HAVE_DECL_ft_pixel_mode_mono,1,Define if your freetype2 build declares ft_pixel_mode_mono.)],,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])

AC_CHECK_DECLS(FT_PIXEL_MODE_GRAY2,,,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])
AC_CHECK_DECLS(FT_PIXEL_MODE_GRAY4,,,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])

AC_CHECK_DECL(FT_PIXEL_MODE_GRAY,[AC_DEFINE(HAVE_DECL_FT_PIXEL_MODE_GRAY,1,Define if your freetype2 build declares FT_PIXEL_MODE_GRAY.)],,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])
AC_CHECK_DECL(ft_pixel_mode_grays,[AC_DEFINE(HAVE_DECL_ft_pixel_mode_grays,1,Define if your freetype2 build declares ft_pixel_mode_grays.)],,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])

AC_CHECK_DECLS(FT_PIXEL_MODE_LCD,,,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])

CFLAGS="$savecflags"
CPPFLAGS="$savecppflags"


wcs_funcs_includes="
#ifdef HAVE_STRING_H
# if !STDC_HEADERS && HAVE_MEMORY_H
#  include <memory.h>
# endif
# include <string.h>
#else
# ifdef HAVE_STRINGS_H
#  include <strings.h>
# endif
#endif
#ifdef HAVE_WCHAR_H
# include <wchar.h>
#endif
"

AC_CHECK_TYPES(wint_t, AC_DEFINE(HAVE_WINT_T, , [Defined when the wint_t type is supported]), ,$wcs_funcs_includes)


################################################################################
# Auxillary modules
################################################################################

# Search for Python.
BUILD_PYTHON=true
AC_ARG_ENABLE(python, [AS_HELP_STRING(--enable-python,Build python bindings [default=yes])],[
if test x"$enableval" != xno ; then
	BUILD_PYTHON=true
else
	BUILD_PYTHON=false
fi],BUILD_PYTHON=true)

if $BUILD_PYTHON ; then
	AM_PATH_PYTHON
	if test -z "$PYTHON" ; then
		BUILD_PYTHON=false
	fi
fi

if $BUILD_PYTHON ; then
	AC_MSG_CHECKING(for python >= 2.2)
	prog="
import sys, string
minver = (2,2,0,'final',0)
if sys.version_info < minver:
	sys.exit(1)
sys.exit(0)
"
	if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC
	then
		AC_MSG_RESULT([okay])
	else
		BUILD_PYTHON=false
		AC_MSG_RESULT([too old])
	fi
fi

if $BUILD_PYTHON ; then
	AM_CHECK_PYTHON_HEADERS(,BUILD_PYTHON=false)
fi

if $BUILD_PYTHON ; then
	AC_MSG_CHECKING([for pygtk-2.0])
	if pkg-config --exists pygtk-2.0 ; then
		AC_MSG_RESULT([found])
		PKG_CHECK_MODULES(PYGTK,[pygtk-2.0])

		AC_PATH_PROG(PYGTK_CODEGEN, pygtk-codegen-2.0, no)
		if test "x$PYGTK_CODEGEN" = xno; then
		  AC_MSG_ERROR(could not find pygtk-codegen-2.0 script)
		fi

		AC_MSG_CHECKING(for pygtk defs)
		PYGTK_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygtk-2.0`
		AC_SUBST(PYGTK_DEFSDIR)
		AC_MSG_RESULT($PYGTK_DEFSDIR)
	else
		AC_MSG_RESULT([not found])
		BUILD_PYTHON=false
	fi
fi

if ! $BUILD_PYTHON ; then
	AC_MSG_RESULT([Python bindings disabled.])
fi

AC_SUBST(PYTHONREV)
AC_SUBST(PYTHONMODULES)
AM_CONDITIONAL(BUILD_PYTHON_MODULES, $BUILD_PYTHON)

AC_ARG_ENABLE(gnome-pty-helper, [AS_HELP_STRING(--enable-gnome-pty-helper,Build a setuid helper for opening ptys [default=yes])], enable_gnome_pty_helper="$enableval", enable_gnome_pty_helper=yes)
if test "$enable_gnome_pty_helper" != no; then
	AC_DEFINE(VTE_USE_GNOME_PTY_HELPER,1,[Define if you intend to use gnome-pty-helper.])
	AC_CONFIG_SUBDIRS(gnome-pty-helper)
fi
AM_CONDITIONAL(BUILD_GNOME_PTY_HELPER,[test "$enable_gnome_pty_helper" != no])

################################################################################

GTK_DOC_CHECK([1.0])

################################################################################

AC_CONFIG_FILES([
Makefile
src/Makefile
termcaps/Makefile
python/Makefile
po/Makefile.in
doc/Makefile
doc/openi18n/Makefile
doc/reference/Makefile
vte.pc
vte-uninstalled.pc
vte.spec
])
AC_OUTPUT


#####################
# Print configuration
#####################
cat <<EOF | tee -a config.log

## -------------- ##
## Configuration. ##
## -------------- ##

Configuration for libvte $VERSION
	With XFT: $with_xft2
	With PangoX: $with_pangox
	With PCRE: $use_pcre
	Debugging: $DEBUG
	Disable deprecated features: $usedeprecation
EOF