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