1dnl#
2dnl# Process this file with autoconf to produce a configure script.
3dnl#
4
5AC_INIT
6AC_PREREQ(2.71)
7AC_CONFIG_SRCDIR([src/feature.h])
8AC_CONFIG_HEADERS(config.h:config.h.in)
9
10dnl RXVT version
11VERSION=`sed -n -e 's/^.* VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
12DATE=`sed -n -e 's/^.* DATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
13AC_SUBST(VERSION)dnl
14AC_SUBST(DATE)dnl
15
16echo ""
17echo "configuring for rxvt $VERSION"
18echo ""
19
20orig_CXXFLAGS="$CXXFLAGS"
21
22dnl# Checks for programs.
23AC_PROG_CC
24AC_PROG_CXX
25AC_PROG_INSTALL
26
27AC_USE_SYSTEM_EXTENSIONS
28AC_LANG(C++)
29
30LINKER="$CXX"
31dnl check whether we can link with gcc -lsupc++
32if test x$GCC = xyes && test x$GXX = xyes; then
33   dnl FreeBSD (at least up to 5.3) has a broken GCC, workaround it
34   AC_MSG_CHECKING([for working libsupc++])
35   save_CXX="$CXX"
36   save_LIBS="$LIBS"
37   CXX="$CC"
38   LIBS="$LIBS -lsupc++"
39   AC_LINK_IFELSE(
40      [AC_LANG_PROGRAM([struct test { }; void f() try { throw new test; } catch (...) { throw; }],[])],
41      [AC_MSG_RESULT(ok)
42       LINKER="$CC"],
43      [
44         AC_MSG_RESULT([no, making everything bigger and slower])
45         LIBS="$save_LIBS"
46      ]
47   )
48   CXX="$save_CXX"
49fi
50AC_SUBST(LINKER,[$LINKER])
51
52dnl# --------------------------------------------------------------------------
53dnl# Supply default CXXFLAGS, if not specified by `CXXFLAGS=flags ./configure'
54dnl#
55if test -z "$orig_CXXFLAGS"; then
56  if test x$GCC = xyes && test "x$GXX" = xyes; then
57    CXXFLAGS="-g -O3 -fno-rtti -fvisibility-inlines-hidden -fno-threadsafe-statics -fno-enforce-eh-specs"
58    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], [], [CXXFLAGS="-g -O3"])
59  else
60    CXXFLAGS="-O"
61  fi
62  CFLAGS="$CXXFLAGS"
63fi
64
65dnl# FreeBSD needs to link libxpg4
66AC_SEARCH_LIBS(setlocale,     xpg4)
67
68dnl# solaris needs to link libnsl and socket
69AC_SEARCH_LIBS(gethostbyname, nsl)
70AC_SEARCH_LIBS(socket,        socket)
71
72support_frills=yes
73support_inheritpixmap=yes
74support_fading=yes
75support_keepscrolling=yes
76support_selectionscrolling=yes
77support_mousewheel=yes
78support_mouseslipwheel=yes
79support_text_blink=yes
80support_pointer_blank=yes
81support_scroll_rxvt=yes
82support_scroll_next=yes
83support_scroll_xterm=yes
84support_xim=yes
85support_pixbuf=yes
86support_startup_notification=yes
87support_xft=yes
88support_unicode3=no
89support_combining=yes
90support_8bitctrls=no
91support_iso14755=yes
92support_styles=yes
93support_perl=yes
94codesets=all
95
96dnl# --------------------------------------------------------------------------
97dnl# CHECKING COMMAND LINE OPTIONS
98dnl# --------------------------------------------------------------------------
99
100AC_ARG_ENABLE(everything,
101  [  --enable-everything     enable standard non-multichoice features
102                          NOTE: this option is order dependent],
103  [
104    if test x$enableval = xno; then
105       support_frills=no
106       support_inheritpixmap=no
107       support_fading=no
108       support_keepscrolling=no
109       support_selectionscrolling=no
110       support_mousewheel=no
111       support_mouseslipwheel=no
112       support_text_blink=no
113       support_pointer_blank=no
114       support_scroll_rxvt=no
115       support_scroll_next=no
116       support_scroll_xterm=no
117       support_xim=no
118       support_pixbuf=no
119       support_startup_notification=no
120       support_xft=no
121       support_unicode3=no
122       support_combining=no
123       support_8bitctrls=no
124       support_iso14755=no
125       support_styles=no
126       support_perl=no
127       codesets=
128    fi
129    if test x$enableval = xyes; then
130       support_frills=yes
131       support_inheritpixmap=yes
132       support_fading=yes
133       support_keepscrolling=yes
134       support_selectionscrolling=yes
135       support_mousewheel=yes
136       support_mouseslipwheel=yes
137       support_text_blink=yes
138       support_pointer_blank=yes
139       support_scroll_rxvt=yes
140       support_scroll_next=yes
141       support_scroll_xterm=yes
142       support_xim=yes
143       support_pixbuf=yes
144       support_startup_notification=yes
145       support_xft=yes
146       support_unicode3=yes
147       support_combining=yes
148       #support_8bitctrls=yes
149       support_iso14755=yes
150       support_styles=yes
151       support_perl=yes
152       codesets=all
153    fi
154  ])
155
156support_assertions=no
157AC_ARG_ENABLE(assert,
158  [  --enable-assert         enable assertions],
159  [if test x$enableval = xyes; then
160    support_assertions=yes
161  fi])
162if test x$support_assertions = xno; then
163  AC_DEFINE(NDEBUG, 1, Disable assertions (good for debugging))
164fi
165
166support_warnings=no
167AC_ARG_ENABLE(warnings,
168  [  --enable-warnings       turn on g++ warnings],
169  [if test x$enableval = xyes; then
170    support_warnings=yes
171  fi])
172if test x$GXX = xyes; then
173  if test $support_warnings = yes; then
174    save_CXXFLAGS="$CXXFLAGS"
175    for warning in \
176      -Wall \
177      -Wno-parentheses \
178      -Wno-reorder \
179      -Wno-sign-compare \
180      -Wno-unused-value \
181      ; do
182      CXXFLAGS="$CXXFLAGS $warning"
183    done
184    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], [], [CXXFLAGS="$save_CXXFLAGS"])
185  else
186    CXXFLAGS="$CXXFLAGS -w"
187  fi
188fi
189
190support_256_color=no
191AC_ARG_ENABLE(256-color,
192  [  --enable-256-color      enable 256-color support],
193  [if test x$enableval = xyes; then
194    support_256_color=yes
195  fi])
196if test x$support_256_color = xyes; then
197  AC_DEFINE(USE_256_COLORS, 1, Define if you want 256-color support)
198fi
199
200AC_ARG_ENABLE(unicode3,
201  [  --enable-unicode3       use 21 instead of 16 bits to represent unicode characters],
202  [if test x$enableval = xyes -o x$enableval = xno; then
203    support_unicode3=$enableval
204  fi])
205
206AC_ARG_ENABLE(combining,
207  [  --enable-combining      enable composition of base and combining characters],
208  [if test x$enableval = xyes -o x$enableval = xno; then
209    support_combining=$enableval
210  fi])
211
212AC_ARG_ENABLE(xft,
213  [  --enable-xft            enable xft support on systems that have it],
214  [if test x$enableval = xyes -o x$enableval = xno; then
215    support_xft=$enableval
216  fi])
217
218AC_ARG_ENABLE(font-styles,
219  [  --enable-font-styles    enable bold and italic support],
220  [if test x$enableval = xyes -o x$enableval = xno; then
221    support_styles=$enableval
222  fi])
223
224AC_ARG_ENABLE(pixbuf,
225  [  --enable-pixbuf         enable integration with gdk-pixbuf for background images],
226  [if test x$enableval = xyes -o x$enableval = xno; then
227    support_pixbuf=$enableval
228  fi])
229
230AC_ARG_ENABLE(startup-notification,
231  [  --enable-startup-notification  enable freedesktop startup notification support],
232  [if test x$enableval = xyes -o x$enableval = xno; then
233    support_startup_notification=$enableval
234  fi])
235
236AC_ARG_ENABLE(transparency,
237  [  --enable-transparency   enable transparent backgrounds],
238  [if test x$enableval = xyes -o x$enableval = xno; then
239    support_inheritpixmap=$enableval
240  fi])
241
242AC_ARG_ENABLE(fading,
243  [  --enable-fading         enable colors fading when off focus],
244  [if test x$enableval = xyes -o x$enableval = xno; then
245    support_fading=$enableval
246  fi])
247
248AC_ARG_ENABLE(rxvt-scroll,
249  [  --enable-rxvt-scroll    enable rxvt style scrollbar],
250  [if test x$enableval = xyes -o x$enableval = xno; then
251    support_scroll_rxvt=$enableval
252  fi])
253
254AC_ARG_ENABLE(next-scroll,
255  [  --enable-next-scroll    enable NeXT style scrollbar],
256  [if test x$enableval = xyes -o x$enableval = xno; then
257    support_scroll_next=$enableval
258  fi])
259
260AC_ARG_ENABLE(xterm-scroll,
261  [  --enable-xterm-scroll   enable Xterm style scrollbar],
262  [if test x$enableval = xyes -o x$enableval = xno; then
263    support_scroll_xterm=$enableval
264  fi])
265
266AC_ARG_ENABLE(perl,
267  [  --enable-perl           enable embedded perl interpreter],
268  [if test x$enableval = xyes -o x$enableval = xno; then
269    support_perl=$enableval
270  fi])
271
272AC_ARG_WITH(codesets,
273  [  --with-codesets=CS,...  compile in additional codesets (jp,jp_ext,kr,zh,zh_ext,all)],
274  [codesets="$withval"])
275
276AC_ARG_ENABLE(xim,
277  [  --enable-xim            XIM (X Input Method) protocol support],
278  [if test x$enableval = xyes -o x$enableval = xno; then
279    support_xim=$enableval
280  fi])
281
282AC_ARG_ENABLE(backspace-key,
283  [  --disable-backspace-key disable handling of the backspace key],
284  [if test x$enableval = xno; then
285    AC_DEFINE(NO_BACKSPACE_KEY, 1, Define if you don't want support for the backspace key)
286  fi])
287
288AC_ARG_ENABLE(delete-key,
289  [  --disable-delete-key    disable handling of the delete key],
290  [if test x$enableval = xno; then
291    AC_DEFINE(NO_DELETE_KEY, 1, Define if you don't want support for the (non-keypad) delete key)
292  fi])
293
294support_resources=yes
295AC_ARG_ENABLE(resources,
296  [  --disable-resources     disable all resource checking],
297  [if test x$enableval = xno; then
298    support_resources=no
299  fi])
300
301AC_ARG_ENABLE(8bitctrls,
302  [  --enable-8bitctrls      enable 8 bit control sequences (not recommended)],
303  [if test x$enableval = xyes -o x$enableval = xno; then
304    support_8bitctrls=$enableval
305  fi])
306
307RESFALLBACK=Rxvt
308AC_ARG_ENABLE(fallback,
309  [  --enable-fallback@<:@=CLASS@:>@ fall back on CLASS resources in addition to URxvt ones (default: Rxvt)],
310  [
311   test x$enableval = xyes && enableval=Rxvt
312   test x$enableval = xno  && enableval=
313   RESFALLBACK="$enableval"
314  ])
315
316if test x$RESFALLBACK != x; then
317   AC_DEFINE_UNQUOTED(RESFALLBACK, "$RESFALLBACK", [Fallback resource class])
318fi
319
320RESNAME=urxvt
321AC_ARG_WITH(res-name,
322  [  --with-res-name=NAME    use this as default resource name (default: urxvt)],
323  [RESNAME="$withval"])
324AC_DEFINE_UNQUOTED(RESNAME,"$RESNAME", [Default resource name])
325
326RESCLASS=URxvt
327AC_ARG_WITH(res-class,
328  [  --with-res-class=CLASS  use this as the resource class (default: URxvt)],
329  [RESCLASS="$withval"])
330AC_DEFINE_UNQUOTED(RESCLASS,"$RESCLASS", [Resource class])
331
332RXVTNAME=urxvt
333AC_ARG_WITH(name,
334  [  --with-name=NAME        set the basename for the installed binaries (default: urxvt)],
335  [RXVTNAME="$withval"])
336AC_DEFINE_UNQUOTED(RXVTNAME,"$RXVTNAME", [Binary base name])
337
338AC_SUBST(RXVTNAME)
339
340AC_ARG_ENABLE(swapscreen,
341  [  --disable-swapscreen    disable swap screen support],
342  [if test x$enableval = xno; then
343    AC_DEFINE(NO_SECONDARY_SCREEN, 1, Disable the secondary screen. Many programs use the secondary screen as their workplace)
344  fi])
345
346AC_ARG_ENABLE(iso14755,
347  [  --enable-iso14755       enable support for extended ISO 14755 modes],
348  [if test x$enableval = xyes -o x$enableval = xno; then
349    support_iso14755=$enableval
350  fi])
351
352AC_ARG_ENABLE(frills,
353  [  --enable-frills         enable support for rarely used features],
354  [if test x$enableval = xyes -o x$enableval = xno; then
355    support_frills=$enableval
356  fi])
357
358AC_ARG_ENABLE(keepscrolling,
359  [  --enable-keepscrolling  enable continual scrolling on scrollbar arrow press],
360  [if test x$enableval = xyes -o x$enableval = xno; then
361    support_keepscrolling=$enableval
362  fi])
363
364AC_ARG_ENABLE(selectionscrolling,
365  [  --enable-selectionscrolling  enable scrolling during selections],
366  [if test x$enableval = xyes -o x$enableval = xno; then
367    support_selectionscrolling=$enableval
368  fi])
369
370AC_ARG_ENABLE(mousewheel,
371  [  --enable-mousewheel     enable scrolling via mouse wheel or buttons 4 & 5],
372  [if test x$enableval = xyes -o x$enableval = xno; then
373    support_mousewheel=$enableval
374  fi])
375
376AC_ARG_ENABLE(slipwheeling,
377  [  --enable-slipwheeling   enable slip wheel scrolling (requires --enable-mousewheel)],
378  [if test x$enableval = xyes -o x$enableval = xno; then
379    support_mouseslipwheel=$enableval
380  fi])
381
382AC_ARG_ENABLE(smart-resize,
383  [  --enable-smart-resize   enable smart growth/shrink behaviour],
384  [if test x$enableval = xyes; then
385    AC_DEFINE(SMART_RESIZE, 1, Define to use "smart" resize behavior)
386  fi])
387
388AC_ARG_ENABLE(text-blink,
389  [  --enable-text-blink     enable blinking text],
390  [if test x$enableval = xyes -o x$enableval = xno; then
391    support_text_blink=$enableval
392  fi])
393
394AC_ARG_ENABLE(pointer-blank,
395  [  --enable-pointer-blank  enable pointer blanking when typing or inactive],
396  [if test x$enableval = xyes -o x$enableval = xno; then
397    support_pointer_blank=$enableval
398  fi])
399
400AC_ARG_WITH(term,
401  [  --with-term=NAME        set the terminal to NAME (default: rxvt)],
402  [if test x$withval != x; then
403    AC_DEFINE_UNQUOTED(TERMENV, "$withval",Set TERM to the value given by configure) term="$withval"
404  fi])
405
406AC_ARG_WITH(terminfo,
407  [  --with-terminfo=PATH    set the path to the terminfo tree to PATH],
408  [if test x$withval != x; then
409    AC_DEFINE_UNQUOTED(RXVT_TERMINFO, "$withval", Set TERMINFO value to the value given by configure) terminfo="$withval"
410  fi])
411
412if test x$support_resources = xno; then
413  if test x$support_frills = xyes || test x$support_perl = xyes; then
414    AC_MSG_ERROR([--disable-resources requires --disable-frills --disable-perl])
415  fi
416
417  AC_DEFINE(NO_RESOURCES, 1, Define if you don't want any resources read)
418fi
419
420dnl# --------------------------------------------------------------------------
421
422LIBEV_M4_AVOID_LIBRT=1
423m4_include([libev/libev.m4])
424
425dnl# --------------------------------------------------------------------------
426
427AC_PATH_PROG(TIC, tic, :)
428
429AC_PATH_XTRA
430
431AC_PATH_TOOL(PKG_CONFIG, pkg-config, no)
432
433RXVT_CHECK_MODULES([PTYTTY], [libptytty], [:], [
434  AC_MSG_ERROR([unable to find libptytty])
435])
436
437AC_SUBST(PTYTTY_CFLAGS)
438AC_SUBST(PTYTTY_LIBS)
439
440image_lib=none
441
442PIXBUF_CFLAGS=
443PIXBUF_LIBS=
444
445if test x$support_pixbuf = xyes; then
446  RXVT_CHECK_MODULES([PIXBUF], [gdk-pixbuf-2.0], [
447    image_lib=gdk-pixbuf
448    AC_DEFINE(HAVE_PIXBUF, 1, Define if you want to use gdk-pixbuf for image processing)
449  ], [:])
450fi
451
452AC_SUBST(PIXBUF_CFLAGS)
453AC_SUBST(PIXBUF_LIBS)
454
455STARTUP_NOTIFICATION_CFLAGS=
456STARTUP_NOTIFICATION_LIBS=
457
458if test x$support_startup_notification = xyes; then
459  RXVT_CHECK_MODULES([STARTUP_NOTIFICATION], [libstartup-notification-1.0], [
460    AC_DEFINE(HAVE_STARTUP_NOTIFICATION, 1, Define if freedesktop startup notifications should be supported)
461  ], [:])
462fi
463
464AC_SUBST(STARTUP_NOTIFICATION_CFLAGS)
465AC_SUBST(STARTUP_NOTIFICATION_LIBS)
466
467if test x$support_frills = xyes; then
468  RXVT_CHECK_MODULES([XMU], [xmu], [
469    X_LIBS="$XMU_LIBS $X_LIBS"
470    CPPFLAGS="$CPPFLAGS $XMU_CFLAGS"
471    AC_DEFINE(HAVE_XMU, 1, Define to enable Xmu support)
472  ], [:])
473fi
474
475dnl# --------------------------------------------------------------------------
476dnl# CHECKING FOR HEADER FILES
477dnl# --------------------------------------------------------------------------
478AC_CHECK_HEADERS( \
479	sys/byteorder.h \
480	sys/ioctl.h \
481	sys/sockio.h \
482	sys/strredir.h \
483	stdint.h \
484	wchar.h \
485)
486
487AC_CACHE_CHECK([for XLIB_ILLEGAL_ACCESS], rxvt_cv_xlib_illegal_access,
488[AC_COMPILE_IFELSE(
489   [AC_LANG_PROGRAM([
490#define XLIB_ILLEGAL_ACCESS
491#include <X11/Xlib.h>
492   ],[
493      Display *dpy;
494      dpy->xdefaults = (char *)0;
495   ])],
496   [rxvt_cv_xlib_illegal_access=yes],[rxvt_cv_xlib_illegal_access=no]
497)])
498if test x$rxvt_cv_xlib_illegal_access = xyes; then
499   AC_DEFINE(XLIB_ILLEGAL_ACCESS, 1, Define ONLY iff Xlib.h supports it)
500fi
501
502dnl# --------------------------------------------------------------------------
503dnl# CHECKING FOR MISSING TYPEDEFS
504dnl# --------------------------------------------------------------------------
505dnl# Missing typedefs and replacements
506AC_TYPE_MODE_T
507AC_TYPE_PID_T
508AC_TYPE_UID_T
509AC_TYPE_INT16_T
510AC_TYPE_UINT16_T
511AC_TYPE_INT32_T
512AC_TYPE_UINT32_T
513
514dnl# --------------------------------------------------------------------------
515dnl# CHECKING FOR LIBRARY FUNCTIONS
516dnl# --------------------------------------------------------------------------
517AC_CHECK_FUNCS(unsetenv)
518
519dnl# --------------------------------------------------------------------------
520
521dnl# --------------------------------------------------------------------------
522dnl# --------------------------------------------------------------------------
523
524dnl# this is a really hack test for some basic Xlocale stuff
525save_LIBS=$LIBS
526save_CXXFLAGS=$CXXFLAGS
527CXXFLAGS="$CXXFLAGS $X_CFLAGS"
528LIBS="$LIBS $X_LIBS $X_EXTRA_LIBS -lX11"
529if test x$support_xim = xyes; then
530  AC_CACHE_CHECK(for working Xlocale, rxvt_cv_func_xlocale,
531  [AC_RUN_IFELSE([AC_LANG_SOURCE([[
532  #include <X11/Xlib.h>
533  #include <stdlib.h>
534  int main() {
535    char *p;
536    if ((p = XSetLocaleModifiers("@im=none")) != NULL && *p)
537      exit (XSupportsLocale() ? 0 : 1);
538    else
539      exit (1);
540  }
541  ]])],[rxvt_cv_func_xlocale=yes],[rxvt_cv_func_xlocale=no],[:])])
542  if test x$rxvt_cv_func_xlocale = xyes; then
543    AC_DEFINE(USE_XIM, 1, Define if you want to have XIM (X Input Method) protocol support - required for multibyte characters input)
544    AC_CACHE_CHECK(for broken XIM callback, rxvt_cv_broken_ximcb,
545    [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
546    #include <X11/Xlib.h>
547
548    void im_destroy_cb (XIC unused1, XPointer client_data, XPointer unused3);
549
550    void f() {
551      XIMCallback cb;
552      cb.callback = im_destroy_cb;
553    }
554    ]])],rxvt_cv_broken_ximcb=yes,rxvt_cv_broken_ximcb=no)])
555
556    if test x$rxvt_cv_broken_ximcb = xyes; then
557       AC_DEFINE(XIMCB_PROTO_BROKEN, 1, Define if your XIMCallback specifies XIC as first type.)
558    fi
559  fi
560fi
561
562AC_CACHE_CHECK(for working X setlocale, rxvt_cv_func_xsetlocale,
563[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define X_LOCALE 1
564#include <X11/Xlocale.h>]], [[setlocale(LC_CTYPE, "");]])],[rxvt_cv_func_xsetlocale=yes],[rxvt_cv_func_xsetlocale=no])])
565if test x$rxvt_cv_func_xsetlocale = xyes; then
566  AC_DEFINE(HAVE_XSETLOCALE, 1, Define if setlocale (defined to Xsetlocale) works)
567fi
568LIBS=$save_LIBS
569CXXFLAGS=$save_CXXFLAGS
570
571AC_CACHE_CHECK(for working nl_langinfo, rxvt_cv_func_nl_langinfo,
572[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]], [[nl_langinfo(CODESET);]])],[rxvt_cv_func_nl_langinfo=yes],[rxvt_cv_func_nl_langinfo=no])])
573if test x$rxvt_cv_func_nl_langinfo = xyes; then
574  AC_DEFINE(HAVE_NL_LANGINFO, 1, Define if nl_langinfo(CODESET) works)
575fi
576
577dnl# --------------------------------------------------------------------------
578dnl# now add and remove other stuff
579dnl# --------------------------------------------------------------------------
580support_image=no
581if test x$support_inheritpixmap = xyes || test x$support_pixbuf = xyes; then
582  support_image=yes
583fi
584if test x$support_xft = xyes || test x$support_image = xyes; then
585  rxvt_have_xrender=no
586  RXVT_CHECK_MODULES([XRENDER], [xrender], [
587    X_LIBS="$XRENDER_LIBS $X_LIBS"
588    CPPFLAGS="$CPPFLAGS $XRENDER_CFLAGS"
589    rxvt_have_xrender=yes
590
591    save_LIBS="$LIBS"
592    LIBS="$LIBS $X_LIBS"
593    AC_CHECK_HEADER(X11/extensions/Xrender.h,,[rxvt_have_xrender=no])
594    AC_CHECK_FUNC(XRenderFindStandardFormat,,[rxvt_have_xrender=no])
595    LIBS="$save_LIBS"
596  ], [:])
597fi
598
599if test x$support_xft = xyes && test x$rxvt_have_xrender = xyes; then
600  RXVT_CHECK_MODULES([XFT], [fontconfig xft], [
601    X_LIBS="$XFT_LIBS $X_LIBS"
602    CPPFLAGS="$CPPFLAGS $XFT_CFLAGS"
603  ], [
604    AC_PATH_PROG(XFT_CONFIG, xft-config, no)
605    if test $XFT_CONFIG != no; then
606      X_LIBS="`$XFT_CONFIG --libs` $X_LIBS"
607      CPPFLAGS="$CPPFLAGS `$XFT_CONFIG --cflags`"
608    fi
609  ])
610
611  save_LIBS="$LIBS"
612  LIBS="$LIBS $X_LIBS"
613  AC_CHECK_HEADERS(X11/Xft/Xft.h fontconfig/fontconfig.h,,[support_xft=no])
614  AC_CHECK_FUNCS(XftDrawString32 FcPatternGet,,[support_xft=no])
615  LIBS="$save_LIBS"
616
617  if test x$support_xft = xyes; then
618    AC_DEFINE(XFT, 1, Define to enable xft support)
619  fi
620fi
621
622if test x$support_image = xyes && test x$rxvt_have_xrender = xyes; then
623  AC_MSG_CHECKING(for Render >= 0.11)
624  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
625#include <X11/extensions/Xrender.h>
626#if RENDER_MAJOR == 0 && RENDER_MINOR <= 10
627error
628#endif
629]])],[],[support_image=no])
630  if test x$support_image = xyes; then
631    AC_MSG_RESULT(ok)
632    LIBS="$LIBS -lm"
633    AC_DEFINE(XRENDER, 1, Define to enable xrender support)
634
635    if test x$support_inheritpixmap = xyes; then
636      AC_DEFINE(ENABLE_TRANSPARENCY, 1, Define if you want your background to use the parent window background)
637    fi
638  else
639    AC_MSG_RESULT(no)
640  fi
641fi
642
643if test x$support_styles = xyes; then
644  AC_DEFINE(ENABLE_STYLES, 1, Define if you want bold and italic support)
645fi
646if test x$support_iso14755 = xyes; then
647  AC_DEFINE(ISO_14755, 1, Define if you want ISO 14755 extended support)
648fi
649if test x$support_8bitctrls = xyes; then
650  AC_DEFINE(EIGHT_BIT_CONTROLS, 1, Define if you want 8 bit control sequences)
651fi
652if test x$support_fading = xyes; then
653  AC_DEFINE(OFF_FOCUS_FADING, 1, Define if you want faded colors when focus is lost)
654fi
655if test x$support_keepscrolling = xno; then
656  AC_DEFINE(NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING, 1, Define for continual scrolling when you keep the scrollbar button pressed)
657fi
658if test x$support_selectionscrolling = xyes; then
659  AC_DEFINE(SELECTION_SCROLLING, 1, Define to allow scrolling when the selection moves to the top or bottom of the screen)
660fi
661if test x$support_frills = xyes; then
662  AC_DEFINE(ENABLE_FRILLS, 1, Define if you want handling for rarely used but handy features)
663fi
664if test x$support_mousewheel = xyes; then
665  AC_DEFINE(MOUSE_WHEEL, 1, Define to use wheel events (button4 and button5) to scroll)
666fi
667if test x$support_mouseslipwheel = xyes; then
668  AC_DEFINE(MOUSE_SLIP_WHEELING, 1, Define to have CTRL cause wheel events to accelerate scrolling. Release CTRL to halt scrolling)
669fi
670
671scrolltypes=plain
672AC_DEFINE(PLAIN_SCROLLBAR, 1, Support plain style scrollbars)
673
674if test x$support_scroll_rxvt = xyes; then
675  AC_DEFINE(RXVT_SCROLLBAR, 1, Support Rxvt original style scrollbars)
676  scrolltypes="$scrolltypes rxvt"
677fi
678if test x$support_scroll_next = xyes; then
679  AC_DEFINE(NEXT_SCROLLBAR, 1, Support NeXT style scrollbars)
680  scrolltypes="$scrolltypes next"
681fi
682if test x$support_scroll_xterm = xyes; then
683  AC_DEFINE(XTERM_SCROLLBAR, 1, Support Xterm style scrollbars)
684  scrolltypes="$scrolltypes xterm"
685fi
686if test x$support_pointer_blank = xyes; then
687  AC_DEFINE(POINTER_BLANK, 1, Define if you want to hide the pointer while typing)
688fi
689if test x$support_text_blink = xyes; then
690  AC_DEFINE(TEXT_BLINK, 1, Define if you want blinking text support)
691fi
692if test x$support_unicode3 = xyes; then
693  AC_DEFINE(UNICODE_3, 1, Define if you want to represent unicode characters outside plane 0)
694fi
695if test x$support_combining = xyes; then
696  AC_DEFINE(ENABLE_COMBINING, 1, Define if you want to automatically compose combining characters)
697fi
698if test x$codesets = xall; then
699  codesets=jp,jp-ext,kr,zh,zh-ext
700fi
701AC_DEFINE(ENCODING_EU, 1, Define if you want european extended codesets)
702AC_DEFINE(ENCODING_VN, 1, Define if you want vietnamese codesets)
703for codeset in `echo $codesets | tr "[a-z,\\-]" "[A-Z _]"`; do
704  case "$codeset" in
705    JP     ) AC_DEFINE(ENCODING_JP,     1, Define if you want japanese codesets) ;;
706    JP_EXT ) AC_DEFINE(ENCODING_JP_EXT, 1, Define if you want extended japanese codesets) ;;
707    KR     ) AC_DEFINE(ENCODING_KR,     1, Define if you want korean codesets) ;;
708    ZH     ) AC_DEFINE(ENCODING_ZH,     1, Define if you want chinese codesets) ;;
709    ZH_EXT ) AC_DEFINE(ENCODING_ZH_EXT, 1, Define if you want extended chinese codesets) ;;
710  esac
711done
712
713IF_PERL=\#
714if test x$support_perl = xyes; then
715  AC_PATH_PROG(PERL, perl5, perl)
716
717  AC_MSG_CHECKING(for $PERL suitability)
718  if $PERL -MExtUtils::Embed -e "use v5.8" >/dev/null 2>/dev/null; then
719
720     save_CXXFLAGS="$CXXFLAGS"
721     save_LIBS="$LIBS"
722     CXXFLAGS="$CXXFLAGS `$PERL -MExtUtils::Embed -e ccopts`"
723     LIBS="$LIBS `$PERL -MExtUtils::Embed -e ldopts`"
724     AC_LINK_IFELSE([AC_LANG_PROGRAM([[
725#include <EXTERN.h>
726#include <perl.h>
727#include <XSUB.h>
728]], [[
729     PerlInterpreter *perl = perl_alloc ();
730]])],[rxvt_perl_link=yes],[rxvt_perl_link=no])
731     CXXFLAGS="$save_CXXFLAGS"
732     LIBS="$save_LIBS"
733
734     if test x$rxvt_perl_link = xyes; then
735        AC_MSG_RESULT(ok)
736        AC_DEFINE(ENABLE_PERL, 1, Define if you can embed a perl interpreter)
737        IF_PERL=
738        PERL_O=rxvtperl.o
739        PERLFLAGS="`$PERL -MExtUtils::Embed -e ccopts`"
740        PERLLIB="`$PERL -MExtUtils::Embed -e ldopts`"
741        PERLPRIVLIBEXP="`$PERL -MConfig -e 'print $Config{privlibexp}'`"
742     else
743        AC_MSG_ERROR([no, unable to link])
744     fi
745  else
746     AC_MSG_ERROR([no working perl found, or perl not version >= 5.8])
747  fi
748fi
749AC_SUBST(PERLLIB)
750AC_SUBST(PERLFLAGS)
751AC_SUBST(PERLPRIVLIBEXP)
752AC_SUBST(PERL)
753AC_SUBST(IF_PERL)
754AC_SUBST(PERL_O)
755
756
757AC_CONFIG_FILES([Makefile \
758doc/Makefile \
759src/Makefile \
760])
761AC_OUTPUT
762
763echo "Configuration:
764
765  Rxvt version:               $VERSION : $DATE
766  Source code location:       $srcdir
767  Install path:               ${prefix}/bin
768  Compiler:                   $CXX
769  Compiler flags:             $CXXFLAGS
770  Linker:                     $LINKER"
771
772if test x$term != x; then
773  echo "  set TERM to:                $term"
774fi
775if test x$terminfo != x; then
776  echo "  set TERMINFO to:            $terminfo"
777fi
778echo "  default resource name:      $RESNAME"
779echo "  resource class:             $RESCLASS"
780if test x$RESFALLBACK != x; then
781   echo "  resource class fallback:    $RESFALLBACK"
782fi
783echo
784echo "  embedded perl:              $support_perl"
785echo "  image library:              $image_lib"
786echo
787if test x$support_xim = xyes -a x$rxvt_cv_func_xlocale = xno; then
788  echo ".----------------------------------------------------------------."
789  echo ". WARNING: --enable-xim was specified however the locale support ."
790  echo ".          functions could not be found.                         ."
791  echo ".          XIM is now being DISABLED!                            ."
792  echo ".----------------------------------------------------------------."
793fi
794
795echo "*** Optionally check src/feature.h for further, rarely used options ***"
796echo
797
798