1dnl $LynxId: configure.in,v 1.337 2021/08/01 18:50:51 tom Exp $
2dnl
3dnl Process this file with autoconf to produce a configure script.
4dnl
5dnl created jan/1997
6dnl by T.E.Dickey <dickey@invisible-island.net>
7dnl and Jim Spath <jspath@mail.bcpl.lib.md.us>
8dnl
9dnl ---------------------------------------------------------------------------
10dnl Copyright 1997-2020,2021 by Thomas E. Dickey
11dnl
12dnl Permission to use, copy, modify, and distribute this software and its
13dnl documentation for any purpose and without fee is hereby granted,
14dnl provided that the above copyright notice appear in all copies and that
15dnl both that copyright notice and this permission notice appear in
16dnl supporting documentation, and that the name of the above listed
17dnl copyright holder(s) not be used in advertising or publicity pertaining
18dnl to distribution of the software without specific, written prior
19dnl permission.
20dnl
21dnl THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
22dnl TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
23dnl AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
24dnl LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
25dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
26dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
27dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
28dnl ---------------------------------------------------------------------------
29dnl
30dnl ask PRCS to plug-in the project-version for the configure-script.
31dnl $Format: "AC_REVISION($ProjectVersion$)"$
32AC_REVISION(2.9.0dev.9)
33
34# Save the original $CFLAGS so we can distinguish whether the user set those
35# in the environment, or whether autoconf added -O and -g options:
36ORIGINAL_CFLAGS="$CFLAGS"
37
38# For autoconf 2.13, make sure we have no cache file at the beginning of this
39# script.  That fixes problems with tests whose cached values change from one
40# run to the next, as well as with tests that are order-dependent.
41rm -f config.cache
42
43AC_PREREQ(2.25.20210105)
44AC_INIT(userdefs.h)
45
46# autoconf 2.5x defaults to no cache file; we need the cache file's information
47# for building the config page.  But start with it empty to avoid confusion by
48# people who don't do a "make distclean" after applying patches.
49cache_file=config.cache
50rm -f config.cache; touch config.cache
51
52CONFIG_H=lynx_cfg.h
53AC_CONFIG_HEADER($CONFIG_H:config.hin)
54AC_SUBST(CONFIG_H)
55
56CF_CHECK_CACHE([AC_CANONICAL_SYSTEM])
57AC_ARG_WITH(system-type,
58[  --with-system-type=XXX  test: override derived host system-type],
59[AC_MSG_WARN(overriding system type $host_os to $withval)
60 host_os=$withval])
61
62AC_ARG_PROGRAM
63
64PACKAGE=lynx
65dnl ask PRCS to plug-in the project-version for the packages.
66# $Format: "VERSION=$ProjectVersion$"$
67VERSION=2.9.0dev.9
68
69AC_SUBST(PACKAGE)
70AC_SUBST(VERSION)
71
72AC_MSG_CHECKING(for DESTDIR)
73CF_WITH_PATH(destdir,
74[  --with-destdir=XXX      set DESTDIR destination for install],
75DESTDIR,
76[$DESTDIR],
77[$DESTDIR])
78AC_MSG_RESULT($DESTDIR)
79
80AC_PREFIX_DEFAULT(/usr/local)
81
82dnl --------------------------------------------------------------------------
83dnl Checks for location of programs
84dnl --------------------------------------------------------------------------
85
86dnl Only add to this case statement when a system has a compiler that is not
87dnl detected by AC_PROG_CC.
88case "$host_os" in
89(openedition)
90	: ${CFLAGS="-D_ALL_SOURCE -Wl,EDIT=NO"}
91	: ${CC=c89}
92	;;
93esac
94
95CF_PROG_CC
96CF_PROG_CPP_COMMENTS
97AC_PROG_LN_S
98case "$host_os" in
99(mingw*)
100LN_S="cp -p"
101AC_MSG_RESULT(Override: No symbolic links in mingw.)
102	;;
103(*)
104	;;
105esac
106AC_PROG_MAKE_SET
107AC_PROG_INSTALL
108AC_PROG_YACC
109AC_PROG_EGREP
110CF_PROG_LINT
111CF_MAKEFLAGS
112CF_MAKE_PHONY
113CF_MAKE_TAGS
114
115CF_ACVERSION_CHECK(2.52,
116	[AC_PATH_TOOL(WINDRES, windres, none)],
117	[AC_PATH_PROG(WINDRES, windres, none)])
118
119CF_BUILD_CC([#],[])
120
121CF_PROG_RANLIB
122CF_AR_FLAGS
123
124dnl --------------------------------------------------------------------------
125dnl Debug/development/test
126dnl --------------------------------------------------------------------------
127
128CF_HELP_MESSAGE(
129Development Options:)
130
131CF_DISABLE_ECHO
132
133# special case for WWW/*
134if test -n "$ECHO_CC" ; then
135	DONT_ECHO_CC="$SHOW_CC ;"
136else
137	DONT_ECHO_CC=''
138fi
139AC_SUBST(DONT_ECHO_CC)
140
141AC_MSG_CHECKING(if you want to check memory-leaks)
142CF_ARG_ENABLE(find-leaks,
143	[  --enable-find-leaks     logic for testing memory leaks],
144	[with_leak_checks=yes],
145	[with_leak_checks=no])
146AC_MSG_RESULT($with_leak_checks)
147test "$with_leak_checks" = "yes" && AC_DEFINE(LY_FIND_LEAKS,1,[Define to 1 if you want to check memory-leaks])
148
149# The comment about adding -g to $CFLAGS is unclear.  Autoconf tries to add
150# a -g flag; we remove it if the user's $CFLAGS was not set and debugging is
151# disabled.
152AC_MSG_CHECKING(if you want to enable debug-code)
153CF_ARG_ENABLE(debug,
154	[  --enable-debug          compile w/ debugging (if \$CFLAGS is set, add -g there, too)],
155	[with_debug=yes],
156	[with_debug=no])
157AC_MSG_RESULT($with_debug)
158if test "$with_debug" = "yes" ; then
159	case "$host_os" in
160	(ultrix*|osf*)
161		test -z "$ORIGINAL_CFLAGS" && CF_STRIP_O_OPT(CFLAGS)
162		if test -z "$GCC" ; then
163			CFLAGS="$CFLAGS -g3"
164		fi
165		;;
166	esac
167else
168	case "$host_os" in
169	(osf*)
170		test -z "$GCC" && CFLAGS="$CFLAGS -std1"
171		test -z "$ORIGINAL_CFLAGS" && CF_STRIP_G_OPT(CFLAGS)
172		;;
173	(*)
174		test -z "$ORIGINAL_CFLAGS" && CF_STRIP_G_OPT(CFLAGS)
175		;;
176	esac
177fi
178
179AC_MSG_CHECKING(if you want to enable lynx trace code *recommended* )
180CF_ARG_DISABLE(trace,
181	[  --disable-trace         disable logic for trace code],
182	[with_trace=$enableval],
183	[with_trace=yes])
184AC_MSG_RESULT($with_trace)
185test "$with_trace" = no && AC_DEFINE(NO_LYNX_TRACE,1,[Define to 1 if you want to enable lynx trace code])
186
187AC_MSG_CHECKING(if you want verbose trace code)
188CF_ARG_ENABLE(vertrace,
189	[  --enable-vertrace       verbose trace code],
190	[with_vertrace=yes],
191	[with_vertrace=no])
192AC_MSG_RESULT($with_vertrace)
193test "$with_vertrace" = yes && AC_DEFINE(LY_TRACELINE,__LINE__,[Define to __LINE__ if you want verbose trace code])
194
195CF_WITH_SCREEN_PDCURSES
196CF_ENABLE_WARNINGS
197CF_WITH_DBMALLOC
198CF_WITH_DMALLOC
199
200dnl --------------------------------------------------------------------------
201dnl Checks for compiler & standard-library characteristics
202dnl --------------------------------------------------------------------------
203
204dnl If we're able to run this script, this is true!
205AC_DEFINE(UNIX,1,[Define to 1 if we can run a configure script])
206
207dnl Only add to this case statement things that we cannot design tests for.
208TRY_CFLAGS=
209case "$host_os" in
210(aix4*)
211	TRY_CFLAGS="$TRY_CFLAGS -DAIX4 -D_BSD=44 -D_AIX"
212	LIBS="$LIBS -lbsd"
213	;;
214(aix*)
215	TRY_CFLAGS="$TRY_CFLAGS -D_ACS_COMPAT_CODE"
216	LIBS="$LIBS -lbsd"
217	;;
218(apollo*)
219	TRY_CFLAGS="$TRY_CFLAGS -D_BUILTINS -W0,-opt,4"
220	;;
221(bsdi*)
222	TRY_CFLAGS="$TRY_CFLAGS -DBSDI"
223	;;
224(clix*)
225	# Tested on CLIX 3.1 (T.Dickey).  The original makefile entry
226	# contributed by Alex Matulich (matuli_a@marlin.navsea.navy.mil) also
227	# references -lmalloc and -lbsd.
228	AC_CHECK_LIB(c_s,strcmp)
229	;;
230(convex*)
231	TRY_CFLAGS="$TRY_CFLAGS -D__STDC__ -Dunix"
232	;;
233(cygwin*)
234	TRY_CFLAGS="$TRY_CFLAGS -DWIN_EX -D_WINDOWS_NSL"
235	LIBS="$LIBS -luser32"
236	;;
237(hpux*)
238	TRY_CFLAGS="$TRY_CFLAGS -D_XOPEN_SOURCE_EXTENDED"
239	test -z "$GCC" && TRY_CFLAGS="$TRY_CFLAGS -Wp,-H600000 -DSYS_HPUX"
240	;;
241(isc*)
242	# -DPOSIX_JC is necessary, else LYBookmark.c never finds out what a mode_t is.
243	TRY_CFLAGS="$TRY_CFLAGS -DISC -DPOSIX_JC"
244	LIBS="$LIBS -linet -lnsl_s -lcposix"
245	;;
246(irix6.*)
247	TRY_CFLAGS="$TRY_CFLAGS -DSYS_IRIX64"
248	;;
249(irix*)
250	# The original makefile used the $CFLAGS option -cckr for some form
251	# of K&R compatibility.  However, this causes compilation warnings for
252	# varargs on IRIX 5.2, and does not appear to be needed.
253	;;
254(linux*)
255	TRY_CFLAGS="$TRY_CFLAGS -DLINUX"
256	;;
257(mingw*)
258	# put these directly in CPPFLAGS since they will not work in lynx_cfg.h
259	CF_ADD_CFLAGS(\
260		-DDOSPATH \
261		-DNOSIGHUP \
262		-DNOUSERS \
263		-DWIN32_LEAN_AND_MEAN \
264		-DWIN_EX \
265		-D_CONSOLE \
266		-D_GNU_SOURCE \
267		-D_MBCS \
268		-D_WINDOWS \
269		-D_WIN_CC \
270		-D__WIN32__ \
271	)
272	EXTRA_OBJS="$EXTRA_OBJS Xsystem\$o"
273	;;
274(msdosdjgpp*)
275	LIBS="$LIBS -lwatt"
276	TRY_CFLAGS="$TRY_CFLAGS -DDOSPATH -DNOUSERS"
277	;;
278(next*)
279	TRY_CFLAGS="$TRY_CFLAGS -DNEXT"
280	;;
281(osf4*)
282	# The -Olimit flag (see below) is no longer available with
283	# Digital C 5.2, which is bundled with Digital UNIX 4.0.
284	TRY_CFLAGS="$TRY_CFLAGS -DDSYS5 -DSYS_TRU64"
285	;;
286(osf*)
287	# Increase the maximum size of functions that will be optimized.
288	test -z "$GCC" && TRY_CFLAGS="$TRY_CFLAGS -O -Olimit 4000"
289	TRY_CFLAGS="$TRY_CFLAGS -DDSYS5 -DSYS_TRU64"
290	;;
291(sco3.2v5*)
292	test "$ac_cv_prog_gcc" != yes && TRY_CFLAGS="$TRY_CFLAGS -belf"
293	;;
294(sco*)
295	LIBS="$LIBS -lmalloc"
296	# It's a little late to do much, but try to warn user if he's using
297	# SCO's cc (which is reported to have broken const/volatile).
298	case "$CC" in
299	(cc|*/cc)
300		AC_MSG_WARN(You should consider using gcc or rcc if available)
301		unset ac_cv_prog_CC
302		AC_CHECK_PROGS(CC,gcc rcc,$CC)
303		;;
304	esac
305	;;
306(sequent-ptx)
307	TRY_CFLAGS="$TRY_CFLAGS -DSVR4_BSDSELECT -DNO_IOCTL -DUSE_FCNTL"
308	;;
309(sequent-ptx2)
310	TRY_CFLAGS="$TRY_CFLAGS -DSVR4_BSDSELECT"
311	;;
312(sony-newsos*)
313	TRY_CFLAGS="$TRY_CFLAGS -I/usr/sony/include"
314	AC_CHECK_HEADERS(jcurses.h)
315	;;
316(svr4)
317	TRY_CFLAGS="$TRY_CFLAGS -DSVR4_BSDSELECT -DSVR4"
318	;;
319(sunos3*)
320	TRY_CFLAGS="$TRY_CFLAGS -DSUN"
321	;;
322(sunos4*)
323	TRY_CFLAGS="$TRY_CFLAGS -DSUN -DSUN4"
324	;;
325(ultrix*)
326	# Increase the maximum size of functions that will be optimized.
327	test -z "$GCC" && TRY_CFLAGS="$TRY_CFLAGS -O -Olimit 600 -G 7"
328	TRY_CFLAGS="$TRY_CFLAGS -DULTRIX"
329	AC_CHECK_HEADERS(cursesX.h,
330		[AC_DEFINE(HAVE_CURSESX_H,1,[Define to 1 if we have cursesX.h])
331		 cf_cv_ncurses_header=cursesX.h])
332	;;
333esac
334
335case "$host_os" in
336(mingw*)
337	EXTRA_OBJS="$EXTRA_OBJS LYIcon\$o"
338	;;
339esac
340
341CF_ANSI_CC_REQD
342
343dnl --------------------------------------------------------------------------
344dnl --------------------------------------------------------------------------
345
346CF_HELP_MESSAGE(
347Basic Configuration Options:)
348
349CF_LARGEFILE
350
351dnl --------------------------------------------------------------------------
352dnl internationalization macros
353dnl --------------------------------------------------------------------------
354
355dnl Set of available languages (based on source distribution)
356if test -z "$ALL_LINGUAS" ; then
357	ALL_LINGUAS=`test -d "$srcdir/po" && cd "$srcdir/po" && echo *.po|sed -e 's/\.po//g' -e 's/*//'`
358	AM_PATH_PROG_WITH_TEST(MSGINIT, msginit,
359		["$ac_dir/$ac_word" --no-translator --version /dev/null >/dev/null 2>&1], :)
360	if test "$MSGINIT" != ":" ; then
361		CF_VERBOSE(adding en.po)
362		ALL_LINGUAS="$ALL_LINGUAS en"
363	fi
364fi
365
366CF_BUNDLED_INTL(makefile,disable)
367
368INTLDIR_CPPFLAGS="#"
369if test -z "$INTLDIR_MAKE" ; then
370	INTLDIR_CPPFLAGS=
371fi
372
373AC_SUBST(INTLDIR_CPPFLAGS)
374
375CF_WITH_PATH(nls-datadir,
376[  --with-nls-datadir=DIR  NLS data, parent of locale],
377NLS_DATADIR,
378[PREFIX/DATADIR],
379[$prefix/$DATADIRNAME])
380
381dnl --------------------------------------------------------------------------
382AC_MSG_CHECKING(if you want full utility pathnames)
383CF_ARG_DISABLE(full-paths,
384	[  --disable-full-paths    control whether full utility pathnames are used],
385	[with_full_paths=no],
386	[with_full_paths=yes])
387AC_MSG_RESULT($with_full_paths)
388test "$with_full_paths" = no && AC_DEFINE(USE_EXECVP,1,[Define to 1 if you want full utility pathnames])
389
390CF_DEFINE_PROG(system mailer, SYSTEM_MAIL,
391	/usr/mmdf/bin/submit \
392	/usr/sbin/sendmail \
393	/usr/lib/sendmail  \
394	)
395CF_SYSTEM_MAIL_FLAGS
396if test -n "$SYSTEM_MAIL" ; then
397if test "$with_full_paths" = no ; then
398	SYSTEM_MAIL=`basename "$SYSTEM_MAIL"`
399fi
400fi
401
402dnl --------------------------------------------------------------------------
403CF_XOPEN_SOURCE(500,199506L)
404CF_SIGWINCH
405
406dnl Collect tests for compiler options into one place
407if test -n "$TRY_CFLAGS" ; then
408	CF_CHECK_CFLAGS($TRY_CFLAGS)
409fi
410
411dnl --------------------------------------------------------------------------
412dnl Checks for library configuration (added right-to-left)
413dnl --------------------------------------------------------------------------
414
415### Look for network libraries first, since some functions (such as gethostname)
416### are used in a lot of places.
417AC_CACHE_CHECK(if you want NSS compatible SSL libraries,cf_cv_use_libnss_compat,[
418AC_ARG_WITH(nss-compat,
419	[  --with-nss-compat{=path}       link with nss_compat library if available],
420	[cf_cv_use_libnss_compat=$withval],
421	[cf_cv_use_libnss_compat=no])
422])
423
424AC_CACHE_CHECK(if you want ssl library,cf_cv_use_libssl,[
425AC_ARG_WITH(ssl,
426	[  --with-ssl{=path}       link with ssl library if available],
427	[cf_cv_use_libssl=$withval],
428	[cf_cv_use_libssl=no])
429])
430
431AC_CACHE_CHECK(if you want gnutls support,cf_cv_use_libgnutls,[
432AC_ARG_WITH(gnutls,
433	[  --with-gnutls{=path}    link with gnutls support],
434	[cf_cv_use_libgnutls=$withval],
435	[cf_cv_use_libgnutls=no])
436])
437
438# this option is mainly for comparing with/without Lynx's wrapper for GNUTLS.
439AC_CACHE_CHECK(if you want gnutls-openssl compat,cf_cv_gnutls_compat,[
440AC_ARG_ENABLE(gnutls-compat,
441	[  --enable-gnutls-compat  link with gnutls-openssl compat],
442	[cf_cv_gnutls_compat=$enableval],
443	[cf_cv_gnutls_compat=no])
444])
445
446AC_CACHE_CHECK(if you want socks library,cf_cv_use_libsocks,[
447AC_ARG_WITH(socks,
448	[  --with-socks{=path}     link with socks library if available],
449	[cf_cv_use_libsocks=$withval],
450	[cf_cv_use_libsocks=no])
451])
452
453AC_CACHE_CHECK(if you want socks5 library,cf_cv_use_libsocks5,[
454AC_ARG_WITH(socks5,
455	[  --with-socks5{=path}    link with socks5 library if available],
456	[cf_cv_use_libsocks5=$withval],
457	[cf_cv_use_libsocks5=no])
458])
459
460if test "x$cf_cv_use_libsocks" != xno ; then
461	CF_SOCKS($cf_cv_use_libsocks)
462elif test "x$cf_cv_use_libsocks5" != xno ; then
463	CF_SOCKS5($cf_cv_use_libsocks5)
464else
465	CF_NETLIBS
466fi
467
468CF_INET_ADDR
469
470CF_PKG_CONFIG
471
472if test "x$cf_cv_use_libssl"  != xno ; then
473	CF_SSL($cf_cv_use_libssl)
474elif test "x$cf_cv_use_libgnutls" != xno ; then
475    if test "x$cf_cv_gnutls_compat" = xno ; then
476        CF_GNUTLS($cf_cv_use_libgnutls,tidy_tls\$o)
477    else
478        CF_GNUTLS($cf_cv_use_libgnutls)
479    fi
480elif test "x$cf_cv_use_libnss_compat"  != xno ; then
481	CF_NSS_COMPAT($cf_cv_use_libnss_compat)
482fi
483
484dnl --------------------------------------------------------------------------
485### check for ipv6 support
486AC_MSG_CHECKING([whether to enable ipv6])
487CF_ARG_ENABLE(ipv6,
488[  --enable-ipv6           use ipv6 (with ipv4) support],
489	[AC_DEFINE(ENABLE_IPV6,1,[Define to 1 if we should enable ipv6])])
490AC_MSG_RESULT($enableval)
491if test "$enableval" = "yes"; then
492	CF_CHECK_IPV6
493fi
494dnl AC_REPLACE_FUNCS(getaddrinfo getnameinfo)
495
496dnl --------------------------------------------------------------------------
497dnl This has to be cached, since there's a lot of interdependent tests.
498AC_CACHE_CHECK(for screen type, cf_cv_screen,[
499AC_ARG_WITH(screen,
500[  --with-screen=XXX       select screen type (XXX is curses (default),
501                          ncurses, ncursesw, pdcurses or slang)],
502	[
503case "$withval" in
504(curses|ncurses*|pdcurses|slang)
505	cf_cv_screen=$withval
506	;;
507(*)	AC_ERROR(Unexpected value $withval)
508	;;
509esac],
510	[cf_cv_screen=curses])])
511
512case "$cf_cv_screen" in
513(curses|ncurses*)
514	CF_WITH_CURSES_DIR
515	;;
516esac
517
518cf_wide_curses=no
519dft_color_style=yes
520case "$cf_cv_screen" in
521(curses)
522	CF_CURSES_CONFIG
523	CF_CURS_PERFORMANCE
524	CF_CURS_TOUCHLINE
525	;;
526(ncursesw*)
527	CF_UTF8_LIB
528	CF_NCURSES_CONFIG($cf_cv_screen)
529	cf_wide_curses=yes
530	;;
531(ncurses*)
532	CF_NCURSES_CONFIG($cf_cv_screen)
533	;;
534(pdcurses)
535	case "$host_os" in
536	(mingw*)
537		cf_cv_ncurses_header=curses.h
538		;;
539	(*)
540		cf_cv_ncurses_header=xcurses.h
541		# do this last, since it changes definition of main: CF_PDCURSES_X11
542		;;
543	esac
544	;;
545(slang)
546	CF_SLANG_UNIX_DEFS
547	dft_color_style=no
548	;;
549esac
550
551CF_TRY_RPATH
552
553CF_CURSES_CHTYPE
554
555AC_MSG_CHECKING(if you want the wide-curses features)
556CF_ARG_ENABLE(widec,
557[  --enable-widec          enable wide-curses features],
558	[use_wide_curses=$enableval],
559	[use_wide_curses=$cf_wide_curses])
560AC_MSG_RESULT($use_wide_curses)
561
562AC_MSG_CHECKING(if color-style code should be used)
563CF_ARG_DISABLE(color-style,
564[  --disable-color-style   use color style (ncurses/curses)],
565	[use_color_style=$enableval],
566	[use_color_style=$dft_color_style])
567
568case "$use_color_style" in
569(no)
570	AC_MSG_RESULT(no)
571	INSTALL_LSS=
572	;;
573(*)
574	AC_DEFINE(USE_COLOR_STYLE,1,[Define to 1 if we should enable color-style])
575	AC_MSG_RESULT(yes)
576
577	AC_MSG_CHECKING(for location of style-sheet file)
578
579CF_WITH_PATH(lss-file,
580[  --with-lss-file{=path}  specify the default style-sheet file
581                         ],
582LYNX_LSS_FILE,
583SYSCONFDIR/lynx.lss,
584$sysconfdir/lynx.lss)
585
586	AC_MSG_RESULT($LYNX_LSS_FILE)
587
588	test "$LYNX_LSS_FILE" = no && LYNX_LSS_FILE=
589	AC_DEFINE_UNQUOTED(LYNX_LSS_FILE,"$LYNX_LSS_FILE",[Define to default path for Lynx lss-file])
590
591	INSTALL_LSS=install-lss
592	;;
593esac
594AC_SUBST(INSTALL_LSS)
595
596dnl --------------------------------------------------------------------------
597
598AC_MSG_CHECKING(for the default configuration-file)
599
600CF_WITH_PATH(cfg-file,
601[  --with-cfg-file{=path}  specify the default configuration file
602                         ],
603LYNX_CFG_FILE,
604SYSCONFDIR/lynx.cfg,
605$sysconfdir/lynx.cfg)
606
607AC_MSG_RESULT($LYNX_CFG_FILE)
608
609test "$LYNX_CFG_FILE" = no && LYNX_CFG_FILE=
610AC_DEFINE_UNQUOTED(LYNX_CFG_FILE,"$LYNX_CFG_FILE",[Define to default path for Lynx cfg-file])
611
612dnl --------------------------------------------------------------------------
613
614AC_MSG_CHECKING(for the default configuration-path)
615
616CF_WITH_PATH(cfg-path,
617[  --with-cfg-path{=path}  specify the default configuration directories
618                         ],
619LYNX_CFG_PATH,
620SYSCONFDIR,
621$sysconfdir)
622
623AC_MSG_RESULT($LYNX_CFG_PATH)
624
625test -z "$LYNX_CFG_PATH" && LYNX_CFG_PATH="`echo "$LYNX_CFG_FILE" | sed -e 's%/[[^/]]*$%%'`"
626test "x$LYNX_CFG_PATH" = xno && LYNX_CFG_PATH=
627AC_DEFINE_UNQUOTED(LYNX_CFG_PATH,"$LYNX_CFG_PATH",[Define to default path for Lynx config-files])
628
629dnl --------------------------------------------------------------------------
630AC_MSG_CHECKING(if htmlized lynx.cfg should be built)
631CF_ARG_ENABLE(htmlized-cfg,
632[  --enable-htmlized-cfg   build htmlized lynx.cfg],
633	[use_htmlized_cfg=$enableval],
634	[use_htmlized_cfg=no])
635AC_MSG_RESULT($use_htmlized_cfg)
636
637LYNXCFG_MAKE=''
638LYNXCFG_NO_MAKE=''
639if test "$use_htmlized_cfg" = no ; then
640	LYNXCFG_MAKE='#'
641else
642	LYNXCFG_NO_MAKE='#'
643fi
644AC_SUBST(LYNXCFG_MAKE)
645AC_SUBST(LYNXCFG_NO_MAKE)
646
647dnl --------------------------------------------------------------------------
648AC_MSG_CHECKING(if local doc directory should be linked to help page)
649CF_ARG_ENABLE(local-docs,
650[  --enable-local-docs     link local doc-directory to help-page],
651	[use_local_docs=$enableval],
652	[use_local_docs=no])
653AC_MSG_RESULT($use_local_docs)
654
655LYNXDOC_MAKE=''
656if test "$use_local_docs" = no ; then
657	LYNXDOC_MAKE='#'
658fi
659AC_SUBST(LYNXDOC_MAKE)
660
661dnl --------------------------------------------------------------------------
662
663AC_MSG_CHECKING(for MIME library directory)
664CF_WITH_PATH(mime-libdir,
665[  --with-mime-libdir=DIR  MIME data, mime.types and mailcap],
666MIME_LIBDIR,
667[/etc])
668AC_MSG_RESULT($MIME_LIBDIR)
669MIME_LIBDIR=`echo "$MIME_LIBDIR" | sed -e 's,/$,,' -e 's,$,/,'`
670AC_DEFINE_UNQUOTED(MIME_LIBDIR,"$MIME_LIBDIR",[Define to default path for MIME library])
671
672dnl --------------------------------------------------------------------------
673AC_MSG_CHECKING(if locale-charset selection logic should be used)
674CF_ARG_DISABLE(locale-charset,
675[  --disable-locale-charset use locale-charset selection logic],
676	[use_locale_charset=$enableval],
677	[use_locale_charset=yes])
678AC_MSG_RESULT($use_locale_charset)
679test "$use_locale_charset" != no && AC_DEFINE(USE_LOCALE_CHARSET,1,[Define to 1 if locale-charset selection logic should be used])
680
681dnl --------------------------------------------------------------------------
682dnl Check for subsets of compiled-in tables.
683dnl --------------------------------------------------------------------------
684CHARSET_DEFS=
685AC_SUBST(CHARSET_DEFS)
686
687AC_MSG_CHECKING(if you want only a few charsets)
688AC_ARG_WITH(charsets,
689[  --with-charsets=list    limit charsets to given list of MIME names],
690[cf_charsets=$withval],
691[cf_charsets=])
692
693if test -n "$cf_charsets" ; then
694	AC_MSG_RESULT(yes)
695	AC_DEFINE(ALL_CHARSETS,0,[Define to 0 if xxx])
696	cf_min_charsets=us-ascii,iso-8859-1,utf-8
697	if test "$cf_charsets" = "no" ; then
698		cf_charsets=minimal
699	fi
700	if test "$cf_charsets" = "minimal" ; then
701		CF_VERBOSE(using minimal list of charsets: $cf_min_charsets)
702	fi
703	cf_charsets=`echo "$cf_charsets" | sed -e "s/minimal/$cf_min_charsets/g" -e 's/,/ /g'`
704	for cf_charset in $cf_charsets
705	do
706		cf_def_charset=`echo "$cf_charset" | sed -e 's/+/_/g' -e 's/-/_/g'`
707		cf_use_charset=no
708		# check charsets that are defined via .tbl files
709		if ( ${EGREP-egrep} '^M'"$cf_charset"'$' "$srcdir"/src/chrtrans/*.tbl 2>/dev/null >/dev/null )
710		then
711			cf_use_charset=yes
712		# check charsets that are "built-in"
713		else
714			for cf_tst_charset in big5 euc_cn euc_jp euc_kr shift_jis x_transparent
715			do
716				if test "$cf_tst_charset" = "$cf_def_charset"
717				then
718					cf_use_charset=yes
719					break
720				fi
721			done
722		fi
723		if test "$cf_use_charset" = yes
724		then
725			CF_VERBOSE(found $cf_charset)
726			CHARSET_DEFS="-DNO_CHARSET_${cf_def_charset}=0 $CHARSET_DEFS"
727		else
728			CF_VERBOSE(not found $cf_charset)
729		fi
730	done
731else
732	AC_MSG_RESULT(no)
733fi
734
735dnl --------------------------------------------------------------------------
736dnl Checks for standard headers
737dnl --------------------------------------------------------------------------
738
739AC_HEADER_STDC
740AC_HEADER_TIME
741AC_HEADER_DIRENT
742dnl Don't check for sys/wait.h here since it is covered by another test.
743AC_CHECK_HEADERS( \
744	arpa/inet.h \
745	fcntl.h \
746	limits.h \
747	stdlib.h \
748	string.h \
749	sys/fcntl.h \
750	sys/filio.h \
751	sys/ioctl.h \
752	sys/param.h \
753	sys/timeb.h \
754	sys/time.h \
755	syslog.h \
756	termio.h \
757	termios.h \
758	unistd.h \
759	vfork.h \
760	wchar.h \
761)
762CF_TERMIO_AND_TERMIOS
763CF_FUNC_SIGACTION
764CF_FUNC_WAIT
765AC_TYPE_GETGROUPS
766AC_TYPE_OFF_T
767AC_TYPE_PID_T
768AC_TYPE_UID_T
769AC_TYPE_MODE_T
770CF_CHECK_TYPE(ssize_t, int)
771CF_CHECK_TYPE(socklen_t, int, [
772#include <sys/types.h>
773#include <sys/socket.h>
774])
775CF_TYPE_LONG_LONG
776CF_TM_GMTOFF
777
778CF_CHECK_SIZEOF(int,4)
779CF_CHECK_SIZEOF(long,4)
780CF_CHECK_SIZEOF(off_t,4)
781CF_CHECK_SIZEOF(size_t,4)
782CF_CHECK_SIZEOF(time_t,4)
783AC_CHECK_TYPE(intptr_t, long)
784
785dnl --------------------------------------------------------------------------
786dnl Checks for library units
787dnl --------------------------------------------------------------------------
788
789AC_FUNC_ALLOCA
790AC_FUNC_VFORK
791CF_FIONBIO
792CF_REMOVE_BROKEN
793CF_FUNC_LSTAT
794CF_FUNC_VASPRINTF
795AC_CHECK_FUNCS( \
796	atoll \
797	ctermid \
798	cuserid \
799	ftime \
800	getcwd \
801	getgroups \
802	gettimeofday \
803	getuid \
804	popen \
805	putenv \
806	readdir \
807	setuid \
808	truncate \
809	ttyname \
810	unsetenv \
811	sleep \
812	usleep \
813	waitpid \
814)
815AC_CHECK_FUNCS( \
816	mkdtemp,,[AC_CHECK_FUNCS(mktemp)]
817)
818AC_REPLACE_FUNCS( \
819	mktime \
820	strstr \
821	wcwidth \
822)
823
824CF_SRAND(lynx_)
825CF_CHECK_FUNCDECLS([
826#ifdef HAVE_STDLIB_H
827#include <stdlib.h>
828#endif
829#ifdef HAVE_UNISTD_H
830#include <unistd.h>
831#endif
832], sleep)
833CF_CHECK_FUNCDECLS([#include <string.h>], strstr)
834CF_CHECK_FUNCDECLS([
835#include <stdio.h>
836#include <grp.h>], getgrgid getgrnam)
837
838dnl --------------------------------------------------------------------------
839dnl Checks for external-data
840dnl --------------------------------------------------------------------------
841
842CF_BOOL_DEFS
843CF_ERRNO
844CF_SET_ERRNO
845CF_LOCALE
846CF_NGROUPS
847AC_CHECK_FUNCS(strerror,,[CF_SYS_ERRLIST])
848CF_UTMP
849CF_CHECK_EXTERN_DATA(h_errno,int)
850
851AC_SUBST(EXTRA_OBJS)
852
853dnl --------------------------------------------------------------------------
854dnl Experimental options that don't need to test system features
855dnl --------------------------------------------------------------------------
856
857CF_HELP_MESSAGE(
858Experimental Options:)
859
860dnl --------------------------------------------------------------------------
861AC_MSG_CHECKING(if bibp: URLs should be supported)
862CF_ARG_DISABLE(bibp-urls,
863[  --disable-bibp-urls     disable support for bibp: URLs],
864	[use_bibp_urls=$enableval],
865	[use_bibp_urls=yes])
866AC_MSG_RESULT($use_bibp_urls)
867test "$use_bibp_urls" = no && AC_DEFINE(DISABLE_BIBP,1,[Define to 1 if bibp: URLs should be supported])
868
869dnl --------------------------------------------------------------------------
870AC_MSG_CHECKING(if configuration info should be browsable)
871CF_ARG_DISABLE(config-info,
872[  --disable-config-info   disable browsable configuration-info],
873	[use_config_info=$enableval],
874	[use_config_info=yes])
875AC_MSG_RESULT($use_config_info)
876test "$use_config_info" = no && AC_DEFINE(NO_CONFIG_INFO,1,[Define to 1 if configuration info should be browsable])
877
878dnl --------------------------------------------------------------------------
879AC_MSG_CHECKING(if new-style forms-based options screen should be used)
880CF_ARG_DISABLE(forms-options,
881[  --disable-forms-options disable forms-based options],
882	[use_forms_options=$enableval],
883	[use_forms_options=yes])
884AC_MSG_RESULT($use_forms_options)
885test "$use_forms_options" = no && AC_DEFINE(NO_OPTION_FORMS,1,[Define to 1 if new-style forms-based options screen should be used])
886
887dnl --------------------------------------------------------------------------
888AC_MSG_CHECKING(if old-style options menu should be used)
889CF_ARG_DISABLE(menu-options,
890[  --disable-menu-options  disable old-style option menu],
891	[use_menu_options=$enableval],
892	[use_menu_options=yes])
893AC_MSG_RESULT($use_menu_options)
894test "$use_menu_options" = no && AC_DEFINE(NO_OPTION_MENU,1,[Define to 1 if old-style options menu should be used])
895
896dnl --------------------------------------------------------------------------
897AC_MSG_CHECKING(if sessions code should be used)
898CF_ARG_DISABLE(sessions,
899[  --disable-sessions      use sessions code],
900	[use_sessions=$enableval],
901	[use_sessions=yes])
902AC_MSG_RESULT($use_sessions)
903if test "$use_sessions" != no ; then
904	AC_DEFINE(USE_SESSIONS,1,[Define to 1 if sessions code should be used])
905	EXTRA_OBJS="$EXTRA_OBJS LYSession\$o"
906fi
907
908dnl --------------------------------------------------------------------------
909AC_MSG_CHECKING(if session-caching code should be used)
910CF_ARG_DISABLE(session-cache,
911[  --disable-session-cache use session-caching code],
912	[use_session_cache=$enableval],
913	[use_session_cache=yes])
914AC_MSG_RESULT($use_session_cache)
915if test "$use_session_cache" != no ; then
916    AC_DEFINE(USE_CACHEJAR,1,[Define to 1 if session-caching code should be used])
917fi
918
919dnl --------------------------------------------------------------------------
920AC_MSG_CHECKING(if address-list page should be used)
921CF_ARG_DISABLE(addrlist-page,
922[  --disable-addrlist-page disable address-list page],
923	[use_addrlist_page=$enableval],
924	[use_addrlist_page=yes])
925AC_MSG_RESULT($use_addrlist_page)
926test "$use_addrlist_page" != no && AC_DEFINE(USE_ADDRLIST_PAGE,1,[Define to 1 if address-list page should be used])
927
928dnl --------------------------------------------------------------------------
929AC_MSG_CHECKING(if support for CJK should be used)
930CF_ARG_DISABLE(cjk,
931[  --disable-cjk           do not use CJK logic],
932	[use_cjk=$enableval],
933	[use_cjk=yes])
934AC_MSG_RESULT($use_cjk)
935test "$use_cjk" != no && AC_DEFINE(CJK_EX,1,[Define to 1 if CJK logic should be used])
936
937use_cjk_utf8=no
938
939AM_ICONV
940if test "x$am_cv_func_iconv" = "xyes"
941then
942
943dnl --------------------------------------------------------------------------
944AC_MSG_CHECKING(if experimental support for Chinese UTF-8 should be used)
945CF_ARG_ENABLE(chinese-utf8,
946[  --enable-chinese-utf8   use Chinese UTF-8 logic],
947	[use_cn_utf8=$enableval],
948	[use_cn_utf8=yes])
949AC_MSG_RESULT($use_cn_utf8)
950if test "$use_cn_utf8" != no ; then
951	AC_DEFINE(EXP_CHINESEUTF8_SUPPORT,1,[Define to 1 if Chinese UTF-8 logic should be used])
952	use_cjk_utf8=yes
953fi
954
955dnl --------------------------------------------------------------------------
956AC_MSG_CHECKING(if support for Japanese UTF-8 should be used)
957CF_ARG_DISABLE(japanese-utf8,
958[  --disable-japanese-utf8 do not use Japanese UTF-8 logic],
959	[use_ja_utf8=$enableval],
960	[use_ja_utf8=yes])
961AC_MSG_RESULT($use_ja_utf8)
962if test "$use_ja_utf8" != no ; then
963	AC_DEFINE(USE_JAPANESEUTF8_SUPPORT,1,[Define to 1 if Japanese UTF-8 logic should be used])
964	use_cjk_utf8=yes
965fi
966
967dnl --------------------------------------------------------------------------
968if test $use_cjk_utf8 = yes
969then
970	if test "$USE_NLS" != yes ; then
971	  LIBS="$LIBICONV $LIBS"
972	fi
973fi
974
975else
976	CF_VERBOSE(skipping CJK features which depend on iconv)
977fi
978
979dnl --------------------------------------------------------------------------
980AC_MSG_CHECKING(if experimental wcwidth/UTF-8 logic should be used)
981CF_ARG_ENABLE(wcwidth-support,
982[  --enable-wcwidth-support use experimental wcwidth/UTF-8 logic],
983	[use_wcwidth=$enableval],
984	[use_wcwidth=no])
985AC_MSG_RESULT($use_wcwidth)
986test "$use_wcwidth" != no && AC_DEFINE(EXP_WCWIDTH_SUPPORT,1,[Define to 1 if experimental wcwidth/UTF-8 logic should be used])
987
988dnl --------------------------------------------------------------------------
989use_dft_colors=no
990case "$cf_cv_screen" in
991(curses|slang|ncurses*)
992	use_dft_colors=maybe
993	;;
994esac
995
996if test "$use_dft_colors" != no ; then
997AC_MSG_CHECKING(if you want to use default-colors)
998CF_ARG_ENABLE(default-colors,
999[  --enable-default-colors enable use of default-colors (ncurses/slang)],
1000	[use_dft_colors=yes],
1001	[use_dft_colors=no])
1002AC_MSG_RESULT($use_dft_colors)
1003test "$use_dft_colors" = "yes" && AC_DEFINE(USE_DEFAULT_COLORS,1,[Define to 1 if you want to use default-colors])
1004fi
1005
1006dnl --------------------------------------------------------------------------
1007AC_MSG_CHECKING(if experimental keyboard-layout logic should be used)
1008CF_ARG_ENABLE(kbd-layout,
1009[  --enable-kbd-layout     use experimental keyboard-layout support],
1010	[use_kbd_layout=$enableval],
1011	[use_kbd_layout=no])
1012AC_MSG_RESULT($use_kbd_layout)
1013test "$use_kbd_layout" != no && AC_DEFINE(EXP_KEYBOARD_LAYOUT,1,[Define to 1 if experimental keyboard-layout logic should be used])
1014
1015dnl --------------------------------------------------------------------------
1016AC_MSG_CHECKING(if experimental nested-table logic should be used)
1017CF_ARG_ENABLE(nested-tables,
1018[  --enable-nested-tables  use experimental nested-table support],
1019	[use_nested_tables=$enableval],
1020	[use_nested_tables=no])
1021AC_MSG_RESULT($use_nested_tables)
1022test "$use_nested_tables" != no && AC_DEFINE(EXP_NESTED_TABLES,1,[Define to 1 if experimental nested-table logic should be used])
1023
1024dnl --------------------------------------------------------------------------
1025dnl Miscellaneous options that don't need to test system features
1026dnl --------------------------------------------------------------------------
1027
1028CF_HELP_MESSAGE(
1029Miscellaneous Options:)
1030
1031dnl --------------------------------------------------------------------------
1032AC_MSG_CHECKING(if alternative line-edit bindings should be used)
1033CF_ARG_DISABLE(alt-bindings,
1034[  --disable-alt-bindings  disable alternative line-edit bindings],
1035	[use_alt_bindings=$enableval],
1036	[use_alt_bindings=yes])
1037AC_MSG_RESULT($use_alt_bindings)
1038test "$use_alt_bindings" != no && AC_DEFINE(USE_ALT_BINDINGS,1,[Define to 1 if alternative line-edit bindings should be used])
1039
1040dnl --------------------------------------------------------------------------
1041AC_MSG_CHECKING(if ascii case-conversion should be used)
1042CF_ARG_DISABLE(ascii-ctypes,
1043[  --disable-ascii-ctypes  disable use of ascii case-conversion],
1044	[use_ascii_ctypes=$enableval],
1045	[use_ascii_ctypes=yes])
1046AC_MSG_RESULT($use_ascii_ctypes)
1047test "$use_ascii_ctypes" != no && AC_DEFINE(USE_ASCII_CTYPES,1,[Define to 1 if ascii case-conversion should be used])
1048
1049dnl --------------------------------------------------------------------------
1050AC_MSG_CHECKING(if you want to use extended HTML DTD logic)
1051CF_ARG_DISABLE(extended-dtd,
1052[  --disable-extended-dtd  disable extended HTML DTD logic],
1053	[use_ext_htmldtd=no],
1054	[use_ext_htmldtd=yes])
1055AC_MSG_RESULT($use_ext_htmldtd)
1056test "$use_ext_htmldtd" = "no" && AC_DEFINE(NO_EXTENDED_HTMLDTD,1,[Define to 1 if you want to use extended HTML DTD logic])
1057
1058dnl --------------------------------------------------------------------------
1059AC_MSG_CHECKING(if file-upload logic should be used)
1060CF_ARG_DISABLE(file-upload,
1061[  --disable-file-upload   disable file-upload support],
1062	[use_file_upload=$enableval],
1063	[use_file_upload=yes])
1064AC_MSG_RESULT($use_file_upload)
1065test "$use_file_upload" != no && AC_DEFINE(USE_FILE_UPLOAD,1,[Define to 1 if file-upload logic should be used])
1066
1067dnl --------------------------------------------------------------------------
1068AC_MSG_CHECKING(if IDNA support should be used)
1069CF_ARG_DISABLE(idna,
1070[  --disable-idna          disable IDNA support],
1071	[use_idna=$enableval],
1072	[use_idna=yes])
1073AC_MSG_RESULT($use_idna)
1074
1075if test "$use_idna" = yes ; then
1076	CF_WITH_IDNA($use_idna)
1077fi
1078
1079dnl --------------------------------------------------------------------------
1080AC_MSG_CHECKING(if element-justification logic should be used)
1081CF_ARG_DISABLE(justify-elts,
1082[  --disable-justify-elts  disable element-justification logic],
1083	[use_justify_elts=$enableval],
1084	[use_justify_elts=yes])
1085AC_MSG_RESULT($use_justify_elts)
1086test "$use_justify_elts" != no && AC_DEFINE(USE_JUSTIFY_ELTS,1,[Define to 1 if element-justification logic should be used])
1087
1088dnl --------------------------------------------------------------------------
1089AC_MSG_CHECKING(if partial-display should be used)
1090CF_ARG_DISABLE(partial,
1091[  --disable-partial       disable partial-display logic],
1092	[use_partial_display=$enableval],
1093	[use_partial_display=yes])
1094AC_MSG_RESULT($use_partial_display)
1095test "$use_partial_display" != no && AC_DEFINE(DISP_PARTIAL,1,[Define to 1 if partial-display should be used])
1096
1097dnl --------------------------------------------------------------------------
1098AC_MSG_CHECKING(if persistent-cookie logic should be used)
1099CF_ARG_DISABLE(persistent-cookies,
1100[  --disable-persistent-cookies  disable persistent-cookie support],
1101	[use_filed_cookies=$enableval],
1102	[use_filed_cookies=yes])
1103AC_MSG_RESULT($use_filed_cookies)
1104test "$use_filed_cookies" != no && AC_DEFINE(USE_PERSISTENT_COOKIES,1,[Define to 1 if persistent-cookie logic should be used])
1105
1106dnl --------------------------------------------------------------------------
1107AC_MSG_CHECKING(if html source should be colorized)
1108CF_ARG_DISABLE(prettysrc,
1109[  --disable-prettysrc     disable colorization of HTML source],
1110	[use_prettysrc=$enableval],
1111	[use_prettysrc=yes])
1112AC_MSG_RESULT($use_prettysrc)
1113test "$use_prettysrc" != no && AC_DEFINE(USE_PRETTYSRC,1,[Define to 1 if html source should be colorized])
1114
1115dnl --------------------------------------------------------------------------
1116AC_MSG_CHECKING(if progress-bar code should be used)
1117CF_ARG_DISABLE(progressbar,
1118[  --disable-progressbar   disable progress-bar],
1119	[use_progressbar=$enableval],
1120	[use_progressbar=yes])
1121AC_MSG_RESULT($use_progressbar)
1122test "$use_progressbar" != no && AC_DEFINE(USE_PROGRESSBAR,1,[Define to 1 if progress-bar code should be used])
1123
1124dnl --------------------------------------------------------------------------
1125AC_MSG_CHECKING(if read-progress message should show ETA)
1126CF_ARG_DISABLE(read-eta,
1127[  --disable-read-eta      disable read-progress message shows ETA],
1128	[use_read_eta=$enableval],
1129	[use_read_eta=yes])
1130AC_MSG_RESULT($use_read_eta)
1131test "$use_read_eta" != no && AC_DEFINE(USE_READPROGRESS,1,[Define to 1 if read-progress message should show ETA])
1132
1133dnl --------------------------------------------------------------------------
1134AC_MSG_CHECKING(if source caching should be used)
1135CF_ARG_DISABLE(source-cache,
1136[  --disable-source-cache  do not cache HTML source for parse mode changes],
1137	[use_source_cache=$enableval],
1138	[use_source_cache=yes])
1139AC_MSG_RESULT($use_source_cache)
1140test "$use_source_cache" != no && AC_DEFINE(USE_SOURCE_CACHE,1,[Define to 1 if source caching should be used])
1141
1142dnl --------------------------------------------------------------------------
1143AC_MSG_CHECKING(if scrollbar code should be used)
1144CF_ARG_DISABLE(scrollbar,
1145[  --disable-scrollbar     disable scrollbar with mouse],
1146	[use_scrollbar=$enableval],
1147	[use_scrollbar=yes])
1148AC_MSG_RESULT($use_scrollbar)
1149
1150dnl --------------------------------------------------------------------------
1151AC_MSG_CHECKING(if charset-selection logic should be used)
1152CF_ARG_ENABLE(charset-choice,
1153[  --enable-charset-choice use charset-selection logic],
1154	[use_charset_choice=$enableval],
1155	[use_charset_choice=no])
1156AC_MSG_RESULT($use_charset_choice)
1157test "$use_charset_choice" != no && AC_DEFINE(USE_CHARSET_CHOICE,1,[Define to 1 if charset-selection logic should be used])
1158
1159dnl --------------------------------------------------------------------------
1160AC_MSG_CHECKING(if you want to use external commands)
1161CF_ARG_ENABLE(externs,
1162[  --enable-externs        use external commands],
1163	[use_externs=yes],
1164	[use_externs=no])
1165AC_MSG_RESULT($use_externs)
1166if test "$use_externs" != "no" ; then
1167	AC_DEFINE(USE_EXTERNALS,1,[Define to 1 if you want to use external commands])
1168	EXTRA_OBJS="$EXTRA_OBJS LYExtern\$o"
1169fi
1170
1171dnl --------------------------------------------------------------------------
1172AC_MSG_CHECKING(if you want to use setfont support)
1173CF_ARG_ENABLE(font-switch,
1174[  --enable-font-switch    use Linux setfont for character-translation],
1175	[use_setfont=yes],
1176	[use_setfont=no])
1177AC_MSG_RESULT($use_setfont)
1178if test "$use_setfont" = yes ; then
1179	case "$host_os" in
1180	(linux*)
1181		CF_PATH_PROG(SETFONT, consolechars, setfont)
1182		;;
1183	(os2*)
1184		SETFONT=built-in
1185		CF_VERBOSE(Assume $host_os has font-switching)
1186		;;
1187	(*)
1188		SETFONT=unknown
1189		CF_VERBOSE(Assume $host_os has no font-switching)
1190		;;
1191	esac
1192	if test -z "$SETFONT" ; then
1193		AC_MSG_WARN(Cannot find a font-setting program)
1194	elif test "$SETFONT" != unknown ; then
1195		AC_DEFINE(EXP_CHARTRANS_AUTOSWITCH,1,[Define to 1 if you want to use setfont support])
1196	fi
1197fi
1198
1199dnl --------------------------------------------------------------------------
1200AC_MSG_CHECKING(if you want cgi-link support)
1201CF_ARG_ENABLE(cgi-links,
1202[  --enable-cgi-links      support cgi links w/o a http daemon],
1203	[AC_DEFINE(LYNXCGI_LINKS,1,[Define to 1 if you want cgi-link support])])
1204AC_MSG_RESULT($enableval)
1205
1206dnl --------------------------------------------------------------------------
1207AC_MSG_CHECKING(if you want change-exec support)
1208CF_ARG_ENABLE(change-exec,
1209[  --enable-change-exec    allow users to change exec options],
1210	[use_change_exec=yes],
1211	[use_change_exec=no])
1212AC_MSG_RESULT($use_change_exec)
1213test "$use_change_exec" = yes && AC_DEFINE(ENABLE_OPTS_CHANGE_EXEC,1,[Define to 1 if you want change-exec support])
1214
1215dnl --------------------------------------------------------------------------
1216AC_MSG_CHECKING(if you want exec-links support)
1217CF_ARG_OPTION(exec-links,
1218[  --enable-exec-links     allow lynx to execute programs accessed via a link],
1219	[use_exec_links=$enableval],
1220	[use_exec_links=$enableval],
1221	[$use_change_exec])
1222AC_MSG_RESULT($use_exec_links)
1223test "$use_exec_links" = yes && AC_DEFINE(EXEC_LINKS,1,[Define to 1 if you want exec-links support])
1224
1225dnl --------------------------------------------------------------------------
1226AC_MSG_CHECKING(if you want exec-scripts support)
1227CF_ARG_OPTION(exec-scripts,
1228[  --enable-exec-scripts   allow lynx to execute programs inferred from a link],
1229	[use_exec_scripts=$enableval],
1230	[use_exec_scripts=$enableval],
1231	[$use_change_exec])
1232AC_MSG_RESULT($use_exec_scripts)
1233test "$use_exec_scripts" = yes && AC_DEFINE(EXEC_SCRIPTS,1,[Define to 1 if you want exec-scripts support])
1234
1235dnl --------------------------------------------------------------------------
1236AC_MSG_CHECKING(if you want internal-links feature)
1237CF_ARG_ENABLE(internal-links,
1238[  --enable-internal-links handle following links to same doc differently],
1239	[use_internal_links=yes],
1240	[use_internal_links=no])
1241AC_MSG_RESULT($use_internal_links)
1242test "$use_internal_links" = yes && AC_DEFINE(TRACK_INTERNAL_LINKS,1,[Define to 1 if you want internal-links feature])
1243
1244dnl --------------------------------------------------------------------------
1245AC_MSG_CHECKING(if you want to fork NSL requests)
1246CF_ARG_ENABLE(nsl-fork,
1247[  --enable-nsl-fork       fork NSL requests, allowing them to be aborted],
1248	[use_nsl_fork=yes],
1249	[use_nsl_fork=no])
1250AC_MSG_RESULT($use_nsl_fork)
1251if test "$use_nsl_fork" = yes ; then
1252	case "$host_os" in
1253	(mingw*)
1254		AC_DEFINE(_WINDOWS_NSL,1,[Define to 1 if we want NSL-fork with Windows])
1255		;;
1256	(*)
1257		AC_DEFINE(NSL_FORK,1,[Define to 1 if we want NSL-fork])
1258		;;
1259	esac
1260fi
1261
1262dnl --------------------------------------------------------------------------
1263AC_MSG_CHECKING(if you want to log URL requests via syslog)
1264CF_ARG_ENABLE(syslog,
1265[  --enable-syslog         log URL requests via syslog],
1266	[use_syslog=yes],
1267	[use_syslog=no])
1268AC_MSG_RESULT($use_syslog)
1269test "$use_syslog" = yes && AC_DEFINE(SYSLOG_REQUESTED_URLS,1,[Define to 1 if you want to log URL requests via syslog])
1270
1271dnl --------------------------------------------------------------------------
1272AC_MSG_CHECKING(if you want to underline links)
1273CF_ARG_ENABLE(underlines,
1274[  --enable-underlines     underline links rather than using boldface],
1275	[use_underline=yes],
1276	[use_underline=no])
1277AC_MSG_RESULT($use_underline)
1278test "$use_underline" = yes && AC_DEFINE(UNDERLINE_LINKS,1,[Define to 1 if xxx])
1279test "$use_underline" = no  && AC_DEFINE(UNDERLINE_LINKS,0,[Define to 0 if xxx])
1280
1281dnl --------------------------------------------------------------------------
1282AC_MSG_CHECKING(if help files should be gzip'ed)
1283CF_ARG_ENABLE(gzip-help,
1284[  --enable-gzip-help      install gzip'ed help files],
1285	[use_gzip_help=$enableval],
1286	[use_gzip_help=no])
1287AC_MSG_RESULT($use_gzip_help)
1288
1289dnl --------------------------------------------------------------------------
1290AC_MSG_CHECKING(if you want to use libbz2 for decompression of some bzip2 files)
1291AC_ARG_WITH(bzlib,
1292[  --with-bzlib            use libbz2 for decompression of some bzip2 files],
1293	[use_bzlib=$withval],
1294	[use_bzlib=no])
1295AC_MSG_RESULT($use_bzlib)
1296
1297if test ".$use_bzlib" != ".no" ; then
1298	CF_WITH_BZLIB($use_bzlib)
1299	test "x$cf_cv_find_linkage_bz2" = "xyes" && AC_DEFINE(USE_BZLIB,1,[Define to 1 if you want to use libbz2 for decompression of some bzip2 files])
1300fi
1301
1302dnl --------------------------------------------------------------------------
1303AC_MSG_CHECKING(if you want to use zlib for decompression of some gzip files)
1304AC_ARG_WITH(zlib,
1305[  --with-zlib             use zlib for decompression of some gzip files],
1306	[use_zlib=$withval],
1307	[use_zlib=no])
1308AC_MSG_RESULT($use_zlib)
1309
1310if test ".$use_zlib" != ".no" ; then
1311	CF_WITH_ZLIB($use_zlib)
1312	test "x$cf_cv_find_linkage_z" = "xyes" && AC_DEFINE(USE_ZLIB,1,[Define to 1 if you want to use zlib for decompression of some gzip files])
1313fi
1314
1315dnl --------------------------------------------------------------------------
1316CF_HELP_MESSAGE(
1317Other Network Services:)
1318
1319dnl --------------------------------------------------------------------------
1320AC_MSG_CHECKING(if you want to exclude FINGER code)
1321CF_ARG_DISABLE(finger,
1322[  --disable-finger        disable FINGER logic],
1323	[use_finger=yes],
1324	[use_finger=no])
1325AC_MSG_RESULT($use_finger)
1326test "$use_finger" != "no" && AC_DEFINE(DISABLE_FINGER,1,[Define to 1 if you want to exclude FINGER code])
1327
1328dnl --------------------------------------------------------------------------
1329AC_MSG_CHECKING(if you want to exclude GOPHER code)
1330CF_ARG_DISABLE(gopher,
1331[  --disable-gopher        disable GOPHER logic],
1332	[use_gopher=yes],
1333	[use_gopher=no])
1334AC_MSG_RESULT($use_gopher)
1335test "$use_gopher" != "no" && AC_DEFINE(DISABLE_GOPHER,1,[Define to 1 if you want to exclude GOPHER code])
1336
1337dnl --------------------------------------------------------------------------
1338AC_MSG_CHECKING(if you want to exclude NEWS code)
1339CF_ARG_DISABLE(news,
1340[  --disable-news          disable NEWS logic],
1341      [use_news=yes],
1342      [use_news=no])
1343AC_MSG_RESULT($use_news)
1344test "$use_news" != "no" && AC_DEFINE(DISABLE_NEWS,1,[Define to 1 if you want to exclude NEWS code])
1345
1346dnl --------------------------------------------------------------------------
1347AC_MSG_CHECKING(if you want to exclude FTP code)
1348CF_ARG_DISABLE(ftp,
1349[  --disable-ftp           disable FTP logic],
1350      [use_ftp=yes],
1351      [use_ftp=no])
1352AC_MSG_RESULT($use_ftp)
1353test "$use_ftp" != "no" && AC_DEFINE(DISABLE_FTP,1,[Define to 1 if you want to exclude FTP code])
1354
1355dnl --------------------------------------------------------------------------
1356AC_MSG_CHECKING(if you want to include WAIS code)
1357CF_ARG_ENABLE(wais,
1358[  --enable-wais           enable WAIS logic],
1359      [use_wais=yes],
1360      [use_wais=no])
1361AC_MSG_RESULT($use_wais)
1362
1363MAKE_WAIS="#"
1364if test "$use_wais" != "no"
1365then
1366	AC_CHECK_LIB(wais,fs_free,[
1367		CF_MATH_LIB
1368		CF_ADD_LIB(wais)
1369		AC_CHECK_HEADERS(wais.h)
1370		MAKE_WAIS=
1371		],[AC_MSG_WARN(could not find WAIS library)])
1372fi
1373AC_SUBST(MAKE_WAIS)
1374
1375dnl --------------------------------------------------------------------------
1376dnl DirEd (directory-editor) options
1377dnl --------------------------------------------------------------------------
1378
1379CF_HELP_MESSAGE(
1380Directory Editor Options:)
1381
1382# All DirEd functions that were enabled on compilation can be disabled
1383# or modified at run time via DIRED_MENU symbols in lynx.cfg.
1384AC_MSG_CHECKING(if directory-editor code should be used)
1385CF_ARG_DISABLE(dired,
1386[  --disable-dired          disable optional directory-editor, DirEd],
1387	[use_dired=$enableval],
1388	[use_dired=yes])
1389AC_MSG_RESULT($use_dired)
1390
1391if test ".$use_dired" != ".no" ; then
1392	EXTRA_OBJS="$EXTRA_OBJS LYLocal\$o"
1393	AC_DEFINE(DIRED_SUPPORT,1,[Define to 1 if we want dired support])
1394
1395	AC_MSG_CHECKING(if you wish to allow extracting from archives via DirEd)
1396	CF_ARG_DISABLE(dired-dearchive,
1397	[  --disable-dired-dearchive disable dearchiving commands],[AC_DEFINE(ARCHIVE_ONLY,1,[Define to 1 if you wish to allow extracting from archives via DirEd])])
1398	AC_MSG_RESULT($enableval)
1399
1400	AC_MSG_CHECKING(if DirEd mode should override keys)
1401	CF_ARG_DISABLE(dired-override,
1402	[  --disable-dired-override disable DirEd override keymap],,[AC_DEFINE(OK_OVERRIDE,1,[Define to 1 if DirEd mode should override keys])])
1403	AC_MSG_RESULT($enableval)
1404
1405	AC_MSG_CHECKING(if you wish to allow permissions commands via DirEd)
1406	CF_ARG_DISABLE(dired-permit,
1407	[  --disable-dired-permit  disable chmod/attrib commands],,[AC_DEFINE(OK_PERMIT,1,[Define to 1 if you wish to allow permissions commands via DirEd])])
1408	AC_MSG_RESULT($enableval)
1409
1410	AC_MSG_CHECKING(if you wish to allow executable-permission commands via DirEd)
1411	CF_ARG_DISABLE(dired-xpermit,
1412	[  --disable-dired-xpermit disable chmod/attrib commands],[AC_DEFINE(NO_CHANGE_EXECUTE_PERMS,1,[Define to 1 if you wish to allow executable-permission commands via DirEd])])
1413	AC_MSG_RESULT($enableval)
1414
1415	AC_MSG_CHECKING(if you wish to allow "tar" commands from DirEd)
1416	CF_ARG_DISABLE(dired-tar,
1417	[  --disable-dired-tar     disable "tar" command],,[AC_DEFINE(OK_TAR,1,[Define to 1 if if you wish to allow "tar" commands from DirEd])])
1418	AC_MSG_RESULT($enableval)
1419
1420	AC_MSG_CHECKING(if you wish to allow "uudecode" commands from DirEd)
1421	CF_ARG_DISABLE(dired-uudecode,
1422	[  --disable-dired-uudecode disable "uudecode" command],,[AC_DEFINE(OK_UUDECODE,1,[Define to 1 if you wish to allow "uudecode" commands from DirEd])])
1423	AC_MSG_RESULT($enableval)
1424
1425	AC_MSG_CHECKING(if you wish to allow "zip" and "unzip" commands from DirEd)
1426	CF_ARG_DISABLE(dired-zip,
1427	[  --disable-dired-zip     disable "zip", "unzip"  commands],,[AC_DEFINE(OK_ZIP,1,[Define to 1 if you wish to allow "zip" and "unzip" commands from DirEd])])
1428	AC_MSG_RESULT($enableval)
1429
1430	AC_MSG_CHECKING(if you wish to allow "gzip" and "gunzip" commands from DirEd)
1431	CF_ARG_DISABLE(dired-gzip,
1432	[  --disable-dired-gzip    disable "gzip", "gunzip" commands],,[AC_DEFINE(OK_GZIP,1,[Define to 1 if you wish to allow "gzip" and "gunzip" commands from DirEd])])
1433	AC_MSG_RESULT($enableval)
1434fi
1435
1436dnl --------------------------------------------------------------------------
1437AC_MSG_CHECKING(if you want long-directory listings)
1438CF_ARG_DISABLE(long-list,
1439[  --disable-long-list     disable long "ls -l" directory listings],,
1440	[AC_DEFINE(LONG_LIST,1,[Define to 1 if you want long-directory listings])])
1441AC_MSG_RESULT($enableval)
1442
1443dnl --------------------------------------------------------------------------
1444AC_MSG_CHECKING(if parent-directory references are permitted)
1445CF_ARG_DISABLE(parent-dir-refs,
1446[  --disable-parent-dir-refs
1447                          disable "Up-to" links in directory listings],
1448	[AC_DEFINE(NO_PARENT_DIR_REFERENCE,1,[Define to 1 if parent-directory references are permitted])])
1449AC_MSG_RESULT($enableval)
1450
1451dnl --------------------------------------------------------------------------
1452CF_PATH_PROG(TELNET,	telnet)
1453CF_PATH_PROG(TN3270,	tn3270)
1454CF_PATH_PROG(RLOGIN,	rlogin)
1455
1456CF_PATH_PROG(MV,	mv)
1457
1458CF_PATH_PROG(GZIP,	gzip)
1459CF_PATH_PROG(UNCOMPRESS,gunzip)
1460CF_PATH_PROG(UNZIP,	unzip)
1461CF_PATH_PROG(BZIP2,	bzip2)
1462
1463CF_PATH_PROG(TAR,	tar, pax gtar gnutar bsdtar star)
1464CF_TAR_OPTIONS($TAR)
1465AC_DEFINE_UNQUOTED(TAR_UP_OPTIONS,   "$TAR_UP_OPTIONS",[Define to command for tar'ing up files])
1466AC_DEFINE_UNQUOTED(TAR_DOWN_OPTIONS, "$TAR_DOWN_OPTIONS",[Define to command for untar'ing files])
1467AC_DEFINE_UNQUOTED(TAR_FILE_OPTIONS, "$TAR_FILE_OPTIONS",[Define to options for tar to work with files])
1468AC_DEFINE_UNQUOTED(TAR_PIPE_OPTIONS, "$TAR_PIPE_OPTIONS",[Define to options for tar to work with pipes])
1469
1470dnl --------------------------------------------------------------------------
1471dnl Test features that rely on configure-definitions
1472dnl --------------------------------------------------------------------------
1473if test ".$use_dired" != ".no" ; then
1474
1475CF_PATH_PROG(COMPRESS,	compress)
1476CF_PATH_PROG(RM,	rm)
1477CF_PATH_PROG(UUDECODE,	uudecode)
1478CF_PATH_PROG(ZCAT,	zcat)
1479CF_PATH_PROG(ZIP,	zip)
1480
1481dnl 'INSTALL' is a special case, since the configure script has to find a
1482dnl BSD-compatible one so the build/install works properly.
1483case "$INSTALL" in
1484($srcdir*)
1485	AC_DEFINE_UNQUOTED(INSTALL_PATH,"install")
1486	;;
1487(*)
1488	cf_save_INSTALL="$INSTALL"
1489	CF_PATH_PROG(INSTALL,	install)
1490	INSTALL="$cf_save_INSTALL"
1491	;;
1492esac
1493fi
1494
1495COMPRESS_PROG=
1496COMPRESS_EXT=
1497if test "$use_gzip_help" = yes ; then
1498	COMPRESS_PROG="$ac_cv_path_GZIP -9 -n"
1499	COMPRESS_EXT=.gz
1500fi
1501AC_SUBST(COMPRESS_PROG)
1502AC_SUBST(COMPRESS_EXT)
1503
1504if test "$cf_cv_screen" = pdcurses ; then
1505	CF_HELP_MESSAGE(Special Libraries for PDCurses X11:)
1506	case "$host_os" in
1507	(mingw*)
1508		CF_PDCURSES_W32
1509		;;
1510	(*)
1511		CF_PDCURSES_X11
1512		;;
1513	esac
1514else
1515	CF_TERMIO_AND_CURSES(LYCurses.h)
1516fi
1517
1518### These tests must be run after establishing the curses library.
1519if test "$cf_cv_screen" != slang ; then
1520	if test "$cf_cv_screen" != pdcurses ; then
1521		AC_CHECK_HEADERS($cf_cv_screen/term.h term.h)
1522	fi
1523	CF_ALT_CHAR_SET
1524	CF_FANCY_CURSES
1525	CF_FUNC_CURSES_VERSION
1526	CF_NCURSES_BROKEN
1527	CF_COLOR_CURSES
1528	CF_SIZECHANGE
1529	CF_TTYTYPE
1530	if test "$use_wide_curses" = yes ; then
1531		CF_WIDEC_CURSES
1532	fi
1533	CF_CURSES_FUNCS( \
1534		assume_default_colors \
1535		cbreak \
1536		define_key \
1537		delscreen \
1538		getattrs \
1539		getbegx \
1540		getbegy \
1541		keypad \
1542		napms \
1543		newpad \
1544		newterm \
1545		pnoutrefresh \
1546		resizeterm \
1547		touchline \
1548		touchwin \
1549		use_default_colors \
1550		use_legacy_coding \
1551		wattr_get \
1552		wborder \
1553		wredrawln \
1554		wresize \
1555		)
1556	AC_CHECK_FUNCS( \
1557		curses_exit \
1558		_nc_free_and_exit \
1559		_nc_freeall \
1560		)
1561fi
1562
1563if test "$use_color_style" != no ; then
1564	if test .$cf_cv_color_curses != .yes ; then
1565		AC_ERROR(Configuration does not support color-styles)
1566	fi
1567	if test "$cf_cv_screen" = slang ; then
1568		AC_ERROR(Configuration does not support color-styles)
1569	fi
1570fi
1571
1572if test "$use_scrollbar" != no ; then
1573	if test .$cf_cv_fancy_curses != .yes ; then
1574		AC_MSG_WARN(Configuration does not support ACS_xxx definitions)
1575	else
1576		AC_DEFINE(USE_SCROLLBAR,1,[Define to 1 if configuration supports ACS_xxx definitions])
1577	fi
1578fi
1579
1580# use rpath for libraries in unusual places
1581CF_DISABLE_RPATH_HACK
1582
1583CF_MERGE_EXTRA_CFLAGS
1584
1585### Finally, build config.h and the makefiles
1586test -z "$CONFIG_SHELL" && CONFIG_SHELL=/bin/sh
1587AC_SUBST(CONFIG_SHELL)
1588
1589srcdir="$srcdir"
1590SRCDIR_CLEAN="#"
1591if test -n "$srcdir" ; then
1592	echo "srcdir is $srcdir"
1593	mkdir -p WWW/Library/Implementation
1594	mkdir -p src/chrtrans
1595	test "$USE_INCLUDED_LIBINTL" = yes && mkdir -p intl
1596	test "$srcdir" != "." && SRCDIR_CLEAN=""
1597fi
1598
1599HOMEPAGE_URL="https://lynx.invisible-island.net/"
1600AC_DEFINE_UNQUOTED(HOMEPAGE_URL,"$HOMEPAGE_URL",[Define to Lynx homepage URL])
1601AC_SUBST(HOMEPAGE_URL)
1602
1603AC_SUBST(SRCDIR_CLEAN)
1604AC_OUTPUT(
1605	[makefile \
1606	WWW/Library/Implementation/makefile \
1607	src/makefile \
1608	src/chrtrans/makefile \
1609	$SUB_MAKEFILE
1610	],[
1611	if test "$USE_NLS" = yes ; then
1612	if test "$use_our_messages" = yes ; then
1613		echo "creating po/makefile"
1614		rm -f	po/temp$$
1615		sed	-e 's%^.*LYMessages.c%	../LYMessages.c%' \
1616			-e '$s/\\//' po/POTFILES >po/temp$$
1617		sed	-e "/POTFILES =/r po/temp$$" \
1618			po/makefile.in > po/makefile
1619		rm -f	po/temp$$
1620	fi
1621	fi
1622	],[
1623	USE_NLS=$USE_NLS
1624	use_our_messages=$use_our_messages
1625	]
1626)
1627