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