summaryrefslogtreecommitdiff
path: root/app/xterm/configure.in
blob: f7bdb901d860e26ccf225cec2c400f4d070945e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
dnl $XTermId: configure.in,v 1.241 2008/02/24 21:46:37 tom Exp $
dnl
dnl ---------------------------------------------------------------------------
dnl
dnl Copyright 1997-2007,2008 by Thomas E. Dickey
dnl
dnl                         All Rights Reserved
dnl
dnl Permission to use, copy, modify, and distribute this software and its
dnl documentation for any purpose and without fee is hereby granted,
dnl provided that the above copyright notice appear in all copies and that
dnl both that copyright notice and this permission notice appear in
dnl supporting documentation, and that the name of the above listed
dnl copyright holder(s) not be used in advertising or publicity pertaining
dnl to distribution of the software without specific, written prior
dnl permission.
dnl
dnl THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
dnl TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
dnl AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
dnl LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
dnl
dnl ---------------------------------------------------------------------------
dnl Process this file with autoconf to produce a configure script.
dnl
AC_PREREQ(2.13.20030927)
AC_INIT(charproc.c)
AC_CONFIG_HEADER(xtermcfg.h:xtermcfg.hin)
CF_CHECK_CACHE

###	checks for alternative programs

dnl Only add to this case statement when a system has a compiler that is not
dnl detected by AC_PROG_CC.
case "$host_os" in
openedition)	: ${CFLAGS="-O2 -Wc,dll -Wl,EDIT=NO"}
		: ${CPPFLAGS="-D_ALL_SOURCE"}
		: ${LIBS="/usr/lib/Xaw.x /usr/lib/SM.x /usr/lib/ICE.x /usr/lib/X11.x"}
		: ${CC=c89};;
darwin*)
		: ${LDFLAGS}="${LDFLAGS} -Wl,-bind_at_load";;
esac

AC_PROG_CC
AC_PROG_CPP
AC_GCC_TRADITIONAL
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
AC_ARG_PROGRAM
AC_CHECK_PROGS(LINT, tdlint lint alint)

###	checks for UNIX variants that set C preprocessor variables
AC_AIX
AC_ISC_POSIX

###	checks for compiler characteristics
CF_ANSI_CC_CHECK
AC_CONST
CF_PROG_EXT
CF_XOPEN_SOURCE
CF_SIGWINCH

###	checks for header files
AC_CHECK_HEADERS( \
ncurses/term.h \
stdlib.h \
sys/ttydefaults.h \
term.h \
termios.h \
unistd.h \
wchar.h \
)
AC_HEADER_TIME
AM_LANGINFO_CODESET

###	checks for typedefs
CF_SIG_ATOMIC_T
CF_SIZE_T
AC_CHECK_TYPE(time_t, long)
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_UID_T
AC_TYPE_OFF_T

###	checks for library functions
AC_CHECK_FUNCS( \
	bcopy \
	gethostname \
	getlogin \
	memmove \
	putenv \
	sched_yield \
	strerror \
	strftime \
	tcgetattr \
	waitpid \
	wcswidth \
	wcwidth )
CF_FUNC_MEMMOVE
CF_UTMP
CF_STRUCT_LASTLOG
CF_POSIX_SAVED_IDS

CF_HELP_MESSAGE(Compile/Install Options:)
CF_FUNC_TGETENT

AC_MSG_CHECKING(for directory to install resource files)
CF_WITH_PATH(app-defaults,
	[  --with-app-defaults=DIR directory in which to install resource files],
	[appsdir],[EPREFIX/lib/X11/app-defaults],
	['\$(exec_prefix)/lib/X11/app-defaults'])
AC_MSG_RESULT($appsdir)
AC_SUBST(appsdir)

no_appsdir=
test "$appsdir" = no && no_appsdir="#"
AC_SUBST(no_appsdir)

AC_MSG_CHECKING(for directory to install icons)
CF_WITH_PATH(icondir,
	[  --with-icondir=DIR      directory in which to install icons],
	[icondir],[EPREFIX/share/pixmaps],
	['\$(exec_prefix)/share/pixmaps'])
AC_MSG_RESULT($icondir)
AC_SUBST(icondir)

no_icondir=
test "$icondir" = no && no_icondir="#"
AC_SUBST(no_icondir)

# Comment-out the install-desktop rule if the desktop-utils are not found.
AC_MSG_CHECKING(if you want to install desktop files)
CF_ARG_OPTION(desktop,
	[  --disable-desktop       disable install of xterm desktop files],
	[enable_desktop=$enableval],
	[enable_desktop=$enableval],yes)
AC_MSG_RESULT($enable_desktop)

desktop_utils=
if test "$enable_desktop" = yes ; then
AC_CHECK_PROG(desktop_utils,desktop-file-install,yes,no)
fi

test "$desktop_utils" = yes && desktop_utils= || desktop_utils="#"
AC_SUBST(DESKTOP_FLAGS)

# inherit SINSTALL_OPTS from environment to allow packager to customize it.

AC_MSG_CHECKING(for install-permissions reference)
AC_ARG_WITH(reference,
	[  --with-reference=XXX    program to use as permissions-reference],
	[with_reference=$withval],
	[with_reference=xterm])
AC_MSG_RESULT($with_reference)

with_full_paths=yes
CF_PATH_PROG(XTERM_PATH,$with_reference)

# If any of --program-prefix, --program-suffix or --program-transform-name is
# given, accept an option tell the makefile to create a symbolic link, e.g.,
# to "xterm" on install.
XTERM_SYMLINK=NONE
AC_SUBST(XTERM_SYMLINK)
if test "$program_transform_name" != "'s,,,'" ; then
cf_name=`echo "$program_transform_name" | sed -e '[s,\\$\\$,$,g]'`
cf_name=`echo xterm |sed -e "$cf_name"`
AC_MSG_CHECKING(for symbolic link to create to $cf_name)
AC_ARG_WITH(xterm-symlink,
	[  --with-xterm-symlink=XXX make symbolic link to installed xterm],
	[with_symlink=$withval],
	[with_symlink=xterm])
AC_MSG_RESULT($with_symlink)
test "$with_symlink" = yes && with_symlink=xterm
test -n "$with_symlink" && \
	test "$with_symlink" != no && \
	test "$with_symlink" != $cf_name && \
	XTERM_SYMLINK="$with_symlink"
fi

AC_MSG_CHECKING(if you want to disable setuid)
CF_ARG_DISABLE(setuid,
	[  --disable-setuid        disable setuid in xterm, do not install setuid/setgid],
	[disable_setuid=yes],
	[disable_setuid=no],
	no)
AC_MSG_RESULT($disable_setuid)

AC_MSG_CHECKING(if you want to disable setgid)
CF_ARG_DISABLE(setgid,
	[  --disable-setgid        disable setgid in xterm, do not install setuid/setgid],
	[disable_setgid=yes],
	[disable_setgid=no],
	no)
AC_MSG_RESULT($disable_setgid)

AC_MSG_CHECKING(if you want to run xterm setuid to a given user)
AC_ARG_WITH(setuid,
	[  --with-setuid=XXX       use the given setuid user],
	[use_given_setuid=$withval],
	[use_given_setuid=no])
AC_MSG_RESULT($use_given_setuid)

if test "$use_given_setuid" != no ; then
	if test "$use_given_setuid" = yes ; then
		cf_cv_given_setuid=root
	else
		cf_cv_given_setuid=$use_given_setuid
	fi
	SINSTALL_OPTS="$SINSTALL_OPTS u+s -u $cf_cv_given_setuid"
fi

AC_MSG_CHECKING(if you want to run xterm setgid to match utmp/utmpx file)
AC_ARG_WITH(utmp-setgid,
	[  --with-utmp-setgid=XXX  use setgid to match utmp/utmpx file],
	[use_utmp_setgid=$withval],
	[use_utmp_setgid=no])
AC_MSG_RESULT($use_utmp_setgid)

if test "$use_utmp_setgid" != no ; then
	if test "$use_utmp_setgid" = yes ; then
		CF_UTMP_GROUP
	else
		cf_cv_utmp_group=$use_utmp_setgid
	fi
	if test "$cf_cv_posix_saved_ids" != yes ; then
		AC_MSG_ERROR(Your system does not support POSIX saved-ids)
	fi
	AC_DEFINE(USE_UTMP_SETGID)
	SINSTALL_OPTS="$SINSTALL_OPTS g+s -g $cf_cv_utmp_group"
fi

AC_SUBST(SINSTALL_OPTS)

AC_MSG_CHECKING(if you want to link with utempter)
AC_ARG_WITH(utempter,
	[  --with-utempter         use utempter library for access to utmp],
	[use_utempter=$withval],
	[use_utempter=no])
AC_MSG_RESULT($use_utempter)

if test "$use_utempter" = yes ; then
	CF_UTEMPTER
	test "$cf_cv_have_utempter" != yes && use_utempter=no
else
	use_utempter=no
fi

# Some configurations permit (or require) either setuid or setgid mode.
# Let the user decide.
if test "$use_utempter" = yes ; then
	if test "${enable_setuid+set}" != set ; then
		disable_setuid=yes
		CF_VERBOSE([No --disable-setuid option given, force to yes])
	fi
fi

###	checks for external data
CF_ERRNO
CF_TTY_GROUP

###	checks for system services and user specified options

CF_POSIX_WAIT
CF_SYSV
CF_SVR4
CF_X_TOOLKIT

AC_CHECK_HEADERS( \
	X11/DECkeysym.h \
	X11/Sunkeysym.h \
	X11/XF86keysym.h \
	X11/Xpoll.h \
	)

CF_X_ATHENA
CF_TYPE_FD_SET
CF_TERMIO_C_ISPEED

LIBS="$LIBS $X_EXTRA_LIBS"

# Check for openpty() in -lutil if the UNIX98-style pty functions are not
# available. E.g. for GNU libc 2.0.
case $host_os in #(vi
freebsd*|netbsd*)	# 2004/8/15 - revisit this if/when grantpt is known to work.
	AC_CHECK_LIB(util,openpty)
	;;
*)
	AC_CHECK_FUNCS(grantpt, [], AC_CHECK_LIB(util,openpty))
	;;
esac

CF_XKB_BELL_EXT
AC_CHECK_FUNCS(Xutf8LookupString, [],[
	EXTRAHDRS="$EXTRAHDRS xutf8.h"
	EXTRASRCS="$EXTRASRCS xutf8.c"
	EXTRAOBJS="$EXTRAOBJS xutf8.o"
])

CF_WITH_IMAKE_CFLAGS($(MAIN_DEFINES) $(VENDORMANDEFS))

CF_HELP_MESSAGE(Terminal Configuration:)

AC_MSG_CHECKING(for default terminal-id)
AC_ARG_WITH(terminal-id,
	[  --with-terminal-id=V    set default decTerminalID (default: vt100)],
	[default_termid=$withval],
	[default_termid=vt100])
AC_MSG_RESULT($default_termid)
case $default_termid in
vt*)	default_termid=`echo $default_termid | sed -e 's/^..//'`
	;;
esac
AC_DEFINE_UNQUOTED(DFT_DECID,"$default_termid")

AC_MSG_CHECKING(for default terminal-type)
AC_ARG_WITH(terminal-type,
	[  --with-terminal-type=T  set default $TERM (default: xterm)],
	[default_TERM=$withval],
	[default_TERM=xterm])
AC_MSG_RESULT($default_TERM)
AC_DEFINE_UNQUOTED(DFT_TERMTYPE,"$default_TERM")

AC_MSG_CHECKING(for private terminfo-directory)
AC_ARG_WITH(own-terminfo,
	[  --with-own-terminfo=P   set default $TERMINFO (default: from environment)],
	[TERMINFO_DIR=$withval],
	[TERMINFO_DIR=${TERMINFO-none}])
AC_MSG_RESULT($TERMINFO_DIR)
if test "$TERMINFO_DIR" = yes ; then
	AC_MSG_WARN(no value given)
elif test "$TERMINFO_DIR" != none ; then
	if test -d $TERMINFO_DIR ; then
		AC_DEFINE_UNQUOTED(OWN_TERMINFO_DIR,"$TERMINFO_DIR")
	else
		AC_MSG_WARN(not a directory)
	fi
elif test "$prefix" != NONE ; then
	TERMINFO_DIR='${prefix}/lib/terminfo'
elif test -d /usr/lib/terminfo ; then
	TERMINFO_DIR=/usr/lib/terminfo
else
	TERMINFO_DIR=
fi
SET_TERMINFO=
if test -n "$TERMINFO_DIR" ; then
	TERMINFO_DIR='$(DESTDIR)'$TERMINFO_DIR
	SET_TERMINFO='TERMINFO=$(TERMINFO_DIR)'
fi
AC_SUBST(TERMINFO_DIR)
AC_SUBST(SET_TERMINFO)

###############################################################################
CF_HELP_MESSAGE(Optional Features:)

AC_MSG_CHECKING(if you want active-icons)
CF_ARG_DISABLE(active-icon,
	[  --disable-active-icon   disable X11R6.3 active-icon feature],
	[enable_active_icon=no],
	[enable_active_icon=yes])
AC_MSG_RESULT($enable_active_icon)
if test "$enable_active_icon" = no ; then
	AC_DEFINE(NO_ACTIVE_ICON)
fi

AC_MSG_CHECKING(if you want ANSI color)
CF_ARG_DISABLE(ansi-color,
	[  --disable-ansi-color    disable ANSI color],
	[enable_ansi_color=no],
	[enable_ansi_color=yes])
AC_MSG_RESULT($enable_ansi_color)
test "$enable_ansi_color" = no && AC_DEFINE(OPT_ISO_COLORS,0)

if test "$enable_ansi_color" = yes ; then

	AC_MSG_CHECKING(if you want 16 colors like aixterm)
	CF_ARG_DISABLE(16-color,
		[  --disable-16-color      disable 16-color support],
		[enable_16_color=no],
		[enable_16_color=yes])
	AC_MSG_RESULT($enable_16_color)
	test "$enable_16_color" = no && AC_DEFINE(OPT_AIX_COLORS,0)

	AC_MSG_CHECKING(if you want 256 colors)
	CF_ARG_ENABLE(256-color,
		[  --enable-256-color      enable 256-color support],
		[enable_256_color=yes],
		[enable_256_color=no])
	AC_MSG_RESULT($enable_256_color)
	if test "$enable_256_color" = yes ; then
		CHARPROC_DEPS="$CHARPROC_DEPS 256colres.h"
		EXTRAHDRS="$EXTRAHDRS 256colres.h"
		AC_DEFINE(OPT_256_COLORS,1)
	else
	AC_MSG_CHECKING(if you want 88 colors)
	CF_ARG_ENABLE(88-color,
		[  --enable-88-color       enable 88-color support],
		[enable_88_color=yes],
		[enable_88_color=no])
	AC_MSG_RESULT($enable_88_color)
	if test "$enable_88_color" = yes ; then
		CHARPROC_DEPS="$CHARPROC_DEPS 88colres.h"
		EXTRAHDRS="$EXTRAHDRS 88colres.h"
		AC_DEFINE(OPT_88_COLORS,1)
	fi
	fi

fi

AC_MSG_CHECKING(if you want blinking cursor)
CF_ARG_DISABLE(blink-cursor,
	[  --disable-blink-cursor  disable support for blinking cursor],
	[enable_blink_curs=no],
	[enable_blink_curs=yes])
AC_MSG_RESULT($enable_blink_curs)
test "$enable_blink_curs" = no && AC_DEFINE(OPT_BLINK_CURS,0)

AC_MSG_CHECKING(if you want to ignore Linux's broken palette-strings)

case $host_os in #(vi
linux*)
	assume_broken_osc=yes ;; #(vi
*)
	assume_broken_osc=no ;;
esac

CF_ARG_OPTION(broken-osc,
	[  --enable-broken-osc     allow broken Linux OSC-strings],
	[enable_broken_osc=$enableval],
	[enable_broken_osc=$enableval],
	[$assume_broken_osc])
AC_MSG_RESULT($enable_broken_osc)
if test "$enable_broken_osc" = yes ; then
	AC_DEFINE(OPT_BROKEN_OSC,1)
else
	AC_DEFINE(OPT_BROKEN_OSC,0)
fi

AC_MSG_CHECKING(if you want to allow broken string-terminators)
CF_ARG_ENABLE(broken-st,
	[  --enable-broken-st      allow broken string-terminators],
	[enable_broken_st=yes],
	[enable_broken_st=no])
AC_MSG_RESULT($enable_broken_st)
test "$enable_broken_st" = no && AC_DEFINE(OPT_BROKEN_ST,0)

AC_MSG_CHECKING(if you want printable 128-159)
CF_ARG_DISABLE(c1-print,
	[  --disable-c1-print      disallow -k8 option for printable 128-159],
	[enable_c1_print=no],
	[enable_c1_print=yes])
AC_MSG_RESULT($enable_c1_print)
test "$enable_c1_print" = no && AC_DEFINE(OPT_C1_PRINT,0)

if test "$enable_ansi_color" = yes ; then

	AC_MSG_CHECKING(if you want bold colors mapped like IBM PC)
	CF_ARG_DISABLE(bold-color,
		[  --disable-bold-color    disable PC-style mapping of bold colors],
		[enable_pc_color=no],
		[enable_pc_color=yes])
	AC_MSG_RESULT($enable_pc_color)
	test "$enable_pc_color" = no && AC_DEFINE(OPT_PC_COLORS,0)

	AC_MSG_CHECKING(if you want separate color-classes)
	CF_ARG_DISABLE(color-class,
		[  --disable-color-class   disable separate color class resources],
		[enable_color_class=no],
		[enable_color_class=yes])
	AC_MSG_RESULT($enable_color_class)
	test "$enable_color_class" = no && AC_DEFINE(OPT_COLOR_CLASS,FALSE)

	AC_MSG_CHECKING(if you want color-mode enabled by default)
	CF_ARG_DISABLE(color-mode,
		[  --disable-color-mode    disable default colorMode resource],
		[default_colormode=no],
		[default_colormode=yes])
	AC_MSG_RESULT($default_colormode)
	test "$default_colormode" = no && AC_DEFINE(DFT_COLORMODE,FALSE)

fi

AC_MSG_CHECKING(if you want support for color highlighting)
CF_ARG_DISABLE(highlighting,
	[  --disable-highlighting  disable support for color highlighting],
	[default_highlight=no],
	[default_highlight=yes])
AC_MSG_RESULT($default_highlight)
test "$default_highlight" = no && AC_DEFINE(OPT_HIGHLIGHT_COLOR,0)

AC_MSG_CHECKING(if you want support for doublesize characters)
CF_ARG_DISABLE(doublechars,
	[  --disable-doublechars   disable support for double-size chars],
	[enable_doublechars=no],
	[enable_doublechars=yes])
AC_MSG_RESULT($enable_doublechars)
test "$enable_doublechars" = no && AC_DEFINE(OPT_DEC_CHRSET,0)

AC_MSG_CHECKING(if you want fallback-support for box characters)
CF_ARG_DISABLE(boxchars,
	[  --disable-boxchars      disable fallback-support for box chars],
	[enable_boxchars=no],
	[enable_boxchars=yes])
AC_MSG_RESULT($enable_boxchars)
test "$enable_boxchars" = no && AC_DEFINE(OPT_BOX_CHARS,0)

AC_MSG_CHECKING(if you want to allow spawning new xterms)
CF_ARG_ENABLE(exec-xterm,
	[  --enable-exec-xterm     enable "spawn-new-terminal" action],
	[enable_exec_xterm=yes],
	[enable_exec_xterm=no])
AC_MSG_RESULT($enable_exec_xterm)
if test "$enable_exec_xterm" = yes ; then
	CF_PROCFS_CWD
	if test "$cf_cv_procfs_cwd" = no ; then
		AC_MSG_WARN(no suitable proc filesystem found)
	else
		AC_DEFINE_UNQUOTED(PROCFS_ROOT,"$cf_cv_procfs_cwd")
		AC_DEFINE(OPT_EXEC_XTERM)
	fi
fi

AC_MSG_CHECKING(if you want to use FreeType library)
CF_ARG_DISABLE(freetype,
	[  --disable-freetype      disable freetype library-support],
	[enable_freetype=no],
	[enable_freetype=yes])
AC_MSG_RESULT($enable_freetype)
if test "$enable_freetype" = yes ; then
	CF_X_FREETYPE
else
	CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-DXRENDERFONT//`
fi

AC_MSG_CHECKING(if you want support for HP-style function keys)
CF_ARG_ENABLE(hp-fkeys,
	[  --enable-hp-fkeys       enable support for HP-style function keys],
	[enable_hp_fkeys=yes],
	[enable_hp_fkeys=no])
AC_MSG_RESULT($enable_hp_fkeys)
if test "$enable_hp_fkeys" = yes ; then
	AC_DEFINE(OPT_HP_FUNC_KEYS,1)
fi

AC_MSG_CHECKING(if you want support for SCO-style function keys)
CF_ARG_ENABLE(sco-fkeys,
	[  --enable-sco-fkeys      enable support for SCO-style function keys],
	[enable_sco_fkeys=yes],
	[enable_sco_fkeys=no])
AC_MSG_RESULT($enable_sco_fkeys)
if test "$enable_sco_fkeys" = yes ; then
	AC_DEFINE(OPT_SCO_FUNC_KEYS,1)
fi

AC_MSG_CHECKING(if you want support for Sun-style function keys)
CF_ARG_DISABLE(sun-fkeys,
	[  --disable-sun-fkeys     disable support for Sun-style function keys],
	[enable_sun_fkeys=no],
	[enable_sun_fkeys=yes])
AC_MSG_RESULT($enable_sun_fkeys)
if test "$enable_sun_fkeys" = no ; then
	AC_DEFINE(OPT_SUN_FUNC_KEYS,0)
fi

AC_MSG_CHECKING(if you want support for internationalization)
CF_ARG_DISABLE(i18n,
	[  --disable-i18n          disable internationalization],
	[enable_i18n=no],
	[enable_i18n=yes])
AC_MSG_RESULT($enable_i18n)
if test "$enable_i18n" = no ; then
	AC_DEFINE(OPT_I18N_SUPPORT,0)
fi

AC_MSG_CHECKING(if you want support for initial-erase setup)
CF_ARG_DISABLE(initial-erase,
	[  --disable-initial-erase disable setup for stty erase],
	[enable_ie=no],
	[enable_ie=yes])
AC_MSG_RESULT($enable_ie)
if test "$enable_ie" = no ; then
	AC_DEFINE(OPT_INITIAL_ERASE,0)
fi

AC_MSG_CHECKING(if you want support for input-method)
CF_ARG_DISABLE(input-method,
	[  --disable-input-method  disable input-method],
	[enable_ximp=no],
	[enable_ximp=yes])
AC_MSG_RESULT($enable_ximp)
CF_INPUT_METHOD
test "$cf_cv_input_method" = no && enable_ximp=no
if test "$enable_ximp" = no ; then
	AC_DEFINE(OPT_INPUT_METHOD,0)
fi

AC_MSG_CHECKING(if you want support for load-vt-fonts)
CF_ARG_ENABLE(load-vt-fonts,
	[  --enable-load-vt-fonts  enable load-vt-fonts() action],
	[enable_load_vt_fonts=yes],
	[enable_load_vt_fonts=no])
AC_MSG_RESULT($enable_load_vt_fonts)
if test "$enable_load_vt_fonts" = yes ; then
	AC_DEFINE(OPT_LOAD_VTFONTS,1)
fi

AC_MSG_CHECKING(if you want support for logging)
CF_ARG_ENABLE(logging,
	[  --enable-logging        enable logging],
	[enable_logging=yes],
	[enable_logging=no])
AC_MSG_RESULT($enable_logging)
if test "$enable_logging" = yes ; then
	AC_DEFINE(ALLOWLOGGING)
	AC_MSG_CHECKING(if you want to allow logging via a pipe)
	CF_ARG_ENABLE(logfile-exec,
		[  --enable-logfile-exec   enable exec'd logfile filter],
		[enable_log_exec=yes],
		[enable_log_exec=no])
	AC_MSG_RESULT($enable_log_exec)
	if test "$enable_log_exec" = yes ; then
		AC_DEFINE(ALLOWLOGFILEEXEC)
	fi
fi

AC_MSG_CHECKING(if you want support for iconify/maximize translations)
CF_ARG_DISABLE(maximize,
	[  --disable-maximize      disable actions for iconify/deiconify/maximize/restore],
	[enable_maximize=no],
	[enable_maximize=yes])
AC_MSG_RESULT($enable_maximize)
test "$enable_maximize" = no && AC_DEFINE(OPT_MAXIMIZE,0)

AC_MSG_CHECKING(if you want NumLock to override keyboard tables)
CF_ARG_DISABLE(num-lock,
	[  --disable-num-lock      disable NumLock keypad support],
	[enable_numlock=no],
	[enable_numlock=yes])
AC_MSG_RESULT($enable_numlock)
test "$enable_numlock" = no && AC_DEFINE(OPT_NUM_LOCK,0)

AC_MSG_CHECKING(if you want support for get/set of base64 selection data)

CF_ARG_ENABLE(paste64,
	[  --enable-paste64        enable get/set base64 selection data],
	[enable_paste64=yes],
	[enable_paste64=no])
AC_MSG_RESULT($enable_paste64)
if test "$enable_paste64" = yes ; then
	AC_DEFINE(OPT_PASTE64,1)
else
	AC_DEFINE(OPT_PASTE64,0)
fi

AC_MSG_CHECKING(if you want support for pty-handshaking)

CF_ARG_DISABLE(pty-handshake,
	[  --disable-pty-handshake disable pty-handshake support],
	[enable_pty_handshake=no],
	[enable_pty_handshake=yes])
AC_MSG_RESULT($enable_pty_handshake)
if test "$enable_pty_handshake" = yes ; then
	AC_DEFINE(OPT_PTY_HANDSHAKE,1)
else
	AC_DEFINE(OPT_PTY_HANDSHAKE,0)
fi

AC_MSG_CHECKING(if you want support for mouse in readline applications)
CF_ARG_ENABLE(readline-mouse,
	[  --enable-readline-mouse enable support for mouse in readline applications],
	[enable_readline_mouse=yes],
	[enable_readline_mouse=no])
AC_MSG_RESULT($enable_readline_mouse)
if test "$enable_readline_mouse" = yes ; then
	AC_DEFINE(OPT_READLINE,1)
fi

AC_MSG_CHECKING(if you want support for regular-expression selections)
CF_ARG_DISABLE(regex,
	[  --disable-regex         disable regular-expression selections],
	[enable_regex=no],
	[enable_regex=yes])
AC_MSG_RESULT($enable_regex)
if test "$enable_regex" = yes ; then
	CF_WITH_PCRE
	if test "$with_pcre" = no ; then
		CF_REGEX
		if test "X$cf_cv_regex" != "Xregex.h" ; then
			AC_MSG_ERROR(Only POSIX or PCRE regular expressions are supported)
		fi
	fi
	AC_DEFINE(OPT_SELECT_REGEX)
fi

AC_MSG_CHECKING(if you want support for right-scrollbar)
CF_ARG_DISABLE(rightbar,
	[  --disable-rightbar      disable right-scrollbar support],
	[enable_rightbar=no],
	[enable_rightbar=yes])
AC_MSG_RESULT($enable_rightbar)
if test "$enable_rightbar" = yes ; then
	AC_DEFINE(SCROLLBAR_RIGHT)
fi

AC_MSG_CHECKING(if you want check for redundant name-change)
CF_ARG_DISABLE(samename,
	[  --disable-samename      disable check for redundant name-change],
	[enable_samename=no],
	[enable_samename=yes])
AC_MSG_RESULT($enable_samename)
test "$enable_samename" = no && AC_DEFINE(OPT_SAME_NAME,0)

AC_MSG_CHECKING(if you want support for session management)
CF_ARG_DISABLE(session-mgt,
	[  --disable-session-mgt   disable support for session management],
	[enable_session_mgt=no],
	[enable_session_mgt=yes])
AC_MSG_RESULT($enable_session_mgt)
test "$enable_session_mgt" = no && AC_DEFINE(OPT_SESSION_MGT,0)

AC_MSG_CHECKING(if you want to use termcap function-keys)
CF_ARG_DISABLE(tcap-fkeys,
	[  --disable-tcap-fkeys    disable termcap function-keys support],
	[enable_tcap_fkeys=no],
	[enable_tcap_fkeys=yes])
AC_MSG_RESULT($enable_tcap_fkeys)
test "$enable_tcap_fkeys" = yes && AC_DEFINE(OPT_TCAP_FKEYS,1)

AC_MSG_CHECKING(if you want to use termcap-query/report)
CF_ARG_ENABLE(tcap-query,
	[  --enable-tcap-query     compile-in termcap-query support],
	[enable_tcap_query=yes],
	[enable_tcap_query=no])
AC_MSG_RESULT($enable_tcap_query)
test "$enable_tcap_query" = yes && AC_DEFINE(OPT_TCAP_QUERY,1)

AC_MSG_CHECKING(if you want support for tek4014)
CF_ARG_DISABLE(tek4014,
	[  --disable-tek4014       disable tek4014 emulation],
	[enable_tek4014=no],
	[enable_tek4014=yes])
AC_MSG_RESULT($enable_tek4014)
if test "$enable_tek4014" = no ; then
	AC_DEFINE(OPT_TEK4014,0)
else
	EXTRAHDRS="$EXTRAHDRS Tekparse.h"
	EXTRASRCS="$EXTRASRCS TekPrsTbl.c Tekproc.c"
	EXTRAOBJS="$EXTRAOBJS TekPrsTbl.o Tekproc.o"
fi

AC_MSG_CHECKING(if you want pulldown menus with a toolbar)
CF_ARG_ENABLE(toolbar,
	[  --enable-toolbar        compile-in toolbar for pulldown menus],
	[enable_toolbar=yes],
	[enable_toolbar=no])
AC_MSG_RESULT($enable_toolbar)
if test "$enable_toolbar" = yes ; then
	AC_DEFINE(OPT_TOOLBAR,1)
fi

AC_MSG_CHECKING(if you want VT52 emulation)
CF_ARG_DISABLE(vt52,
	[  --disable-vt52          disable VT52 emulation],
	[enable_vt52=no],
	[enable_vt52=yes])
AC_MSG_RESULT($enable_vt52)
test "$enable_vt52" = no && AC_DEFINE(OPT_VT52_MODE,0)

AC_MSG_CHECKING(if you want to use mini-luit/Latin9 built-in support)
CF_ARG_ENABLE(mini-luit,
	[  --enable-mini-luit      enable mini-luit (built-in Latin9 support)],
	[enable_mini_luit=yes],
	[enable_mini_luit=no])
AC_MSG_RESULT($enable_mini_luit)
if test "$enable_mini_luit" = yes ; then
	AC_DEFINE(OPT_MINI_LUIT,1)
fi

AC_MSG_CHECKING(if you want to use luit)
CF_ARG_ENABLE(luit,
	[  --enable-luit           enable luit filter (Unicode translation)],
	[enable_luit=yes],
	[enable_luit=$enable_mini_luit])
AC_MSG_RESULT($enable_luit)
if test "$enable_luit" = yes ; then
	AC_DEFINE(OPT_LUIT_PROG,1)
	CF_PATH_PROG(LUIT,luit)
fi

AC_MSG_CHECKING(if you want wide-character support)
CF_ARG_OPTION(wide-chars,
	[  --enable-wide-chars     enable wide-character support],
	[enable_wchar=yes],
	[enable_wchar=$enable_luit],
	[$enable_luit])
AC_MSG_RESULT($enable_wchar)
if test "$enable_wchar" = yes ; then
	AC_DEFINE(OPT_WIDE_CHARS,1)
	EXTRAHDRS="$EXTRAHDRS charclass.h precompose.h wcwidth.h"
	EXTRASRCS="$EXTRASRCS charclass.c precompose.c wcwidth.c"
	EXTRAOBJS="$EXTRAOBJS charclass.o precompose.o wcwidth.o"
fi

AC_MSG_CHECKING(if you want dynamic-abbreviation support)
CF_ARG_ENABLE(dabbrev,
	[  --enable-dabbrev        enable dynamic-abbreviation support],
	[enable_dabbrev=yes],
	[enable_dabbrev=no])
AC_MSG_RESULT($enable_dabbrev)
if test "$enable_dabbrev" = yes ; then
	AC_DEFINE(OPT_DABBREV,1)
fi

AC_MSG_CHECKING(if you want DECterm Locator support)
CF_ARG_ENABLE(dec-locator,
	[  --enable-dec-locator    enable DECterm Locator support],
	[enable_dec_locator=yes],
	[enable_dec_locator=no])
AC_MSG_RESULT($enable_dec_locator)
if test "$enable_dec_locator" = yes ; then
	AC_DEFINE(OPT_DEC_LOCATOR,1)
fi

AC_MSG_CHECKING(if you want VT420 rectangle support)
CF_ARG_DISABLE(rectangles,
	[  --disable-rectangles    disable VT420 rectangle support],
	[enable_rectangles=no],
	[enable_rectangles=yes])
AC_MSG_RESULT($enable_rectangles)
if test "$enable_rectangles" = yes ; then
	AC_DEFINE(OPT_DEC_RECTOPS,1)
fi

AC_MSG_CHECKING(if you want -ziconbeep option)
CF_ARG_DISABLE(ziconbeep,
	[  --disable-ziconbeep     disable -ziconbeep option],
	[enable_ziconbeep=no],
	[enable_ziconbeep=yes])
AC_MSG_RESULT($enable_ziconbeep)
test "$enable_ziconbeep" = no && AC_DEFINE(OPT_ZICONBEEP,0)

###############################################################################
CF_HELP_MESSAGE(Testing/development Options:)

AC_MSG_CHECKING(if you want debugging traces)
CF_ARG_ENABLE(trace,
	[  --enable-trace          test: set to enable debugging traces],
	[enable_trace=yes],
	[enable_trace=no])
AC_MSG_RESULT($enable_trace)
if test "$enable_trace" = yes ; then
	AC_DEFINE(OPT_TRACE)
	EXTRASRCS="$EXTRASRCS trace.c"
	EXTRAOBJS="$EXTRAOBJS trace.o"
fi

AC_MSG_CHECKING(if you want to test memory leaks)
CF_ARG_DISABLE(leaks,
	[  --disable-leaks         test: set to test memory leaks],
	[disable_leaks=yes],
	[disable_leaks=no])
AC_MSG_RESULT($disable_leaks)
if test "$disable_leaks" = yes ; then
	AC_DEFINE(NO_LEAKS)
fi

CF_DISABLE_ECHO

AC_MSG_CHECKING(if you want magic cookie emulation)
CF_ARG_ENABLE(xmc-glitch,
	[  --enable-xmc-glitch     test: enable xmc magic-cookie emulation],
	[enable_xmc=yes],
	[enable_xmc=no])
AC_MSG_RESULT($enable_xmc)
if test "$enable_xmc" = yes ; then
	AC_DEFINE(OPT_XMC_GLITCH,1)
	EXTRASRCS="$EXTRASRCS testxmc.c"
	EXTRAOBJS="$EXTRAOBJS testxmc.o"
fi

dnl FIXME - extra test needed to make tcap-fkeys work on HPUX
AC_CHECK_FUNCS(tigetstr)

if test -n "$GCC" ; then
AC_MSG_CHECKING(if you want to turn on gcc warnings)
CF_ARG_ENABLE(warnings,
	[  --enable-warnings       test: turn on GCC compiler warnings],
	[with_warnings=yes],
	[with_warnings=no])
AC_MSG_RESULT($with_warnings)
if test "$with_warnings" = yes
then
	CF_GCC_ATTRIBUTES
	CF_GCC_WARNINGS(Wdeclaration-after-statement Wextra Wno-unknown-pragmas Wswitch-enum)
fi
fi

AC_SUBST(EXTRA_CFLAGS)
AC_SUBST(CHARPROC_DEPS)
AC_SUBST(EXTRAHDRS)
AC_SUBST(EXTRASRCS)
AC_SUBST(EXTRAOBJS)

test "$disable_setuid" = yes && AC_DEFINE(DISABLE_SETUID)
test "$disable_setgid" = yes && AC_DEFINE(DISABLE_SETGID)

if test $disable_setuid = yes ; then
	MAY_SETUID="#"
	NOT_SETUID=
elif test $disable_setgid = yes ; then
	MAY_SETUID="#"
	NOT_SETUID=
else
	MAY_SETUID=
	NOT_SETUID="#"
fi

AC_SUBST(MAY_SETUID)
AC_SUBST(NOT_SETUID)

###	remove from CPPFLAGS the optional features we define in xtermcfg.h
###	or other conflicting symbols that may be defined via imake:
for cf_def in \
	__STDC__ \
	ALLOWLOGGING \
	ALLOWLOGFILEEXEC \
	OPT_LUIT_PROG \
	OPT_WIDE_CHARS \
	SCROLLBAR_RIGHT \
	USE_TTY_GROUP \
	USE_UTEMPTER \
	XRENDERFONT
do
	CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-D$cf_def//`
done

###	output Makefile and xtermcfg.h
AC_OUTPUT(Makefile)