configure.in revision 20d2c4d2
1dnl $XTermId: configure.in,v 1.266 2010/06/15 22:30:01 tom Exp $
2dnl
3dnl -----------------------------------------------------------------------------
4dnl this file is part of xterm
5dnl
6dnl Copyright 1997-2009,2010 by Thomas E. Dickey
7dnl 
8dnl                         All Rights Reserved
9dnl 
10dnl Permission is hereby granted, free of charge, to any person obtaining a
11dnl copy of this software and associated documentation files (the
12dnl "Software"), to deal in the Software without restriction, including
13dnl without limitation the rights to use, copy, modify, merge, publish,
14dnl distribute, sublicense, and/or sell copies of the Software, and to
15dnl permit persons to whom the Software is furnished to do so, subject to
16dnl the following conditions:
17dnl 
18dnl The above copyright notice and this permission notice shall be included
19dnl in all copies or substantial portions of the Software.
20dnl 
21dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24dnl IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
25dnl CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26dnl TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27dnl SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28dnl 
29dnl Except as contained in this notice, the name(s) of the above copyright
30dnl holders shall not be used in advertising or otherwise to promote the
31dnl sale, use or other dealings in this Software without prior written
32dnl authorization.
33dnl ---------------------------------------------------------------------------
34dnl Process this file with autoconf to produce a configure script.
35dnl
36AC_PREREQ(2.13.20030927)
37AC_INIT(charproc.c)
38AC_CONFIG_HEADER(xtermcfg.h:xtermcfg.hin)
39CF_CHECK_CACHE
40
41###	checks for alternative programs
42
43dnl Only add to this case statement when a system has a compiler that is not
44dnl detected by AC_PROG_CC.
45case "$host_os" in
46openedition)	: ${CFLAGS="-O2 -Wc,dll -Wl,EDIT=NO"}
47		: ${CPPFLAGS="-D_ALL_SOURCE"}
48		: ${LIBS="/usr/lib/Xaw.x /usr/lib/SM.x /usr/lib/ICE.x /usr/lib/X11.x"}
49		: ${CC=c89};;
50darwin*)
51		: ${LDFLAGS}="${LDFLAGS} -Wl,-bind_at_load";;
52esac
53
54AC_PROG_CC
55AC_PROG_CPP
56AC_PROG_GCC_TRADITIONAL
57AC_PROG_AWK
58AC_PROG_INSTALL
59AC_PROG_LN_S
60AC_ARG_PROGRAM
61AC_CHECK_PROGS(LINT, tdlint lint alint)
62
63###	checks for UNIX variants that set C preprocessor variables
64AC_AIX
65AC_ISC_POSIX
66
67###	checks for compiler characteristics
68CF_ANSI_CC_CHECK
69AC_C_CONST
70CF_PROG_EXT
71CF_XOPEN_SOURCE
72CF_SIGWINCH
73
74###	checks for header files
75AC_CHECK_HEADERS( \
76ncurses/term.h \
77stdlib.h \
78sys/ttydefaults.h \
79term.h \
80termios.h \
81unistd.h \
82wchar.h \
83)
84AC_HEADER_TIME
85AM_LANGINFO_CODESET
86
87###	checks for typedefs
88CF_SIG_ATOMIC_T
89CF_SIZE_T
90AC_CHECK_TYPE(time_t, long)
91AC_TYPE_MODE_T
92AC_TYPE_PID_T
93AC_TYPE_UID_T
94AC_TYPE_OFF_T
95
96###	checks for library functions
97AC_CHECK_FUNCS( \
98	bcopy \
99	gethostname \
100	getlogin \
101	memmove \
102	putenv \
103	sched_yield \
104	strerror \
105	strftime \
106	tcgetattr \
107	waitpid \
108	wcswidth \
109	wcwidth )
110CF_FUNC_MEMMOVE
111CF_UTMP
112CF_STRUCT_LASTLOG
113CF_POSIX_SAVED_IDS
114
115CF_HELP_MESSAGE(Compile/Install Options:)
116CF_FUNC_TGETENT
117
118AC_MSG_CHECKING(for directory to install resource files)
119CF_WITH_PATH(app-defaults,
120	[  --with-app-defaults=DIR directory in which to install resource files],
121	[appsdir],[EPREFIX/lib/X11/app-defaults],
122	['\$(exec_prefix)/lib/X11/app-defaults'])
123AC_MSG_RESULT($appsdir)
124AC_SUBST(appsdir)
125
126no_appsdir=
127test "$appsdir" = no && no_appsdir="#"
128AC_SUBST(no_appsdir)
129
130AC_MSG_CHECKING(for directory to install icons)
131CF_WITH_PATH(icondir,
132	[  --with-icondir=DIR      directory in which to install icons],
133	[icondir],[EPREFIX/share/pixmaps],
134	['\$(exec_prefix)/share/pixmaps'])
135AC_MSG_RESULT($icondir)
136AC_SUBST(icondir)
137
138no_icondir=
139test "$icondir" = no && no_icondir="#"
140AC_SUBST(no_icondir)
141
142# Comment-out the install-desktop rule if the desktop-utils are not found.
143AC_MSG_CHECKING(if you want to install desktop files)
144CF_ARG_OPTION(desktop,
145	[  --disable-desktop       disable install of xterm desktop files],
146	[enable_desktop=$enableval],
147	[enable_desktop=$enableval],yes)
148AC_MSG_RESULT($enable_desktop)
149
150desktop_utils=
151if test "$enable_desktop" = yes ; then
152AC_CHECK_PROG(desktop_utils,desktop-file-install,yes,no)
153fi
154
155test "$desktop_utils" = yes && desktop_utils= || desktop_utils="#"
156AC_SUBST(DESKTOP_FLAGS)
157
158# inherit SINSTALL_OPTS from environment to allow packager to customize it.
159
160AC_MSG_CHECKING(for install-permissions reference)
161AC_ARG_WITH(reference,
162	[  --with-reference=XXX    program to use as permissions-reference],
163	[with_reference=$withval],
164	[with_reference=xterm])
165AC_MSG_RESULT($with_reference)
166
167with_full_paths=yes
168CF_PATH_PROG(XTERM_PATH,$with_reference)
169
170# If any of --program-prefix, --program-suffix or --program-transform-name is
171# given, accept an option tell the makefile to create a symbolic link, e.g.,
172# to "xterm" on install.
173XTERM_SYMLINK=NONE
174AC_SUBST(XTERM_SYMLINK)
175if test "$program_transform_name" != "'s,,,'" ; then
176cf_name=`echo "$program_transform_name" | sed -e '[s,\\$\\$,$,g]'`
177cf_name=`echo xterm |sed -e "$cf_name"`
178AC_MSG_CHECKING(for symbolic link to create to $cf_name)
179AC_ARG_WITH(xterm-symlink,
180	[  --with-xterm-symlink=XXX make symbolic link to installed xterm],
181	[with_symlink=$withval],
182	[with_symlink=xterm])
183AC_MSG_RESULT($with_symlink)
184test "$with_symlink" = yes && with_symlink=xterm
185test -n "$with_symlink" && \
186	test "$with_symlink" != no && \
187	test "$with_symlink" != $cf_name && \
188	XTERM_SYMLINK="$with_symlink"
189fi
190
191AC_MSG_CHECKING(if you want to disable setuid)
192CF_ARG_DISABLE(setuid,
193	[  --disable-setuid        disable setuid in xterm, do not install setuid/setgid],
194	[disable_setuid=yes],
195	[disable_setuid=no],
196	no)
197AC_MSG_RESULT($disable_setuid)
198
199AC_MSG_CHECKING(if you want to disable setgid)
200CF_ARG_DISABLE(setgid,
201	[  --disable-setgid        disable setgid in xterm, do not install setuid/setgid],
202	[disable_setgid=yes],
203	[disable_setgid=no],
204	no)
205AC_MSG_RESULT($disable_setgid)
206
207AC_MSG_CHECKING(if you want to run xterm setuid to a given user)
208AC_ARG_WITH(setuid,
209	[  --with-setuid=XXX       use the given setuid user],
210	[use_given_setuid=$withval],
211	[use_given_setuid=no])
212AC_MSG_RESULT($use_given_setuid)
213
214if test "$use_given_setuid" != no ; then
215	if test "$use_given_setuid" = yes ; then
216		cf_cv_given_setuid=root
217	else
218		cf_cv_given_setuid=$use_given_setuid
219	fi
220	SINSTALL_OPTS="$SINSTALL_OPTS u+s -u $cf_cv_given_setuid"
221fi
222
223AC_MSG_CHECKING(if you want to run xterm setgid to match utmp/utmpx file)
224AC_ARG_WITH(utmp-setgid,
225	[  --with-utmp-setgid=XXX  use setgid to match utmp/utmpx file],
226	[use_utmp_setgid=$withval],
227	[use_utmp_setgid=no])
228AC_MSG_RESULT($use_utmp_setgid)
229
230if test "$use_utmp_setgid" != no ; then
231	if test "$use_utmp_setgid" = yes ; then
232		CF_UTMP_GROUP
233	else
234		cf_cv_utmp_group=$use_utmp_setgid
235	fi
236	if test "$cf_cv_posix_saved_ids" != yes ; then
237		AC_MSG_ERROR(Your system does not support POSIX saved-ids)
238	fi
239	AC_DEFINE(USE_UTMP_SETGID)
240	SINSTALL_OPTS="$SINSTALL_OPTS g+s -g $cf_cv_utmp_group"
241fi
242
243AC_SUBST(SINSTALL_OPTS)
244
245AC_MSG_CHECKING(if you want to link with utempter)
246AC_ARG_WITH(utempter,
247	[  --with-utempter         use utempter library for access to utmp],
248	[use_utempter=$withval],
249	[use_utempter=no])
250AC_MSG_RESULT($use_utempter)
251
252if test "$use_utempter" = yes ; then
253	CF_UTEMPTER
254	test "$cf_cv_have_utempter" != yes && use_utempter=no
255else
256	use_utempter=no
257fi
258
259# Some configurations permit (or require) either setuid or setgid mode.
260# Let the user decide.
261if test "$use_utempter" = yes ; then
262	if test "${enable_setuid+set}" != set ; then
263		disable_setuid=yes
264		CF_VERBOSE([No --disable-setuid option given, force to yes])
265	fi
266fi
267
268###	checks for external data
269CF_ERRNO
270CF_TTY_GROUP
271
272###	checks for system services and user specified options
273
274CF_POSIX_WAIT
275CF_SYSV
276CF_SVR4
277CF_X_TOOLKIT
278
279AC_CHECK_HEADERS( \
280	X11/DECkeysym.h \
281	X11/Sunkeysym.h \
282	X11/XF86keysym.h \
283	X11/XKBlib.h \
284	X11/Xpoll.h \
285	X11/extensions/XKB.h \
286	)
287
288CF_X_ATHENA
289CF_TYPE_FD_MASK
290CF_TERMIO_C_ISPEED
291
292LIBS="$LIBS $X_EXTRA_LIBS"
293
294# Check for openpty() in -lutil if the UNIX98-style pty functions are not
295# available. E.g. for GNU libc 2.0.
296case $host_os in #(vi
297freebsd*|netbsd*|dragonfly*) # 2004/8/15 - revisit this if/when grantpt is known to work.
298	AC_CHECK_LIB(util,openpty)
299	;;
300*)
301	AC_CHECK_FUNCS(grantpt, [], AC_CHECK_LIB(util,openpty))
302	;;
303esac
304
305AC_CHECK_FUNCS(XkbQueryExtension)
306
307CF_XKB_BELL_EXT
308
309AC_CHECK_FUNCS(Xutf8LookupString, [],[
310	EXTRAHDRS="$EXTRAHDRS xutf8.h"
311	EXTRASRCS="$EXTRASRCS xutf8.c"
312	EXTRAOBJS="$EXTRAOBJS xutf8.o"
313])
314
315CF_WITH_IMAKE_CFLAGS($(MAIN_DEFINES) $(VENDORMANDEFS))
316
317CF_HELP_MESSAGE(Terminal Configuration:)
318
319AC_MSG_CHECKING(for default terminal-id)
320AC_ARG_WITH(terminal-id,
321	[  --with-terminal-id=V    set default decTerminalID (default: vt100)],
322	[default_termid=$withval],
323	[default_termid=vt100])
324AC_MSG_RESULT($default_termid)
325case $default_termid in
326vt*)	default_termid=`echo $default_termid | sed -e 's/^..//'`
327	;;
328esac
329AC_DEFINE_UNQUOTED(DFT_DECID,"$default_termid")
330
331AC_MSG_CHECKING(for default terminal-type)
332AC_ARG_WITH(terminal-type,
333	[  --with-terminal-type=T  set default $TERM (default: xterm)],
334	[default_TERM=$withval],
335	[default_TERM=xterm])
336AC_MSG_RESULT($default_TERM)
337AC_DEFINE_UNQUOTED(DFT_TERMTYPE,"$default_TERM")
338
339AC_CHECK_PROG(cf_tic_prog,tic,yes,no)
340if test "$cf_tic_prog" = yes ; then
341	AC_MSG_CHECKING(for private terminfo-directory)
342	AC_ARG_WITH(own-terminfo,
343		[  --with-own-terminfo=P   set default $TERMINFO (default: from environment)],
344		[TERMINFO_DIR=$withval],
345		[TERMINFO_DIR=${TERMINFO-none}])
346	AC_MSG_RESULT($TERMINFO_DIR)
347	if test "$TERMINFO_DIR" = yes ; then
348		AC_MSG_WARN(no value given)
349	elif test "$TERMINFO_DIR" != none ; then
350		if test -d $TERMINFO_DIR ; then
351			AC_DEFINE_UNQUOTED(OWN_TERMINFO_DIR,"$TERMINFO_DIR")
352		else
353			AC_MSG_WARN(not a directory)
354		fi
355	elif test "$prefix" != NONE ; then
356		TERMINFO_DIR='${prefix}/lib/terminfo'
357	elif test -d /usr/lib/terminfo ; then
358		TERMINFO_DIR=/usr/lib/terminfo
359	else
360		TERMINFO_DIR=
361	fi
362	SET_TERMINFO=
363	if test -n "$TERMINFO_DIR" ; then
364		TERMINFO_DIR='$(DESTDIR)'$TERMINFO_DIR
365		SET_TERMINFO='TERMINFO=$(TERMINFO_DIR)'
366	fi
367	no_ticprog=
368else
369	no_ticprog="#"
370	TERMINFO_DIR=
371	SET_TERMINFO=
372fi
373AC_SUBST(no_ticprog)
374AC_SUBST(TERMINFO_DIR)
375AC_SUBST(SET_TERMINFO)
376
377###############################################################################
378CF_HELP_MESSAGE(Optional Features:)
379
380AC_MSG_CHECKING(if you want active-icons)
381CF_ARG_DISABLE(active-icon,
382	[  --disable-active-icon   disable X11R6.3 active-icon feature],
383	[enable_active_icon=no],
384	[enable_active_icon=yes])
385AC_MSG_RESULT($enable_active_icon)
386if test "$enable_active_icon" = no ; then
387	AC_DEFINE(NO_ACTIVE_ICON)
388fi
389
390AC_MSG_CHECKING(if you want ANSI color)
391CF_ARG_DISABLE(ansi-color,
392	[  --disable-ansi-color    disable ANSI color],
393	[enable_ansi_color=no],
394	[enable_ansi_color=yes])
395AC_MSG_RESULT($enable_ansi_color)
396test "$enable_ansi_color" = no && AC_DEFINE(OPT_ISO_COLORS,0)
397
398if test "$enable_ansi_color" = yes ; then
399
400	AC_MSG_CHECKING(if you want 16 colors like aixterm)
401	CF_ARG_DISABLE(16-color,
402		[  --disable-16-color      disable 16-color support],
403		[enable_16_color=no],
404		[enable_16_color=yes])
405	AC_MSG_RESULT($enable_16_color)
406	test "$enable_16_color" = no && AC_DEFINE(OPT_AIX_COLORS,0)
407
408	AC_MSG_CHECKING(if you want 256 colors)
409	CF_ARG_ENABLE(256-color,
410		[  --enable-256-color      enable 256-color support],
411		[enable_256_color=yes],
412		[enable_256_color=no])
413	AC_MSG_RESULT($enable_256_color)
414	if test "$enable_256_color" = yes ; then
415		CHARPROC_DEPS="$CHARPROC_DEPS 256colres.h"
416		EXTRAHDRS="$EXTRAHDRS 256colres.h"
417		AC_DEFINE(OPT_256_COLORS,1)
418	else
419	AC_MSG_CHECKING(if you want 88 colors)
420	CF_ARG_ENABLE(88-color,
421		[  --enable-88-color       enable 88-color support],
422		[enable_88_color=yes],
423		[enable_88_color=no])
424	AC_MSG_RESULT($enable_88_color)
425	if test "$enable_88_color" = yes ; then
426		CHARPROC_DEPS="$CHARPROC_DEPS 88colres.h"
427		EXTRAHDRS="$EXTRAHDRS 88colres.h"
428		AC_DEFINE(OPT_88_COLORS,1)
429	fi
430	fi
431
432fi
433
434AC_MSG_CHECKING(if you want blinking cursor)
435CF_ARG_DISABLE(blink-cursor,
436	[  --disable-blink-cursor  disable support for blinking cursor],
437	[enable_blink_curs=no],
438	[enable_blink_curs=yes])
439AC_MSG_RESULT($enable_blink_curs)
440test "$enable_blink_curs" = no && AC_DEFINE(OPT_BLINK_CURS,0)
441
442AC_MSG_CHECKING(if you want to ignore Linux's broken palette-strings)
443
444case $host_os in #(vi
445linux*)
446	assume_broken_osc=yes ;; #(vi
447*)
448	assume_broken_osc=no ;;
449esac
450
451CF_ARG_OPTION(broken-osc,
452	[  --enable-broken-osc     allow broken Linux OSC-strings],
453	[enable_broken_osc=$enableval],
454	[enable_broken_osc=$enableval],
455	[$assume_broken_osc])
456AC_MSG_RESULT($enable_broken_osc)
457if test "$enable_broken_osc" = yes ; then
458	AC_DEFINE(OPT_BROKEN_OSC,1)
459else
460	AC_DEFINE(OPT_BROKEN_OSC,0)
461fi
462
463AC_MSG_CHECKING(if you want to allow broken string-terminators)
464CF_ARG_ENABLE(broken-st,
465	[  --disable-broken-st     disallow broken string-terminators],
466	[enable_broken_st=no],
467	[enable_broken_st=yes])
468AC_MSG_RESULT($enable_broken_st)
469test "$enable_broken_st" = no && AC_DEFINE(OPT_BROKEN_ST,0)
470
471AC_MSG_CHECKING(if you want printable 128-159)
472CF_ARG_DISABLE(c1-print,
473	[  --disable-c1-print      disallow -k8 option for printable 128-159],
474	[enable_c1_print=no],
475	[enable_c1_print=yes])
476AC_MSG_RESULT($enable_c1_print)
477test "$enable_c1_print" = no && AC_DEFINE(OPT_C1_PRINT,0)
478
479if test "$enable_ansi_color" = yes ; then
480
481	AC_MSG_CHECKING(if you want bold colors mapped like IBM PC)
482	CF_ARG_DISABLE(bold-color,
483		[  --disable-bold-color    disable PC-style mapping of bold colors],
484		[enable_pc_color=no],
485		[enable_pc_color=yes])
486	AC_MSG_RESULT($enable_pc_color)
487	test "$enable_pc_color" = no && AC_DEFINE(OPT_PC_COLORS,0)
488
489	AC_MSG_CHECKING(if you want separate color-classes)
490	CF_ARG_DISABLE(color-class,
491		[  --disable-color-class   disable separate color class resources],
492		[enable_color_class=no],
493		[enable_color_class=yes])
494	AC_MSG_RESULT($enable_color_class)
495	test "$enable_color_class" = no && AC_DEFINE(OPT_COLOR_CLASS,FALSE)
496
497	AC_MSG_CHECKING(if you want color-mode enabled by default)
498	CF_ARG_DISABLE(color-mode,
499		[  --disable-color-mode    disable default colorMode resource],
500		[default_colormode=no],
501		[default_colormode=yes])
502	AC_MSG_RESULT($default_colormode)
503	test "$default_colormode" = no && AC_DEFINE(DFT_COLORMODE,FALSE)
504
505fi
506
507AC_MSG_CHECKING(if you want support for color highlighting)
508CF_ARG_DISABLE(highlighting,
509	[  --disable-highlighting  disable support for color highlighting],
510	[default_highlight=no],
511	[default_highlight=yes])
512AC_MSG_RESULT($default_highlight)
513test "$default_highlight" = no && AC_DEFINE(OPT_HIGHLIGHT_COLOR,0)
514
515AC_MSG_CHECKING(if you want support for doublesize characters)
516CF_ARG_DISABLE(doublechars,
517	[  --disable-doublechars   disable support for double-size chars],
518	[enable_doublechars=no],
519	[enable_doublechars=yes])
520AC_MSG_RESULT($enable_doublechars)
521test "$enable_doublechars" = no && AC_DEFINE(OPT_DEC_CHRSET,0)
522
523AC_MSG_CHECKING(if you want fallback-support for box characters)
524CF_ARG_DISABLE(boxchars,
525	[  --disable-boxchars      disable fallback-support for box chars],
526	[enable_boxchars=no],
527	[enable_boxchars=yes])
528AC_MSG_RESULT($enable_boxchars)
529test "$enable_boxchars" = no && AC_DEFINE(OPT_BOX_CHARS,0)
530
531AC_MSG_CHECKING(if you want to allow spawning new xterms)
532CF_ARG_ENABLE(exec-xterm,
533	[  --enable-exec-xterm     enable "spawn-new-terminal" action],
534	[enable_exec_xterm=yes],
535	[enable_exec_xterm=no])
536AC_MSG_RESULT($enable_exec_xterm)
537if test "$enable_exec_xterm" = yes ; then
538	CF_PROCFS_CWD
539	if test "$cf_cv_procfs_cwd" = no ; then
540		AC_MSG_WARN(no suitable proc filesystem found)
541	else
542		AC_DEFINE_UNQUOTED(PROCFS_ROOT,"$cf_cv_procfs_cwd")
543		AC_DEFINE(OPT_EXEC_XTERM)
544	fi
545fi
546
547AC_MSG_CHECKING(if you want to use FreeType library)
548CF_ARG_DISABLE(freetype,
549	[  --disable-freetype      disable freetype library-support],
550	[enable_freetype=no],
551	[enable_freetype=yes])
552AC_MSG_RESULT($enable_freetype)
553if test "$enable_freetype" = yes ; then
554	CF_X_FREETYPE
555else
556	CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-DXRENDERFONT//`
557fi
558
559AC_MSG_CHECKING(if you want support for HP-style function keys)
560CF_ARG_ENABLE(hp-fkeys,
561	[  --enable-hp-fkeys       enable support for HP-style function keys],
562	[enable_hp_fkeys=yes],
563	[enable_hp_fkeys=no])
564AC_MSG_RESULT($enable_hp_fkeys)
565if test "$enable_hp_fkeys" = yes ; then
566	AC_DEFINE(OPT_HP_FUNC_KEYS,1)
567fi
568
569AC_MSG_CHECKING(if you want support for SCO-style function keys)
570CF_ARG_ENABLE(sco-fkeys,
571	[  --enable-sco-fkeys      enable support for SCO-style function keys],
572	[enable_sco_fkeys=yes],
573	[enable_sco_fkeys=no])
574AC_MSG_RESULT($enable_sco_fkeys)
575if test "$enable_sco_fkeys" = yes ; then
576	AC_DEFINE(OPT_SCO_FUNC_KEYS,1)
577fi
578
579AC_MSG_CHECKING(if you want support for Sun-style function keys)
580CF_ARG_DISABLE(sun-fkeys,
581	[  --disable-sun-fkeys     disable support for Sun-style function keys],
582	[enable_sun_fkeys=no],
583	[enable_sun_fkeys=yes])
584AC_MSG_RESULT($enable_sun_fkeys)
585if test "$enable_sun_fkeys" = no ; then
586	AC_DEFINE(OPT_SUN_FUNC_KEYS,0)
587fi
588
589AC_MSG_CHECKING(if you want saved-lines stored as a FIFO)
590CF_ARG_DISABLE(fifo-lines,
591	[  --disable-fifo-lines    disable FIFO-storage for saved-lines],
592	[enable_fifo_lines=no],
593	[enable_fifo_lines=yes])
594AC_MSG_RESULT($enable_fifo_lines)
595if test "$enable_fifo_lines" = yes ; then
596	AC_DEFINE(OPT_FIFO_LINES,1)
597fi
598
599AC_MSG_CHECKING(if you want support for internationalization)
600CF_ARG_DISABLE(i18n,
601	[  --disable-i18n          disable internationalization],
602	[enable_i18n=no],
603	[enable_i18n=yes])
604AC_MSG_RESULT($enable_i18n)
605if test "$enable_i18n" = no ; then
606	AC_DEFINE(OPT_I18N_SUPPORT,0)
607fi
608
609AC_MSG_CHECKING(if you want support for initial-erase setup)
610CF_ARG_DISABLE(initial-erase,
611	[  --disable-initial-erase disable setup for stty erase],
612	[enable_ie=no],
613	[enable_ie=yes])
614AC_MSG_RESULT($enable_ie)
615if test "$enable_ie" = no ; then
616	AC_DEFINE(OPT_INITIAL_ERASE,0)
617fi
618
619AC_MSG_CHECKING(if you want support for input-method)
620CF_ARG_DISABLE(input-method,
621	[  --disable-input-method  disable input-method],
622	[enable_ximp=no],
623	[enable_ximp=yes])
624AC_MSG_RESULT($enable_ximp)
625CF_INPUT_METHOD
626test "$cf_cv_input_method" = no && enable_ximp=no
627if test "$enable_ximp" = no ; then
628	AC_DEFINE(OPT_INPUT_METHOD,0)
629fi
630
631AC_MSG_CHECKING(if you want support for load-vt-fonts)
632CF_ARG_ENABLE(load-vt-fonts,
633	[  --enable-load-vt-fonts  enable load-vt-fonts() action],
634	[enable_load_vt_fonts=yes],
635	[enable_load_vt_fonts=no])
636AC_MSG_RESULT($enable_load_vt_fonts)
637if test "$enable_load_vt_fonts" = yes ; then
638	AC_DEFINE(OPT_LOAD_VTFONTS,1)
639fi
640
641AC_MSG_CHECKING(if you want support for logging)
642CF_ARG_ENABLE(logging,
643	[  --enable-logging        enable logging],
644	[enable_logging=yes],
645	[enable_logging=no])
646AC_MSG_RESULT($enable_logging)
647if test "$enable_logging" = yes ; then
648	AC_DEFINE(ALLOWLOGGING)
649	AC_MSG_CHECKING(if you want to allow logging via a pipe)
650	CF_ARG_ENABLE(logfile-exec,
651		[  --enable-logfile-exec   enable exec'd logfile filter],
652		[enable_log_exec=yes],
653		[enable_log_exec=no])
654	AC_MSG_RESULT($enable_log_exec)
655	if test "$enable_log_exec" = yes ; then
656		AC_DEFINE(ALLOWLOGFILEEXEC)
657	fi
658fi
659
660AC_MSG_CHECKING(if you want support for iconify/maximize translations)
661CF_ARG_DISABLE(maximize,
662	[  --disable-maximize      disable actions for iconify/deiconify/maximize/restore],
663	[enable_maximize=no],
664	[enable_maximize=yes])
665AC_MSG_RESULT($enable_maximize)
666test "$enable_maximize" = no && AC_DEFINE(OPT_MAXIMIZE,0)
667
668AC_MSG_CHECKING(if you want NumLock to override keyboard tables)
669CF_ARG_DISABLE(num-lock,
670	[  --disable-num-lock      disable NumLock keypad support],
671	[enable_numlock=no],
672	[enable_numlock=yes])
673AC_MSG_RESULT($enable_numlock)
674test "$enable_numlock" = no && AC_DEFINE(OPT_NUM_LOCK,0)
675
676AC_MSG_CHECKING(if you want support for get/set of base64 selection data)
677
678CF_ARG_DISABLE(paste64,
679	[  --disable-paste64       disable get/set base64 selection data],
680	[enable_paste64=no],
681	[enable_paste64=yes])
682AC_MSG_RESULT($enable_paste64)
683if test "$enable_paste64" = yes ; then
684	AC_DEFINE(OPT_PASTE64,1)
685else
686	AC_DEFINE(OPT_PASTE64,0)
687fi
688
689AC_MSG_CHECKING(if you want support for pty-handshaking)
690
691CF_ARG_DISABLE(pty-handshake,
692	[  --disable-pty-handshake disable pty-handshake support],
693	[enable_pty_handshake=no],
694	[enable_pty_handshake=yes])
695AC_MSG_RESULT($enable_pty_handshake)
696if test "$enable_pty_handshake" = yes ; then
697	AC_DEFINE(OPT_PTY_HANDSHAKE,1)
698else
699	AC_DEFINE(OPT_PTY_HANDSHAKE,0)
700fi
701
702AC_MSG_CHECKING(if you want support for mouse in readline applications)
703CF_ARG_ENABLE(readline-mouse,
704	[  --enable-readline-mouse enable support for mouse in readline applications],
705	[enable_readline_mouse=yes],
706	[enable_readline_mouse=no])
707AC_MSG_RESULT($enable_readline_mouse)
708if test "$enable_readline_mouse" = yes ; then
709	AC_DEFINE(OPT_READLINE,1)
710fi
711
712AC_MSG_CHECKING(if you want support for regular-expression selections)
713CF_ARG_DISABLE(regex,
714	[  --disable-regex         disable regular-expression selections],
715	[enable_regex=no],
716	[enable_regex=yes])
717AC_MSG_RESULT($enable_regex)
718if test "$enable_regex" = yes ; then
719	CF_WITH_PCRE
720	if test "$with_pcre" = no ; then
721		CF_REGEX
722		if test "X$cf_cv_regex_hdrs" != "Xregex.h" ; then
723			AC_MSG_ERROR(Only POSIX or PCRE regular expressions are supported)
724		fi
725	fi
726	AC_DEFINE(OPT_SELECT_REGEX)
727fi
728
729AC_MSG_CHECKING(if you want support for right-scrollbar)
730CF_ARG_DISABLE(rightbar,
731	[  --disable-rightbar      disable right-scrollbar support],
732	[enable_rightbar=no],
733	[enable_rightbar=yes])
734AC_MSG_RESULT($enable_rightbar)
735if test "$enable_rightbar" = yes ; then
736	AC_DEFINE(SCROLLBAR_RIGHT)
737fi
738
739AC_MSG_CHECKING(if you want check for redundant name-change)
740CF_ARG_DISABLE(samename,
741	[  --disable-samename      disable check for redundant name-change],
742	[enable_samename=no],
743	[enable_samename=yes])
744AC_MSG_RESULT($enable_samename)
745test "$enable_samename" = no && AC_DEFINE(OPT_SAME_NAME,0)
746
747AC_MSG_CHECKING(if you want support for session management)
748CF_ARG_DISABLE(session-mgt,
749	[  --disable-session-mgt   disable support for session management],
750	[enable_session_mgt=no],
751	[enable_session_mgt=yes])
752AC_MSG_RESULT($enable_session_mgt)
753test "$enable_session_mgt" = no && AC_DEFINE(OPT_SESSION_MGT,0)
754
755AC_MSG_CHECKING(if you want to use termcap function-keys)
756CF_ARG_DISABLE(tcap-fkeys,
757	[  --disable-tcap-fkeys    disable termcap function-keys support],
758	[enable_tcap_fkeys=no],
759	[enable_tcap_fkeys=yes])
760AC_MSG_RESULT($enable_tcap_fkeys)
761test "$enable_tcap_fkeys" = yes && AC_DEFINE(OPT_TCAP_FKEYS,1)
762
763AC_MSG_CHECKING(if you want to use termcap-query/report)
764CF_ARG_DISABLE(tcap-query,
765	[  --disable-tcap-query    disable compiled-in termcap-query support],
766	[enable_tcap_query=no],
767	[enable_tcap_query=yes])
768AC_MSG_RESULT($enable_tcap_query)
769test "$enable_tcap_query" = yes && AC_DEFINE(OPT_TCAP_QUERY,1)
770
771AC_MSG_CHECKING(if you want support for tek4014)
772CF_ARG_DISABLE(tek4014,
773	[  --disable-tek4014       disable tek4014 emulation],
774	[enable_tek4014=no],
775	[enable_tek4014=yes])
776AC_MSG_RESULT($enable_tek4014)
777if test "$enable_tek4014" = no ; then
778	AC_DEFINE(OPT_TEK4014,0)
779else
780	EXTRAHDRS="$EXTRAHDRS Tekparse.h"
781	EXTRASRCS="$EXTRASRCS TekPrsTbl.c Tekproc.c"
782	EXTRAOBJS="$EXTRAOBJS TekPrsTbl.o Tekproc.o"
783fi
784
785AC_MSG_CHECKING(if you want pulldown menus with a toolbar)
786CF_ARG_ENABLE(toolbar,
787	[  --enable-toolbar        compile-in toolbar for pulldown menus],
788	[enable_toolbar=yes],
789	[enable_toolbar=no])
790AC_MSG_RESULT($enable_toolbar)
791if test "$enable_toolbar" = yes ; then
792	AC_DEFINE(OPT_TOOLBAR,1)
793fi
794
795AC_MSG_CHECKING(if you want VT52 emulation)
796CF_ARG_DISABLE(vt52,
797	[  --disable-vt52          disable VT52 emulation],
798	[enable_vt52=no],
799	[enable_vt52=yes])
800AC_MSG_RESULT($enable_vt52)
801test "$enable_vt52" = no && AC_DEFINE(OPT_VT52_MODE,0)
802
803AC_MSG_CHECKING(if you want to use mini-luit/Latin9 built-in support)
804CF_ARG_ENABLE(mini-luit,
805	[  --enable-mini-luit      enable mini-luit (built-in Latin9 support)],
806	[enable_mini_luit=yes],
807	[enable_mini_luit=no])
808AC_MSG_RESULT($enable_mini_luit)
809if test "$enable_mini_luit" = yes ; then
810	AC_DEFINE(OPT_MINI_LUIT,1)
811fi
812
813AC_MSG_CHECKING(if you want to use luit)
814CF_ARG_ENABLE(luit,
815	[  --enable-luit           enable luit filter (Unicode translation)],
816	[enable_luit=yes],
817	[enable_luit=$enable_mini_luit])
818AC_MSG_RESULT($enable_luit)
819if test "$enable_luit" = yes ; then
820	AC_DEFINE(OPT_LUIT_PROG,1)
821	CF_PATH_PROG(LUIT,xterm-filter,bluit luit)
822fi
823
824AC_MSG_CHECKING(if you want wide-character support)
825CF_ARG_OPTION(wide-chars,
826	[  --enable-wide-chars     enable wide-character support],
827	[enable_wchar=yes],
828	[enable_wchar=$enable_luit],
829	[$enable_luit])
830AC_MSG_RESULT($enable_wchar)
831
832AC_MSG_CHECKING(if you want only 16-bit character support)
833CF_ARG_ENABLE(16bit-chars,
834	[  --enable-16bit-chars    enable 16-bit character support],
835	[enable_16bit_chars=yes],
836	[enable_16bit_chars=no])
837AC_MSG_RESULT($enable_16bit_chars)
838
839if test "$enable_16bit_chars" = yes ; then
840	AC_DEFINE(OPT_WIDER_ICHAR,0)
841	enable_wchar=yes
842fi
843
844if test "$enable_wchar" = yes ; then
845	AC_DEFINE(OPT_WIDE_CHARS,1)
846	EXTRAHDRS="$EXTRAHDRS charclass.h precompose.h wcwidth.h"
847	EXTRASRCS="$EXTRASRCS charclass.c precompose.c wcwidth.c"
848	EXTRAOBJS="$EXTRAOBJS charclass.o precompose.o wcwidth.o"
849fi
850
851AC_MSG_CHECKING(if you want dynamic-abbreviation support)
852CF_ARG_ENABLE(dabbrev,
853	[  --enable-dabbrev        enable dynamic-abbreviation support],
854	[enable_dabbrev=yes],
855	[enable_dabbrev=no])
856AC_MSG_RESULT($enable_dabbrev)
857if test "$enable_dabbrev" = yes ; then
858	AC_DEFINE(OPT_DABBREV,1)
859fi
860
861AC_MSG_CHECKING(if you want DECterm Locator support)
862CF_ARG_ENABLE(dec-locator,
863	[  --enable-dec-locator    enable DECterm Locator support],
864	[enable_dec_locator=yes],
865	[enable_dec_locator=no])
866AC_MSG_RESULT($enable_dec_locator)
867if test "$enable_dec_locator" = yes ; then
868	AC_DEFINE(OPT_DEC_LOCATOR,1)
869fi
870
871AC_MSG_CHECKING(if you want VT420 rectangle support)
872CF_ARG_DISABLE(rectangles,
873	[  --disable-rectangles    disable VT420 rectangle support],
874	[enable_rectangles=no],
875	[enable_rectangles=yes])
876AC_MSG_RESULT($enable_rectangles)
877if test "$enable_rectangles" = yes ; then
878	AC_DEFINE(OPT_DEC_RECTOPS,1)
879fi
880
881AC_MSG_CHECKING(if you want -ziconbeep option)
882CF_ARG_DISABLE(ziconbeep,
883	[  --disable-ziconbeep     disable -ziconbeep option],
884	[enable_ziconbeep=no],
885	[enable_ziconbeep=yes])
886AC_MSG_RESULT($enable_ziconbeep)
887test "$enable_ziconbeep" = no && AC_DEFINE(OPT_ZICONBEEP,0)
888
889###############################################################################
890CF_HELP_MESSAGE(Testing/development Options:)
891
892AC_MSG_CHECKING(if you want debugging traces)
893CF_ARG_ENABLE(trace,
894	[  --enable-trace          test: set to enable debugging traces],
895	[enable_trace=yes],
896	[enable_trace=no])
897AC_MSG_RESULT($enable_trace)
898if test "$enable_trace" = yes ; then
899	AC_DEFINE(OPT_TRACE)
900	EXTRASRCS="$EXTRASRCS trace.c"
901	EXTRAOBJS="$EXTRAOBJS trace.o"
902fi
903
904AC_MSG_CHECKING(if you want to test memory leaks)
905CF_ARG_DISABLE(leaks,
906	[  --disable-leaks         test: set to test memory leaks],
907	[disable_leaks=yes],
908	[disable_leaks=no])
909AC_MSG_RESULT($disable_leaks)
910if test "$disable_leaks" = yes ; then
911	AC_DEFINE(NO_LEAKS)
912fi
913
914CF_DISABLE_ECHO
915
916AC_MSG_CHECKING(if you want magic cookie emulation)
917CF_ARG_ENABLE(xmc-glitch,
918	[  --enable-xmc-glitch     test: enable xmc magic-cookie emulation],
919	[enable_xmc=yes],
920	[enable_xmc=no])
921AC_MSG_RESULT($enable_xmc)
922if test "$enable_xmc" = yes ; then
923	AC_DEFINE(OPT_XMC_GLITCH,1)
924	EXTRASRCS="$EXTRASRCS testxmc.c"
925	EXTRAOBJS="$EXTRAOBJS testxmc.o"
926fi
927
928dnl FIXME - extra test needed to make tcap-fkeys work on HPUX
929AC_CHECK_FUNCS(tigetstr)
930
931dnl only check for ncurses' use_extended_names if really not using termcap
932if test -n "$cf_cv_lib_part_tgetent"; then
933    AC_CHECK_FUNCS(use_extended_names)
934fi
935
936if test -n "$GCC" ; then
937AC_MSG_CHECKING(if you want to turn on gcc warnings)
938CF_ARG_ENABLE(warnings,
939	[  --enable-warnings       test: turn on GCC compiler warnings],
940	[with_warnings=yes],
941	[with_warnings=no])
942AC_MSG_RESULT($with_warnings)
943if test "$with_warnings" = yes
944then
945	CF_GCC_ATTRIBUTES
946	CF_GCC_WARNINGS(Wdeclaration-after-statement Wextra Wno-unknown-pragmas Wswitch-enum)
947fi
948fi
949
950AC_SUBST(EXTRA_CFLAGS)
951AC_SUBST(CHARPROC_DEPS)
952AC_SUBST(EXTRAHDRS)
953AC_SUBST(EXTRASRCS)
954AC_SUBST(EXTRAOBJS)
955
956test "$disable_setuid" = yes && AC_DEFINE(DISABLE_SETUID)
957test "$disable_setgid" = yes && AC_DEFINE(DISABLE_SETGID)
958
959if test $disable_setuid = yes ; then
960	MAY_SETUID="#"
961	NOT_SETUID=
962elif test $disable_setgid = yes ; then
963	MAY_SETUID="#"
964	NOT_SETUID=
965else
966	MAY_SETUID=
967	NOT_SETUID="#"
968fi
969
970AC_SUBST(MAY_SETUID)
971AC_SUBST(NOT_SETUID)
972
973###	remove from CPPFLAGS the optional features we define in xtermcfg.h
974###	or other conflicting symbols that may be defined via imake:
975for cf_def in \
976	__STDC__ \
977	ALLOWLOGGING \
978	ALLOWLOGFILEEXEC \
979	OPT_LUIT_PROG \
980	OPT_WIDE_CHARS \
981	SCROLLBAR_RIGHT \
982	USE_TTY_GROUP \
983	USE_UTEMPTER \
984	XRENDERFONT
985do
986	CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-D$cf_def//`
987done
988
989CF_MAKE_TAGS
990CF_DISABLE_RPATH_HACK
991
992# Force plink.sh to not trim pcre's libraries, which have the same symbol
993# names as the system regexp.
994if test "$with_pcre" != no
995then
996	LIBS=`echo "$LIBS" | sed -e 's/-lpcre/-kpcre/g'`
997fi
998
999###	output Makefile and xtermcfg.h
1000AC_OUTPUT(Makefile)
1001