1dnl# -*- sh -*-
2dnl#
3dnl# $Id: configure.in,v 1.126 2003/03/07 02:32:17 gcw Exp $
4dnl#
5dnl# Process this file with autoconf to produce a configure script.
6dnl#
7AC_INIT(src/feature.h)
8AC_CONFIG_AUX_DIR(autoconf)
9AC_CONFIG_HEADER(config.h:autoconf/config.h.in)
10
11dnl XVT version
12changequote(, )dnl
13VERSION=`sed -n -e 's/^.*[ \t]VERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
14DATE=`sed -n -e 's/^.*[ \t]DATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
15LSMDATE=`sed -n -e 's/^.*[ \t]LSMDATE.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
16LIBVERSION=`sed -n -e 's/^.*[ \t]LIBVERSION.*"\(.*\)"$/\1/p' ${srcdir}/src/version.h`
17changequote([, ])dnl
18AC_SUBST(VERSION)dnl
19AC_SUBST(DATE)dnl
20AC_SUBST(LSMDATE)dnl
21AC_SUBST(LIBVERSION)dnl
22echo ""
23echo "configuring for xvt $VERSION"
24echo ""
25
26dnl# Checks for programs.
27dnl AC_MAKE_SET
28
29AC_PROG_CC
30AC_PROG_CPP
31AC_PROG_INSTALL
32AC_PROG_AWK
33
34dnl# system hacks
35AC_AIX
36AC_ISC_POSIX
37
38AC_ENABLE_SHARED(no)dnl#	libtool
39AC_ENABLE_STATIC(yes)dnl#	libtool
40AC_PROG_LIBTOOL()dnl#		libtool
41
42MALLOC_TYPE=S
43support_addstrings=no
44support_frills=no
45support_linespace=no
46support_graphics=no
47support_inheritpixmap=no
48support_keepscrolling=no
49support_menubar=no
50support_mousewheel=no
51support_mouseslipwheel=no
52support_oldselection=no
53support_utmp=no
54support_wtmp=no
55support_lastlog=no
56support_xim=no
57support_xpm=no
58support_scroll_xvt=no
59support_scroll_next=no
60support_scroll_xterm=no
61multichar_set=no
62
63dnl# --------------------------------------------------------------------------
64dnl# CHECKING COMMAND LINE OPTIONS
65dnl# --------------------------------------------------------------------------
66
67if test "x$enable_shared" = xyes; then
68    AC_DEFINE(LIBXVT, 1, Build shared library version - specify via configure only)
69    INSTALL_LIBXVT=yes
70fi
71AC_SUBST(INSTALL_LIBXVT)
72
73AC_ARG_ENABLE(everything,
74  [  --enable-everything     enable standard non-multichoice features: marked *
75                     NOTE: this option is order dependent
76                     NOTE: automatically enabled with --enable-shared],
77  [if test x$enableval = xyes; then
78    support_24bit=yes
79    support_frills=yes
80    support_linespace=yes
81    support_graphics=yes
82    support_inheritpixmap=yes
83    support_keepscrolling=yes
84    support_lastlog=yes
85    support_menubar=yes
86    support_mousewheel=yes
87    support_mouseslipwheel=yes
88    support_oldselection=yes
89    support_scroll_xvt=yes
90    support_scroll_next=yes
91    support_scroll_xterm=yes
92    support_utmp=yes
93    support_wtmp=yes
94    support_xim=yes
95    support_xpm=yes
96  fi])
97
98AC_ARG_ENABLE(languages,
99  [  --enable-languages      enable multichar glyph language support],
100  [if test x$enableval = xyes; then
101    AC_DEFINE(MULTICHAR_SET, 1, Define to enable multichar glyph language support) multichar_set=yes
102  fi])
103
104AC_ARG_WITH(encoding,
105  [  --with-encoding=NAME    set language default encoding to NAME (default: sjis)
106                          (eucj|sjis|big5|gb|kr|noenc)],
107  [if test x$enableval = xyes; then
108    withval=`echo $withval | tr '[a-z]' '[A-Z]'`
109    AC_DEFINE_UNQUOTED(MULTICHAR_ENCODING, $withval, Define default multichar glyph encoding)
110  fi])
111
112AC_ARG_ENABLE(utmp,
113  [  --enable-utmp           enable utmp (utmpx) support                         *],
114  [if test x$enableval = xyes -o x$enableval = xno; then
115    support_utmp=$enableval
116  fi])
117
118AC_ARG_ENABLE(wtmp,
119  [  --enable-wtmp           enable wtmp (wtmpx) support (requires --enable-utmp)*],
120  [if test x$enableval = xyes -o x$enableval = xno; then
121    support_wtmp=$enableval
122  fi])
123
124AC_ARG_ENABLE(lastlog,
125  [  --enable-lastlog        enable lastlog support (requires --enable-utmp)     *],
126  [if test x$enableval = xyes -o x$enableval = xno; then
127    support_lastlog=$enableval
128  fi])
129
130AC_ARG_ENABLE(xpm-background,
131  [  --enable-xpm-background enable XPM background pixmaps                       *],
132  [if test x$enableval = xyes -o x$enableval = xno; then
133    support_xpm=$enableval
134  fi])
135
136AC_ARG_ENABLE(transparency,
137  [  --enable-transparency   enable transparent backgrounds                      *],
138  [if test x$enableval = xyes -o x$enableval = xno; then
139    support_inheritpixmap=$enableval
140  fi])
141
142AC_ARG_ENABLE(menubar,
143  [  --enable-menubar        enable menubar                                      *],
144  [if test x$enableval = xyes -o x$enableval = xno; then
145    support_menubar=$enableval
146  fi])
147
148AC_ARG_ENABLE(graphics,
149  [  --enable-graphics       enable xvt own graphics mode (see src/graphics)    *],
150  [if test x$enableval = xyes -o x$enableval = xno; then
151    support_graphics=$enableval
152  fi])
153
154AC_ARG_ENABLE(xvt-scroll,
155  [  --enable-xvt-scroll    enable xvt style scrollbar                         *],
156  [if test x$enableval = xyes; then
157    support_scroll_xvt=yes
158  fi])
159
160AC_ARG_ENABLE(next-scroll,
161  [  --enable-next-scroll    enable NeXT style scrollbar                         *],
162  [if test x$enableval = xyes; then
163    support_scroll_next=yes
164  fi])
165
166AC_ARG_ENABLE(xterm-scroll,
167  [  --enable-xterm-scroll   enable Xterm style scrollbar                        *],
168  [if test x$enableval = xyes; then
169    support_scroll_xterm=yes
170  fi])
171
172AC_ARG_ENABLE(half-shadow,
173  [  --enable-half-shadow    use half width/height shadow on xvt scrollbar],
174  [if test x$enableval = xyes; then
175    AC_DEFINE(HALFSHADOW, 1, Define if you want the depth of scrollbars and menus to be less)
176  fi])
177
178AC_ARG_ENABLE(xim,
179  [  --enable-xim            XIM (X Input Method) protocol support               *],
180  [if test x$enableval = xyes -o x$enableval = xno; then
181    support_xim=$enableval
182  fi])
183
184AC_ARG_ENABLE(greek,
185  [  --enable-greek          enable greek keyboard support],
186  [if test x$enableval = xyes; then
187    AC_DEFINE(GREEK_SUPPORT, 1, Define if you want support for Greek Elot-928 & IBM-437 keyboard)
188    OBJGRKELOT="grkelot.o"
189  fi])
190
191AC_ARG_ENABLE(ttygid,
192  [  --enable-ttygid         enable tty setting to group named "tty"],
193  [if test x$enableval = xyes; then
194    AC_DEFINE(TTY_GID_SUPPORT, 1, Define to change gid of ttys to group tty)
195  fi])
196
197AC_ARG_ENABLE(backspace-key,
198  [  --disable-backspace-key disable handling of the backspace key],
199  [if test x$enableval = xno; then
200    AC_DEFINE(NO_BACKSPACE_KEY, 1, Define if you don't want support for the backspace key)
201  fi])
202
203AC_ARG_ENABLE(delete-key,
204  [  --disable-delete-key    disable handling of the delete key],
205  [if test x$enableval = xno; then
206    AC_DEFINE(NO_DELETE_KEY, 1, Define if you don't want support for the (non-keypad) delete key)
207  fi])
208
209AC_ARG_ENABLE(resources,
210  [  --disable-resources     disable all resource checking],
211  [if test x$enableval = xno; then
212    AC_DEFINE(NO_RESOURCES, 1, Define if you don't want any resources read)
213  fi])
214
215AC_ARG_ENABLE(xgetdefault,
216  [  --enable-xgetdefault    enable resources via X instead of our small version],
217  [if test x$enableval = xyes; then
218    AC_DEFINE(USE_XGETDEFAULT, 1, Define if you want to use XGetDefault instead of our internal version)
219  fi])
220
221AC_ARG_ENABLE(strings,
222  [  --enable-strings        enable some replacement system functions],
223  [if test x$enableval = xyes -o x$enableval = xno; then
224    support_addstrings=$enableval
225  fi])
226
227AC_ARG_ENABLE(swapscreen,
228  [  --disable-swapscreen    disable swap screen support],
229  [if test x$enableval = xno; then
230    AC_DEFINE(NO_SECONDARY_SCREEN, 1, Disable the secondary screen. Many programs use the secondary screen as their workplace)
231  fi])
232
233AC_ARG_ENABLE(frills,
234  [  --enable-frills         enable support for rarely used features             *],
235  [if test x$enableval = xyes -o x$enableval = xno; then
236    support_frills=$enableval
237  fi])
238
239AC_ARG_ENABLE(linespace,
240  [  --enable-linespace      enable support for linespace                        *],
241  [if test x$enableval = xyes -o x$enableval = xno; then
242    support_linespace=$enableval
243  fi])
244
245AC_ARG_ENABLE(24bit,
246  [  --enable-24bit          enable support for using 24bit visuals if available *],
247  [if test x$enableval = xyes -o x$enableval = xno; then
248    support_24bit=$enableval
249  fi])
250
251AC_ARG_ENABLE(keepscrolling,
252  [  --enable-keepscrolling  enable continual scrolling on scrollbar arrow press *],
253  [if test x$enableval = xyes -o x$enableval = xno; then
254    support_keepscrolling=$enableval
255  fi])
256
257AC_ARG_ENABLE(mousewheel,
258  [  --enable-mousewheel     enable scrolling via mouse wheel or buttons 4 & 5   *],
259  [if test x$enableval = xyes -o x$enableval = xno; then
260    support_mousewheel=$enableval
261  fi])
262
263AC_ARG_ENABLE(slipwheeling,
264  [  --enable-slipwheeling   enable slip wheel scrolling     (requires previous) *],
265  [if test x$enableval = xyes -o x$enableval = xno; then
266    support_mouseslipwheel=$enableval
267  fi])
268
269AC_ARG_ENABLE(old-selection,
270  [  --enable-old-selection  enable v2.20 (& prior) mouse selection style support*],
271  [if test x$enableval = xyes -o x$enableval = xno; then
272    support_oldselection=$enableval
273  fi])
274
275AC_ARG_ENABLE(new-selection,
276  [  --disable-new-selection disable new mouse (xterm) selection style support],
277  [if test x$enableval = xno; then
278    AC_DEFINE(NO_NEW_SELECTION, 1, Define to remove xterm style mouse selection)
279  fi])
280
281AC_ARG_ENABLE(dmalloc,
282  [  --enable-dmalloc        enable Gray Watson's malloc - for debugging use],
283  [if test x$enableval = xyes; then
284    MALLOC_TYPE=G
285    DEBUG=-DDEBUG_MALLOC
286    DLIB="-L/usr/local/lib -ldmalloc"
287    DINCLUDE=-I/usr/local/include
288  fi])
289
290AC_ARG_ENABLE(dlmalloc,
291  [  --enable-dlmalloc       enable Doug Lea's malloc - for production use
292                     NOTE: enable only one malloc package],
293  [if test x$enableval = xyes; then
294    MALLOC_TYPE=D
295    DEBUG=
296    DLIB="-L/usr/local/lib -ldlmalloc"
297    DINCLUDE=
298  fi])
299
300AC_ARG_ENABLE(smart-resize,
301  [  --enable-smart-resize   enable smart growth/shrink behaviour],
302  [if test x$enableval = xyes; then
303    AC_DEFINE(SMART_RESIZE, 1, Define to use "smart" resize behavior)
304  fi])
305
306AC_ARG_ENABLE(256-color,
307  [  --enable-256-color      enable 256-color support],
308  [if test x$enableval = xyes; then
309    AC_DEFINE(TTY_256COLOR, 1, Define if you want 256 colour support)
310  fi])
311
312AC_ARG_WITH(term,
313  [  --with-term=NAME        set the terminal to NAME (default \"xterm\")],
314  [if test x$withval != x; then
315    AC_DEFINE_UNQUOTED(TERMENV, "$withval",Set TERM to the value given by configure) term="$withval"
316  fi])
317
318AC_ARG_WITH(terminfo,
319  [  --with-terminfo=PATH    set the path to the terminfo tree to PATH],
320  [if test x$withval != x; then
321    AC_DEFINE_UNQUOTED(XVT_TERMINFO, "$withval", Set TERMINFO value to the value given by configure) terminfo="$withval"
322  fi])
323
324dnl# --------------------------------------------------------------------------
325
326AC_DEFINE(PROTOTYPES, 1, Define if you need function prototypes)
327
328dnl# --------------------------------------------------------------------------
329dnl# Supply default CFLAGS, if not specified by `CFLAGS=flags ./configure'
330dnl#
331if test -z "$CFLAGS"; then
332    if test -z "$CCOPTS"; then
333	CCOPTS='-O'
334dnl>	if test "x$GCC" = xyes; then
335dnl>	    if test x$system = xLinux; then
336dnl>		CCOPTS="$CCOPTS "'-O2 -fno-strength-reduce'
337dnl>	    fi
338dnl>	fi
339    fi
340    CFLAGS="$CCOPTS"
341fi
342
343AC_PATH_PROG(MV, mv, mv)
344AC_PATH_PROG(RM, rm, rm)
345AC_PATH_PROG(CP, cp, cp)
346AC_PATH_PROG(LN, ln, ln)
347AC_PATH_PROG(SED, sed, sed)
348AC_PATH_PROG(ECHO, echo, echo)
349AC_PATH_PROG(CMP, cmp, cmp)
350AC_PATH_PROG(TBL, tbl)
351
352dnl# need a neat way to detect SVR4 or its features
353dnl# in src/command.c we use these functions:
354dnl# grantpt(), unlockpt(), ptsname(), which are defined in <sys/ptms.h>
355dnl# - but are these also defined for other systems?
356
357dnl# hack to find if this is SVR4 -- who knows?
358dnl## AC_MSG_CHECKING(for SVR4)
359dnl## AC_EGREP_CPP(yes,
360dnl## [#if defined (SVR4) || defined (_SVR4) || defined (__svr4__)
361dnl##   yes;
362dnl## #endif
363dnl## ], [AC_MSG_RESULT(yes); AC_DEFINE(PERHAPS_SVR4)], AC_MSG_RESULT(perhaps not?))
364
365AC_PATH_XTRA
366
367dnl# the only reasonable way to find libXpm is do-it-yourself
368dnl# only check if we want xpm-background
369
370if test x$support_xpm = xyes; then
371  VT_FIND_LIBXPM
372  if test x$no_xpm = xyes; then
373    support_xpm=needsmanualspecification
374  fi
375fi
376
377dnl# --------------------------------------------------------------------------
378dnl# CHECKING FOR HEADER FILES
379dnl# --------------------------------------------------------------------------
380AC_HEADER_SYS_WAIT
381AC_CHECK_HEADERS( \
382	assert.h \
383	fcntl.h \
384	grp.h \
385	libc.h \
386	lastlog.h \
387	stdarg.h \
388	stdlib.h \
389	string.h \
390	termios.h \
391	unistd.h \
392	sys/byteorder.h \
393	sys/ioctl.h \
394	sys/select.h \
395	sys/sockio.h \
396	sys/strredir.h \
397	sys/time.h \
398	utmp.h \
399	utmpx.h \
400)
401
402AC_HEADER_TIME
403
404dnl# check to allow both <termios.h> and <sys/ioctl.h>
405AC_CACHE_CHECK(whether termios.h and sys/ioctl.h may both be included, xvt_cv_header_sysioctl,
406[AC_TRY_COMPILE([#include <stdio.h>
407#include <sys/ioctl.h>
408#ifdef HAVE_TERMIOS_H
409#include <termios.h>
410#endif], [int a = ECHO;], xvt_cv_header_sysioctl=yes, xvt_cv_header_sysioctl=no)])
411
412dnl# ELF systems may want to store paths for dynamic libraries.
413dnl# Lets see if the compiler can accept "-Rpath" or "-Wl,-Rpath"
414dnl# At least one version of SunOS wants "-R path" but it's not checked yet.
415if test -n "$GCC"; then
416  LDARG="-Wl,"
417else
418  LDARG=""
419fi
420changequote(, )dnl
421R_TRANSLATE='s/-L\([^ ]*\)/-L\1 '$LDARG'-rpath '$LDARG'\1/g'
422changequote([, ])dnl
423
424ac_save_CFLAGS=$CFLAGS
425ac_save_LIBS=$LIBS
426CFLAGS="$CFLAGS $X_CFLAGS"
427LIBS=`echo "$LIBS $X_LIBS $X_EXTRA_LIBS -lX11" | sed "$R_TRANSLATE"`
428AC_CACHE_CHECK([for -rpath dynamic library path recording], xvt_cv_rpath,
429[AC_TRY_RUN([
430main()
431{
432    exit(0);
433    (void) XOpenDisplay("foobar");
434}], xvt_cv_rpath=yes, xvt_cv_rpath=no, dnl
435  AC_MSG_WARN([You may need to check the LIBS line]))])
436if test x$xvt_cv_rpath != xyes; then
437  changequote(, )dnl
438  R_TRANSLATE='s/-L\([^ ]*\)/-L\1 '$LDARG'-R\1/g'
439  changequote([, ])dnl
440  LIBS=`echo "$ac_save_LIBS $X_LIBS $X_EXTRA_LIBS -lX11" | sed "$R_TRANSLATE"`
441  AC_CACHE_CHECK([for -R dynamic library path recording], xvt_cv_R,
442[AC_TRY_RUN([
443main()
444{
445    exit(0);
446    (void) XOpenDisplay("foobar");
447}], xvt_cv_R=yes, xvt_cv_R=no, xvt_cv_R=no)])
448  if test x$xvt_cv_R != xyes; then
449    LIBS="$ac_save_LIBS $X_LIBS $X_EXTRA_LIBS -lX11"
450  fi
451fi
452
453AC_CACHE_CHECK([for XPointer], xvt_cv_xpointer,
454[AC_TRY_COMPILE([#include <X11/Xlib.h>], [XPointer dummy;],
455xvt_cv_xpointer=yes, xvt_cv_xpointer=no)])
456if test x$xvt_cv_xpointer = xyes; then
457  AC_DEFINE(HAVE_XPOINTER, 1, Define if you have XPointer typedef)
458fi
459LIBS=$ac_save_LIBS
460CFLAGS=$ac_save_CFLAGS
461
462
463AC_C_CONST
464AC_C_INLINE
465
466dnl> AC_HEADER_STDC	 dnl# skip this test, Sun always fails anyhow.
467
468dnl# --------------------------------------------------------------------------
469dnl# CHECKING FOR MISSING TYPEDEFS
470dnl# --------------------------------------------------------------------------
471dnl# Missing typedefs and replacements
472AC_TYPE_MODE_T
473dnl> AC_CHECK_TYPE(umode_t, int)
474dnl> AC_CHECK_TYPE(off_t, long)
475AC_TYPE_PID_T
476AC_TYPE_UID_T
477
478
479AC_CHECK_SIZEOF(char, 1)
480AC_CHECK_SIZEOF(short, 2)
481AC_CHECK_SIZEOF(int, 4)
482AC_CHECK_SIZEOF(long, 4)
483AC_CHECK_SIZEOF(long long, 8)
484AC_CHECK_SIZEOF(int *, 4)
485
486dnl# see usage below
487AC_DEFUN(XVT_CHECK_SIZE,
488  [AC_CACHE_CHECK([for $2], $1,
489    [AC_TRY_COMPILE([#include <sys/types.h>], $2 dummy;,
490      [$1=yes],
491      [dnl
492if test $ac_cv_sizeof_char -ge $3; then
493  $1="$4 char"
494else
495  if test $ac_cv_sizeof_short -ge $3; then
496    $1="$4 short"
497  else
498    if test $ac_cv_sizeof_int -ge $3; then
499      $1="$4 int"
500    else
501      if test $ac_cv_sizeof_long -ge $3; then
502        $1="$4 long"
503      else
504        if test $ac_cv_sizeof_long_long -ge $3; then
505          $1="$4 long long"
506        else
507          $1="$4 $5" # we _must_ have a (possibly wrong) default
508        fi
509      fi
510    fi
511  fi
512fi])])]
513if test x"$$1" != xyes; then
514  $6="typedef $$1 $2;"
515else
516  if test x"$4" = x; then
517    $6="/* typedef $5 $2; */"
518  else
519    $6="/* typedef $4 $5 $2; */"
520  fi
521fi dnl
522)
523dnl#
524dnl# Look for types the system may know about anyway.
525dnl#
526XVT_CHECK_SIZE(xvt_cv_int16_t, int16_t, 2, , short, xvt_int16_typedef)
527AC_SUBST(xvt_int16_typedef)
528XVT_CHECK_SIZE(xvt_cv_u_int16_t, u_int16_t, 2, unsigned, short, xvt_u_int16_typedef)
529AC_SUBST(xvt_u_int16_typedef)
530XVT_CHECK_SIZE(xvt_cv_int32_t, int32_t, 4, , int, xvt_int32_typedef)
531AC_SUBST(xvt_int32_typedef)
532XVT_CHECK_SIZE(xvt_cv_u_int32_t, u_int32_t, 4, unsigned, int, xvt_u_int32_typedef)
533AC_SUBST(xvt_u_int32_typedef)
534XVT_CHECK_SIZE(xvt_cv_int64_t, int64_t, 8, , long long, xvt_int64_typedef)
535AC_SUBST(xvt_int64_typedef)
536XVT_CHECK_SIZE(xvt_cv_u_int64_t, u_int64_t, 8, unsigned, long long, xvt_u_int64_typedef)
537AC_SUBST(xvt_u_int64_typedef)
538dnl#
539dnl# Now look for another we use
540dnl#
541if test $ac_cv_sizeof_int_p -eq 8; then
542  xvt_intp_define="#define intp_t int64_t"
543  xvt_u_intp_define="#define u_intp_t u_int64_t"
544else
545  if test $ac_cv_sizeof_int_p -eq 4; then
546    xvt_intp_define="#define intp_t int32_t"
547    xvt_u_intp_define="#define u_intp_t u_int32_t"
548  else
549    if test $ac_cv_sizeof_int_p -eq 2; then
550      xvt_intp_define="#define intp_t int16_t"
551      xvt_u_intp_define="#define u_intp_t u_int16_t"
552    else
553      xvt_intp_define="#error set intp_t"
554      xvt_u_intp_define="#error set u_intp_t"
555    fi
556  fi
557fi
558AC_SUBST(xvt_intp_define)
559AC_SUBST(xvt_u_intp_define)
560
561dnl# --------------------------------------------------------------------------
562dnl# CHECKING FOR LIBRARY FUNCTIONS
563dnl# --------------------------------------------------------------------------
564AC_TYPE_SIGNAL
565dnl> AC_FUNC_VPRINTF
566
567dnl# Note: On Ultrix, setsid() does weirdo stuff, disable it
568case "$host_alias" in
569    *ultrix) ac_cv_func_setsid='no' ;;
570    *) break;;
571esac
572
573AC_CHECK_FUNCS( \
574	atexit \
575	revoke \
576	unsetenv \
577	setutent \
578	seteuid \
579	setreuid \
580	setsid \
581	setpgrp \
582	setpgid \
583	openpty \
584	_getpty \
585	grantpt \
586	unlockpt \
587	isastream \
588	on_exit \
589	nanosleep \
590	updwtmp \
591	ttyslot \
592)
593dnl# Note: On NetBSD, openpty() exists in libutil.  Don't pull it in
594
595dnl# --------------------------------------------------------------------------
596dnl# DO ALL UTMP AND WTMP CHECKING
597dnl# --------------------------------------------------------------------------
598dnl# check for host field in utmp structure
599
600dnl# --------------------------------------------
601AC_CHECK_HEADER(utmp.h,
602[AC_CACHE_CHECK([for struct utmp], xvt_cv_struct_utmp,
603[AC_TRY_COMPILE([#include <sys/types.h>
604#include <utmp.h>],
605[struct utmp ut;],
606xvt_cv_struct_utmp=yes, xvt_cv_struct_utmp=no)])
607if test x$xvt_cv_struct_utmp = xyes; then
608  AC_DEFINE(HAVE_STRUCT_UTMP, 1, Define if utmp.h has struct utmp)
609fi
610]
611
612AC_CACHE_CHECK(for ut_host in utmp struct, xvt_cv_struct_utmp_host,
613[AC_TRY_COMPILE([#include <sys/types.h>
614#include <utmp.h>],
615[struct utmp ut; ut.ut_host;],
616xvt_cv_struct_utmp_host=yes, xvt_cv_struct_utmp_host=no)])
617if test x$xvt_cv_struct_utmp_host = xyes; then
618  AC_DEFINE(HAVE_UTMP_HOST, 1, Define if struct utmp contains ut_host)
619fi
620
621AC_CACHE_CHECK(for ut_pid in utmp struct, xvt_cv_struct_utmp_pid,
622[AC_TRY_COMPILE([#include <sys/types.h>
623#include <utmp.h>],
624[struct utmp ut; ut.ut_pid;],
625xvt_cv_struct_utmp_pid=yes, xvt_cv_struct_utmp_pid=no)])
626if test x$xvt_cv_struct_utmp_pid = xyes; then
627  AC_DEFINE(HAVE_UTMP_PID, 1, Define if struct utmp contains ut_pid)
628fi
629) dnl# AC_CHECK_HEADER(utmp.h
630
631dnl# --------------------------------------------
632
633AC_CHECK_HEADER(utmpx.h,
634[AC_CACHE_CHECK([for struct utmpx], xvt_cv_struct_utmpx,
635[AC_TRY_COMPILE([#include <sys/types.h>
636#include <utmpx.h>],
637[struct utmpx ut;],
638xvt_cv_struct_utmpx=yes, xvt_cv_struct_utmpx=no)])
639if test x$xvt_cv_struct_utmpx = xyes; then
640  AC_DEFINE(HAVE_STRUCT_UTMPX, 1, Define if utmpx.h has struct utmpx)
641fi
642]
643
644AC_CACHE_CHECK(for host in utmpx struct, xvt_cv_struct_utmpx_host,
645[AC_TRY_COMPILE([#include <sys/types.h>
646#include <utmpx.h>],
647[struct utmpx utx; utx.ut_host;],
648xvt_cv_struct_utmpx_host=yes, xvt_cv_struct_utmpx_host=no)])
649if test x$xvt_cv_struct_utmpx_host = xyes; then
650  AC_DEFINE(HAVE_UTMPX_HOST, 1, Define if struct utmpx contains ut_host)
651fi
652) dnl# AC_CHECK_HEADER(utmpx.h
653
654
655dnl# --------------------------------------------------------------------------
656dnl# check for struct lastlog
657AC_CACHE_CHECK(for struct lastlog, xvt_cv_struct_lastlog,
658[AC_TRY_COMPILE([#include <sys/types.h>
659#include <utmp.h>
660#ifdef HAVE_LASTLOG_H
661#include <lastlog.h>
662#endif
663],
664[struct lastlog ll;],
665xvt_cv_struct_lastlog=yes, xvt_cv_struct_lastlog=no)])
666if test x$xvt_cv_struct_lastlog = xyes; then
667  AC_DEFINE(HAVE_STRUCT_LASTLOG, 1, Define if utmp.h or lastlog.h has struct lastlog)
668fi
669
670dnl# check for struct lastlogx
671AC_CACHE_CHECK(for struct lastlogx, xvt_cv_struct_lastlogx,
672[AC_TRY_COMPILE([#include <sys/types.h>
673#include <utmpx.h>
674#ifdef HAVE_LASTLOG_H
675#include <lastlog.h>
676#endif
677],
678[struct lastlogx ll;],
679xvt_cv_struct_lastlogx=yes, xvt_cv_struct_lastlogx=no)])
680if test x$xvt_cv_struct_lastlogx = xyes; then
681  AC_DEFINE(HAVE_STRUCT_LASTLOGX, 1, Define if utmpx.h or lastlog.h has struct lastlogx)
682fi
683
684dnl# --------------------------------------------------------------------------
685dnl# FIND FILES
686dnl# --------------------------------------------------------------------------
687
688dnl# find utmp
689AC_CACHE_CHECK(where utmp is located, xvt_cv_path_utmp,
690[AC_TRY_RUN([#include <stdio.h>
691#include <sys/types.h>
692#include <utmp.h>
693#include <errno.h>
694main()
695{
696    char **u, *utmplist[] = {
697    "/var/run/utmp", "/var/adm/utmp", "/etc/utmp", "/usr/etc/utmp", "/usr/adm/utmp", NULL };
698    FILE *a, *f=fopen("conftestval", "w");
699    if (!f) exit(1);
700#ifdef UTMP_FILE
701    fprintf(f, "%s\n", UTMP_FILE);
702    exit(0);
703#endif
704#ifdef _PATH_UTMP
705    fprintf(f, "%s\n", _PATH_UTMP);
706    exit(0);
707#endif
708    for (u = utmplist; *u; u++) {
709	if ((a = fopen(*u, "r")) != NULL || errno == EACCES) {
710	    fprintf(f, "%s\n", *u);
711	    exit(0);
712	}
713    }
714    exit(0);
715}], xvt_cv_path_utmp=`cat conftestval`, xvt_cv_path_utmp=, dnl
716  AC_MSG_WARN([Define XVT_UTMP_FILE in config.h manually]))])
717if test x$xvt_cv_path_utmp != x; then
718  AC_DEFINE_UNQUOTED(XVT_UTMP_FILE, "$xvt_cv_path_utmp", Define location of utmp)
719fi
720
721dnl# --------------------------------------------------------------------------
722
723dnl# find utmpx - if a utmp file exists at the same location and is more than
724dnl# a day newer, then dump the utmpx.  People leave lots of junk around.
725AC_CACHE_CHECK(where utmpx is located, xvt_cv_path_utmpx,
726[AC_TRY_RUN([#include <stdio.h>
727#include <sys/types.h>
728#include <utmpx.h>
729#include <errno.h>
730#include <sys/stat.h>
731#ifdef HAVE_STRING_H
732#include <string.h>
733#endif
734main()
735{
736    char **u, *p, *utmplist[] = {
737#ifdef UTMPX_FILE
738	UTMPX_FILE,
739#endif
740#ifdef _PATH_UTMPX
741	_PATH_UTMPX,
742#endif
743    "/var/adm/utmpx", "/etc/utmpx", NULL };
744    FILE *a, *f=fopen("conftestval", "w");
745    struct stat statu, statux;
746    if (!f) exit(1);
747    for (u = utmplist; *u; u++) {
748	if ((a = fopen(*u, "r")) != NULL || errno == EACCES) {
749	    if (stat(*u, &statux) < 0)
750		continue;
751	    p = strdup(*u);
752	    p[strlen(p) - 1] = '\0';
753	    if (stat(p, &statu) >= 0
754		&& (statu.st_mtime - statux.st_mtime > 86400))
755		continue;
756	    fprintf(f, "%s\n", *u);
757	    exit(0);
758	}
759    }
760    exit(0);
761}], xvt_cv_path_utmpx=`cat conftestval`, xvt_cv_path_utmpx=, dnl
762  AC_MSG_WARN([Define XVT_UTMPX_FILE in config.h manually]))])
763if test x$xvt_cv_path_utmpx != x; then
764  AC_DEFINE_UNQUOTED(XVT_UTMPX_FILE, "$xvt_cv_path_utmpx", Define location of utmpx)
765fi
766
767dnl# --------------------------------------------------------------------------
768
769dnl# find wtmp
770AC_CACHE_CHECK(where wtmp is located, xvt_cv_path_wtmp,
771[AC_TRY_RUN([#include <stdio.h>
772#include <sys/types.h>
773#ifdef HAVE_UTMP_H
774#include <utmp.h>
775#endif
776#include <errno.h>
777main()
778{
779    char **w, *wtmplist[] = {
780    "/var/log/wtmp", "/var/adm/wtmp", "/etc/wtmp", "/usr/etc/wtmp", "/usr/adm/wtmp", NULL };
781    FILE *a, *f=fopen("conftestval", "w");
782    if (!f) exit(1);
783#ifdef WTMP_FILE
784    fprintf(f, "%s\n", WTMP_FILE);
785    exit(0);
786#endif
787#ifdef _PATH_WTMP
788    fprintf(f, "%s\n", _PATH_WTMP);
789    exit(0);
790#endif
791    for (w = wtmplist; *w; w++) {
792	if ((a = fopen(*w, "r")) != NULL || errno == EACCES) {
793	    fprintf(f, "%s\n", *w);
794	    exit(0);
795	}
796    }
797    exit(0);
798}], xvt_cv_path_wtmp=`cat conftestval`, xvt_cv_path_wtmp=, dnl
799  AC_MSG_WARN([Define XVT_WTMP_FILE in config.h manually]))])
800if test x$xvt_cv_path_wtmp != x; then
801  AC_DEFINE_UNQUOTED(XVT_WTMP_FILE, "$xvt_cv_path_wtmp", Define location of wtmp)
802fi
803dnl# --------------------------------------------------------------------------
804
805dnl# find wtmpx
806AC_CACHE_CHECK(where wtmpx is located, xvt_cv_path_wtmpx,
807[AC_TRY_RUN([#include <stdio.h>
808#ifdef HAVE_UTMPX_H
809#include <utmpx.h>
810#endif
811#include <errno.h>
812main()
813{
814    char **w, *wtmplist[] = {
815    "/var/log/wtmpx", "/var/adm/wtmpx", NULL };
816    FILE *a, *f=fopen("conftestval", "w");
817    if (!f) exit(1);
818#ifdef WTMPX_FILE
819    fprintf(f, "%s\n", WTMPX_FILE);
820    exit(0);
821#endif
822#ifdef _PATH_WTMPX
823    fprintf(f, "%s\n", _PATH_WTMPX);
824    exit(0);
825#endif
826    for (w = wtmplist; *w; w++) {
827	if ((a = fopen(*w, "r")) != NULL || errno == EACCES) {
828	    fprintf(f, "%s\n", *w);
829	    exit(0);
830	}
831    }
832    exit(0);
833}], xvt_cv_path_wtmpx=`cat conftestval`, xvt_cv_path_wtmpx=, dnl
834  AC_MSG_WARN([Define XVT_WTMPX_FILE in config.h manually]))])
835if test x$xvt_cv_path_wtmpx != x; then
836  AC_DEFINE_UNQUOTED(XVT_WTMPX_FILE, "$xvt_cv_path_wtmpx", Define location of wtmpx)
837fi
838dnl# --------------------------------------------------------------------------
839
840dnl# find lastlog
841AC_CACHE_CHECK(where lastlog is located, xvt_cv_path_lastlog,
842[AC_TRY_RUN([#include <stdio.h>
843#include <sys/types.h>
844#ifdef HAVE_UTMPX_H
845#include <utmpx.h>
846#elif defined(HAVE_UTMP_H)
847#include <utmp.h>
848#endif
849#ifdef HAVE_LASTLOG_H
850#include <lastlog.h>
851#endif
852#include <errno.h>
853main()
854{
855    char **w, *lastloglist[] = { "/var/log/lastlog", NULL };
856    FILE *a, *f=fopen("conftestval", "w");
857    if (!f) exit(1);
858#ifdef LASTLOG_FILE
859    fprintf(f, "%s\n", LASTLOG_FILE);
860    exit(0);
861#endif
862#ifdef _PATH_LASTLOG
863    fprintf(f, "%s\n", _PATH_LASTLOG);
864    exit(0);
865#endif
866    for (w = lastloglist; *w; w++) {
867	if ((a = fopen(*w, "r")) != NULL || errno == EACCES) {
868	    fprintf(f, "%s\n", *w);
869	    exit(0);
870	}
871    }
872    exit(0);
873}], xvt_cv_path_lastlog=`cat conftestval`, xvt_cv_path_lastlog=, dnl
874  AC_MSG_WARN([Define XVT_LASTLOG_FILE in config.h manually]))])
875if test x$xvt_cv_path_lastlog != x; then
876  AC_DEFINE_UNQUOTED(XVT_LASTLOG_FILE, "$xvt_cv_path_lastlog", Define location of lastlog)
877  if test -d "$xvt_cv_path_lastlog"; then
878    AC_DEFINE(LASTLOG_IS_DIR, 1, Define if lastlog is provided via a directory)
879  fi
880fi
881dnl# --------------------------------------------------------------------------
882
883dnl# find lastlogx
884AC_CACHE_CHECK(where lastlogx is located, xvt_cv_path_lastlogx,
885[AC_TRY_RUN([#include <stdio.h>
886#ifdef HAVE_UTMPX_H
887#include <utmpx.h>
888#endif
889#include <errno.h>
890main()
891{
892    char **w, *wtmplist[] = { "/var/log/lastlogx", "/var/adm/lastlogx", NULL };
893    FILE *a, *f=fopen("conftestval", "w");
894    if (!f) exit(1);
895#ifdef LASTLOGX_FILE
896    fprintf(f, "%s\n", LASTLOGX_FILE);
897    exit(0);
898#endif
899#ifdef _PATH_LASTLOGX
900    fprintf(f, "%s\n", _PATH_LASTLOGX);
901    exit(0);
902#endif
903    for (w = wtmplist; *w; w++) {
904	if ((a = fopen(*w, "r")) != NULL || errno == EACCES) {
905	    fprintf(f, "%s\n", *w);
906	    exit(0);
907	}
908    }
909    exit(0);
910}], xvt_cv_path_lastlogx=`cat conftestval`, xvt_cv_path_lastlogx=, dnl
911  AC_MSG_WARN([Define XVT_LASTLOGX_FILE in config.h manually]))])
912if test x$xvt_cv_path_lastlogx != x; then
913  AC_DEFINE_UNQUOTED(XVT_LASTLOGX_FILE, "$xvt_cv_path_lastlogx", Define location of lastlogx)
914fi
915
916dnl# --------------------------------------------------------------------------
917
918dnl# find ttys/ttytab
919AC_CACHE_CHECK(where ttys/ttytab is located, xvt_cv_path_ttytab,
920[for ttys_file in   dnl
921  /etc/ttys /etc/ttytab;
922do
923  if test -f "$ttys_file" ; then
924    xvt_cv_path_ttytab=$ttys_file
925    break
926  fi
927done
928])
929if test x$xvt_cv_path_ttytab != x; then
930  AC_DEFINE_UNQUOTED(TTYTAB_FILENAME, "$xvt_cv_path_ttytab", Define location of ttys/ttytab)
931fi
932
933dnl# --------------------------------------------------------------------------
934dnl# --------------------------------------------------------------------------
935
936dnl# this is a really hack test for some basic Xlocale stuff
937ac_save_LIBS=$LIBS
938ac_save_CFLAGS=$CFLAGS
939CFLAGS="$CFLAGS $X_CFLAGS"
940LIBS="$LIBS $X_LIBS $X_EXTRA_LIBS -lX11"
941if test x$xvt_cv_rpath = xyes -o x$xvt_cv_R = xyes; then
942  LIBS=`echo $LIBS | sed "$R_TRANSLATE"`
943fi
944AC_CACHE_CHECK(for working Xlocale, xvt_cv_func_xlocale,
945[AC_TRY_RUN([#include <X11/Xlib.h>
946main() {
947char *p;
948if ((p = XSetLocaleModifiers("@im=none")) != NULL && *p)
949exit (XSupportsLocale() ? 0 : 1);
950else
951exit (1);}],  dnl
952  xvt_cv_func_xlocale=yes, xvt_cv_func_xlocale=no,  dnl
953  AC_MSG_WARN([Define NO_XLOCALE in config.h manually]))])
954if test x$xvt_cv_func_xlocale = xyes; then
955  AC_DEFINE(HAVE_XLOCALE, 1, Define if Xlocale support works)
956fi
957
958AC_CACHE_CHECK(for working X setlocale, xvt_cv_func_xsetlocale,
959[AC_TRY_LINK([#define X_LOCALE 1
960#include <X11/Xlocale.h>],
961  [setlocale(LC_CTYPE, "");],
962  xvt_cv_func_xsetlocale=yes, xvt_cv_func_xsetlocale=no)])
963if test x$xvt_cv_func_xsetlocale = xyes; then
964  AC_DEFINE(HAVE_XSETLOCALE, 1, Define if setlocale (defined to Xsetlocale) works)
965fi
966LIBS=$ac_save_LIBS
967CFLAGS=$ac_save_CFLAGS
968
969AC_CACHE_CHECK(for working plain setlocale, xvt_cv_func_setlocale,
970[AC_TRY_LINK([#include <locale.h>],
971  [setlocale(LC_CTYPE, "");],
972  xvt_cv_func_setlocale=yes, xvt_cv_func_setlocale=no)])
973if test x$xvt_cv_func_setlocale = xyes; then
974  AC_DEFINE(HAVE_SETLOCALE, 1, Define if plain old setlocale works)
975fi
976
977AC_CACHE_CHECK(for working nl_langinfo, xvt_cv_func_nl_langinfo,
978[AC_TRY_LINK([#include <langinfo.h>],
979  [nl_langinfo(CODESET);],
980  xvt_cv_func_nl_langinfo=yes, xvt_cv_func_nl_langinfo=no)])
981if test x$xvt_cv_func_nl_langinfo = xyes; then
982  AC_DEFINE(HAVE_NL_LANGINFO, 1, Define if nl_langinfo(CODESET) works)
983fi
984
985AC_CACHE_CHECK(for getpt, xvt_cv_func_getpt,
986[AC_TRY_LINK([#define _GNU_SOURCE
987#ifdef HAVE_STDLIB_H
988# include <stdlib.h>
989#endif],
990  [(void)getpt();],
991  xvt_cv_func_getpt=yes, xvt_cv_func_getpt=no)])
992if test x$xvt_cv_func_getpt = xyes; then
993  AC_DEFINE(HAVE_GETPT, 1, Define if you have _GNU_SOURCE getpt() )
994fi
995
996dnl# if we don't guess right then it's up to the user
997AC_CACHE_CHECK(for pty/tty type, xvt_cv_ptys,
998[if test x$ac_cv_func_openpty = xyes; then
999    xvt_cv_ptys=OPENPTY
1000 else if test x$ac_cv_func__getpty = xyes; then
1001    xvt_cv_ptys=SGI4
1002 else if test -c /dev/ttyp20; then
1003    xvt_cv_ptys=SCO
1004 else if test -c /dev/ptym/clone; then
1005    xvt_cv_ptys=HPUX
1006 else if test x$xvt_cv_func_getpt = xyes; then
1007    xvt_cv_ptys=GLIBC
1008 else if test -c /dev/ptc -a -c /dev/pts; then
1009    xvt_cv_ptys=PTC
1010 else if test -c /dev/ptc -a -d /dev/pts; then
1011    xvt_cv_ptys=PTC
1012 else if test -c /dev/ptmx -a -c /dev/pts/0; then
1013    xvt_cv_ptys=STREAMS
1014 else if test x$ac_cv_func_grantpt = xyes && test x$ac_cv_func_unlockpt = xyes; then
1015dnl# catch CYGWIN
1016    xvt_cv_ptys=STREAMS
1017 else
1018    xvt_cv_ptys=BSD
1019fi
1020fi
1021fi
1022fi
1023fi
1024fi
1025fi
1026fi
1027fi
1028])
1029
1030if test x$xvt_cv_ptys = xOPENPTY; then
1031  AC_DEFINE(PTYS_ARE_OPENPTY, 1, Define for this pty type)
1032fi
1033if test x$xvt_cv_ptys = xSCO; then
1034  AC_DEFINE(PTYS_ARE_NUMERIC, 1, Define for this pty type)
1035fi
1036if test x$xvt_cv_ptys = xSTREAMS; then
1037  AC_DEFINE(PTYS_ARE_PTMX, 1, Define for this pty type)
1038fi
1039if test x$xvt_cv_ptys = xPTC; then
1040  AC_DEFINE(PTYS_ARE_PTC, 1, Define for this pty type)
1041fi
1042if test x$xvt_cv_ptys = xSGI4; then
1043  AC_DEFINE(PTYS_ARE__GETPTY, 1, Define for this pty type)
1044fi
1045if test x$xvt_cv_ptys = xCONVEX; then
1046  AC_DEFINE(PTYS_ARE_GETPTY, 1, Define for this pty type)
1047fi
1048if test x$xvt_cv_ptys = xGLIBC; then
1049  AC_DEFINE(PTYS_ARE_GETPT, 1, Define for this pty type)
1050fi
1051if test x$xvt_cv_ptys = xHPUX; then
1052  AC_DEFINE(PTYS_ARE_CLONE, 1, Define for this pty type)
1053fi
1054if test x$xvt_cv_ptys = xBSD -o x$xvt_cv_ptys = xHPUX -o x$xvt_cv_ptys = xGLIBC; then
1055  AC_DEFINE(PTYS_ARE_SEARCHED, 1, Define for this pty type)
1056fi
1057
1058
1059AC_CHECKING(for pty ranges)
1060ptys=`echo /dev/pty??`
1061pch1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'`
1062pch2=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'`
1063if test x$pch1 != x; then
1064  AC_DEFINE_UNQUOTED(PTYCHAR1, "$pch1", Define for first char in devptyXX)
1065fi
1066if test x$pch2 != x; then
1067  AC_DEFINE_UNQUOTED(PTYCHAR2, "$pch2", Define for second char in devptyXX)
1068fi
1069
1070dnl# FreeBSD needs to link libxpg4
1071AC_CHECK_LIB(xpg4, setlocale, [LIBS="$LIBS -lxpg4"])
1072
1073dnl# --------------------------------------------------------------------------
1074dnl# now add and remove other stuff
1075dnl# --------------------------------------------------------------------------
1076if test x$support_graphics = xyes; then
1077  AC_DEFINE(XVT_GRAPHICS, 1, Define if you want Rob Nation's own graphic mode)
1078  OBJGRAPHICS="graphics.o"
1079fi
1080if test x$support_inheritpixmap = xyes; then
1081  AC_DEFINE(TRANSPARENT, 1, Define if you want your background to use the parent window background)
1082fi
1083if test x$support_keepscrolling = xno; then
1084  AC_DEFINE(NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING, 1, Define for continual scrolling when you keep the scrollbar button pressed)
1085fi
1086if test x$support_menubar = xyes; then
1087  AC_DEFINE(MENUBAR, 1, Define if you want Menubar support)
1088  OBJMENUBAR="menubar.o"
1089fi
1090if test x$support_frills = xno; then
1091  AC_DEFINE(NO_FRILLS, 1, Define if you don't want handling for rarely used features)
1092fi
1093if test x$support_linespace = xno; then
1094  AC_DEFINE(NO_LINESPACE, 1, Define if you don't want support linespace)
1095fi
1096if test x$support_24bit = xyes; then
1097  AC_DEFINE(PREFER_24BIT, 1, Define to use a 24 bit visual if the screen has 24 bit mode, even if the default is 8 bit)
1098fi
1099if test x$support_mousewheel = xyes; then
1100  AC_DEFINE(MOUSE_WHEEL, 1, Define to use wheel events (button4 and button5) to scroll)
1101fi
1102if test x$support_mouseslipwheel = xyes; then
1103  AC_DEFINE(MOUSE_SLIP_WHEELING, 1, Define to have CTRL cause wheel events to accelerate scrolling. Release CTRL to halt scrolling)
1104fi
1105if test x$support_oldselection = xno; then
1106  AC_DEFINE(NO_OLD_SELECTION, 1, Define to remove old xvt (ver 2.20 and before) style selection)
1107fi
1108if test x$support_utmp = xyes; then
1109  AC_DEFINE(UTMP_SUPPORT, 1, Define if you want to have utmp/utmpx support)
1110  OBJLOGGING="logging.o"
1111fi
1112if test x$support_wtmp = xyes; then
1113  AC_DEFINE(WTMP_SUPPORT, 1, Define if you want to have wtmp support when utmp/utmpx is enabled)
1114fi
1115if test x$support_lastlog = xyes; then
1116  AC_DEFINE(LASTLOG_SUPPORT, 1, Define if you want to have lastlog support when utmp/utmpx is enabled)
1117fi
1118if test x$support_xim = xyes -o x$multichar_set = xyes; then
1119  if test x$xvt_cv_func_xlocale = xyes; then
1120    AC_DEFINE(USE_XIM, 1, Define if you want to have XIM (X Input Method) protocol support - required for multibyte characters input)
1121  fi
1122fi
1123if test x$support_xpm = xyes; then
1124  AC_DEFINE(XPM_BACKGROUND, 1, Define if you want to have sexy-looking background pixmaps. Needs libXpm)
1125  OBJXPM="xpm.o"
1126fi
1127if test x$support_scroll_xvt = xyes; then
1128  AC_DEFINE(XVT_SCROLLBAR, 1, Support xvt original style scrollbars - specify via configure only)
1129  OBJSCROLLBAR="scrollbar-xvt.o"
1130  scrolltypes="xvt"
1131fi
1132if test x$support_scroll_next = xyes; then
1133  AC_DEFINE(NEXT_SCROLLBAR, 1, Support NeXT style scrollbars - specify via configure only)
1134  OBJSCROLLBAR="$OBJSCROLLBAR scrollbar-next.o"
1135  scrolltypes="$scrolltypes next"
1136fi
1137if test x$support_scroll_xterm = xyes; then
1138  AC_DEFINE(XTERM_SCROLLBAR, 1, Support Xterm style scrollbars - specify via configure only)
1139  OBJSCROLLBAR="$OBJSCROLLBAR scrollbar-xterm.o"
1140  scrolltypes="$scrolltypes xterm"
1141fi
1142
1143dnl> AC_CHECK_FUNCS(gettimeofday putenv select socket)
1144
1145CFLAGS=${CFLAGS--O}
1146LDFLAGS=${LDFLAGS--O}
1147
1148CPPFLAGS="$CPPFLAGS"
1149AC_SUBST(DEBUG)
1150AC_SUBST(DINCLUDE)
1151AC_SUBST(CFLAGS)
1152AC_SUBST(CPPFLAGS)
1153AC_SUBST(LDFLAGS)
1154AC_SUBST(X_CFLAGS)
1155
1156dnl# Attack the libs
1157if test x$xvt_cv_rpath = xyes -o x$xvt_cv_R = xyes; then
1158  DLIB=`echo $DLIB | sed "$R_TRANSLATE"`
1159  LIBS=`echo $LIBS | sed "$R_TRANSLATE"`
1160  X_LIBS=`echo $X_LIBS | sed "$R_TRANSLATE"`
1161  X_EXTRA_LIBS=`echo $X_EXTRA_LIBS | sed "$R_TRANSLATE"`
1162  XPM_LIBS=`echo $XPM_LIBS | sed "$R_TRANSLATE"`
1163fi
1164AC_SUBST(DLIB)
1165AC_SUBST(LIBS)
1166AC_SUBST(X_LIBS)
1167AC_SUBST(X_EXTRA_LIBS)
1168
1169if test x$support_addstrings = xyes; then
1170    OBJSTRINGS="strings.o"
1171else
1172    AC_DEFINE(NO_STRINGS, 1, Define if you don't need to use our replacement string functions)
1173fi
1174OBJLIST="command.o defaultfont.o init.o $OBJGRAPHICS $OBJGRKELOT $OBJLOGGING main.o $OBJMENUBAR misc.o netdisp.o ptytty.o screen.o scrollbar.o $OBJSCROLLBAR $OBJSTRINGS xdefaults.o $OBJXPM"
1175AC_SUBST(OBJLIST)
1176LIBOBJLIST=`echo $OBJLIST | sed 's/\.o/.lo/g'`
1177AC_SUBST(LIBOBJLIST)
1178
1179dnl# common parts of the Makefile
1180MCOMMON=./autoconf/Make.common
1181AC_SUBST_FILE(MCOMMON)
1182
1183AC_ARG_PROGRAM
1184
1185XVTNAME=`echo xvt|sed "$program_transform_name"`
1186AC_SUBST(XVTNAME)
1187
1188dnl# test for "sun" or "__sun__" before include sys_ioctl
1189
1190dnl# revert HAVE_BLAH_H into a "#include <blah.h>"
1191AC_DEFUN(XVT_DEFINE_TO_INCLUDE, dnl
1192[if test "$$3" = "$4" -o "$$5" = "$6"; then
1193  $1="#include <$2>"
1194else
1195  $1="/* #include <$2> */"
1196fi dnl
1197AC_SUBST($1)])
1198
1199XVT_DEFINE_TO_INCLUDE(include_stdarg_h, stdarg.h, ac_cv_header_stdarg_h, yes, notset, dontmatch)
1200XVT_DEFINE_TO_INCLUDE(include_stdlib_h, stdlib.h, ac_cv_header_stdlib_h, yes, notset, dontmatch)
1201XVT_DEFINE_TO_INCLUDE(include_unistd_h, unistd.h, ac_cv_header_unistd_h, yes, notset, dontmatch)
1202XVT_DEFINE_TO_INCLUDE(include_string_h, string.h, ac_cv_header_string_h, yes, notset, dontmatch)
1203XVT_DEFINE_TO_INCLUDE(include_fcntl_h, fcntl.h, ac_cv_header_fcntl_h, yes, notset, dontmatch)
1204XVT_DEFINE_TO_INCLUDE(include_util_h, util.h, ac_cv_header_util_h, yes, notset, dontmatch)
1205XVT_DEFINE_TO_INCLUDE(include_assert_h, assert.h, ac_cv_header_assert_h, yes, notset, dontmatch)
1206XVT_DEFINE_TO_INCLUDE(include_sys_ioctl_h, sys/ioctl.h, xvt_cv_header_sysioctl, yes, notset, dontmatch)
1207XVT_DEFINE_TO_INCLUDE(include_sys_select_h, sys/select.h, ac_cv_header_sys_select_h, yes, notset, dontmatch)
1208XVT_DEFINE_TO_INCLUDE(include_sys_strredir_h, sys/strredir.h, ac_cv_header_sys_strredir_h, yes, notset, dontmatch)
1209XVT_DEFINE_TO_INCLUDE(include_sys_time_h, sys/time.h, ac_cv_header_sys_time_h, yes, notset, dontmatch)
1210XVT_DEFINE_TO_INCLUDE(include_time_h, time.h, ac_cv_header_sys_time_h, no, ac_cv_header_time, yes)
1211
1212if test "$multichar_set" = yes; then
1213  lib_multicharset="#define MULTICHAR_SET 1"
1214else
1215  lib_multicharset="/* #undef MULTICHAR_SET */"
1216fi
1217AC_SUBST(lib_multicharset)
1218
1219AC_OUTPUT(autoconf/Make.common \
1220Makefile \
1221doc/Makefile \
1222src/Makefile \
1223src/graphics/Makefile \
1224src/test/Makefile \
1225src/xvtlib.h \
1226rclock/Makefile \
1227W11/Makefile \
1228)
1229
1230echo "Configuration:
1231
1232  xvt version:               $VERSION : $DATE
1233  Source code location:       $srcdir
1234  Install path:               ${prefix}/bin
1235  Compiler:                   $CC
1236  Compiler flags:             $CFLAGS"
1237
1238if test "$MALLOC_TYPE" = S; then
1239  echo "  malloc support:             system default"
1240fi
1241if test "$MALLOC_TYPE" = G; then
1242  echo "  malloc support:             Gray Watson's dmalloc"
1243fi
1244if test "$MALLOC_TYPE" = D; then
1245  echo "  malloc support:             Doug Lea's malloc"
1246fi
1247
1248if test x$support_xpm = xyes; then
1249  echo "  Xpm library:                $XPM_LIBS"
1250fi
1251
1252echo "
1253Adding modules:"
1254if test x$OBJGRAPHICS != x; then HASIT="yes"; else HASIT="no"; fi
1255echo "  graphics.o:                 "$HASIT
1256if test x$OBJGRKELOT != x; then HASIT="yes"; else HASIT="no"; fi
1257echo "  grkelot.o:                  "$HASIT
1258if test x$OBJLOGGING != x; then HASIT="yes"; else HASIT="no"; fi
1259echo "  logging.o:                  "$HASIT
1260if test x$OBJMENUBAR != x; then HASIT="yes"; else HASIT="no"; fi
1261echo "  menubar.o:                  "$HASIT
1262if test x$support_scroll_xvt = xyes; then HASIT="yes"; else HASIT="no"; fi
1263echo "  scrollbar-xvt.o:           "$HASIT
1264if test x$support_scroll_next = xyes; then HASIT="yes"; else HASIT="no"; fi
1265echo "  scrollbar-next.o:           "$HASIT
1266if test x$support_scroll_xterm = xyes; then HASIT="yes"; else HASIT="no"; fi
1267echo "  scrollbar-xterm.o:          "$HASIT
1268if test x$OBJSTRINGS != x; then HASIT="yes"; else HASIT="no"; fi
1269echo "  strings.o:                  "$HASIT
1270if test x$OBJXPM != x; then HASIT="yes"; else HASIT="no"; fi
1271echo "  xpm.o:                      "$HASIT
1272echo "
1273The following are set in config.h
1274"
1275echo "  multichar glyph languages:  "$multichar_set
1276echo "  pty/tty type:               "$xvt_cv_ptys
1277if test x$support_utmp != xyes; then
1278  echo "  utmp support:               disabled
1279"
1280else
1281  echo "  utmp support:               enabled
1282  utmp file:                  $xvt_cv_path_utmp
1283  utmpx file:                 $xvt_cv_path_utmpx
1284  wtmp file:                  $xvt_cv_path_wtmp
1285  wtmpx file:                 $xvt_cv_path_wtmpx
1286  lastlog file:               $xvt_cv_path_lastlog
1287  ttys/ttytab file:           $xvt_cv_path_ttytab
1288"
1289fi
1290if test x$term != x; then
1291  echo "  set TERM to:                $term
1292"
1293fi
1294if test x$terminfo != x; then
1295  echo "  set TERMINFO to:            $terminfo
1296"
1297fi
1298if test x$xvt_cv_ptys = xUNKNOWN; then
1299  echo ".----------------------------------------------------------------."
1300  echo ". WARNING: could not determine pty/tty type.  Do not build until ."
1301  echo ".          the appropriate PTYS_ARE_* is defined in config.h     ."
1302  echo ".----------------------------------------------------------------."
1303fi
1304if test x$support_xpm = xneedsmanualspecification; then
1305  echo ".----------------------------------------------------------------."
1306  echo ". WARNING: --enable-xpm-background was specified however the     ."
1307  echo ".          XPM includes files and libraries could not be found.  ."
1308  echo ".          XPM backgrounds are now being DISABLED!  If you want  ."
1309  echo ".          to use them you should rerun   configure   with the   ."
1310  echo ".          appropriate --with-xpm-includes=/path/to/xpm/includes ."
1311  echo ".          and --with-xpm-library=/path/to/xpm/library lines.    ."
1312  echo ".----------------------------------------------------------------."
1313fi
1314if test x$support_xim = xyes -a x$xvt_cv_func_xlocale = xno; then
1315  echo ".----------------------------------------------------------------."
1316  echo ". WARNING: --enable-xim was specified however the locale support ."
1317  echo ".          functions could not be found.                         ."
1318  echo ".          XIM is now being DISABLED!                            ."
1319  echo ".----------------------------------------------------------------."
1320fi
1321echo "  *** Please check src/feature.h for further options ***
1322"
1323