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