configure.in revision e0a2b6df
1dnl $XTermId: configure.in,v 1.322 2014/01/16 01:44:05 tom Exp $
2dnl
3dnl -----------------------------------------------------------------------------
4dnl this file is part of xterm
5dnl
6dnl Copyright 1997-2013,2014 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.52.20030208)
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
54CF_PROG_CC
55AC_PROG_CPP
56AC_PROG_AWK
57CF_PROG_GROFF
58AC_PROG_INSTALL
59AC_PROG_LN_S
60AC_ARG_PROGRAM
61AC_CHECK_PROGS(LINT, tdlint lint alint)
62
63###	checks for compiler characteristics
64CF_XOPEN_SOURCE
65CF_SIGWINCH
66
67###	checks for header files
68AC_CHECK_HEADERS( \
69ncurses/curses.h \
70ncurses/term.h \
71stdlib.h \
72sys/ptem.h sys/ttydefaults.h \
73term.h \
74termios.h \
75unistd.h \
76wchar.h \
77)
78AC_HEADER_TIME
79AM_LANGINFO_CODESET
80
81###	checks for typedefs
82CF_SIG_ATOMIC_T
83AC_CHECK_TYPE(time_t, long)
84CF_TYPE_CC_T
85AC_TYPE_MODE_T
86AC_TYPE_PID_T
87AC_TYPE_UID_T
88AC_TYPE_OFF_T
89
90###	checks for library functions
91AC_CHECK_FUNCS( \
92	gethostname \
93	getlogin \
94	initgroups \
95	mkdtemp \
96	putenv \
97	unsetenv \
98	sched_yield \
99	setpgid \
100	strftime \
101	tcgetattr \
102	waitpid \
103	wcswidth \
104	wcwidth )
105CF_UTMP
106CF_STRUCT_LASTLOG
107CF_POSIX_SAVED_IDS
108
109CF_HELP_MESSAGE(Compile/Install Options:)
110CF_FUNC_TGETENT
111
112CF_WITH_APP_CLASS(XTerm)
113CF_WITH_APP_DEFAULTS
114CF_WITH_ICON_NAME(xterm-color)
115CF_WITH_ICON_SYMLINK(xterm)
116CF_WITH_ICON_THEME([icons/$ICON_NAME icons/${ICON_NAME}_48x48],,,icons/${ICON_NAME}_48x48)
117CF_DISABLE_DESKTOP(xterm)
118CF_WITH_DESKTOP_CATEGORY(xterm,
119	[*rxvt*|konsole|*-terminal],
120	[System|TerminalEmulator|Utility|*])
121
122AC_MSG_CHECKING(for install-permissions reference)
123AC_ARG_WITH(reference,
124	[  --with-reference=XXX    program to use as permissions-reference],
125	[with_reference=$withval],
126	[with_reference=xterm])
127AC_MSG_RESULT($with_reference)
128
129with_full_paths=yes
130CF_PATH_PROG(XTERM_PATH,$with_reference)
131
132# If any of --program-prefix, --program-suffix or --program-transform-name is
133# given, accept an option tell the makefile to create a symbolic link, e.g.,
134# to "xterm" on install.
135XTERM_SYMLINK=NONE
136AC_SUBST(XTERM_SYMLINK)
137if test "$program_transform_name" != "'s,,,'" ; then
138cf_name=`echo "$program_transform_name" | sed -e '[s,\\$\\$,$,g]'`
139cf_name=`echo xterm |sed -e "$cf_name"`
140AC_MSG_CHECKING(for symbolic link to create to $cf_name)
141AC_ARG_WITH(xterm-symlink,
142	[  --with-xterm-symlink=XXX make symbolic link to installed xterm],
143	[with_symlink=$withval],
144	[with_symlink=xterm])
145AC_MSG_RESULT($with_symlink)
146test "$with_symlink" = yes && with_symlink=xterm
147test -n "$with_symlink" && \
148	test "$with_symlink" != no && \
149	test "$with_symlink" != $cf_name && \
150	XTERM_SYMLINK="$with_symlink"
151fi
152
153AC_MSG_CHECKING(if you want to disable openpty)
154CF_ARG_DISABLE(openpty,
155	[  --disable-openpty       disable openpty, prefer other interfaces],
156	[disable_openpty=yes],
157	[disable_openpty=no],
158	no)
159AC_MSG_RESULT($disable_openpty)
160
161AC_MSG_CHECKING(if you want to disable setuid)
162CF_ARG_DISABLE(setuid,
163	[  --disable-setuid        disable setuid in xterm, do not install setuid/setgid],
164	[disable_setuid=yes],
165	[disable_setuid=no],
166	no)
167AC_MSG_RESULT($disable_setuid)
168
169AC_MSG_CHECKING(if you want to disable setgid)
170CF_ARG_DISABLE(setgid,
171	[  --disable-setgid        disable setgid in xterm, do not install setuid/setgid],
172	[disable_setgid=yes],
173	[disable_setgid=no],
174	no)
175AC_MSG_RESULT($disable_setgid)
176
177AC_MSG_CHECKING(if you want to run xterm setuid to a given user)
178AC_ARG_WITH(setuid,
179	[  --with-setuid=XXX       use the given setuid user],
180	[use_given_setuid=$withval],
181	[use_given_setuid=no])
182AC_MSG_RESULT($use_given_setuid)
183
184if test "$use_given_setuid" != no ; then
185	if test "$use_given_setuid" = yes ; then
186		cf_cv_given_setuid=root
187	else
188		cf_cv_given_setuid=$use_given_setuid
189	fi
190	# inherit SINSTALL_OPTS from environment to allow packager to customize it.
191	SINSTALL_OPTS="$SINSTALL_OPTS u+s -u $cf_cv_given_setuid"
192fi
193
194AC_MSG_CHECKING(if you want to run xterm setgid to match utmp/utmpx file)
195AC_ARG_WITH(utmp-setgid,
196	[  --with-utmp-setgid=XXX  use setgid to match utmp/utmpx file],
197	[use_utmp_setgid=$withval],
198	[use_utmp_setgid=no])
199AC_MSG_RESULT($use_utmp_setgid)
200
201if test "$use_utmp_setgid" != no ; then
202	if test "$use_utmp_setgid" = yes ; then
203		CF_UTMP_GROUP
204	else
205		cf_cv_utmp_group=$use_utmp_setgid
206	fi
207	if test "$cf_cv_posix_saved_ids" != yes ; then
208		AC_MSG_ERROR(Your system does not support POSIX saved-ids)
209	fi
210	AC_DEFINE(USE_UTMP_SETGID,1,[Define to 1 if we should use setgid to access utmp/utmpx])
211	SINSTALL_OPTS="$SINSTALL_OPTS g+s -g $cf_cv_utmp_group"
212fi
213
214AC_SUBST(SINSTALL_OPTS)
215
216AC_MSG_CHECKING(if you want to link with utempter)
217AC_ARG_WITH(utempter,
218	[  --with-utempter         use utempter library for access to utmp],
219	[use_utempter=$withval],
220	[use_utempter=no])
221AC_MSG_RESULT($use_utempter)
222
223if test "$use_utempter" = yes ; then
224	CF_UTEMPTER
225	test "$cf_cv_have_utempter" != yes && use_utempter=no
226else
227	use_utempter=no
228fi
229
230# Some configurations permit (or require) either setuid or setgid mode.
231# Let the user decide.
232if test "$use_utempter" = yes ; then
233	if test "${enable_setuid+set}" != set ; then
234		disable_setuid=yes
235		CF_VERBOSE([No --disable-setuid option given, force to yes])
236	fi
237fi
238
239###	checks for external data
240CF_ERRNO
241CF_TTY_GROUP
242
243###	checks for system services and user specified options
244
245CF_POSIX_WAIT
246CF_SYSV
247CF_SVR4
248CF_X_TOOLKIT
249
250AC_CHECK_HEADERS( \
251	X11/DECkeysym.h \
252	X11/Sunkeysym.h \
253	X11/XF86keysym.h \
254	X11/XKBlib.h \
255	X11/Xpoll.h \
256	X11/extensions/XKB.h \
257	)
258
259CF_WITH_XPM
260CF_X_ATHENA
261CF_TYPE_FD_MASK
262CF_TERMIO_C_ISPEED
263
264# If we notice Xcursor, there is a workaround needed.
265AC_CHECK_LIB(Xcursor, XcursorGetTheme,[AC_DEFINE(HAVE_LIB_XCURSOR)])
266
267LIBS="$LIBS $X_EXTRA_LIBS"
268
269CF_FUNC_GRANTPT
270CF_XKB_QUERY_EXTENSION
271CF_XKB_KEYCODE_TO_KEYSYM
272CF_XKB_BELL_EXT
273
274AC_CHECK_FUNCS(Xutf8LookupString, [],[
275	EXTRAHDRS="$EXTRAHDRS xutf8.h"
276	EXTRASRCS="$EXTRASRCS xutf8.c"
277	EXTRAOBJS="$EXTRAOBJS xutf8.o"
278])
279
280CF_WITH_IMAKE_CFLAGS($(MAIN_DEFINES) $(VENDORMANDEFS))
281
282# If we have already established that there is a full termcap implementation,
283# suppress the definitions for terminfo that we make have imported from the
284# imake-file.
285if test "x$cf_cv_lib_tgetent" != xno || test "x$cf_cv_lib_part_tgetent" != xno ; then
286	case "$IMAKE_CFLAGS" in
287	*-DUSE_TERMINFO\ -DHAVE_TIGETSTR*)
288		CF_UNDO_CFLAGS(IMAKE_CFLAGS,terminfo,[-DUSE_TERMINFO[[ 	]]*-DHAVE_TIGETSTR[[ 	]]*])
289		CF_UNDO_CFLAGS(CPPFLAGS,terminfo,[-DUSE_TERMINFO[[ 	]]*-DHAVE_TIGETSTR[[ 	]]*])
290		;;
291	esac
292fi
293
294CF_HELP_MESSAGE(Terminal Configuration:)
295
296AC_MSG_CHECKING(for default terminal-id)
297AC_ARG_WITH(terminal-id,
298	[  --with-terminal-id=V    set default decTerminalID (default: vt420)],
299	[default_termid=$withval],
300	[default_termid=vt420])
301AC_MSG_RESULT($default_termid)
302case $default_termid in
303vt*)	default_termid=`echo $default_termid | sed -e 's/^..//'`
304	;;
305esac
306AC_DEFINE_UNQUOTED(DFT_DECID,"$default_termid",[default terminal-id])
307AC_SUBST(default_termid)
308
309AC_MSG_CHECKING(for default terminal-type)
310AC_ARG_WITH(terminal-type,
311	[  --with-terminal-type=T  set default $TERM (default: xterm)],
312	[default_TERM=$withval],
313	[default_TERM=xterm])
314AC_MSG_RESULT($default_TERM)
315AC_DEFINE_UNQUOTED(DFT_TERMTYPE,"$default_TERM",[default terminal-type])
316AC_SUBST(default_TERM)
317
318###############################################################################
319AC_MSG_CHECKING(if backarrow-key should be BS)
320CF_ARG_DISABLE(backarrow-key,
321	[  --enable-backarrow-key  set default backarrowKey resource (default: true)],
322	[backarrow_is_bs=$enableval],
323	[backarrow_is_bs=yes])
324CF_XBOOL_RESULT(DEF_BACKARO_BS,backarrow_is_bs,[Define to 1 if backarrow-key should be BS])
325
326AC_MSG_CHECKING(if backarrow-key should be treated as erase)
327CF_ARG_ENABLE(backarrow-is-erase,
328	[  --enable-backarrow-is-erase set default backarrowKeyIsErase resource (default: false)],
329	[backarrow_is_erase=$enableval],
330	[backarrow_is_erase=no])
331CF_XBOOL_RESULT(DEF_BACKARO_ERASE,backarrow_is_erase,[Define to 1 if backarrow-key should be treated as erase])
332
333AC_MSG_CHECKING(for default backspace/DEL setting)
334AC_ARG_ENABLE(delete-is-del,
335	[  --enable-delete-is-del  set default deleteIsDEL resource (default: maybe)],
336	[delete_is_del=$enableval],
337	[delete_is_del=maybe])
338CF_XBOOL_RESULT(DEFDELETE_DEL,delete_is_del,[Define to 1 if default backspace/DEL setting is DEL])
339
340AC_MSG_CHECKING(if alt should send ESC)
341CF_ARG_ENABLE(alt-sends-esc,
342	[  --enable-alt-sends-esc  set default altSendsEscape resource (default: no)],
343	[alt_sends_esc=$enableval],
344	[alt_sends_esc=no])
345CF_XBOOL_RESULT(DEF_ALT_SENDS_ESC,alt_sends_esc,[Define to 1 if alt should send ESC])
346
347AC_MSG_CHECKING(if meta should send ESC)
348CF_ARG_ENABLE(meta-sends-esc,
349	[  --enable-meta-sends-esc set default metaSendsEscape resource (default: no)],
350	[meta_sends_esc=$enableval],
351	[meta_sends_esc=no])
352CF_XBOOL_RESULT(DEF_META_SENDS_ESC,meta_sends_esc,[Define to 1 if meta should send ESC])
353
354###############################################################################
355AC_CHECK_PROG(cf_tic_prog,tic,yes,no)
356if test "$cf_tic_prog" = yes ; then
357	AC_MSG_CHECKING(for private terminfo-directory)
358	AC_ARG_WITH(own-terminfo,
359		[  --with-own-terminfo=P   set default $TERMINFO (default: from environment)],
360		[TERMINFO_DIR=$withval],
361		[TERMINFO_DIR=${TERMINFO-none}])
362	AC_MSG_RESULT($TERMINFO_DIR)
363	if test "$TERMINFO_DIR" = yes ; then
364		AC_MSG_WARN(no value given)
365	elif test "$TERMINFO_DIR" != none ; then
366		if test -d $TERMINFO_DIR ; then
367			AC_DEFINE_UNQUOTED(OWN_TERMINFO_DIR,"$TERMINFO_DIR",[Define to override default TERMINFO value])
368		else
369			AC_MSG_WARN(not a directory)
370		fi
371	elif test "$prefix" != NONE ; then
372		TERMINFO_DIR='${prefix}/lib/terminfo'
373	elif test -d /usr/lib/terminfo ; then
374		TERMINFO_DIR=/usr/lib/terminfo
375	else
376		TERMINFO_DIR=
377	fi
378	SET_TERMINFO=
379	if test -n "$TERMINFO_DIR" ; then
380		TERMINFO_DIR='$(DESTDIR)'$TERMINFO_DIR
381		SET_TERMINFO='TERMINFO=$(TERMINFO_DIR)'
382	fi
383	no_ticprog=
384else
385	no_ticprog="#"
386	TERMINFO_DIR=
387	SET_TERMINFO=
388fi
389AC_SUBST(no_ticprog)
390AC_SUBST(TERMINFO_DIR)
391AC_SUBST(SET_TERMINFO)
392
393###############################################################################
394CF_HELP_MESSAGE(Optional Features:)
395
396AC_MSG_CHECKING(if you want active-icons)
397CF_ARG_DISABLE(active-icon,
398	[  --disable-active-icon   disable X11R6.3 active-icon feature],
399	[enable_active_icon=no],
400	[enable_active_icon=yes])
401AC_MSG_RESULT($enable_active_icon)
402if test "$enable_active_icon" = no ; then
403	AC_DEFINE(NO_ACTIVE_ICON,1,[Define to 1 to disable X11R6.3 active-icon feature])
404fi
405
406AC_MSG_CHECKING(if you want ANSI color)
407CF_ARG_DISABLE(ansi-color,
408	[  --disable-ansi-color    disable ANSI color],
409	[enable_ansi_color=no],
410	[enable_ansi_color=yes])
411AC_MSG_RESULT($enable_ansi_color)
412test "$enable_ansi_color" = no && AC_DEFINE(OPT_ISO_COLORS,0,[Define to 0 to disable ANSI color])
413
414if test "$enable_ansi_color" = yes ; then
415
416	AC_MSG_CHECKING(if you want 16 colors like aixterm)
417	CF_ARG_DISABLE(16-color,
418		[  --disable-16-color      disable 16-color support],
419		[enable_16_color=no],
420		[enable_16_color=yes])
421	AC_MSG_RESULT($enable_16_color)
422	test "$enable_16_color" = no && AC_DEFINE(OPT_AIX_COLORS,0,[Define to 0 to disable 16-color support])
423
424	AC_MSG_CHECKING(if you want 256 colors)
425	CF_ARG_ENABLE(256-color,
426		[  --enable-256-color      enable 256-color support],
427		[enable_256_color=yes],
428		[enable_256_color=no])
429	AC_MSG_RESULT($enable_256_color)
430	if test "$enable_256_color" = yes ; then
431		CHARPROC_DEPS="$CHARPROC_DEPS 256colres.h"
432		EXTRAHDRS="$EXTRAHDRS 256colres.h"
433		AC_DEFINE(OPT_256_COLORS,1,[Define to 1 to enable 256-color support])
434	else
435	AC_MSG_CHECKING(if you want 88 colors)
436	CF_ARG_ENABLE(88-color,
437		[  --enable-88-color       enable 88-color support],
438		[enable_88_color=yes],
439		[enable_88_color=no])
440	AC_MSG_RESULT($enable_88_color)
441	if test "$enable_88_color" = yes ; then
442		CHARPROC_DEPS="$CHARPROC_DEPS 88colres.h"
443		EXTRAHDRS="$EXTRAHDRS 88colres.h"
444		AC_DEFINE(OPT_88_COLORS,1,[Define to 1 to enable 88-color support])
445	fi
446	fi
447
448fi
449
450AC_MSG_CHECKING(if you want blinking cursor)
451CF_ARG_DISABLE(blink-cursor,
452	[  --disable-blink-cursor  disable support for blinking cursor],
453	[enable_blink_curs=no],
454	[enable_blink_curs=yes])
455AC_MSG_RESULT($enable_blink_curs)
456test "$enable_blink_curs" = no && AC_DEFINE(OPT_BLINK_CURS,0,[Define to 0 to disable support for blinking cursor])
457
458AC_MSG_CHECKING(if you want to ignore Linux's broken palette-strings)
459
460case $host_os in #(vi
461linux*)
462	assume_broken_osc=yes ;; #(vi
463*)
464	assume_broken_osc=no ;;
465esac
466
467CF_ARG_OPTION(broken-osc,
468	[  --enable-broken-osc     allow broken Linux OSC-strings],
469	[enable_broken_osc=$enableval],
470	[enable_broken_osc=$enableval],
471	[$assume_broken_osc])
472AC_MSG_RESULT($enable_broken_osc)
473if test "$enable_broken_osc" = yes ; then
474	AC_DEFINE(OPT_BROKEN_OSC,1,[Define to 1 to allow broken Linux OSC-strings])
475else
476	AC_DEFINE(OPT_BROKEN_OSC,0,[Define to 0 to allow broken Linux OSC-strings])
477fi
478
479AC_MSG_CHECKING(if you want to allow broken string-terminators)
480CF_ARG_ENABLE(broken-st,
481	[  --disable-broken-st     disallow broken string-terminators],
482	[enable_broken_st=no],
483	[enable_broken_st=yes])
484AC_MSG_RESULT($enable_broken_st)
485test "$enable_broken_st" = no && AC_DEFINE(OPT_BROKEN_ST,0,[Define to 0 to disallow broken string-terminators])
486
487AC_MSG_CHECKING(if you want printable 128-159)
488CF_ARG_DISABLE(c1-print,
489	[  --disable-c1-print      disallow -k8 option for printable 128-159],
490	[enable_c1_print=no],
491	[enable_c1_print=yes])
492AC_MSG_RESULT($enable_c1_print)
493test "$enable_c1_print" = no && AC_DEFINE(OPT_C1_PRINT,0,[Define to 0 to disallow -k8 option for printable 128-159])
494
495if test "$enable_ansi_color" = yes ; then
496
497	AC_MSG_CHECKING(if you want bold colors mapped like IBM PC)
498	CF_ARG_DISABLE(bold-color,
499		[  --disable-bold-color    disable PC-style mapping of bold colors],
500		[enable_pc_color=no],
501		[enable_pc_color=yes])
502	AC_MSG_RESULT($enable_pc_color)
503	test "$enable_pc_color" = no && AC_DEFINE(OPT_PC_COLORS,0,[Define to 0 to disable PC-style mapping of bold colors])
504
505	AC_MSG_CHECKING(if you want separate color-classes)
506	CF_ARG_DISABLE(color-class,
507		[  --disable-color-class   disable separate color class resources],
508		[enable_color_class=no],
509		[enable_color_class=yes])
510	AC_MSG_RESULT($enable_color_class)
511	test "$enable_color_class" = no && AC_DEFINE(OPT_COLOR_CLASS,0,[Define to 0 to disable separate color class resources])
512
513	AC_MSG_CHECKING(if you want color-mode enabled by default)
514	CF_ARG_DISABLE(color-mode,
515		[  --disable-color-mode    disable default colorMode resource],
516		[default_colormode=no],
517		[default_colormode=yes])
518	AC_MSG_RESULT($default_colormode)
519	test "$default_colormode" = no && AC_DEFINE(DFT_COLORMODE,0,[Define to 0 if you want color-mode enabled by default])
520
521fi
522
523AC_MSG_CHECKING(if you want support for color highlighting)
524CF_ARG_DISABLE(highlighting,
525	[  --disable-highlighting  disable support for color highlighting],
526	[default_highlight=no],
527	[default_highlight=yes])
528AC_MSG_RESULT($default_highlight)
529test "$default_highlight" = no && AC_DEFINE(OPT_HIGHLIGHT_COLOR,0,[Define to 1 if you want support for color highlighting])
530
531AC_MSG_CHECKING(if you want support for doublesize characters)
532CF_ARG_DISABLE(doublechars,
533	[  --disable-doublechars   disable support for double-size chars],
534	[enable_doublechars=no],
535	[enable_doublechars=yes])
536AC_MSG_RESULT($enable_doublechars)
537test "$enable_doublechars" = no && AC_DEFINE(OPT_DEC_CHRSET,0,[Define to 0 to disable support for double-size chars])
538
539AC_MSG_CHECKING(if you want fallback-support for box characters)
540CF_ARG_DISABLE(boxchars,
541	[  --disable-boxchars      disable fallback-support for box chars],
542	[enable_boxchars=no],
543	[enable_boxchars=yes])
544AC_MSG_RESULT($enable_boxchars)
545test "$enable_boxchars" = no && AC_DEFINE(OPT_BOX_CHARS,0,[Define to 0 to disable fallback-support for box chars])
546
547AC_MSG_CHECKING(if you want to allow spawning new xterms)
548CF_ARG_ENABLE(exec-xterm,
549	[  --enable-exec-xterm     enable "spawn-new-terminal" action],
550	[enable_exec_xterm=yes],
551	[enable_exec_xterm=no])
552AC_MSG_RESULT($enable_exec_xterm)
553if test "$enable_exec_xterm" = yes ; then
554	CF_PROCFS_CWD
555	if test "$cf_cv_procfs_cwd" = no ; then
556		AC_MSG_WARN(no suitable proc filesystem found)
557	else
558		AC_DEFINE_UNQUOTED(PROCFS_ROOT,"$cf_cv_procfs_cwd",[This is defined via the --enable-exec-xterm option])
559		AC_DEFINE(OPT_EXEC_XTERM,1,[Define to 1 to enable "spawn-new-terminal" action])
560	fi
561fi
562
563AC_MSG_CHECKING(if you want to use double-buffering)
564CF_ARG_ENABLE(double-buffer,
565	[  --enable-double-buffer  enable double-buffering],
566	[enable_double_bfr=yes],
567	[enable_double_bfr=no])
568AC_MSG_RESULT($enable_double_bfr)
569if test "$enable_double_bfr" = yes ; then
570	case "x$LIBS" in
571	*Xext*)
572		;;
573	*)
574		CF_X_EXT 
575		;;
576	esac
577	AC_DEFINE(OPT_DOUBLE_BUFFER,1,[Define to 1 to enable double-buffering])
578fi
579
580AC_MSG_CHECKING(if you want to use FreeType library)
581CF_ARG_DISABLE(freetype,
582	[  --disable-freetype      disable freetype library-support],
583	[enable_freetype=no],
584	[enable_freetype=yes])
585AC_MSG_RESULT($enable_freetype)
586if test "$enable_freetype" = yes ; then
587	CF_X_FONTCONFIG
588else
589	CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-DXRENDERFONT//`
590fi
591
592AC_MSG_CHECKING(if you want support for HP-style function keys)
593CF_ARG_ENABLE(hp-fkeys,
594	[  --enable-hp-fkeys       enable support for HP-style function keys],
595	[enable_hp_fkeys=yes],
596	[enable_hp_fkeys=no])
597AC_MSG_RESULT($enable_hp_fkeys)
598if test "$enable_hp_fkeys" = yes ; then
599	AC_DEFINE(OPT_HP_FUNC_KEYS,1,[Define to 1 to enable support for HP-style function keys])
600fi
601
602AC_MSG_CHECKING(if you want support for SCO-style function keys)
603CF_ARG_ENABLE(sco-fkeys,
604	[  --enable-sco-fkeys      enable support for SCO-style function keys],
605	[enable_sco_fkeys=yes],
606	[enable_sco_fkeys=no])
607AC_MSG_RESULT($enable_sco_fkeys)
608if test "$enable_sco_fkeys" = yes ; then
609	AC_DEFINE(OPT_SCO_FUNC_KEYS,1,[Define to 1 to enable support for SCO-style function keys])
610fi
611
612AC_MSG_CHECKING(if you want support for Sun-style function keys)
613CF_ARG_DISABLE(sun-fkeys,
614	[  --disable-sun-fkeys     disable support for Sun-style function keys],
615	[enable_sun_fkeys=no],
616	[enable_sun_fkeys=yes])
617AC_MSG_RESULT($enable_sun_fkeys)
618if test "$enable_sun_fkeys" = no ; then
619	AC_DEFINE(OPT_SUN_FUNC_KEYS,0,[Define to 0 to disable support for Sun-style function keys])
620fi
621
622AC_MSG_CHECKING(if you want saved-lines stored as a FIFO)
623CF_ARG_DISABLE(fifo-lines,
624	[  --disable-fifo-lines    disable FIFO-storage for saved-lines],
625	[enable_fifo_lines=no],
626	[enable_fifo_lines=yes])
627AC_MSG_RESULT($enable_fifo_lines)
628if test "$enable_fifo_lines" = yes ; then
629	AC_DEFINE(OPT_FIFO_LINES,1,[Define to 1 to disable FIFO-storage for saved-lines])
630fi
631
632AC_MSG_CHECKING(if you want support for internationalization)
633CF_ARG_DISABLE(i18n,
634	[  --disable-i18n          disable internationalization],
635	[enable_i18n=no],
636	[enable_i18n=yes])
637AC_MSG_RESULT($enable_i18n)
638if test "$enable_i18n" = no ; then
639	AC_DEFINE(OPT_I18N_SUPPORT,0,[Define to 0 to disable internationalization])
640fi
641
642AC_MSG_CHECKING(if you want support for initial-erase setup)
643CF_ARG_DISABLE(initial-erase,
644	[  --disable-initial-erase disable setup for stty erase],
645	[enable_ie=no],
646	[enable_ie=yes])
647AC_MSG_RESULT($enable_ie)
648if test "$enable_ie" = no ; then
649	AC_DEFINE(OPT_INITIAL_ERASE,0,[Define to 0 to disable setup for stty erase])
650fi
651
652AC_MSG_CHECKING(if you want support for input-method)
653CF_ARG_DISABLE(input-method,
654	[  --disable-input-method  disable input-method],
655	[enable_ximp=no],
656	[enable_ximp=yes])
657AC_MSG_RESULT($enable_ximp)
658CF_INPUT_METHOD
659test "$cf_cv_input_method" = no && enable_ximp=no
660if test "$enable_ximp" = no ; then
661	AC_DEFINE(OPT_INPUT_METHOD,0,[Define to 0 to disable input-method])
662fi
663
664AC_MSG_CHECKING(if you want support for load-vt-fonts)
665CF_ARG_ENABLE(load-vt-fonts,
666	[  --enable-load-vt-fonts  enable load-vt-fonts() action],
667	[enable_load_vt_fonts=yes],
668	[enable_load_vt_fonts=no])
669AC_MSG_RESULT($enable_load_vt_fonts)
670if test "$enable_load_vt_fonts" = yes ; then
671	AC_DEFINE(OPT_LOAD_VTFONTS,1,[Define to 1 to enable load-vt-fonts() action])
672fi
673
674AC_MSG_CHECKING(if you want support for logging)
675CF_ARG_ENABLE(logging,
676	[  --enable-logging        enable logging],
677	[enable_logging=yes],
678	[enable_logging=no])
679AC_MSG_RESULT($enable_logging)
680if test "$enable_logging" = yes ; then
681	AC_DEFINE(ALLOWLOGGING,1,[if you want support for logging])
682	AC_MSG_CHECKING(if you want to allow logging via a pipe)
683	CF_ARG_ENABLE(logfile-exec,
684		[  --enable-logfile-exec   enable exec'd logfile filter],
685		[enable_log_exec=yes],
686		[enable_log_exec=no])
687	AC_MSG_RESULT($enable_log_exec)
688	if test "$enable_log_exec" = yes ; then
689		AC_DEFINE(ALLOWLOGFILEEXEC,1,[if you want to allow logging via a pipe])
690	fi
691fi
692
693AC_MSG_CHECKING(if you want support for iconify/maximize translations)
694CF_ARG_DISABLE(maximize,
695	[  --disable-maximize      disable actions for iconify/deiconify/maximize/restore],
696	[enable_maximize=no],
697	[enable_maximize=yes])
698AC_MSG_RESULT($enable_maximize)
699test "$enable_maximize" = no && AC_DEFINE(OPT_MAXIMIZE,0,[Define to 0 to disable actions for iconify/deiconify/maximize/restore])
700
701AC_MSG_CHECKING(if you want NumLock to override keyboard tables)
702CF_ARG_DISABLE(num-lock,
703	[  --disable-num-lock      disable NumLock keypad support],
704	[enable_numlock=no],
705	[enable_numlock=yes])
706AC_MSG_RESULT($enable_numlock)
707test "$enable_numlock" = no && AC_DEFINE(OPT_NUM_LOCK,0,[Define to 0 to disable NumLock keypad support])
708
709AC_MSG_CHECKING(if you want support for get/set of base64 selection data)
710
711CF_ARG_DISABLE(paste64,
712	[  --disable-paste64       disable get/set base64 selection data],
713	[enable_paste64=no],
714	[enable_paste64=yes])
715AC_MSG_RESULT($enable_paste64)
716if test "$enable_paste64" = yes ; then
717	AC_DEFINE(OPT_PASTE64,1,[Define to 1 to disable get/set base64 selection data])
718else
719	AC_DEFINE(OPT_PASTE64,0,[Define to 0 to disable get/set base64 selection data])
720fi
721
722AC_MSG_CHECKING(if you want support for pty-handshaking)
723
724CF_ARG_DISABLE(pty-handshake,
725	[  --disable-pty-handshake disable pty-handshake support],
726	[enable_pty_handshake=no],
727	[enable_pty_handshake=yes])
728AC_MSG_RESULT($enable_pty_handshake)
729if test "$enable_pty_handshake" = yes ; then
730	AC_DEFINE(OPT_PTY_HANDSHAKE,1,[Define to 1 to disable pty-handshake support])
731else
732	AC_DEFINE(OPT_PTY_HANDSHAKE,0,[Define to 0 to disable pty-handshake support])
733fi
734
735AC_MSG_CHECKING(if you want support for mouse in readline applications)
736CF_ARG_ENABLE(readline-mouse,
737	[  --enable-readline-mouse enable support for mouse in readline applications],
738	[enable_readline_mouse=yes],
739	[enable_readline_mouse=no])
740AC_MSG_RESULT($enable_readline_mouse)
741if test "$enable_readline_mouse" = yes ; then
742	AC_DEFINE(OPT_READLINE,1,[Define to 1 to enable support for mouse in readline applications])
743fi
744
745AC_MSG_CHECKING(if you want support for regular-expression selections)
746CF_ARG_DISABLE(regex,
747	[  --disable-regex         disable regular-expression selections],
748	[enable_regex=no],
749	[enable_regex=yes])
750AC_MSG_RESULT($enable_regex)
751if test "$enable_regex" = yes ; then
752	CF_WITH_PCRE
753	if test "$with_pcre" = no ; then
754		CF_REGEX
755		if test "X$cf_cv_regex_hdrs" != "Xregex.h" ; then
756			AC_MSG_ERROR(Only POSIX or PCRE regular expressions are supported)
757		fi
758	fi
759	AC_DEFINE(OPT_SELECT_REGEX,1,[Define to 1 to enable regular-expression selections])
760fi
761
762AC_MSG_CHECKING(if you want support for right-scrollbar)
763CF_ARG_DISABLE(rightbar,
764	[  --disable-rightbar      disable right-scrollbar support],
765	[enable_rightbar=no],
766	[enable_rightbar=yes])
767AC_MSG_RESULT($enable_rightbar)
768if test "$enable_rightbar" = yes ; then
769	AC_DEFINE(SCROLLBAR_RIGHT,1,[Define to 1 to enable right-scrollbar support])
770fi
771
772AC_MSG_CHECKING(if you want check for redundant name-change)
773CF_ARG_DISABLE(samename,
774	[  --disable-samename      disable check for redundant name-change],
775	[enable_samename=no],
776	[enable_samename=yes])
777AC_MSG_RESULT($enable_samename)
778test "$enable_samename" = no && AC_DEFINE(OPT_SAME_NAME,0,[Define to 0 to disable check for redundant name-change])
779
780AC_MSG_CHECKING(if you want support for selection-actions)
781CF_ARG_DISABLE(selection-ops,
782	[  --disable-selection-ops disable selection-action operations],
783	[enable_selection_ops=no],
784	[enable_selection_ops=yes])
785AC_MSG_RESULT($enable_selection_ops)
786test "$enable_selection_ops" = no && AC_DEFINE(OPT_SELECTION_OPS,0,[Define to 0 disable selection-action operations])
787
788AC_MSG_CHECKING(if you want support for session management)
789CF_ARG_DISABLE(session-mgt,
790	[  --disable-session-mgt   disable support for session management],
791	[enable_session_mgt=no],
792	[enable_session_mgt=yes])
793AC_MSG_RESULT($enable_session_mgt)
794test "$enable_session_mgt" = no && AC_DEFINE(OPT_SESSION_MGT,0,[Define to 0 to disable support for session management])
795
796AC_MSG_CHECKING(if you want to use termcap function-keys)
797CF_ARG_DISABLE(tcap-fkeys,
798	[  --disable-tcap-fkeys    disable termcap function-keys support],
799	[enable_tcap_fkeys=no],
800	[enable_tcap_fkeys=yes])
801AC_MSG_RESULT($enable_tcap_fkeys)
802test "$enable_tcap_fkeys" = yes && AC_DEFINE(OPT_TCAP_FKEYS,1,[Define to 1 to disable termcap function-keys support])
803
804AC_MSG_CHECKING(if you want to use termcap-query/report)
805CF_ARG_DISABLE(tcap-query,
806	[  --disable-tcap-query    disable compiled-in termcap-query support],
807	[enable_tcap_query=no],
808	[enable_tcap_query=yes])
809AC_MSG_RESULT($enable_tcap_query)
810test "$enable_tcap_query" = yes && AC_DEFINE(OPT_TCAP_QUERY,1,[Define to 1 to disable compiled-in termcap-query support])
811
812AC_MSG_CHECKING(if you want support for tek4014)
813CF_ARG_DISABLE(tek4014,
814	[  --disable-tek4014       disable tek4014 emulation],
815	[enable_tek4014=no],
816	[enable_tek4014=yes])
817AC_MSG_RESULT($enable_tek4014)
818if test "$enable_tek4014" = no ; then
819	AC_DEFINE(OPT_TEK4014,0,[Define to 0 to disable tek4014 emulation])
820else
821	EXTRAHDRS="$EXTRAHDRS Tekparse.h"
822	EXTRASRCS="$EXTRASRCS TekPrsTbl.c Tekproc.c"
823	EXTRAOBJS="$EXTRAOBJS TekPrsTbl.o Tekproc.o"
824fi
825
826AC_MSG_CHECKING(if you want pulldown menus with a toolbar)
827CF_ARG_ENABLE(toolbar,
828	[  --enable-toolbar        compile-in toolbar for pulldown menus],
829	[enable_toolbar=yes],
830	[enable_toolbar=no])
831AC_MSG_RESULT($enable_toolbar)
832if test "$enable_toolbar" = yes ; then
833	AC_DEFINE(OPT_TOOLBAR,1,[Define to 1 to compile-in toolbar for pulldown menus])
834fi
835
836AC_MSG_CHECKING(if you want VT52 emulation)
837CF_ARG_DISABLE(vt52,
838	[  --disable-vt52          disable VT52 emulation],
839	[enable_vt52=no],
840	[enable_vt52=yes])
841AC_MSG_RESULT($enable_vt52)
842test "$enable_vt52" = no && AC_DEFINE(OPT_VT52_MODE,0,[Define to 0 to disable VT52 emulation])
843
844AC_MSG_CHECKING(if you want wide-character support)
845CF_ARG_DISABLE(wide-chars,
846	[  --disable-wide-chars    disable wide-character support],
847	[enable_wchar=no],
848	[enable_wchar=yes])
849AC_MSG_RESULT($enable_wchar)
850
851AC_MSG_CHECKING(if you want only 16-bit character support)
852CF_ARG_ENABLE(16bit-chars,
853	[  --enable-16bit-chars    enable 16-bit character support],
854	[enable_16bit_chars=yes],
855	[enable_16bit_chars=no])
856AC_MSG_RESULT($enable_16bit_chars)
857
858if test "$enable_16bit_chars" = yes ; then
859	AC_DEFINE(OPT_WIDER_ICHAR,0,[Define to 0 to enable 16-bit character support])
860	enable_wchar=yes
861fi
862
863if test "$enable_wchar" = yes ; then
864
865AC_MSG_CHECKING(if you want to use mini-luit/Latin9 built-in support)
866CF_ARG_ENABLE(mini-luit,
867	[  --enable-mini-luit      enable mini-luit (built-in Latin9 support)],
868	[enable_mini_luit=yes],
869	[enable_mini_luit=no])
870AC_MSG_RESULT($enable_mini_luit)
871if test "$enable_mini_luit" = yes ; then
872	AC_DEFINE(OPT_MINI_LUIT,1,[Define to 1 to enable mini-luit (built-in Latin9 support)])
873fi
874
875AC_MSG_CHECKING(if you want to use luit)
876CF_ARG_DISABLE(luit,
877	[  --disable-luit          enable luit filter (Unicode translation)],
878	[enable_luit=no],
879	[enable_luit=yes])
880AC_MSG_RESULT($enable_luit)
881if test "$enable_luit" = yes ; then
882	AC_DEFINE(OPT_LUIT_PROG,1,[Define to 1 to enable luit filter (Unicode translation)])
883	CF_PATH_PROG(LUIT,xterm-filter,bluit luit)
884fi
885
886	AC_DEFINE(OPT_WIDE_CHARS,1,[Define to 1 to enable wide-character support])
887	EXTRAHDRS="$EXTRAHDRS charclass.h precompose.h wcwidth.h"
888	EXTRASRCS="$EXTRASRCS charclass.c precompose.c wcwidth.c"
889	EXTRAOBJS="$EXTRAOBJS charclass.o precompose.o wcwidth.o"
890fi
891
892AC_MSG_CHECKING(if you want dynamic-abbreviation support)
893CF_ARG_ENABLE(dabbrev,
894	[  --enable-dabbrev        enable dynamic-abbreviation support],
895	[enable_dabbrev=yes],
896	[enable_dabbrev=no])
897AC_MSG_RESULT($enable_dabbrev)
898if test "$enable_dabbrev" = yes ; then
899	AC_DEFINE(OPT_DABBREV,1,[Define to 1 to enable dynamic-abbreviation support])
900fi
901
902AC_MSG_CHECKING(if you want DECterm Locator support)
903CF_ARG_ENABLE(dec-locator,
904	[  --enable-dec-locator    enable DECterm Locator support],
905	[enable_dec_locator=yes],
906	[enable_dec_locator=no])
907AC_MSG_RESULT($enable_dec_locator)
908if test "$enable_dec_locator" = yes ; then
909	AC_DEFINE(OPT_DEC_LOCATOR,1,[Define to 1 to enable DECterm Locator support])
910fi
911
912AC_MSG_CHECKING(if you want sixel graphics support)
913CF_ARG_ENABLE(sixel-graphics,
914	[  --enable-sixel-graphics enable sixel graphics support],
915	[enable_sixel_graphics=yes],
916	[enable_sixel_graphics=no])
917AC_MSG_RESULT($enable_sixel_graphics)
918if test "$enable_sixel_graphics" = yes ; then
919	AC_DEFINE(OPT_SIXEL_GRAPHICS,1,[Define to 1 to enable sixel graphics support])
920	EXTRAHDRS="$EXTRAHDRS graphics.h"
921	EXTRASRCS="$EXTRASRCS graphics.c"
922	EXTRAOBJS="$EXTRAOBJS graphics.o"
923fi
924
925AC_MSG_CHECKING(if you want VT420 rectangle support)
926CF_ARG_DISABLE(rectangles,
927	[  --disable-rectangles    disable VT420 rectangle support],
928	[enable_rectangles=no],
929	[enable_rectangles=yes])
930AC_MSG_RESULT($enable_rectangles)
931if test "$enable_rectangles" = yes ; then
932	AC_DEFINE(OPT_DEC_RECTOPS,1,[Define to 1 to disable VT420 rectangle support])
933fi
934
935AC_MSG_CHECKING(if you want -ziconbeep option)
936CF_ARG_DISABLE(ziconbeep,
937	[  --disable-ziconbeep     disable -ziconbeep option],
938	[enable_ziconbeep=no],
939	[enable_ziconbeep=yes])
940AC_MSG_RESULT($enable_ziconbeep)
941test "$enable_ziconbeep" = no && AC_DEFINE(OPT_ZICONBEEP,0,[Define to 0 to disable -ziconbeep option])
942
943###############################################################################
944CF_HELP_MESSAGE(Testing/development Options:)
945
946AC_MSG_CHECKING(if you want debugging traces)
947CF_ARG_ENABLE(trace,
948	[  --enable-trace          test: set to enable debugging traces],
949	[enable_trace=yes],
950	[enable_trace=no])
951AC_MSG_RESULT($enable_trace)
952if test "$enable_trace" = yes ; then
953	AC_DEFINE(OPT_TRACE,1,[Define to 1 to enable debugging traces])
954	EXTRASRCS="$EXTRASRCS trace.c"
955	EXTRAOBJS="$EXTRAOBJS trace.o"
956fi
957
958CF_DISABLE_LEAKS
959CF_DISABLE_ECHO
960
961AC_MSG_CHECKING(if you want magic cookie emulation)
962CF_ARG_ENABLE(xmc-glitch,
963	[  --enable-xmc-glitch     test: enable xmc magic-cookie emulation],
964	[enable_xmc=yes],
965	[enable_xmc=no])
966AC_MSG_RESULT($enable_xmc)
967if test "$enable_xmc" = yes ; then
968	AC_DEFINE(OPT_XMC_GLITCH,1,[Define to 1 to enable xmc magic-cookie emulation])
969	EXTRASRCS="$EXTRASRCS testxmc.c"
970	EXTRAOBJS="$EXTRAOBJS testxmc.o"
971fi
972
973dnl FIXME - extra test needed to make tcap-fkeys work on HPUX
974AC_CHECK_FUNCS(tigetstr)
975
976dnl only check for ncurses' use_extended_names if really not using termcap
977if test -n "$cf_cv_lib_part_tgetent"; then
978    AC_CHECK_FUNCS(use_extended_names)
979fi
980
981if test -n "$GCC" ; then
982AC_MSG_CHECKING(if you want to turn on gcc warnings)
983CF_ARG_ENABLE(warnings,
984	[  --enable-warnings       test: turn on GCC compiler warnings],
985	[with_warnings=yes],
986	[with_warnings=no])
987AC_MSG_RESULT($with_warnings)
988if test "$with_warnings" = yes
989then
990	CF_GCC_ATTRIBUTES
991	CF_GCC_WARNINGS(Wdeclaration-after-statement Wextra Wno-unknown-pragmas Wswitch-enum)
992fi
993fi
994
995AC_SUBST(EXTRA_CFLAGS)
996AC_SUBST(CHARPROC_DEPS)
997AC_SUBST(EXTRAHDRS)
998AC_SUBST(EXTRASRCS)
999AC_SUBST(EXTRAOBJS)
1000
1001test "$disable_setuid" = yes && AC_DEFINE(DISABLE_SETUID,1,[Define to 1 if you want to disable setuid])
1002test "$disable_setgid" = yes && AC_DEFINE(DISABLE_SETGID,1,[Define to 1 if you want to disable setgid])
1003
1004if test $disable_setuid = yes ; then
1005	MAY_SETUID="#"
1006	NOT_SETUID=
1007elif test $disable_setgid = yes ; then
1008	MAY_SETUID="#"
1009	NOT_SETUID=
1010else
1011	MAY_SETUID=
1012	NOT_SETUID="#"
1013fi
1014
1015AC_SUBST(MAY_SETUID)
1016AC_SUBST(NOT_SETUID)
1017
1018###	remove from CPPFLAGS the optional features we define in xtermcfg.h
1019###	or other conflicting symbols that may be defined via imake:
1020for cf_def in \
1021	__STDC__ \
1022	ALLOWLOGGING \
1023	ALLOWLOGFILEEXEC \
1024	OPT_LUIT_PROG \
1025	OPT_WIDE_CHARS \
1026	SCROLLBAR_RIGHT \
1027	USE_TTY_GROUP \
1028	USE_UTEMPTER \
1029	XRENDERFONT
1030do
1031	CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-D$cf_def//`
1032done
1033
1034CF_MAKE_TAGS
1035CF_DISABLE_RPATH_HACK
1036
1037# Force plink.sh to not trim pcre's libraries, which have the same symbol
1038# names as the system regexp.
1039if test "$with_pcre" != no
1040then
1041	LIBS=`echo "$LIBS" | sed -e 's/-lpcre/-kpcre/g'`
1042fi
1043
1044###	output xtermcfg.h, etc
1045AC_OUTPUT(Makefile df-install minstall:minstall.in)
1046