1dnl***************************************************************************
2dnl Copyright 2018-2020,2021 Thomas E. Dickey                                *
3dnl Copyright 1998-2017,2018 Free Software Foundation, Inc.                  *
4dnl                                                                          *
5dnl Permission is hereby granted, free of charge, to any person obtaining a  *
6dnl copy of this software and associated documentation files (the            *
7dnl "Software"), to deal in the Software without restriction, including      *
8dnl without limitation the rights to use, copy, modify, merge, publish,      *
9dnl distribute, distribute with modifications, sublicense, and/or sell       *
10dnl copies of the Software, and to permit persons to whom the Software is    *
11dnl furnished to do so, subject to the following conditions:                 *
12dnl                                                                          *
13dnl The above copyright notice and this permission notice shall be included  *
14dnl in all copies or substantial portions of the Software.                   *
15dnl                                                                          *
16dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
17dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
18dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
19dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
20dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
21dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
22dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
23dnl                                                                          *
24dnl Except as contained in this notice, the name(s) of the above copyright   *
25dnl holders shall not be used in advertising or otherwise to promote the     *
26dnl sale, use or other dealings in this Software without prior written       *
27dnl authorization.                                                           *
28dnl***************************************************************************
29dnl
30dnl Author: Thomas E. Dickey 1995-on
31dnl
32dnl $Id: configure.in,v 1.736 2021/07/18 22:17:57 tom Exp $
33dnl Process this file with autoconf to produce a configure script.
34dnl
35dnl For additional information, see
36dnl     https://invisible-island.net/autoconf/
37dnl     https://invisible-island.net/autoconf/my-autoconf.html
38dnl
39dnl ---------------------------------------------------------------------------
40AC_PREREQ(2.52.20210101)
41AC_REVISION($Revision: 1.736 $)
42AC_INIT(ncurses/base/lib_initscr.c)
43AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin)
44
45AC_DEFUN([AC_PATH_XTRA],[])dnl ignore dependencies on this
46
47CF_TOP_BUILDDIR
48CF_SUBST_NCURSES_VERSION
49CF_VERSION_INFO(NCURSES,ncurses)
50
51CF_WITH_REL_VERSION(NCURSES)
52CF_NCURSES_WITH_ABI_VERSION
53
54CF_WITH_SYSTYPE
55
56###	Save the given $CFLAGS to allow user-override.
57cf_user_CFLAGS="$CFLAGS"
58
59###	Default install-location
60CF_CFG_DEFAULTS
61### Defaults for ncurses ABI
62CF_ABI_DEFAULTS
63
64###	Checks for programs.
65AC_ARG_WITH(ada,
66	[  --without-ada           suppress check for Ada compiler, don't build demo],
67	[cf_with_ada=$withval],
68	[cf_with_ada=yes])
69
70if test "x$cf_with_ada" = xyes
71then
72	cf_prog_cc="gnatgcc gcc cc"
73else
74	cf_prog_cc="gcc cc"
75fi
76CF_PROG_CC($cf_prog_cc)
77
78AC_PROG_CPP
79AC_PROG_GCC_TRADITIONAL
80CF_PROG_CC_C_O(CC,[$CFLAGS $CPPFLAGS])
81CF_PROG_LDCONFIG
82
83dnl DEFECT in autoconf 2.12:	an attempt to set policy, this breaks the
84dnl				configure script by not letting us test if C++
85dnl				is present, making this option necessary.
86AC_MSG_CHECKING(if you want to ensure bool is consistent with C++)
87AC_ARG_WITH(cxx,
88	[  --without-cxx           do not adjust ncurses bool to match C++],
89	[cf_with_cxx=$withval],
90	[cf_with_cxx=yes])
91AC_MSG_RESULT($cf_with_cxx)
92if test "X$cf_with_cxx" = Xno ; then
93	CXX=""
94	GXX=""
95else
96	# with autoconf 2.13, we can change the error to a warning:
97	pushdef([AC_MSG_ERROR],
98		[AC_MSG_RESULT(no)
99		 AC_MSG_WARN([You don't have any C++ compiler, too bad])
100		cf_with_cxx=no; CXX=""; GXX="";])dnl
101	AC_PROG_CXX
102	popdef([AC_MSG_ERROR])dnl
103
104	AC_LANG_PUSH(C++)
105	if test "x$cf_with_cxx" != xno
106	then
107		# Several of the C++ configurations do not work, particularly when
108		# cross-compiling (20140913 -TD)
109		AC_MSG_CHECKING(if $CXX works)
110
111		save_CPPFLAGS="$CPPFLAGS"
112		eval cf_includedir=${includedir}
113		CPPFLAGS="$CPPFLAGS -I${cf_includedir}"
114		AC_TRY_COMPILE([
115#include <stdlib.h>
116#include <stdio.h>
117],
118		[
119		printf("Hello world!\n")
120		],
121		[cf_cxx_works=yes],
122		[cf_cxx_works=no])
123		CPPFLAGS="$save_CPPFLAGS"
124
125		AC_MSG_RESULT($cf_cxx_works)
126		if test "x$cf_cxx_works" = xno
127		then
128			AC_MSG_WARN([Ignore $CXX, since it cannot compile hello-world.])
129			cf_with_cxx=no; CXX=""; GXX="";
130		fi
131	fi
132	AC_LANG_POP
133
134	# autoconf 2.5x removed the error (hardcoding it to g++, or just blank)
135	if test "$CXX" = "g++" ; then
136		AC_PATH_PROG(CXX,g++)
137	fi
138	case "x$CXX" in
139	(x|xg++)
140		AC_MSG_WARN([You don't have any C++ compiler, too bad])
141		cf_with_cxx=no; CXX=""; GXX="";
142		;;
143	esac
144fi
145
146CF_GXX_VERSION
147case "$GXX_VERSION" in
148([[1-9]][[0-9]].*)
149	;;
150(1.*|2.[[0-6]]*)
151	AC_MSG_WARN(templates do not work)
152	;;
153esac
154
155AC_MSG_CHECKING(if you want to build C++ binding and demo)
156AC_ARG_WITH(cxx-binding,
157	[  --without-cxx-binding   do not build C++ binding and demo],
158	[cf_with_cxx_binding=$withval],
159	[cf_with_cxx_binding=$cf_with_cxx])
160AC_MSG_RESULT($cf_with_cxx_binding)
161
162AC_MSG_CHECKING(if you want to build with Ada)
163AC_MSG_RESULT($cf_with_ada)
164
165AC_MSG_CHECKING(if you want to install terminal database)
166AC_ARG_ENABLE(db-install,
167	[  --disable-db-install    suppress install of terminal database],
168	[cf_with_db_install=$enableval],
169	[cf_with_db_install=yes])
170AC_MSG_RESULT($cf_with_db_install)
171
172AC_MSG_CHECKING(if you want to install manpages)
173AC_ARG_WITH(manpages,
174	[  --without-manpages      suppress install of manpages],
175	[cf_with_manpages=$withval],
176	[cf_with_manpages=yes])
177AC_MSG_RESULT($cf_with_manpages)
178
179AC_MSG_CHECKING(if you want to build programs such as tic)
180AC_ARG_WITH(progs,
181	[  --without-progs         suppress build/install with programs (e.g., tic)],
182	[cf_with_progs=$withval],
183	[cf_with_progs=yes])
184AC_MSG_RESULT($cf_with_progs)
185
186if test -f "$srcdir/tack/tack.h" ; then
187	if test "x$cross_compiling" = xyes ; then
188		CF_VERBOSE(ignoring tack because we are cross-compiling)
189		cf_with_tack=no
190	else
191		AC_MSG_CHECKING(if you want to build the tack program)
192		AC_ARG_WITH(tack,
193			[  --without-tack          suppress build/install with tack program],
194			[cf_with_tack=$withval],
195			[cf_with_tack=$cf_with_progs])
196		AC_MSG_RESULT($cf_with_tack)
197	fi
198else
199	cf_with_tack=no
200fi
201
202AC_MSG_CHECKING(if you want to build test-programs)
203AC_ARG_WITH(tests,
204	[  --without-tests         suppress build/install with test-programs],
205	[cf_with_tests=$withval],
206	[cf_with_tests=yes])
207AC_MSG_RESULT($cf_with_tests)
208
209AC_MSG_CHECKING(if you wish to install curses.h)
210AC_ARG_WITH(curses-h,
211	[  --without-curses-h      install curses.h as ncurses.h only],
212	[with_curses_h=$withval],
213	[with_curses_h=yes])
214AC_MSG_RESULT($with_curses_h)
215
216modules_to_build="ncurses"
217test "X$cf_with_progs" != Xno && modules_to_build="$modules_to_build progs"
218test "X$cf_with_tack"  != Xno && modules_to_build="$modules_to_build tack"
219modules_to_build="$modules_to_build panel menu form"
220
221AC_ARG_PROGRAM
222
223CF_PROG_AWK
224CF_PROG_INSTALL
225CF_PROG_LINT
226CF_PROG_LN_S
227
228AC_SYS_LONG_FILE_NAMES
229
230# Provide for renaming "ncurses5-config" to "ncurses5X-config", etc., in case
231# of package conflict.
232cf_config_suffix=
233AC_ARG_WITH(config-suffix,
234	[  --with-config-suffix=X  suffixes ncursesXX-config file],
235	[case "x$withval" in
236	(xyes|xno)
237		AC_MSG_WARN(expected a value for config-suffix option)
238		;;
239	(*)	cf_config_suffix="$withval"
240		;;
241	esac])
242AC_SUBST(cf_config_suffix)
243
244# If we find pkg-config, check if we should install the ".pc" files.
245CF_PKG_CONFIG
246CF_WITH_PKG_CONFIG_LIBDIR
247CF_ENABLE_PC_FILES
248if test -z "$MAKE_PC_FILES"
249then
250	AC_MSG_CHECKING(for suffix to add to pc-files)
251AC_ARG_WITH(pc-suffix,
252	[  --with-pc-suffix        suffixes pc-files],
253	[case "x$withval" in
254	(xyes|xno)
255		PC_MODULE_SUFFIX=
256		;;
257	(*)	PC_MODULE_SUFFIX="$withval"
258		;;
259	esac])
260	test -z "$PC_MODULE_SUFFIX" && PC_MODULE_SUFFIX=none
261	AC_MSG_RESULT($PC_MODULE_SUFFIX)
262	test "$PC_MODULE_SUFFIX" = none && PC_MODULE_SUFFIX=
263	AC_SUBST(PC_MODULE_SUFFIX)
264fi
265
266AC_MSG_CHECKING(if we should assume mixed-case filenames)
267AC_ARG_ENABLE(mixed-case,
268	[  --enable-mixed-case     tic should assume mixed-case filenames],
269	[enable_mixedcase=$enableval],
270	[enable_mixedcase=auto])
271AC_MSG_RESULT($enable_mixedcase)
272if test "$enable_mixedcase" = "auto" ; then
273	CF_MIXEDCASE_FILENAMES
274else
275	cf_cv_mixedcase=$enable_mixedcase
276	if test "x$enable_mixedcase" = "xyes" ; then
277		AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if tic should assume mixed-case filenames])
278	fi
279fi
280
281# do this after mixed-case option (tags/TAGS is not as important as tic).
282AC_PROG_MAKE_SET
283CF_MAKE_PHONY
284CF_MAKE_TAGS
285CF_MAKEFLAGS
286
287dnl These are standard among *NIX systems, but not when cross-compiling
288AC_CHECK_TOOL(RANLIB, ranlib, ':')
289AC_CHECK_TOOL(LD, ld, ld)
290AC_CHECK_TOOL(AR, ar, ar)
291AC_CHECK_TOOL(NM, nm, nm)
292CF_AR_FLAGS
293
294dnl Special option for use by system-builders: the install-prefix is used to
295dnl adjust the location into which the actual install is done, so that an
296dnl archive can be built without modifying the host system's configuration.
297AC_MSG_CHECKING(if you have specified an install-prefix)
298AC_ARG_WITH(install-prefix,
299	[  --with-install-prefix   prefixes actual install-location ($DESTDIR)],
300	[case "x$withval" in
301	(xyes|xno)
302		;;
303	(*)	DESTDIR="$withval"
304		;;
305	esac])
306AC_MSG_RESULT($DESTDIR)
307AC_SUBST(DESTDIR)
308
309###############################################################################
310CF_HELP_MESSAGE(Build-Tools Needed to Compile Temporary Applications for Cross-compiling:)
311# If we're cross-compiling, allow the user to override the tools and their
312# options.  The configure script is oriented toward identifying the host
313# compiler, etc., but we need a build compiler to generate parts of the source.
314
315case "$cf_cv_system_name" in
316(*-msvc*)
317	LDFLAGS="$LDFLAGS user32.lib"
318	export LDFLAGS
319	;;
320esac
321
322CF_BUILD_CC
323
324###############################################################################
325CF_HELP_MESSAGE(Options to Specify the Libraries Built/Used:)
326
327### Options to allow the user to specify the set of libraries which are used.
328### Use "--without-normal --with-shared" to allow the default model to be
329### shared, for example.
330cf_list_models=""
331AC_SUBST(cf_list_models)dnl	the complete list of models ("normal debug")
332
333CF_WITH_LIBTOOL
334if test "$with_libtool" != "no" ; then
335
336cf_list_models="$cf_list_models libtool"
337
338else
339
340AC_MSG_CHECKING(if you want to build shared libraries)
341AC_ARG_WITH(shared,
342	[  --with-shared           generate shared-libraries],
343	[with_shared=$withval],
344	[with_shared=no])
345AC_MSG_RESULT($with_shared)
346test "x$with_shared" = "xyes" && cf_list_models="$cf_list_models shared"
347
348AC_MSG_CHECKING(if you want to build static libraries)
349AC_ARG_WITH(normal,
350	[  --with-normal           generate normal-libraries (default)],
351	[with_normal=$withval],
352	[with_normal=yes])
353AC_MSG_RESULT($with_normal)
354test "x$with_normal" = "xyes" && cf_list_models="$cf_list_models normal"
355
356AC_MSG_CHECKING(if you want to build debug libraries)
357AC_ARG_WITH(debug,
358	[  --with-debug            generate debug-libraries (default)],
359	[with_debug=$withval],
360	[with_debug=yes])
361AC_MSG_RESULT($with_debug)
362test "x$with_debug" = "xyes" && cf_list_models="$cf_list_models debug"
363
364AC_MSG_CHECKING(if you want to build profiling libraries)
365AC_ARG_WITH(profile,
366	[  --with-profile          generate profile-libraries],
367	[with_profile=$withval],
368	[with_profile=no])
369AC_MSG_RESULT($with_profile)
370test "x$with_profile" = "xyes" && cf_list_models="$cf_list_models profile"
371
372fi
373
374if test "X$cf_with_cxx_binding" != Xno; then
375if test "x$with_shared" = "xyes"; then
376AC_MSG_CHECKING(if you want to build C++ shared libraries)
377AC_ARG_WITH(cxx-shared,
378	[  --with-cxx-shared       generate C++ shared-libraries],
379	[with_shared_cxx=$withval],
380	[with_shared_cxx=no])
381AC_MSG_RESULT($with_shared_cxx)
382fi
383fi
384
385###############################################################################
386
387AC_MSG_CHECKING(for specified models)
388test -z "$cf_list_models" && cf_list_models=normal
389dnl If we use libtool to generate libraries, then it must be the only
390dnl specified model.
391test "$with_libtool" != "no" && cf_list_models=libtool
392AC_MSG_RESULT($cf_list_models)
393
394### Use the first model as the default, and save its suffix for use in building
395### up test-applications.
396AC_MSG_CHECKING(for default model)
397DFT_LWR_MODEL=`echo "$cf_list_models" | $AWK '{print $1}'`
398AC_MSG_RESULT($DFT_LWR_MODEL)
399
400CF_UPPER(DFT_UPR_MODEL,$DFT_LWR_MODEL)dnl
401
402AC_SUBST(DFT_LWR_MODEL)dnl	the default model ("normal")
403AC_SUBST(DFT_UPR_MODEL)dnl	the default model ("NORMAL")
404
405TICS_NAME=tic
406AC_SUBST(TICS_NAME)
407
408TINFO_NAME=tinfo
409AC_SUBST(TINFO_NAME)
410
411LIB_NAME=ncurses
412AC_SUBST(LIB_NAME)
413
414LIB_DIR=../lib
415LIB_2ND=../../lib
416
417CF_WITH_LIB_PREFIX(cf_prefix)
418
419LIB_SUFFIX=
420AC_SUBST(LIB_SUFFIX)
421CF_PATHSEP
422
423###############################################################################
424
425AC_MSG_CHECKING(if you want to build a separate terminfo library)
426AC_ARG_WITH(termlib,
427	[  --with-termlib          generate separate terminfo library],
428	[with_termlib=$withval],
429	[with_termlib=no])
430AC_MSG_RESULT($with_termlib)
431
432AC_MSG_CHECKING(if you want to build a separate tic library)
433AC_ARG_WITH(ticlib,
434	[  --with-ticlib           generate separate tic library],
435	[with_ticlib=$withval],
436	[with_ticlib=no])
437AC_MSG_RESULT($with_ticlib)
438
439dnl Not all ports of gcc support the -g option
440
441if test X"$CC_G_OPT" = X"" ; then
442	CC_G_OPT='-g'
443	test -n "$GCC" && test "x${ac_cv_prog_cc_g}" != xyes && CC_G_OPT=''
444fi
445AC_SUBST(CC_G_OPT)
446
447if test X"$CXX_G_OPT" = X"" ; then
448	CXX_G_OPT='-g'
449	test -n "$GXX" && test "x${ac_cv_prog_cxx_g}" != xyes && CXX_G_OPT=''
450fi
451AC_SUBST(CXX_G_OPT)
452
453AC_MSG_CHECKING(for default loader flags)
454case "$DFT_LWR_MODEL" in
455(libtool) LD_MODEL=''   ;;
456(normal)  LD_MODEL=''   ;;
457(debug)   LD_MODEL=$CC_G_OPT ;;
458(profile) LD_MODEL='-pg';;
459(shared)  LD_MODEL=''   ;;
460esac
461AC_SUBST(LD_MODEL)dnl		the type of link (e.g., -g or -pg)
462AC_MSG_RESULT($LD_MODEL)
463
464case "$DFT_LWR_MODEL" in
465(shared)
466CF_ENABLE_RPATH
467AC_MSG_CHECKING(if shared libraries should be relinked during install)
468AC_ARG_ENABLE(relink,
469[  --disable-relink        relink shared libraries during install],
470[cf_cv_do_relink=$enableval],
471[cf_cv_do_relink=yes])
472AC_MSG_RESULT($cf_cv_do_relink)
473	;;
474esac
475
476# we will build libraries one-level down.
477rel_builddir=..
478CF_SHARED_OPTS
479for model in $cf_list_models ; do
480	case "$model" in
481	(libtool)
482		CF_WITH_LIBTOOL_OPTS
483		CF_WITH_EXPORT_SYMS
484		;;
485	(shared)
486		if test "$CC_SHARED_OPTS" = "unknown"; then
487			AC_ERROR(Shared libraries are not supported in this version)
488		fi
489		# workaround for inept transition to PIE vs PIC...
490		AC_MSG_CHECKING(if current CFLAGS link properly)
491		AC_TRY_LINK(
492			[#include <stdio.h>],
493			[printf("Hello work\\n");],
494			[cf_cflags_work=yes],
495			[cf_cflags_work=no])
496		AC_MSG_RESULT($cf_cflags_work)
497		if test "$cf_cflags_work" = no
498		then
499			CF_VERBOSE(try to work around by appending shared-options)
500			CFLAGS="$CFLAGS $CC_SHARED_OPTS"
501		fi
502		CF_WITH_VERSIONED_SYMS
503		;;
504	esac
505done
506
507### Checks for special libraries, must be done up-front.
508SHLIB_LIST=""
509CF_WITH_GPM
510if test "$with_gpm" != no ; then
511	AC_MSG_CHECKING(if you want to load GPM dynamically)
512	AC_ARG_WITH(dlsym,
513		[  --without-dlsym         do not use dlsym() to load GPM dynamically],
514		[with_dlsym=$withval],
515		[with_dlsym=yes])
516	AC_MSG_RESULT($with_dlsym)
517	if test "x$with_dlsym" = xyes ; then
518		CF_FUNC_DLSYM
519		if test "x$with_gpm" != xyes ; then
520			CF_VERBOSE(assuming soname for gpm is $with_gpm)
521			cf_cv_gpm_soname="$with_gpm"
522		else
523			CF_LIB_SONAME([#include <gpm.h>],[if (Gpm_Open(0,0)) Gpm_Close();],gpm)
524		fi
525		test "$cf_cv_gpm_soname" != "unknown" && AC_DEFINE_UNQUOTED(LIBGPM_SONAME,"$cf_cv_gpm_soname",[Define as needed to set the gpm share library soname])
526		SHLIB_LIST="-ldl $SHLIB_LIST"
527		CF_ADD_LIB(dl,PRIVATE_LIBS)
528	else
529		SHLIB_LIST="-lgpm $SHLIB_LIST"
530		CF_ADD_LIB(gpm,TEST_LIBS)
531		CF_ADD_LIB(gpm,PRIVATE_LIBS)
532	fi
533	AC_DEFINE(HAVE_LIBGPM,1,[Define to 1 if we have the gpm library])
534	CF_CHECK_GPM_WGETCH
535fi
536
537CF_WITH_PCRE2
538CF_WITH_SYSMOUSE
539
540# pretend that ncurses==ncursesw==ncursest
541AC_MSG_CHECKING(if you want to disable library suffixes)
542CF_ARG_DISABLE(lib-suffixes,
543	[  --disable-lib-suffixes  disable library suffixes],
544	[disable_lib_suffixes=yes],
545	[disable_lib_suffixes=no],
546	no)
547AC_MSG_RESULT($disable_lib_suffixes)
548
549### If we're building with rpath, try to link non-standard libs that way too.
550if test "$DFT_LWR_MODEL" = "shared" && test "x$cf_cv_enable_rpath" != xno; then
551	CF_DISABLE_RPATH_HACK
552fi
553
554### Depending on the system, someone may use rpath to build ncurses but not
555# want users of the package to rely upon that feature.  Give those people an
556# option to suppress that detail from EXTRA_LDFLAGS.
557EXTRA_PKG_LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
558if test -n "$EXTRA_PKG_LDFLAGS"
559then
560	AC_MSG_CHECKING(if you want to disable extra LDFLAGS for package-scripts)
561	CF_ARG_DISABLE(pkg-ldflags,
562		[  --disable-pkg-ldflags   disable extra LDFLAGS for package-scripts],
563		[disable_pkg_ldflags=yes],
564		[disable_pkg_ldflags=no],
565		no)
566	AC_MSG_RESULT($disable_pkg_ldflags)
567	test "$disable_pkg_ldflags" = yes && EXTRA_PKG_LDFLAGS=
568fi
569AC_SUBST(EXTRA_PKG_LDFLAGS)
570
571###############################################################################
572CF_HELP_MESSAGE(Fine-Tuning Your Configuration:)
573
574###	use option --with-extra-suffix to append suffix to headers and libraries
575AC_MSG_CHECKING(if you wish to append extra suffix to header/library paths)
576EXTRA_SUFFIX=
577AC_ARG_WITH(extra-suffix,
578	[  --with-extra-suffix=X   append extra suffix to header/library paths],
579	[case x$withval in
580	(xno)
581		;;
582	(xyes|x)
583		EXTRA_SUFFIX=$cf_cv_abi_version
584		;;
585	(*)
586		EXTRA_SUFFIX=$withval
587		;;
588	esac
589	])
590AC_MSG_RESULT($EXTRA_SUFFIX)
591AC_SUBST(EXTRA_SUFFIX)
592
593###	use option --disable-overwrite to leave out the link to -lcurses
594AC_MSG_CHECKING(if you wish to install ncurses overwriting curses)
595AC_ARG_ENABLE(overwrite,
596	[  --disable-overwrite     put headers in subdir, omit link to -lcurses],
597	[with_overwrite=$enableval],
598	[if test "$prefix" = "/usr" ; then with_overwrite=yes; else with_overwrite=no; fi])
599AC_MSG_RESULT($with_overwrite)
600
601AC_MSG_CHECKING(if external terminfo-database is used)
602AC_ARG_ENABLE(database,
603	[  --disable-database      do not use terminfo, only fallbacks/termcap],
604	[use_database=$enableval],
605	[use_database=yes])
606AC_MSG_RESULT($use_database)
607
608case "$host_os" in
609(os2*)
610	TERMINFO_SRC='${top_srcdir}/misc/emx.src'
611	;;
612(*)
613	TERMINFO_SRC='${top_srcdir}/misc/terminfo.src'
614	;;
615esac
616AC_SUBST(TERMINFO_SRC)
617
618NCURSES_USE_DATABASE=0
619if test "$use_database" != no ; then
620	NCURSES_USE_DATABASE=1
621
622	AC_MSG_CHECKING(which terminfo source-file will be installed)
623	AC_ARG_WITH(database,
624		[  --with-database=XXX     specify terminfo source to install],
625		[TERMINFO_SRC=$withval])
626	AC_MSG_RESULT($TERMINFO_SRC)
627
628	AC_MSG_CHECKING(whether to use hashed database instead of directory/tree)
629	AC_ARG_WITH(hashed-db,
630		[  --with-hashed-db        specify hashed-database library],,
631		[with_hashed_db=no])
632	AC_MSG_RESULT($with_hashed_db)
633else
634	with_hashed_db=no
635fi
636AC_SUBST(NCURSES_USE_DATABASE)
637
638AC_MSG_CHECKING(for list of fallback descriptions)
639AC_ARG_WITH(fallbacks,
640	[  --with-fallbacks=XXX    specify list of fallback terminal descriptions],
641	[with_fallback=$withval],
642	[with_fallback=])
643AC_MSG_RESULT($with_fallback)
644
645case ".$with_fallback" in
646(.|.no)
647	FALLBACK_LIST=
648	;;
649(.yes)
650	AC_MSG_WARN(expected a list of terminal descriptions)
651	;;
652(*)
653	FALLBACK_LIST=`echo "$with_fallback" | sed -e 's/,/ /g'`
654	;;
655esac
656
657# The fallback feature in ncurses relies upon tic/infocmp outside the build
658# tree for generating the terminal descriptions that will be compiled into the
659# library.  If your toolchain is old, it may not handle current terminal
660# databases.  Use configure-options to point to the tools which will be used,
661# rather than the first ones found on the $PATH.
662AC_CHECK_TOOL(TIC, tic)
663AC_CHECK_TOOL(INFOCMP, infocmp)
664if test -n "$FALLBACK_LIST"
665then
666	CF_WITH_PATH_PROG(TIC,     tic,     [for fallbacks], $PATH:/usr/local/ncurses/bin)
667	CF_WITH_PATH_PROG(INFOCMP, infocmp, [for fallbacks], $PATH:/usr/local/ncurses/bin)
668	test -z "$TIC" && FALLBACK_LIST=
669	test -z "$INFOCMP" && FALLBACK_LIST=
670	if test -z "$FALLBACK_LIST"
671	then
672		AC_MSG_WARN(ignoring fallback option because tic/infocmp are not available)
673	fi
674fi
675AC_SUBST(TIC)
676AC_SUBST(INFOCMP)
677
678USE_FALLBACKS=
679test -z "$FALLBACK_LIST" && USE_FALLBACKS="#"
680AC_SUBST(FALLBACK_LIST)
681AC_SUBST(USE_FALLBACKS)
682
683AC_MSG_CHECKING(if you want modern xterm or antique)
684AC_ARG_WITH(xterm-new,
685	[  --without-xterm-new     specify if xterm terminfo should be old version],
686	[with_xterm_new=$withval],
687	[with_xterm_new=yes])
688case "$with_xterm_new" in
689(no) with_xterm_new=xterm-old;;
690(*)	 with_xterm_new=xterm-new;;
691esac
692AC_MSG_RESULT($with_xterm_new)
693WHICH_XTERM=$with_xterm_new
694AC_SUBST(WHICH_XTERM)
695
696AC_MSG_CHECKING(if xterm backspace sends BS or DEL)
697AC_ARG_WITH(xterm-kbs,
698	[  --with-xterm-kbs=XXX    specify if xterm backspace sends BS or DEL],
699	[with_xterm_kbs=$withval],
700	[with_xterm_kbs=BS])
701case x$with_xterm_kbs in
702(xyes|xno|xBS|xbs|x8)
703	with_xterm_kbs=BS
704	;;
705(xDEL|xdel|x127)
706	with_xterm_kbs=DEL
707	;;
708(*)
709	with_xterm_kbs=$withval
710	;;
711esac
712AC_MSG_RESULT($with_xterm_kbs)
713XTERM_KBS=$with_xterm_kbs
714AC_SUBST(XTERM_KBS)
715
716MAKE_TERMINFO=
717if test "$use_database" = no ; then
718	TERMINFO="${datadir}/terminfo"
719	MAKE_TERMINFO="#"
720else
721
722AC_MSG_CHECKING(for list of terminfo directories)
723CF_WITH_PATHLIST(terminfo-dirs,
724	[  --with-terminfo-dirs=XXX specify list of terminfo directories],
725	TERMINFO_DIRS,
726	DATADIR/terminfo,
727	${datadir}/terminfo)
728AC_MSG_RESULT($TERMINFO_DIRS)
729test -n "$TERMINFO_DIRS" && AC_DEFINE_UNQUOTED(TERMINFO_DIRS,"$TERMINFO_DIRS",[Define as needed to predefine the TERMINFO_DIR searchlist])
730
731case "x$TERMINFO" in
732x???:*)
733	AC_MSG_WARN(ignoring non-directory/file TERMINFO value)
734	unset TERMINFO
735	;;
736esac
737
738AC_MSG_CHECKING(for default terminfo directory)
739CF_WITH_PATH(default-terminfo-dir,
740	[  --with-default-terminfo-dir=DIR default terminfo directory],
741	TERMINFO,
742	DATADIR/terminfo,
743	${datadir}/terminfo)
744AC_MSG_RESULT($TERMINFO)
745AC_DEFINE_UNQUOTED(TERMINFO,"$TERMINFO",[Define to set the default terminal database path])
746
747fi
748
749AC_SUBST(TERMINFO)
750AC_SUBST(MAKE_TERMINFO)
751
752###	use option --disable-big-core to make tic run on small machines
753###	We need 4Mb, check if we can allocate 50% more than that.
754AC_MSG_CHECKING(if big-core option selected)
755AC_ARG_ENABLE(big-core,
756	[  --disable-big-core      assume machine has little memory],
757	[with_big_core=$enableval],
758	[AC_TRY_RUN([
759#include <stdlib.h>
760#include <string.h>
761int main() {
762	unsigned long n = 6000000L;
763	char *s = malloc(n);
764	if (s != 0)
765		s[0] = s[n-1] = 0;
766	${cf_cv_main_return:-return}(s == 0);
767}],
768	[with_big_core=yes],
769	[with_big_core=no],
770	[with_big_core=no])])
771AC_MSG_RESULT($with_big_core)
772test "x$with_big_core" = "xyes" && AC_DEFINE(HAVE_BIG_CORE,1,[Define to 1 if machine has ample memory for tic])
773
774### ISO C only guarantees 512-char strings, we have tables which load faster
775### when constructed using "big" strings.  More than the C compiler, the awk
776### program is a limit on most vendor UNIX systems.  Check that we can build.
777AC_MSG_CHECKING(if big-strings option selected)
778AC_ARG_ENABLE(big-strings,
779	[  --disable-big-strings   assume compiler has only standard-size strings],
780	[with_big_strings=$enableval],
781	[CF_AWK_BIG_PRINTF(12000,with_big_strings)])
782AC_MSG_RESULT($with_big_strings)
783
784USE_BIG_STRINGS=0
785test "x$with_big_strings" = "xyes" && USE_BIG_STRINGS=1
786AC_SUBST(USE_BIG_STRINGS)
787
788###	use option --enable-termcap to compile in the termcap fallback support
789AC_MSG_CHECKING(if you want termcap-fallback support)
790AC_ARG_ENABLE(termcap,
791	[  --enable-termcap        compile in termcap fallback support],
792	[with_termcap=$enableval],
793	[with_termcap=no])
794AC_MSG_RESULT($with_termcap)
795
796NCURSES_USE_TERMCAP=0
797if test "x$with_termcap" != "xyes" ; then
798	if test "$use_database" = no ; then
799		if test -z "$with_fallback" ; then
800			AC_ERROR(You have disabled the database w/o specifying fallbacks)
801		fi
802	fi
803	AC_DEFINE(PURE_TERMINFO,1,[Define to 1 if we should support only terminfo])
804else
805
806	if test "$with_ticlib" != no ; then
807		AC_ERROR(Options --with-ticlib and --enable-termcap cannot be combined)
808	fi
809
810	NCURSES_USE_TERMCAP=1
811	AC_MSG_CHECKING(for list of termcap files)
812	CF_WITH_PATHLIST(termpath,
813		[  --with-termpath=XXX     specify list of termcap files],
814		TERMPATH,
815		/etc/termcap:/usr/share/misc/termcap)
816	AC_MSG_RESULT($TERMPATH)
817	test -n "$TERMPATH" && AC_DEFINE_UNQUOTED(TERMPATH,"$TERMPATH",[Define to set the termcap searchlist])
818
819	###	use option --enable-getcap to use a hacked getcap for reading termcaps
820	AC_MSG_CHECKING(if fast termcap-loader is needed)
821	AC_ARG_ENABLE(getcap,
822		[  --enable-getcap         fast termcap load, no xrefs to terminfo],
823		[with_getcap=$enableval],
824		[with_getcap=no])
825	AC_MSG_RESULT($with_getcap)
826	test "x$with_getcap" = "xyes" && AC_DEFINE(USE_GETCAP,1,[Define to 1 to use fast termcap-loader])
827
828	AC_MSG_CHECKING(if translated termcaps will be cached in ~/.terminfo)
829	AC_ARG_ENABLE(getcap-cache,
830		[  --enable-getcap-cache   cache translated termcaps in ~/.terminfo],
831		[with_getcap_cache=$enableval],
832		[with_getcap_cache=no])
833	AC_MSG_RESULT($with_getcap_cache)
834	test "x$with_getcap_cache" = "xyes" && AC_DEFINE(USE_GETCAP_CACHE,1,[Define to 1 if translated termcap should be stored in $HOME/.terminfo])
835
836fi
837AC_SUBST(NCURSES_USE_TERMCAP)
838
839###   Use option --disable-home-terminfo to completely remove ~/.terminfo
840AC_MSG_CHECKING(if ~/.terminfo is wanted)
841AC_ARG_ENABLE(home-terminfo,
842	[  --disable-home-terminfo drop ~/.terminfo from terminfo search-path],
843	[with_home_terminfo=$enableval],
844	[with_home_terminfo=yes])
845AC_MSG_RESULT($with_home_terminfo)
846test "x$with_home_terminfo" = "xyes" && AC_DEFINE(USE_HOME_TERMINFO,1,[Define to 1 if $HOME/.terminfo feature is wanted])
847
848AC_MSG_CHECKING(if you want to permit root to use ncurses environment variables)
849AC_ARG_ENABLE(root-environ,
850	[  --disable-root-environ  restrict root use of ncurses environment variables],
851	[with_root_environ=$enableval],
852	[with_root_environ=yes])
853AC_MSG_RESULT($with_root_environ)
854test "x$with_root_environ" = xyes && AC_DEFINE(USE_ROOT_ENVIRON,1,[Define to 1 if root is allowed to use ncurses environment])
855
856AC_MSG_CHECKING(if you want to permit setuid programs to access all files)
857AC_ARG_ENABLE(root-environ,
858	[  --disable-root-access   restrict file-access when running setuid],
859	[with_root_access=$enableval],
860	[with_root_access=yes])
861AC_MSG_RESULT($with_root_access)
862test "x$with_root_access" = xyes && AC_DEFINE(USE_ROOT_ACCESS,1,[Define to 1 if setuid is allowed all file-access])
863
864###   Use option --enable-symlinks to make tic use symlinks, not hard links
865###   to reduce storage requirements for the terminfo database.
866CF_LINK_FUNCS
867
868with_links=no
869with_symlinks=no
870
871# soft links (symbolic links) are useful for some systems where hard links do
872# not work, or to make it simpler to copy terminfo trees around.
873if test "x$ac_cv_func_symlink" = xyes ; then
874	AC_MSG_CHECKING(if tic should use symbolic links)
875	AC_ARG_ENABLE(symlinks,
876	[  --enable-symlinks       make tic use symbolic links not hard links],
877	[with_symlinks=$enableval],
878	[with_symlinks=no])
879	AC_MSG_RESULT($with_symlinks)
880fi
881
882# If we have hard links and did not choose to use soft links instead, there is
883# no reason to make this choice optional - use the hard links.
884if test "$with_symlinks" = no ; then
885	AC_MSG_CHECKING(if tic should use hard links)
886	if test "x$ac_cv_func_link" = xyes ; then
887		with_links=yes
888	else
889		with_links=no
890	fi
891	AC_MSG_RESULT($with_links)
892fi
893
894test "x$with_links" = xyes && AC_DEFINE(USE_LINKS,1,[Define to 1 if hardlinks should be used in terminfo database])
895test "x$with_symlinks" = xyes && AC_DEFINE(USE_SYMLINKS,1,[Define to 1 if symbolic links should be used in terminfo database])
896
897###   use option --enable-broken-linker to force on use of broken-linker support
898CF_ENABLE_BROKEN_LINKER
899
900###   use option --enable-bsdpad to have tputs process BSD-style prefix padding
901AC_MSG_CHECKING(if tputs should process BSD-style prefix padding)
902AC_ARG_ENABLE(bsdpad,
903	[  --enable-bsdpad         recognize BSD-style prefix padding],
904	[with_bsdpad=$enableval],
905	[with_bsdpad=no])
906AC_MSG_RESULT($with_bsdpad)
907test "x$with_bsdpad" = xyes && AC_DEFINE(BSD_TPUTS,1,[Define to 1 to recognize BSD-style prefix padding])
908
909###   use option --enable-widec to turn on use of wide-character support
910NCURSES_CH_T=chtype
911NCURSES_LIBUTF8=0
912
913NEED_WCHAR_H=0
914NCURSES_MBSTATE_T=0
915NCURSES_WCHAR_T=0
916NCURSES_WINT_T=0
917
918# Check to define _XOPEN_SOURCE "automatically"
919CPPFLAGS_before_XOPEN="$CPPFLAGS"
920CF_XOPEN_SOURCE(600)
921CPPFLAGS_after_XOPEN="$CPPFLAGS"
922
923# Work around breakage on OS X
924CF_SIGWINCH
925
926# Checks for CODESET support.
927AM_LANGINFO_CODESET
928
929# use these variables to work around a defect in gcc's fixincludes.
930NCURSES_OK_WCHAR_T=
931NCURSES_OK_WINT_T=
932
933AC_MSG_CHECKING(if you want wide-character code)
934AC_ARG_ENABLE(widec,
935	[  --enable-widec          compile with wide-char/UTF-8 code],
936	[with_widec=$enableval],
937	[with_widec=no])
938AC_MSG_RESULT($with_widec)
939
940NCURSES_WCWIDTH_GRAPHICS=1
941AC_SUBST(NCURSES_WCWIDTH_GRAPHICS)
942
943if test "x$with_widec" = xyes ; then
944	if test "x$disable_lib_suffixes" = xno ; then
945		LIB_SUFFIX="w${LIB_SUFFIX}"
946	fi
947	AC_DEFINE(USE_WIDEC_SUPPORT,1,[Define to 1 to compile with wide-char/UTF-8 code])
948	AC_DEFINE(NCURSES_WIDECHAR,1,[Define to 1 to compile with wide-char/UTF-8 code])
949
950	CF_CHECK_WCHAR_H
951	CF_CHECK_WCWIDTH_GRAPHICS
952	test "$cf_cv_wcwidth_graphics" = no && NCURSES_WCWIDTH_GRAPHICS=0
953
954	# with_overwrite=no
955	NCURSES_CH_T=cchar_t
956	AC_CHECK_FUNCS(putwc btowc wctob mbtowc wctomb mblen mbrlen mbrtowc wcsrtombs mbsrtowcs wcstombs mbstowcs)
957	if test "x$ac_cv_func_putwc" != xyes ; then
958		CF_UTF8_LIB
959		if test "$cf_cv_utf8_lib" != no ; then
960			NCURSES_LIBUTF8=1
961		fi
962	fi
963	CF_WCHAR_TYPE(mbstate_t, NCURSES_MBSTATE_T)
964	CF_WCHAR_TYPE(wchar_t,   NCURSES_WCHAR_T,   NCURSES_OK_WCHAR_T)
965	CF_WCHAR_TYPE(wint_t,    NCURSES_WINT_T,    NCURSES_OK_WINT_T)
966
967	if test "$NCURSES_MBSTATE_T" != 0; then
968		AC_DEFINE(NEED_MBSTATE_T_DEF,1,[Define to 1 if we must declare mbstate_t])
969	fi
970fi
971AC_SUBST(NCURSES_CH_T)
972AC_SUBST(NCURSES_LIBUTF8)
973
974AC_SUBST(NEED_WCHAR_H)
975AC_SUBST(NCURSES_MBSTATE_T)
976AC_SUBST(NCURSES_WCHAR_T)
977AC_SUBST(NCURSES_WINT_T)
978
979AC_SUBST(NCURSES_OK_WCHAR_T)
980AC_SUBST(NCURSES_OK_WINT_T)
981
982###   use option --disable-lp64 to allow long chtype
983AC_MSG_CHECKING(whether to enable _LP64 definition in curses.h)
984AC_ARG_ENABLE(lp64,
985	[  --disable-lp64          allow chtype to be long (ignore _LP64)],
986	[with_lp64=$enableval],
987	[with_lp64=$cf_dft_with_lp64])
988AC_MSG_RESULT($with_lp64)
989
990if test "x$with_lp64" = xyes ; then
991	cf_cv_enable_lp64=1
992else
993	cf_cv_enable_lp64=0
994fi
995AC_SUBST(cf_cv_enable_lp64)
996
997CF_LARGEFILE
998
999###   use option --disable-tparm-varargs to make tparm() conform to X/Open
1000AC_MSG_CHECKING(if you want tparm not to use X/Open fixed-parameter list)
1001AC_ARG_ENABLE(tparm-varargs,
1002	[  --disable-tparm-varargs compile tparm() without varargs interface],
1003	[with_tparm_varargs=$enableval],
1004	[with_tparm_varargs=yes])
1005AC_MSG_RESULT($with_tparm_varargs)
1006NCURSES_TPARM_VARARGS=0
1007test "x$with_tparm_varargs" = xyes && NCURSES_TPARM_VARARGS=1
1008AC_SUBST(NCURSES_TPARM_VARARGS)
1009
1010###   use option --disable-tic-depends to make libtic not explicitly depend on ncurses/ncursesw
1011if test "$with_ticlib" != no ; then
1012AC_MSG_CHECKING(if you want tic library to use explicit dependency on ncurses$LIB_SUFFIX library)
1013AC_ARG_ENABLE(tic-depends,
1014	[  --disable-tic-depends   link tic library without explicit dependency on ncurses library],
1015	[with_tic_depends=$enableval],
1016	[with_tic_depends=yes])
1017AC_MSG_RESULT($with_tic_depends)
1018else
1019	with_tic_depends=no
1020fi
1021
1022###   use option --enable-wattr-macros to enable wattr* macros in curses.h
1023AC_MSG_CHECKING(if you want to enable wattr* macros)
1024AC_ARG_ENABLE(wattr-macros,
1025	[  --enable-wattr-macros   enable wattr* macros],
1026	[with_wattr_macros=$enableval],
1027	[with_wattr_macros=no])
1028if [[ "x$with_wattr_macros" != xyes ]]; then
1029	NCURSES_WATTR_MACROS=0
1030	AC_MSG_RESULT(no)
1031else
1032	NCURSES_WATTR_MACROS=1
1033	AC_MSG_RESULT(yes)
1034fi
1035AC_SUBST(NCURSES_WATTR_MACROS)
1036
1037CF_WITH_X11_RGB
1038
1039###   use option --with-bool to override bool's type
1040AC_MSG_CHECKING(for type of bool)
1041AC_ARG_WITH(bool,
1042	[  --with-bool=TYPE        override fallback type of bool variable],
1043	[NCURSES_BOOL="$withval"],
1044	[NCURSES_BOOL=auto])
1045AC_MSG_RESULT($NCURSES_BOOL)
1046AC_SUBST(NCURSES_BOOL)
1047
1048AC_MSG_CHECKING(for alternate terminal capabilities file)
1049AC_ARG_WITH(caps,
1050	[  --with-caps=alt         compile with alternate Caps file],
1051	[TERMINFO_CAPS=Caps.$withval],
1052	[TERMINFO_CAPS=Caps])
1053test -f "${srcdir}/include/${TERMINFO_CAPS}" || TERMINFO_CAPS=Caps
1054AC_MSG_RESULT($TERMINFO_CAPS)
1055AC_SUBST(TERMINFO_CAPS)
1056
1057###   use option --with-chtype to override chtype's type
1058AC_MSG_CHECKING(for type of chtype)
1059AC_ARG_WITH(chtype,
1060	[  --with-chtype=TYPE      override type of chtype],
1061	[NCURSES_CHTYPE="$withval"],
1062	[NCURSES_CHTYPE=$cf_dft_chtype])
1063AC_MSG_RESULT($NCURSES_CHTYPE)
1064
1065###   use option --with-ospeed to override ospeed's type
1066AC_MSG_CHECKING(for type of ospeed)
1067AC_ARG_WITH(ospeed,
1068	[  --with-ospeed=TYPE      override type of ospeed variable],
1069	[NCURSES_OSPEED="$withval"],
1070	[NCURSES_OSPEED=short])
1071AC_MSG_RESULT($NCURSES_OSPEED)
1072AC_SUBST(NCURSES_OSPEED)
1073
1074###   use option --with-mmask-t to override mmask_t's type
1075AC_MSG_CHECKING(for type of mmask_t)
1076AC_ARG_WITH(mmask-t,
1077	[  --with-mmask-t=TYPE     override type of mmask_t],
1078	[NCURSES_MMASK_T="$withval"],
1079	[NCURSES_MMASK_T=$cf_dft_mmask_t])
1080AC_MSG_RESULT($NCURSES_MMASK_T)
1081
1082###   use option --with-ccharw-max to override CCHARW_MAX size
1083AC_MSG_CHECKING(for size CCHARW_MAX)
1084AC_ARG_WITH(ccharw-max,
1085	[  --with-ccharw-max=XXX   override size CCHARW_MAX],
1086	[NCURSES_CCHARW_MAX="$withval"],
1087	[NCURSES_CCHARW_MAX=5])
1088AC_MSG_RESULT($NCURSES_CCHARW_MAX)
1089AC_SUBST(NCURSES_CCHARW_MAX)
1090
1091AC_CHECK_SIZEOF([signed char])
1092if test "$ac_cv_sizeof_signed_char" = 1 ; then
1093	NCURSES_SBOOL="signed char"
1094else
1095	NCURSES_SBOOL="char"
1096fi
1097AC_MSG_CHECKING(if you want to use signed Boolean array in term.h)
1098AC_ARG_ENABLE(signed-char,
1099	[  --enable-signed-char    compile using signed Boolean's in term.h],
1100	[with_signed_char=$enableval],
1101	[with_signed_char=no])
1102AC_MSG_RESULT($with_signed_char)
1103test "x$with_signed_char" != xyes && NCURSES_SBOOL="char"
1104AC_SUBST(NCURSES_SBOOL)
1105
1106###   use option --with-tparm-arg to override tparm's argument type
1107AC_MSG_CHECKING(for type of tparm args)
1108AC_ARG_WITH(tparm-arg,
1109	[  --with-tparm-arg=TYPE   override parameter type of tparm],
1110	[NCURSES_TPARM_ARG="$withval"],
1111	[NCURSES_TPARM_ARG=$cf_dft_tparm_arg])
1112AC_MSG_RESULT($NCURSES_TPARM_ARG)
1113AC_SUBST(NCURSES_TPARM_ARG)
1114
1115### Enable compiling-in rcs id's
1116AC_MSG_CHECKING(if RCS identifiers should be compiled-in)
1117AC_ARG_WITH(rcs-ids,
1118	[  --with-rcs-ids          compile-in RCS identifiers],
1119	[with_rcs_ids=$withval],
1120	[with_rcs_ids=no])
1121AC_MSG_RESULT($with_rcs_ids)
1122test "x$with_rcs_ids" = xyes && AC_DEFINE(USE_RCS_IDS,1,[Define to 1 to compile-in RCS identifiers])
1123
1124###############################################################################
1125CF_MAN_PAGES([ captoinfo clear infocmp infotocap reset tabs tic toe tput tset ])
1126
1127###############################################################################
1128CF_HELP_MESSAGE(Extensions:)
1129
1130### Note that some functions (such as const) are normally disabled anyway.
1131AC_MSG_CHECKING(if you want to build with function extensions)
1132AC_ARG_ENABLE(ext-funcs,
1133	[  --disable-ext-funcs     disable function-extensions],
1134	[with_ext_funcs=$enableval],
1135	[with_ext_funcs=yes])
1136AC_MSG_RESULT($with_ext_funcs)
1137if test "x$with_ext_funcs" = xyes ; then
1138	NCURSES_EXT_FUNCS=1
1139	AC_DEFINE(NCURSES_EXT_FUNCS,1,[Define to 1 to enable ncurses extended functions])
1140	AC_DEFINE(HAVE_ASSUME_DEFAULT_COLORS,1,[Define to 1 to enable assume_default_colors() function in test-programs])
1141	AC_DEFINE(HAVE_CURSES_VERSION,1,[Define to 1 to enable curses_version() function in test-programs])
1142	AC_DEFINE(HAVE_HAS_KEY,1,[Define to 1 to enable has_key() function in test-programs])
1143	AC_DEFINE(HAVE_RESIZETERM,1,[Define to 1 to enable resizeterm() function in test-programs])
1144	AC_DEFINE(HAVE_RESIZE_TERM,1,[Define to 1 to enable resize_term() function in test-programs])
1145	AC_DEFINE(HAVE_TERM_ENTRY_H,1,[Define to 1 to enable term_entry() function in test-programs])
1146	AC_DEFINE(HAVE_USE_DEFAULT_COLORS,1,[Define to 1 to enable use_default_colors() function in test-programs])
1147	AC_DEFINE(HAVE_USE_EXTENDED_NAMES,1,[Define to 1 to enable use_extended_names() function in test-programs])
1148	AC_DEFINE(HAVE_USE_SCREEN,1,[Define to 1 to enable use_screen() function in test-programs])
1149	AC_DEFINE(HAVE_USE_WINDOW,1,[Define to 1 to enable use_window() function in test-programs])
1150	AC_DEFINE(HAVE_WRESIZE,1,[Define to 1 to enable wresize() function in test-programs])
1151	GENERATED_EXT_FUNCS=generated
1152	test "x$with_ext_funcs" = xyes || cf_dft_ext_spfuncs=no
1153else
1154	NCURSES_EXT_FUNCS=0
1155	GENERATED_EXT_FUNCS=
1156fi
1157AC_SUBST(NCURSES_EXT_FUNCS)
1158AC_SUBST(GENERATED_EXT_FUNCS)
1159
1160AC_MSG_CHECKING(if you want to build with SCREEN extensions)
1161AC_ARG_ENABLE(sp-funcs,
1162	[  --enable-sp-funcs       enable SCREEN-extensions],
1163	[with_sp_funcs=$enableval],
1164	[with_sp_funcs=$cf_dft_ext_spfuncs])
1165AC_MSG_RESULT($with_sp_funcs)
1166if test "x$with_sp_funcs" = xyes ; then
1167	NCURSES_SP_FUNCS=1
1168	AC_DEFINE(NCURSES_SP_FUNCS,1,[Define to 1 to enable SCREEN-extensions])
1169	AC_DEFINE(HAVE_TPUTS_SP,1,[Define to 1 to enable tputs_sp() function in test-programs])
1170	GENERATED_SP_FUNCS=generated
1171else
1172	NCURSES_SP_FUNCS=0
1173	GENERATED_SP_FUNCS=
1174fi
1175AC_SUBST(NCURSES_SP_FUNCS)
1176AC_SUBST(GENERATED_SP_FUNCS)
1177
1178AC_MSG_CHECKING(if you want to build with terminal-driver)
1179AC_ARG_ENABLE(term-driver,
1180	[  --enable-term-driver    enable terminal-driver],
1181	[with_term_driver=$enableval],
1182	[with_term_driver=no])
1183AC_MSG_RESULT($with_term_driver)
1184if test "x$with_term_driver" = xyes ; then
1185	AC_DEFINE(USE_TERM_DRIVER,1,[Define to 1 to enable terminal-driver])
1186	if test "x$with_termlib" != xno ; then
1187		AC_MSG_ERROR(The term-driver option conflicts with the termlib option)
1188	fi
1189	if test "x$with_sp_funcs" != xyes ; then
1190		AC_MSG_ERROR(The term-driver option relies upon sp-funcs)
1191	fi
1192fi
1193
1194###   use option --enable-const to turn on use of const beyond that in XSI.
1195AC_MSG_CHECKING(for extended use of const keyword)
1196AC_ARG_ENABLE(const,
1197	[  --enable-const          compile with extra/non-standard const],
1198	[with_ext_const=$enableval],
1199	[with_ext_const=$cf_dft_ext_const])
1200AC_MSG_RESULT($with_ext_const)
1201NCURSES_CONST='/*nothing*/'
1202if test "x$with_ext_const" = xyes ; then
1203	NCURSES_CONST=const
1204fi
1205AC_SUBST(NCURSES_CONST)
1206
1207###   use option --enable-ext-colors to turn on use of colors beyond 16.
1208AC_MSG_CHECKING(if you want to use extended colors)
1209AC_ARG_ENABLE(ext-colors,
1210	[  --enable-ext-colors     compile for 256-color support],
1211	[with_ext_colors=$enableval],
1212	[with_ext_colors=$cf_dft_ext_colors])
1213AC_MSG_RESULT($with_ext_colors)
1214NCURSES_EXT_COLORS=0
1215if test "x$with_ext_colors" = xyes ; then
1216	if test "x$with_widec" != xyes ; then
1217		AC_MSG_WARN(This option applies only to wide-character library)
1218	else
1219		# cannot be ABI 5 since it changes sizeof(cchar_t)
1220		CF_NCURSES_ABI_6
1221		NCURSES_EXT_COLORS=1
1222		AC_DEFINE(NCURSES_EXT_COLORS,1,[Define to 1 to compile for 256-color support])
1223		AC_DEFINE(HAVE_ALLOC_PAIR,1,[Define to 1 to enable alloc_pair() function])
1224		AC_DEFINE(HAVE_INIT_EXTENDED_COLOR,1,[Define to 1 to enable init_extended_color() function in test-programs])
1225		AC_DEFINE(HAVE_RESET_COLOR_PAIRS,1,[Define to 1 to enable reset_color_pairs() function in test-programs])
1226	fi
1227fi
1228AC_SUBST(NCURSES_EXT_COLORS)
1229
1230###   use option --enable-ext-mouse to modify coding to support 5-button mice
1231AC_MSG_CHECKING(if you want to use extended mouse encoding)
1232AC_ARG_ENABLE(ext-mouse,
1233	[  --enable-ext-mouse      compile for extended mouse-encoding],
1234	[with_ext_mouse=$enableval],
1235	[with_ext_mouse=$cf_dft_ext_mouse])
1236AC_MSG_RESULT($with_ext_mouse)
1237NCURSES_MOUSE_VERSION=1
1238if test "x$with_ext_mouse" = xyes ; then
1239	NCURSES_MOUSE_VERSION=2
1240	CF_NCURSES_ABI_6
1241fi
1242AC_SUBST(NCURSES_MOUSE_VERSION)
1243
1244###   use option --enable-ext-putwin to turn on extended screendumps
1245AC_MSG_CHECKING(if you want to use extended putwin/screendump)
1246AC_ARG_ENABLE(ext-putwin,
1247	[  --enable-ext-putwin     compile with extended putwin/screendump],
1248	[with_ext_putwin=$enableval],
1249	[with_ext_putwin=$cf_dft_ext_putwin])
1250AC_MSG_RESULT($with_ext_putwin)
1251if test "x$with_ext_putwin" = xyes ; then
1252	AC_DEFINE(NCURSES_EXT_PUTWIN,1,[Define to 1 to compile with extended putwin/screendump])
1253fi
1254
1255AC_MSG_CHECKING(if you want \$NCURSES_NO_PADDING code)
1256AC_ARG_ENABLE(no-padding,
1257	[  --enable-no-padding     compile with $NCURSES_NO_PADDING code],
1258	[with_no_padding=$enableval],
1259	[with_no_padding=$with_ext_funcs])
1260AC_MSG_RESULT($with_no_padding)
1261test "x$with_no_padding" = xyes && AC_DEFINE(NCURSES_NO_PADDING,1,[Define to 1 to compile with $NCURSES_NO_PADDING code])
1262
1263###   use option --enable-sigwinch to turn on use of SIGWINCH logic
1264AC_MSG_CHECKING(if you want SIGWINCH handler)
1265AC_ARG_ENABLE(sigwinch,
1266	[  --enable-sigwinch       compile with SIGWINCH handler],
1267	[with_sigwinch=$enableval],
1268	[with_sigwinch=$with_ext_funcs])
1269AC_MSG_RESULT($with_sigwinch)
1270test "x$with_sigwinch" = xyes && AC_DEFINE(USE_SIGWINCH,1,[Define to 1 to compile with SIGWINCH handler])
1271
1272###   use option --enable-tcap-names to allow user to define new capabilities
1273AC_MSG_CHECKING(if you want user-definable terminal capabilities like termcap)
1274AC_ARG_ENABLE(tcap-names,
1275	[  --enable-tcap-names     compile with user-definable terminal capabilities],
1276	[with_tcap_names=$enableval],
1277	[with_tcap_names=$with_ext_funcs])
1278AC_MSG_RESULT($with_tcap_names)
1279NCURSES_XNAMES=0
1280test "x$with_tcap_names" = xyes && NCURSES_XNAMES=1
1281AC_SUBST(NCURSES_XNAMES)
1282
1283##############################################################################
1284CF_HELP_MESSAGE(Reentrant Code:)
1285CF_WITH_PTHREAD
1286
1287if test "x$with_pthread" != xno; then
1288	AC_CHECK_FUNC(pthread_kill,[
1289		AC_MSG_CHECKING(if you want to allow EINTR in wgetch with pthreads)
1290		AC_ARG_ENABLE(pthreads-eintr,
1291			[  --enable-pthreads-eintr enable EINTR in wgetch with pthreads],
1292			[use_pthreads_eintr=$enableval],
1293			[use_pthreads_eintr=no])
1294		AC_MSG_RESULT($use_pthreads_eintr)
1295		if test "x$use_pthreads_eintr" = xyes ; then
1296			AC_DEFINE(USE_PTHREADS_EINTR,1,[Define to 1 to enable EINTR in wgetch with pthreads])
1297		fi])
1298
1299	AC_MSG_CHECKING(if you want to use weak-symbols for pthreads)
1300	AC_ARG_ENABLE(weak-symbols,
1301		[  --enable-weak-symbols   enable weak-symbols for pthreads],
1302		[use_weak_symbols=$enableval],
1303		[use_weak_symbols=no])
1304	AC_MSG_RESULT($use_weak_symbols)
1305	if test "x$use_weak_symbols" = xyes ; then
1306		CF_WEAK_SYMBOLS
1307	else
1308		cf_cv_weak_symbols=no
1309	fi
1310
1311	if test "x$cf_cv_weak_symbols" = xyes ; then
1312		AC_DEFINE(USE_WEAK_SYMBOLS,1,[Define to 1 to enable weak-symbols for pthreads])
1313	fi
1314fi
1315
1316PTHREAD=
1317if test "x$with_pthread" = "xyes" ; then
1318	AC_DEFINE(USE_PTHREADS,1,[Define to 1 to use pthreads feature])
1319	enable_reentrant=yes
1320	if test "x$cf_cv_weak_symbols" = xyes ; then
1321		PTHREAD=-lpthread
1322		CF_ADD_LIB(pthread,PRIVATE_LIBS)
1323	fi
1324fi
1325AC_SUBST(PTHREAD)
1326
1327# Reentrant code has to be opaque; there's little advantage to making ncurses
1328# opaque outside of that, so there is no --enable-opaque option.  We can use
1329# this option without --with-pthreads, but this will be always set for
1330# pthreads.
1331AC_MSG_CHECKING(if you want reentrant code)
1332AC_ARG_ENABLE(reentrant,
1333	[  --enable-reentrant      compile with reentrant code],
1334	[with_reentrant=$enableval],
1335	[with_reentrant=no])
1336AC_MSG_RESULT($with_reentrant)
1337if test "x$with_reentrant" = xyes ; then
1338	cf_cv_enable_reentrant=1
1339	cf_cv_enable_opaque="NCURSES_INTERNALS"
1340	NCURSES_SIZE_T=int
1341	if test "x$cf_cv_weak_symbols" = xyes ; then
1342		CF_REMOVE_LIB(LIBS,$LIBS,pthread)
1343		CF_ADD_LIB(pthread,TEST_LIBS)
1344		CF_ADD_LIB(pthread,TEST_LIBS2)
1345		CF_ADD_LIB(pthread,PRIVATE_LIBS)
1346	else
1347		# when not using weak symbols but with_reentrant,
1348		# add 't' to the library suffix on all platforms
1349		# except cygwin, where we only do that if ALSO
1350		# compiling with full thread support.
1351		case "$host" in
1352		(*cygwin* | *msys*)
1353			if test "$with_pthread" = "yes" ; then
1354				if test "x$disable_lib_suffixes" = "xno" ; then
1355					LIB_SUFFIX="t${LIB_SUFFIX}"
1356				fi
1357			fi ;;
1358		(*)
1359			if test "x$disable_lib_suffixes" = "xno" ; then
1360				LIB_SUFFIX="t${LIB_SUFFIX}"
1361			fi
1362			;;
1363		esac
1364	fi
1365	AC_DEFINE(USE_REENTRANT,1,[Define to 1 to use reentrant feature])
1366	CF_NCURSES_ABI_6
1367else
1368	cf_cv_enable_reentrant=0
1369	cf_cv_enable_opaque="NCURSES_OPAQUE"
1370	NCURSES_SIZE_T=short
1371fi
1372AC_SUBST(cf_cv_enable_reentrant)
1373AC_SUBST(cf_cv_enable_opaque)
1374
1375AC_SUBST(NCURSES_SIZE_T)
1376
1377AC_MSG_CHECKING(if you want opaque curses-library structures)
1378CF_ARG_ENABLE(opaque-curses,
1379	[  --enable-opaque-curses  make curses WINDOW, etc., "opaque"],
1380	[enable_opaque_curses=yes],[
1381	 test "$cf_cv_enable_reentrant" = 1 && enable_opaque_curses=yes
1382	 test "$cf_cv_enable_reentrant" = 1 || enable_opaque_curses=no
1383	])
1384AC_MSG_RESULT($enable_opaque_curses)
1385
1386test "$cf_cv_enable_reentrant" = 1 && \
1387test "$enable_opaque_curses" = no && \
1388AC_MSG_ERROR(reentrant configuration requires opaque library)
1389
1390AC_MSG_CHECKING(if you want opaque form-library structures)
1391AC_ARG_ENABLE(opaque-form,
1392	[  --enable-opaque-form    make form-library structures "opaque"],
1393	[enable_opaque_form=yes],[enable_opaque_form=no])
1394AC_MSG_RESULT($enable_opaque_form)
1395
1396AC_MSG_CHECKING(if you want opaque menu-library structures)
1397AC_ARG_ENABLE(opaque-menu,
1398	[  --enable-opaque-menu    make menu-library structures "opaque"],
1399	[enable_opaque_menu=yes],[enable_opaque_menu=no])
1400AC_MSG_RESULT($enable_opaque_menu)
1401
1402AC_MSG_CHECKING(if you want opaque panel-library structures)
1403AC_ARG_ENABLE(opaque-panel,
1404	[  --enable-opaque-panel   make panel-library structures "opaque"],
1405	[enable_opaque_panel=yes],[enable_opaque_panel=no])
1406AC_MSG_RESULT($enable_opaque_panel)
1407
1408NCURSES_OPAQUE=0;		test "$enable_opaque_curses" = yes && NCURSES_OPAQUE=1
1409NCURSES_OPAQUE_FORM=0;	test "$enable_opaque_form"   = yes && NCURSES_OPAQUE_FORM=1
1410NCURSES_OPAQUE_MENU=0;	test "$enable_opaque_menu"   = yes && NCURSES_OPAQUE_MENU=1
1411NCURSES_OPAQUE_PANEL=0;	test "$enable_opaque_panel"  = yes && NCURSES_OPAQUE_PANEL=1
1412
1413AC_SUBST(NCURSES_OPAQUE)
1414AC_SUBST(NCURSES_OPAQUE_FORM)
1415AC_SUBST(NCURSES_OPAQUE_MENU)
1416AC_SUBST(NCURSES_OPAQUE_PANEL)
1417
1418### Allow using a different wrap-prefix
1419if test "$cf_cv_enable_reentrant" != 0 || test "$BROKEN_LINKER" = 1 ; then
1420	AC_MSG_CHECKING(for prefix used to wrap public variables)
1421	AC_ARG_WITH(wrap-prefix,
1422		[  --with-wrap-prefix=XXX  override prefix used for public variables],
1423		[NCURSES_WRAP_PREFIX=$withval],
1424		[NCURSES_WRAP_PREFIX=_nc_])
1425	AC_MSG_RESULT($NCURSES_WRAP_PREFIX)
1426else
1427	NCURSES_WRAP_PREFIX=_nc_
1428fi
1429AC_SUBST(NCURSES_WRAP_PREFIX)
1430AC_DEFINE_UNQUOTED(NCURSES_WRAP_PREFIX,"$NCURSES_WRAP_PREFIX",[Define to override _nc_ prefix])
1431
1432###############################################################################
1433# These options are relatively safe to experiment with.
1434CF_HELP_MESSAGE(Development Code:)
1435AC_MSG_CHECKING(if you want all development code)
1436AC_ARG_WITH(develop,
1437	[  --without-develop       disable development options],
1438	[with_develop=$withval],
1439	[with_develop=no])
1440AC_MSG_RESULT($with_develop)
1441
1442###   use option --enable-hard-tabs to turn on use of hard-tabs optimize
1443AC_MSG_CHECKING(if you want hard-tabs code)
1444AC_ARG_ENABLE(hard-tabs,
1445	[  --enable-hard-tabs      compile with hard-tabs code],,
1446	[enable_hard_tabs=$with_develop])
1447AC_MSG_RESULT($enable_hard_tabs)
1448test "x$enable_hard_tabs" = xyes && AC_DEFINE(USE_HARD_TABS,1,[Define to 1 to compile with hard-tabs code])
1449
1450###   use option --enable-xmc-glitch to turn on use of magic-cookie optimize
1451AC_MSG_CHECKING(if you want limited support for xmc)
1452AC_ARG_ENABLE(xmc-glitch,
1453	[  --enable-xmc-glitch     compile with support for xmc (magic-cookie)],,
1454	[enable_xmc_glitch=$with_develop])
1455AC_MSG_RESULT($enable_xmc_glitch)
1456test "x$enable_xmc_glitch" = xyes && AC_DEFINE(USE_XMC_SUPPORT,1,[Define to 1 to compile with support for xmc (magic-cookie)])
1457
1458###############################################################################
1459# These are just experimental, probably should not be in a package:
1460CF_HELP_MESSAGE(Experimental Code:)
1461
1462AC_MSG_CHECKING(if you do not want to assume colors are white-on-black)
1463AC_ARG_ENABLE(assumed-color,
1464	[  --disable-assumed-color do not assume anything about default-colors],
1465	[with_assumed_color=$enableval],
1466	[with_assumed_color=yes])
1467AC_MSG_RESULT($with_assumed_color)
1468test "x$with_assumed_color" = xyes && AC_DEFINE(USE_ASSUMED_COLOR,1,[Define to 1 to assume things about default-colors])
1469
1470###   use option --enable-hashmap to turn on use of hashmap scrolling logic
1471AC_MSG_CHECKING(if you want hashmap scrolling-optimization code)
1472AC_ARG_ENABLE(hashmap,
1473	[  --disable-hashmap       compile without hashmap scrolling-optimization],
1474	[with_hashmap=$enableval],
1475	[with_hashmap=yes])
1476AC_MSG_RESULT($with_hashmap)
1477test "x$with_hashmap" = xyes && AC_DEFINE(USE_HASHMAP,1,[Define to 1 to compile with hashmap scrolling-optimization])
1478
1479###   use option --enable-colorfgbg to turn on use of $COLORFGBG environment
1480AC_MSG_CHECKING(if you want colorfgbg code)
1481AC_ARG_ENABLE(colorfgbg,
1482	[  --enable-colorfgbg      compile-in experimental $COLORFGBG code],
1483	[with_colorfgbg=$enableval],
1484	[with_colorfgbg=no])
1485AC_MSG_RESULT($with_colorfgbg)
1486test "x$with_colorfgbg" = xyes && AC_DEFINE(USE_COLORFGBG,1,[Define to 1 to compile-in experimental $COLORFGBG code])
1487
1488###   use option --enable-fvisibility to turn on use of gcc-specific feature
1489AC_MSG_CHECKING(if you want to use gcc -fvisibility option)
1490AC_ARG_ENABLE(fvisibility,
1491	[  --enable-fvisibility    compile with -fvisibility=hidden],
1492	[cf_with_fvisibility=$enableval],
1493	[cf_with_fvisibility=no])
1494AC_MSG_RESULT($cf_with_fvisibility)
1495
1496NCURSES_IMPEXP=
1497NCURSES_CXX_IMPEXP=
1498if test "x$cf_with_fvisibility" = xyes; then
1499	CF_CHECK_FVISIBILITY($CC,CFLAGS,cf_cv_fvisibility_hidden)
1500	if test "x$cf_cv_fvisibility_hidden" = xyes
1501	then
1502		CF_ADD_CFLAGS([-fvisibility=hidden])
1503		NCURSES_IMPEXP="__attribute__ ((visibility(\"default\")))"
1504	fi
1505	if test -n "$CXX"
1506	then
1507		AC_LANG_PUSH(C++)
1508		CF_CHECK_FVISIBILITY($CXX,CXXFLAGS,cf_cv_fvisibility_hidden2)
1509		if test "x$cf_cv_fvisibility_hidden2" = xyes
1510		then
1511			CF_ADD_CXXFLAGS([-fvisibility=hidden])
1512			NCURSES_CXX_IMPEXP="__attribute__ ((visibility(\"default\")))"
1513		fi
1514		AC_LANG_POP
1515	fi
1516fi
1517AC_SUBST(NCURSES_IMPEXP)
1518AC_SUBST(NCURSES_CXX_IMPEXP)
1519
1520###   use option --enable-interop to turn on use of bindings used for interop
1521AC_MSG_CHECKING(if you want interop bindings)
1522AC_ARG_ENABLE(interop,
1523	[  --enable-interop        compile-in interop bindings],
1524	[with_exp_interop=$enableval],
1525	[with_exp_interop=$cf_dft_interop])
1526AC_MSG_RESULT($with_exp_interop)
1527
1528NCURSES_INTEROP_FUNCS=0
1529test "x$with_exp_interop" = xyes && NCURSES_INTEROP_FUNCS=1
1530AC_SUBST(NCURSES_INTEROP_FUNCS)
1531
1532
1533AC_MSG_CHECKING(if you want experimental safe-sprintf code)
1534AC_ARG_ENABLE(safe-sprintf,
1535	[  --enable-safe-sprintf   compile with experimental safe-sprintf code],
1536	[with_safe_sprintf=$enableval],
1537	[with_safe_sprintf=no])
1538AC_MSG_RESULT($with_safe_sprintf)
1539
1540###   use option --disable-scroll-hints to turn off use of scroll-hints scrolling logic
1541# when hashmap is used scroll hints are useless
1542if test "$with_hashmap" = no ; then
1543AC_MSG_CHECKING(if you want to experiment without scrolling-hints code)
1544AC_ARG_ENABLE(scroll-hints,
1545	[  --disable-scroll-hints  compile without scroll-hints code],
1546	[with_scroll_hints=$enableval],
1547	[with_scroll_hints=yes])
1548AC_MSG_RESULT($with_scroll_hints)
1549test "x$with_scroll_hints" = xyes && AC_DEFINE(USE_SCROLL_HINTS,1,[Define to 1 to compile without scroll-hints code])
1550fi
1551
1552AC_MSG_CHECKING(if you want wgetch-events code)
1553AC_ARG_ENABLE(wgetch-events,
1554	[  --enable-wgetch-events  compile with wgetch-events code],
1555	[with_wgetch_events=$enableval],
1556	[with_wgetch_events=no])
1557AC_MSG_RESULT($with_wgetch_events)
1558if test "x$with_wgetch_events" = xyes ; then
1559	AC_DEFINE(NCURSES_WGETCH_EVENTS,1,[Define to 1 to compile with wgetch-events code])
1560	NCURSES_WGETCH_EVENTS=1
1561else
1562	NCURSES_WGETCH_EVENTS=0
1563fi
1564AC_SUBST(NCURSES_WGETCH_EVENTS)
1565
1566case "$cf_cv_system_name" in
1567(*mingw32*|*mingw64*|*-msvc*)
1568	AC_MSG_CHECKING(if you want experimental-Windows driver)
1569	AC_ARG_ENABLE(exp-win32,
1570		[  --enable-exp-win32      compile with experimental-Windows driver],
1571		[with_exp_win32=$enableval],
1572		[with_exp_win32=no])
1573	AC_MSG_RESULT($with_exp_win32)
1574	if test "x$with_exp_win32" = xyes
1575	then
1576		AC_DEFINE(EXP_WIN32_DRIVER,1,[Define to 1 to compile with experimental win32 driver])
1577		EXP_WIN32_DRIVER=1
1578		INTERNALS_HDR='[$](INCDIR)/nc_win32.h'
1579	else
1580		INTERNALS_HDR='[$](INCDIR)/nc_mingw.h'
1581		EXP_WIN32_DRIVER=0
1582	fi
1583	;;
1584(*)
1585	EXP_WIN32_DRIVER=0
1586	INTERNALS_HDR=
1587	;;
1588esac
1589AC_SUBST(EXP_WIN32_DRIVER)
1590AC_SUBST(INTERNALS_HDR)
1591
1592###############################################################################
1593CF_HELP_MESSAGE(Testing/development Options:)
1594
1595###	use option --disable-echo to suppress full display compiling commands
1596CF_DISABLE_ECHO
1597if test "x$enable_echo" = xyes; then
1598	ECHO_LINK=
1599else
1600	ECHO_LINK='@ echo linking $@ ... ;'
1601	test -n "$LIBTOOL" && LIBTOOL="$LIBTOOL --silent"
1602	test -n "$LIBTOOL_CXX" && LIBTOOL_CXX="$LIBTOOL_CXX --silent"
1603fi
1604AC_SUBST(ECHO_LINK)
1605
1606# --disable-stripping is used for debugging
1607CF_INSTALL_OPTS
1608
1609# If we're avoiding relinking of shared libraries during install, that is to
1610# avoid modifying the build-tree.  For the same reason, avoid doing ranlib if
1611# the install program has "-p" (for preserving timestamps).
1612cf_cv_do_reranlib=yes
1613if test "x$cf_cv_install_p" = xyes
1614then
1615	if test "x$cf_cv_do_relink" != xyes
1616	then
1617		cf_cv_do_reranlib=no
1618		INSTALL_OPT_P="-p"
1619		INSTALL_LIB="$INSTALL_LIB $INSTALL_OPT_P"
1620	fi
1621fi
1622AC_SUBST(INSTALL_OPT_P)
1623
1624###	use option --enable-warnings to turn on all gcc warnings
1625CF_ENABLE_WARNINGS(Wno-unknown-pragmas Wswitch-enum,yes)
1626
1627if test "x$enable_warnings" = "xyes"; then
1628 	CF_ADD_ADAFLAGS(-gnatg)
1629	if test "x$cf_with_cxx" = xyes ; then
1630		CF_GXX_WARNINGS(Wno-unused)
1631	fi
1632fi
1633CF_ENABLE_STRING_HACKS
1634
1635###	use option --enable-assertions to turn on generation of assertion code
1636AC_MSG_CHECKING(if you want to enable runtime assertions)
1637AC_ARG_ENABLE(assertions,
1638	[  --enable-assertions     test: turn on generation of assertion code],
1639	[with_assertions=$enableval],
1640	[with_assertions=no])
1641AC_MSG_RESULT($with_assertions)
1642if test -n "$GCC"
1643then
1644	if test "$with_assertions" = no
1645	then
1646		CPPFLAGS="$CPPFLAGS -DNDEBUG"
1647	else
1648		CF_ADD_ADAFLAGS(-gnata)
1649	fi
1650fi
1651
1652###	use option --disable-leaks to suppress "permanent" leaks, for testing
1653CF_DISABLE_LEAKS
1654AC_DEFINE(HAVE_NC_ALLOC_H,1,[Define to 1 if we have nc_alloc.h header])
1655
1656###	use option --enable-expanded to generate certain macros as functions
1657AC_ARG_ENABLE(expanded,
1658	[  --enable-expanded       test: generate functions for certain macros],
1659	[test "x$enableval" = xyes && AC_DEFINE(NCURSES_EXPANDED,1,[Define to 1 to generate functions for certain macros])])
1660
1661###	use option --disable-macros to suppress macros in favor of functions
1662AC_ARG_ENABLE(macros,
1663	[  --disable-macros        test: use functions rather than macros],
1664	[test "$enableval" = no && AC_DEFINE(NCURSES_NOMACROS,1,[Define to 1 to use functions rather than macros])])
1665
1666# Normally we only add trace() to the debug-library.  Allow this to be
1667# extended to all models of the ncurses library:
1668cf_all_traces=no
1669case "$CFLAGS $CPPFLAGS" in
1670(*-DTRACE*)
1671	cf_all_traces=yes
1672	;;
1673esac
1674
1675AC_MSG_CHECKING(whether to add trace feature to all models)
1676AC_ARG_WITH(trace,
1677[  --with-trace            test: add trace() function to all models of ncurses],
1678[cf_with_trace=$withval],
1679[cf_with_trace=$cf_all_traces])
1680AC_MSG_RESULT($cf_with_trace)
1681
1682if test "x$cf_with_trace" = xyes ; then
1683	LIB_TRACING=all
1684	ADA_TRACE=TRUE
1685	CF_ADD_CFLAGS(-DTRACE)
1686	AC_DEFINE(HAVE__TRACEF,1,[Define to 1 if we have _tracef function])
1687else
1688	LIB_TRACING=DEBUG
1689	ADA_TRACE=FALSE
1690fi
1691
1692AC_SUBST(ADA_TRACE)
1693
1694CF_DISABLE_GNAT_PROJECTS
1695
1696###	Checks for libraries.
1697case "$cf_cv_system_name" in
1698(*mingw32*|*mingw64*)
1699	if test "x$with_exp_win32" = xyes ; then
1700	CPPFLAGS="$CPPFLAGS -DWINVER=0x0600 -DWIN32_LEAN_AND_MEAN"
1701	else
1702	CPPFLAGS="$CPPFLAGS -DWINVER=0x0501 -DWIN32_LEAN_AND_MEAN"
1703	fi
1704	# Note: WINVER may be a problem with Windows 10
1705	;;
1706(*)
1707AC_CHECK_FUNC(gettimeofday,
1708	AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define to 1 if we have gettimeofday function]),[
1709
1710AC_CHECK_LIB(bsd, gettimeofday,
1711	AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define to 1 if we have gettimeofday function])
1712	CF_ADD_LIB(bsd))])dnl CLIX: bzero, select, gettimeofday
1713	;;
1714esac
1715
1716CF_MATH_LIB(MATH_LIB,pow(sin(x),x))
1717AC_SUBST(MATH_LIB)
1718
1719###	Checks for header files.
1720AC_STDC_HEADERS
1721AC_HEADER_DIRENT
1722AC_HEADER_TIME
1723CF_REGEX
1724
1725dnl These are some other potentially nonportable headers.
1726AC_CHECK_HEADERS( \
1727fcntl.h \
1728getopt.h \
1729limits.h \
1730locale.h \
1731math.h \
1732poll.h \
1733sys/ioctl.h \
1734sys/param.h \
1735sys/poll.h \
1736sys/select.h \
1737sys/time.h \
1738sys/times.h \
1739ttyent.h \
1740unistd.h \
1741wctype.h \
1742)
1743
1744CF_GETOPT_HEADER
1745
1746CF_CHECK_ENVIRON(environ)
1747CF_CHECK_GETENV
1748if test "x$cf_cv_consistent_getenv" = xno && \
1749	test "x$cf_with_trace" = xyes
1750then
1751	AC_MSG_WARN(The NCURSES_TRACE environment variable is not supported with this configuration)
1752fi
1753
1754CF_SYS_TIME_SELECT
1755
1756###	checks for compiler characteristics
1757AC_LANG_C
1758AC_C_CONST
1759CF_C_INLINE(NCURSES_INLINE,1200)
1760CF_SIG_ATOMIC_T
1761
1762if test "$NCURSES_CHTYPE" = auto ; then
1763	CF_TYPEOF_CHTYPE
1764else
1765	cf_cv_typeof_chtype=$NCURSES_CHTYPE
1766fi
1767test "$cf_cv_typeof_chtype" = unsigned && cf_cv_typeof_chtype=""
1768AC_SUBST(cf_cv_typeof_chtype)
1769
1770CF_UNSIGNED_LITERALS
1771cf_cv_1UL="1"
1772test ".$cf_cv_unsigned_literals" = .yes && cf_cv_1UL="${cf_cv_1UL}U"
1773test ".$cf_cv_typeof_chtype"    = .long && cf_cv_1UL="${cf_cv_1UL}L"
1774AC_SUBST(cf_cv_1UL)
1775
1776if test "$NCURSES_MMASK_T" = auto ; then
1777	cf_cv_typeof_mmask_t=long
1778else
1779	cf_cv_typeof_mmask_t=$NCURSES_MMASK_T
1780fi
1781test "$cf_cv_typeof_mmask_t" = unsigned && cf_cv_typeof_mmask_t=""
1782AC_SUBST(cf_cv_typeof_mmask_t)
1783
1784###	Checks for external-data
1785CF_ERRNO
1786CF_LINK_DATAONLY
1787
1788###	Checks for library functions.
1789AC_CHECK_FUNCS( \
1790getcwd \
1791getegid \
1792geteuid \
1793getopt \
1794getttynam \
1795issetugid \
1796localeconv \
1797poll \
1798putenv \
1799remove \
1800select \
1801setbuf \
1802setbuffer \
1803setenv \
1804setfsuid \
1805setvbuf \
1806sigaction \
1807sigvec \
1808snprintf \
1809strdup \
1810strstr \
1811sysconf \
1812tcgetpgrp \
1813times \
1814tsearch \
1815vsnprintf \
1816)
1817
1818if test "x$ac_cv_func_getopt" = xno && \
1819   test "x$cf_with_progs$cf_with_tests" != xnono; then
1820	AC_MSG_ERROR(getopt is required for building programs)
1821fi
1822
1823if test "x$with_safe_sprintf" = xyes
1824then
1825	if test "x$ac_cv_func_vsnprintf" = xyes
1826	then
1827		AC_MSG_WARN(will use vsnprintf instead of safe-sprintf option)
1828	else
1829		AC_DEFINE(USE_SAFE_SPRINTF,1,[Define to 1 to compile with experimental safe-sprintf code])
1830	fi
1831fi
1832
1833if test "x$with_getcap" = "xyes" ; then
1834	CF_CGETENT
1835fi
1836
1837CF_ISASCII
1838CF_STRUCT_SIGACTION
1839CF_FUNC_NANOSLEEP
1840CF_FUNC_TERMIOS
1841CF_FUNC_VSSCANF
1842CF_MKSTEMP
1843
1844# setup for prototype of fallback for vsscanf()
1845CF_SUBST_IF(["$cf_cv_func_vsscanf" = vsscanf], HAVE_VSSCANF, 1, 0)
1846
1847dnl FIXME (may need this) AC_SYS_RESTARTABLE_SYSCALLS
1848if test "x$cross_compiling" = xyes ; then
1849	AC_MSG_WARN(cross compiling: assume setvbuf params not reversed)
1850else
1851	AC_FUNC_SETVBUF_REVERSED
1852fi
1853AC_CHECK_TYPE(intptr_t, long)
1854AC_CHECK_TYPE(ssize_t, int)
1855CF_TYPE_SIGACTION
1856CF_SIZECHANGE
1857CF_FUNC_MEMMOVE
1858CF_FUNC_POLL
1859CF_VA_COPY
1860AC_FUNC_VFORK
1861CF_FOPEN_BIN_R
1862
1863# special check for test/ditto.c
1864CF_FUNC_OPENPTY
1865if test "$cf_cv_func_openpty" != no ; then
1866	AC_DEFINE_UNQUOTED(USE_OPENPTY_HEADER,<$cf_cv_func_openpty>,[Define to actual header for openpty function])
1867	AC_DEFINE(USE_XTERM_PTY,1,[Define to 1 if we should assume xterm pseudoterminal interface])
1868	if test "x$cf_cv_lib_util" = xyes ; then
1869		CF_ADD_LIB(util,TEST_LIBS)
1870	fi
1871fi
1872AC_SUBST(TEST_LIBS)
1873AC_SUBST(TEST_LIBS2)
1874
1875if test "$with_hashed_db" != no ; then
1876	AC_DEFINE(USE_HASHED_DB,1,[Define to 1 if we should build terminfo in hashed database])
1877	CF_HASHED_DB($with_hashed_db)
1878fi
1879
1880dnl We'll do our own -g libraries, unless the user's overridden via $CFLAGS
1881if test -z "$cf_user_CFLAGS" && test "$enable_leaks" = yes ; then
1882	CF_STRIP_G_OPT(CFLAGS)
1883	CF_STRIP_G_OPT(CXXFLAGS)
1884fi
1885
1886# Just in case, check if the C compiler has a bool type.
1887CF_BOOL_DECL(cf_cv_cc_bool_type)
1888
1889# Check for C++ compiler characteristics (and ensure that it's there!)
1890if test -n "$CXX" ; then
1891	AC_LANG_CPLUSPLUS
1892	CF_STDCPP_LIBRARY
1893	CF_PROG_CC_C_O(CXX,[$CXXFLAGS $CPPFLAGS])
1894
1895	case "$GXX_VERSION" in
1896	(1.*|2.[[0-6]]*|[[1-9]][[0-9]].*)
1897		cf_cxx_library=yes
1898		;;
1899	(*-2.7*|2.7*)
1900		CF_GPP_LIBRARY
1901		;;
1902	(*)
1903		cf_cxx_library=no
1904		;;
1905	esac
1906
1907	AC_CHECK_HEADERS(typeinfo)
1908	CF_CXX_IOSTREAM_NAMESPACE
1909	CF_BOOL_DECL
1910	CF_BOOL_SIZE
1911	CF_ETIP_DEFINES
1912	CF_CPP_PARAM_INIT
1913	CF_CPP_STATIC_CAST
1914	CF_CXX_AR_FLAGS
1915else
1916	cf_cxx_library=no
1917	cf_cv_builtin_bool=1
1918
1919	# Just because we are not configuring against C++ right now does not
1920	# mean that a user will not want to use C++.  Some distributors disable
1921	# the C++ portion of this configuration as a shortcut (or just to avoid
1922	# compiling the demo in the c++ directory).  So we need a reasonable
1923	# default for the 'bool' type.
1924	#
1925	# Caveat: since the storage of the bool type is not standardized, it
1926	# may change.
1927
1928	if test "$NCURSES_BOOL" != auto ; then
1929		cf_cv_type_of_bool=$NCURSES_BOOL
1930		cf_cv_header_stdbool_h=0
1931	else
1932		if test "$cf_cv_header_stdbool_h" = 1 ; then
1933			CF_BOOL_SIZE
1934		else
1935			AC_MSG_CHECKING(for fallback type of bool)
1936			case "$host_cpu" in
1937			(i?86)	cf_cv_type_of_bool=char	;;
1938			(*)	cf_cv_type_of_bool=int	;;
1939			esac
1940			AC_MSG_RESULT($cf_cv_type_of_bool)
1941		fi
1942	fi
1943fi
1944AC_SUBST(CXXLIBS)
1945
1946# If the C compiler did not declare bool, and we did not determine that the C++
1947# compiler does not declare bool, turn on an ifdef in curses.h that makes the
1948# ncurses library use the same type as C++ bool.  Note that this allows one to
1949# specify the type of bool in a configure-script option and postpone
1950# integration with the C++ compiler provided that the types are compatible.
1951USE_CXX_BOOL=1
1952if test "$cf_cv_cc_bool_type" = 1
1953then
1954	# oops: C has a bool.  Unlikely, but C++ could differ.
1955	USE_CXX_BOOL=0
1956elif test "$cf_cv_builtin_bool" = 0
1957then
1958	# C++ has no bool
1959	USE_CXX_BOOL=0
1960else
1961	# this is the normal case
1962	USE_CXX_BOOL='defined(__cplusplus)'
1963fi
1964AC_SUBST(USE_CXX_BOOL)
1965
1966CF_HELP_MESSAGE(Ada Binding Options:)
1967
1968dnl If the Ada95 source-tree is present, add that to the build unless it will
1969dnl not work, or was not requested.
1970if test -f "${srcdir}/Ada95/Makefile.in" ; then
1971
1972dnl libtool does not know anything about GNAT, though a change made in 1998
1973dnl provided for it "someday".  Disable the ada subtree if we are using
1974dnl libtool -TD 20070714
1975	if test "$cf_with_ada" != "no" ; then
1976		if test "$with_libtool" != "no"; then
1977			AC_MSG_WARN(libtool does not support Ada - disabling feature)
1978			cf_with_ada=no
1979		fi
1980	fi
1981
1982dnl Check for availability of GNU Ada Translator (GNAT).
1983dnl At the moment we support no other Ada compiler.
1984	if test "$cf_with_ada" != "no" ; then
1985		CF_PROG_GNAT
1986		if test	"x$cf_cv_prog_gnat_correct" = xyes; then
1987			CF_ADD_ADAFLAGS(-gnatpn)
1988			CF_FIXUP_ADAFLAGS
1989
1990			CF_GNATPREP_OPT_T
1991
1992			CF_GNAT_GENERICS
1993			CF_GNAT_SIGINT
1994			CF_GNAT_PROJECTS
1995
1996			CF_WITH_ADA_COMPILER
1997
1998			cf_ada_package=terminal_interface
1999			AC_SUBST(cf_ada_package)
2000
2001			CF_WITH_ADA_INCLUDE
2002			CF_WITH_ADA_OBJECTS
2003			CF_WITH_ADA_SHAREDLIB
2004
2005			# allow the Ada binding to be renamed
2006			CF_WITH_ADA_LIBNAME(AdaCurses)
2007		fi
2008	fi
2009else
2010	cf_with_ada=no
2011fi
2012
2013# do this "late" to avoid conflict with header-checks
2014if test "x$with_widec" = xyes ; then
2015	AC_CHECK_SIZEOF(wchar_t)
2016	# cross-compiling to mingw can run into the problem that attempting to
2017	# link with the regex library fails, causing the test to not set this to
2018	# a number.  "recent" autoconf does not address this problem either -TD
2019	if test -z "$ac_cv_sizeof_wchar_t"
2020	then
2021		CF_VERBOSE(test failed (assume 2))
2022		sed /SIZEOF_WCHAR_T/d confdefs.h >confdefs.tmp
2023		mv confdefs.tmp confdefs.h
2024		echo "#define SIZEOF_WCHAR_T 2" >>confdefs.h
2025	fi
2026fi
2027
2028### Construct the ncurses library-subsets, if any, from this set of keywords:
2029###	none, base, ext_funcs, ext_tinfo, ticlib, termlib, widechar
2030###
2031### ticlib modules may be a separate library, otherwise contained in termlib.
2032### termlib modules may be a separate library, otherwise contained in ncurses.
2033###
2034### The of "+" or " " between the tokens controls the way the script
2035### chooses to split module lists into libraries.
2036###
2037### (see CF_LIB_RULES).
2038AC_MSG_CHECKING(for library subsets)
2039LIB_SUBSETS=
2040
2041if test "x$cf_with_progs" = xyes || test "$with_ticlib" != no || test "$with_termcap" != no; then
2042	LIB_SUBSETS="${LIB_SUBSETS}ticlib"
2043	if test "$with_ticlib" != no ; then
2044		LIB_SUBSETS="${LIB_SUBSETS} "
2045	else
2046		LIB_SUBSETS="${LIB_SUBSETS}+"
2047	fi
2048fi
2049
2050LIB_SUBSETS="${LIB_SUBSETS}termlib"
2051test "x$with_ext_funcs" = xyes && LIB_SUBSETS="${LIB_SUBSETS}+ext_tinfo"
2052
2053if test "$with_termlib" != no ; then
2054	LIB_SUBSETS="${LIB_SUBSETS} "
2055else
2056	LIB_SUBSETS="${LIB_SUBSETS}+"
2057fi
2058
2059LIB_SUBSETS="${LIB_SUBSETS}base"
2060
2061# Most term-driver calls are to tinfo, but some like init_pair are to the
2062# base library (so it resides in base).
2063if test "$with_term_driver" != no ; then
2064	LIB_SUBSETS="${LIB_SUBSETS}+port_drivers"
2065	case "$cf_cv_system_name" in
2066	(*mingw32*|*mingw64*)
2067		if test "x$with_exp_win32" = xyes ; then
2068			LIB_SUBSETS="${LIB_SUBSETS}+port_tinfo+port_win32"
2069		else
2070			LIB_SUBSETS="${LIB_SUBSETS}+port_tinfo+port_win32con"
2071		fi
2072		CPPFLAGS="$CPPFLAGS -DUSE_WIN32CON_DRIVER"
2073		;;
2074	(*)
2075		LIB_SUBSETS="${LIB_SUBSETS}+port_tinfo"
2076		;;
2077	esac
2078elif test "x$with_exp_win32" = xyes ; then
2079	case "$cf_cv_system_name" in
2080	(*mingw32*|*mingw64*)
2081		LIB_SUBSETS="${LIB_SUBSETS}+port_win32"
2082		;;
2083	(*)
2084		;;
2085	esac
2086fi
2087
2088test "x$with_widec"     = xyes && LIB_SUBSETS="${LIB_SUBSETS}+widechar"
2089test "x$with_ext_funcs" = xyes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs"
2090
2091AC_MSG_RESULT($LIB_SUBSETS)
2092
2093### Construct the list of include-directories to be generated
2094CF_INCLUDE_DIRS
2095CF_ADA_INCLUDE_DIRS
2096
2097### Build up pieces for makefile rules
2098AC_MSG_CHECKING(default library suffix)
2099CF_LIB_TYPE($DFT_LWR_MODEL,DFT_ARG_SUFFIX)dnl
2100AC_SUBST(DFT_ARG_SUFFIX)dnl the string to append to "-lncurses" ("")
2101AC_MSG_RESULT($DFT_ARG_SUFFIX)
2102
2103AC_MSG_CHECKING(default library-dependency suffix)
2104CF_LIB_SUFFIX($DFT_LWR_MODEL,DFT_LIB_SUFFIX,DFT_DEP_SUFFIX)dnl
2105AC_SUBST(DFT_DEP_SUFFIX)dnl the corresponding library-suffix (".a")
2106AC_MSG_RESULT($DFT_DEP_SUFFIX)
2107
2108AC_MSG_CHECKING(default object directory)
2109CF_OBJ_SUBDIR($DFT_LWR_MODEL,DFT_OBJ_SUBDIR)dnl
2110AC_SUBST(DFT_OBJ_SUBDIR)dnl the default object-directory ("obj")
2111AC_MSG_RESULT($DFT_OBJ_SUBDIR)
2112
2113if test "x$cf_with_cxx" = xyes ; then
2114AC_MSG_CHECKING(c++ library-dependency suffix)
2115if test "$with_libtool" != "no"; then
2116	# libtool thinks it can make c++ shared libraries (perhaps only g++)
2117	CXX_LIB_SUFFIX=$DFT_DEP_SUFFIX
2118elif test "$with_shared_cxx" != "no"; then
2119	# also for g++ users...
2120	CXX_LIB_SUFFIX=$DFT_DEP_SUFFIX
2121else
2122	# we normally make a static library because C/C++ library rules differ
2123	CF_LIB_SUFFIX(normal,CXX_LIB_SUFFIX,CXX_DEP_SUFFIX)
2124fi
2125AC_MSG_RESULT($CXX_LIB_SUFFIX)
2126AC_SUBST(CXX_LIB_SUFFIX)
2127fi
2128
2129# do not want -ldl in build except as needed for -lncurses dependency
2130if test "x$with_dlsym" = xyes ; then
2131if test "$DFT_LWR_MODEL" = shared || \
2132   test "$DFT_LWR_MODEL" = libtool ; then
2133	CF_REMOVE_LIB(LIBS,$LIBS,dl)
2134fi
2135fi
2136### Set up low-level terminfo dependencies for makefiles.
2137
2138# TICS_LIST and TINFO_LIST are needed to build libtic.so and libterm.so, but
2139# do not need libdl
2140TICS_LIST=
2141if test "x$with_dlsym" = xyes ; then
2142	CF_REMOVE_LIB(TINFO_LIST,$SHLIB_LIST,dl)
2143fi
2144
2145USE_ARG_SUFFIX="${DFT_ARG_SUFFIX}${EXTRA_SUFFIX}"
2146USE_LIB_SUFFIX="${LIB_SUFFIX}${EXTRA_SUFFIX}"
2147USE_CFG_SUFFIX=${DFT_ARG_SUFFIX}${cf_cv_abi_version}
2148if test -n "$EXTRA_SUFFIX" && test "x$EXTRA_SUFFIX" != "x${cf_cv_abi_version}"
2149then
2150	USE_CFG_SUFFIX="${USE_CFG_SUFFIX}${EXTRA_SUFFIX}"
2151fi
2152AC_SUBST(USE_ARG_SUFFIX)
2153AC_SUBST(USE_CFG_SUFFIX)
2154AC_SUBST(USE_LIB_SUFFIX)
2155
2156if test "$with_ticlib" != no ; then
2157
2158	if test "x$with_ticlib" != xyes ; then
2159		TICS_NAME=$with_ticlib
2160		TICS_SUFFIX="`echo "${DFT_LIB_SUFFIX}" |sed -e "s/^${USE_LIB_SUFFIX}//"`"
2161		TICS_ARG_SUFFIX="${with_ticlib}`echo "${USE_ARG_SUFFIX}" |sed -e "s/^${LIB_SUFFIX}//"`"
2162		TICS_DEP_SUFFIX="${with_ticlib}`echo "${DFT_DEP_SUFFIX}" |sed -e "s/^${LIB_SUFFIX}//"`"
2163		TICS_LIB_SUFFIX="${with_ticlib}"
2164	else
2165		TICS_SUFFIX=${DFT_LIB_SUFFIX}
2166		TICS_ARG_SUFFIX="${TICS_NAME}${USE_ARG_SUFFIX}"
2167		TICS_DEP_SUFFIX="${TICS_NAME}${DFT_DEP_SUFFIX}"
2168		TICS_LIB_SUFFIX="${TICS_NAME}${USE_LIB_SUFFIX}"
2169	fi
2170	TICS_LDFLAGS="-L${LIB_DIR}"
2171	TICS_LIBS="-l${TICS_ARG_SUFFIX}"
2172else
2173	TICS_SUFFIX=${DFT_LIB_SUFFIX}
2174	TICS_LDFLAGS="-L${LIB_DIR}"
2175	TICS_LIBS="-l${LIB_NAME}${USE_ARG_SUFFIX}"
2176fi
2177AC_SUBST(TICS_ARG_SUFFIX)
2178AC_SUBST(TICS_DEP_SUFFIX)
2179AC_SUBST(TICS_LIB_SUFFIX)
2180AC_SUBST(TICS_LDFLAGS)
2181AC_SUBST(TICS_LIBS)
2182
2183if test "$with_termlib" != no ; then
2184
2185	if test "x$with_termlib" != xyes ; then
2186		TINFO_NAME=$with_termlib
2187		TINFO_SUFFIX="`echo "${DFT_LIB_SUFFIX}" |sed -e "s/^${USE_LIB_SUFFIX}//"`"
2188		TINFO_ARG_SUFFIX="${with_termlib}`echo "${USE_ARG_SUFFIX}" |sed -e "s/^${LIB_SUFFIX}//"`"
2189		TINFO_DEP_SUFFIX="${with_termlib}`echo "${DFT_DEP_SUFFIX}" |sed -e "s/^${LIB_SUFFIX}//"`"
2190		TINFO_LIB_SUFFIX="${with_termlib}"
2191	else
2192		TINFO_SUFFIX=${DFT_LIB_SUFFIX}
2193		TINFO_ARG_SUFFIX="${TINFO_NAME}${USE_ARG_SUFFIX}"
2194		TINFO_DEP_SUFFIX="${TINFO_NAME}${DFT_DEP_SUFFIX}"
2195		TINFO_LIB_SUFFIX="${TINFO_NAME}${USE_LIB_SUFFIX}"
2196	fi
2197
2198	TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${TINFO_DEP_SUFFIX}"
2199	TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${TINFO_DEP_SUFFIX}"
2200	if test "$DFT_LWR_MODEL" = "libtool"; then
2201		TEST_ARGS="${TEST_DEPS}"
2202		TEST_ARG2="${TEST_DEP2}"
2203		TINFO_LDFLAGS="-L${LIB_DIR}"
2204		TINFO_LIBS="$TEST_ARGS"
2205		TICS_LIST="$SHLIB_LIST $TEST_ARGS"
2206		SHLIB_LIST="${SHLIB_LIST} $TEST_ARGS"
2207	else
2208		TEST_ARGS="-l${TINFO_ARG_SUFFIX}"
2209		TEST_ARG2="-l${TINFO_ARG_SUFFIX}"
2210		if test "x$with_term_driver" != xno ; then
2211			TICS_LIST="$SHLIB_LIST -l${LIB_NAME}${USE_ARG_SUFFIX}"
2212			TICS_LIBS="$TICS_LIBS -l${LIB_NAME}${USE_ARG_SUFFIX}"
2213			TINFO_LIBS="-l${LIB_NAME}${USE_ARG_SUFFIX} $TEST_ARGS"
2214		else
2215			TICS_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}"
2216			TINFO_LIBS="$TEST_ARGS"
2217		fi
2218		TINFO_LDFLAGS="-L${LIB_DIR}"
2219		SHLIB_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}"
2220	fi
2221else
2222	# the next lines are needed for linking libtic over libncurses
2223	TINFO_NAME=${LIB_NAME}
2224	TINFO_SUFFIX=${DFT_LIB_SUFFIX}
2225	TINFO_ARG_SUFFIX=${LIB_NAME}${USE_ARG_SUFFIX}
2226	if test "x$with_tic_depends" = xyes ; then
2227		TICS_LIST="$SHLIB_LIST -l${LIB_NAME}${USE_ARG_SUFFIX}"
2228	else
2229		TICS_LIST="$SHLIB_LIST"
2230	fi
2231
2232	TINFO_LDFLAGS="-L${LIB_DIR}"
2233	TINFO_LIBS="-l${LIB_NAME}${USE_ARG_SUFFIX}"
2234fi
2235
2236if test "$DFT_LWR_MODEL" = shared ; then
2237	case "$cf_cv_system_name" in
2238	(cygwin*|msys*)
2239		# "lib" files have ".dll.a" suffix, "cyg"or "msys-" files have ".dll"
2240		TINFO_SUFFIX=.dll
2241		;;
2242	esac
2243fi
2244
2245AC_SUBST(TINFO_ARG_SUFFIX)
2246AC_SUBST(TINFO_DEP_SUFFIX)
2247AC_SUBST(TINFO_LIB_SUFFIX)
2248AC_SUBST(TINFO_LDFLAGS)
2249AC_SUBST(TINFO_LIBS)
2250
2251if test "x$with_dlsym" = xyes ; then
2252	CF_REMOVE_LIB(TICS_LIST,$TICS_LIST,dl)
2253fi
2254
2255if test "$DFT_LWR_MODEL" = "libtool"; then
2256	OBJEXT=lo
2257fi
2258
2259# needed for Ada95
2260TINFO_LDFLAGS2=`echo "$TINFO_LDFLAGS" | sed -e 's,-L\.\./,-L../../,'`
2261AC_SUBST(TINFO_LDFLAGS2)
2262
2263case "$DFT_LWR_MODEL" in
2264(normal|debug|profile)
2265	CF_LDFLAGS_STATIC
2266	;;
2267esac
2268
2269AC_MSG_CHECKING(where we will install curses.h)
2270AC_SUBST(includesubdir)
2271includesubdir=
2272if test "$with_overwrite" = no && \
2273 { test "x$includedir" = 'x${prefix}/include' || \
2274   test "x$includedir" = "x${prefix}/include"; }
2275then
2276	includesubdir="/ncurses${USE_LIB_SUFFIX}"
2277fi
2278AC_MSG_RESULT(${includedir}${includesubdir})
2279
2280### Resolve a conflict between normal and wide-curses by forcing applications
2281### that will need libutf8 to add it to their configure script.
2282if test "$with_overwrite" != no ; then
2283if test "$NCURSES_LIBUTF8" = 1 ; then
2284	NCURSES_LIBUTF8='defined(HAVE_LIBUTF8_H)'
2285	AC_MSG_WARN(Wide-character applications must define HAVE_LIBUTF8_H to include curses.h)
2286fi
2287fi
2288WITH_OVERWRITE=$with_overwrite
2289
2290### At least on MinGW a shared library build without libtool
2291### requires adding the additional libs to the link list.
2292case "$cf_cv_system_name" in
2293(*mingw32*|*mingw64*)
2294	if test "$DFT_LWR_MODEL" != "libtool"; then
2295   	   SHLIB_LIST="$SHLIB_LIST ${LIBS}"
2296	fi
2297	;;
2298*)	;;
2299esac
2300
2301AC_SUBST(WITH_OVERWRITE)
2302AC_SUBST(TICS_LIST)
2303AC_SUBST(TINFO_LIST)
2304AC_SUBST(SHLIB_LIST)
2305
2306# used to separate tack out of the tree
2307NCURSES_TREE=
2308AC_SUBST(NCURSES_TREE)
2309
2310### predefined stuff for the test programs
2311AC_DEFINE(HAVE_SLK_COLOR,1,[Define to 1 if we have slk_color for test-programs])
2312
2313# pkgsrc uses these
2314CF_WITH_LIB_BASENAME(FORM_NAME,form)
2315CF_WITH_LIB_BASENAME(MENU_NAME,menu)
2316CF_WITH_LIB_BASENAME(PANEL_NAME,panel)
2317CF_WITH_LIB_BASENAME(CXX_NAME,cxx,ncurses++)
2318
2319### Construct the list of subdirectories for which we'll customize makefiles
2320### with the appropriate compile-rules.
2321
2322CF_SRC_MODULES($modules_to_build)
2323
2324if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = "xyes"; then
2325   SUB_MAKEFILES="$SUB_MAKEFILES Ada95/src/library.gpr:Ada95/src/library.gpr.in"
2326   SUB_MAKEFILES="$SUB_MAKEFILES Ada95/gen/adacurses${USE_CFG_SUFFIX}-config:Ada95/gen/adacurses-config.in"
2327   SUB_MAKEFILES="$SUB_MAKEFILES man/adacurses${USE_CFG_SUFFIX}-config.1:man/MKada_config.in"
2328fi
2329
2330CF_DIRS_TO_MAKE
2331
2332# symbols that differ when compiling Ada95 by itself.
2333NCURSES_SHLIB2=$SHELL' $(top_srcdir)/misc/shlib'
2334AC_SUBST(NCURSES_SHLIB2)
2335
2336# values to use as strings
2337AC_DEFINE_UNQUOTED(NCURSES_PATHSEP,'$PATH_SEPARATOR',[Define to override ':' as library path-separator])
2338
2339AC_DEFINE_UNQUOTED(NCURSES_VERSION_STRING, "${NCURSES_MAJOR}.${NCURSES_MINOR}.${NCURSES_PATCH}",[Define to 1 if machine has ample memory for tic])
2340
2341### Define substitutions for header files to avoid name-pollution
2342CF_SUBST_IF(["x$cf_cv_have_tcgetattr" = xyes], HAVE_TCGETATTR, 1, 0)
2343CF_SUBST_IF(["x$ac_cv_header_stdint_h" = xyes], HAVE_STDINT_H, 1, 0)
2344CF_SUBST_IF(["x$ac_cv_header_termio_h" = xyes], HAVE_TERMIO_H, 1, 0)
2345CF_SUBST_IF(["x$ac_cv_header_termios_h" = xyes], HAVE_TERMIOS_H, 1, 0)
2346
2347################################################################################
2348test "x$use_database" = xyes && \
2349SUB_MAKEFILES="$SUB_MAKEFILES misc/run_tic.sh:misc/run_tic.in"
2350
2351SUB_MAKEFILES="$SUB_MAKEFILES misc/ncurses-config:misc/ncurses-config.in"
2352SUB_MAKEFILES="$SUB_MAKEFILES man/ncurses${USE_CFG_SUFFIX}-config.1:man/MKncu_config.in"
2353
2354if test "x$enable_pc_files" = xyes && test -z "$MAKE_PC_FILES" ; then
2355SUB_MAKEFILES="$SUB_MAKEFILES misc/gen-pkgconfig:misc/gen-pkgconfig.in"
2356fi
2357AC_SUBST(cross_compiling)
2358
2359if test "x$cf_with_tests" != xno ; then
2360	MAKE_TESTS=
2361else
2362	MAKE_TESTS="#"
2363fi
2364AC_SUBST(MAKE_TESTS)
2365
2366ADAHTML_DIR=../../doc/html/ada
2367AC_SUBST(ADAHTML_DIR)
2368
2369# workaround for OS/2 (20151017)
2370case "$cf_cv_system_name" in
2371(os2*)
2372	LIBTOOL_OPTS_CXX="-os2dllname ncurs++"
2373	;;
2374(*)
2375	LIBTOOL_OPTS_CXX=
2376	;;
2377esac
2378AC_SUBST(LIBTOOL_OPTS_CXX)
2379
2380# workaround for g++ versus Solaris (20131116)
2381case "$cf_cv_system_name" in
2382(solaris2*)
2383	case "x$CPPFLAGS" in
2384	(*-D_XOPEN_SOURCE_EXTENDED*)
2385		CF_VERBOSE(moving _XOPEN_SOURCE_EXTENDED to work around g++ problem)
2386		CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
2387		CPPFLAGS=`echo "x$CPPFLAGS" | sed -e  's/^.//' -e 's/-D_XOPEN_SOURCE_EXTENDED//'`
2388		;;
2389	esac
2390	;;
2391esac
2392
2393# Help to automatically enable the extended curses features when using either
2394# the *-config or the ".pc" files by adding defines.
2395AC_MSG_CHECKING(for defines to add to ncurses${USE_CFG_SUFFIX}-config script)
2396PKG_CFLAGS=
2397for cf_loop1 in $CPPFLAGS_after_XOPEN
2398do
2399	cf_found=no
2400	for cf_loop2 in $CPPFLAGS_before_XOPEN
2401	do
2402		if test "x$cf_loop1" = "x$cf_loop2"
2403		then
2404			cf_found=yes
2405			break
2406		fi
2407	done
2408	test "$cf_found" = no && PKG_CFLAGS="$PKG_CFLAGS $cf_loop1"
2409done
2410AC_MSG_RESULT($PKG_CFLAGS)
2411AC_SUBST(PKG_CFLAGS)
2412
2413# AC_CHECK_SIZEOF demands a literal parameter, no variables.  So we do this.
2414case "x$NCURSES_OSPEED" in
2415(*short*)
2416	cf_compatible=1
2417	;;
2418(*)
2419	cf_compatible=0
2420	;;
2421esac
2422AC_DEFINE_UNQUOTED(NCURSES_OSPEED_COMPAT,$cf_compatible,[Define to 1 if termcap variable ospeed is short])
2423
2424case "x$cf_cv_typeof_chtype" in
2425(xshort|xint|xlong)
2426	cf_cv_typeof_chtype="unsigned $cf_cv_typeof_chtype"
2427	;;
2428esac
2429
2430case "x$cf_cv_typeof_mmask_t" in
2431(xshort|xint|xlong)
2432	cf_cv_typeof_mmask_t="unsigned $cf_cv_typeof_mmask_t"
2433	;;
2434esac
2435
2436# substitute into misc/Makefile to suppress
2437# (un)install.data from the
2438# (un)install rules.
2439if test "x$cf_with_db_install" = "xno"; then
2440	MISC_INSTALL_DATA=
2441	MISC_UNINSTALL_DATA=
2442else
2443	MISC_INSTALL_DATA=install.data
2444	MISC_UNINSTALL_DATA=uninstall.data
2445fi
2446AC_SUBST(MISC_INSTALL_DATA)
2447AC_SUBST(MISC_UNINSTALL_DATA)
2448
2449if test "x$cf_with_db_install" = "xno" || test "x$TERMINFO_SRC" = "xno"; then
2450	MAKE_DATABASE="#"
2451else
2452	MAKE_DATABASE="$MAKE_TERMINFO"
2453fi
2454AC_SUBST(MAKE_DATABASE)
2455
2456dnl Override the package used for exported symbols
2457if test -n "$PACKAGE"
2458then
2459	PACKAGE="${PACKAGE}${DFT_ARG_SUFFIX}"
2460	export PACKAGE
2461	echo "package: $PACKAGE"
2462fi
2463
2464UNALTERED_SYMS=
2465cf_filter_syms=no
2466
2467if test -n "$RESULTING_SYMS"
2468then
2469	cf_filter_syms=$cf_dft_filter_syms
2470	CF_VERBOSE(will map symbols to ABI=$cf_cv_abi_version)
2471fi
2472
2473if test "x$WILDCARD_SYMS" = xno
2474then
2475	cf_filter_syms=yes
2476fi
2477
2478test "x$cf_with_trace" = xyes && NCURSES_INLINE=
2479
2480UNALTERED_SYMS=`echo "$RESULTING_SYMS" | sed -e 's/\\$/\\\\$/g'`
2481if test "$cf_filter_syms" = yes
2482then
2483	RESULTING_SYMS=resulting.map
2484fi
2485AC_SUBST(UNALTERED_SYMS)
2486
2487if test "x$cross_compiling" = xyes ; then
2488	ADAGEN_LDFLAGS='$(CROSS_LDFLAGS)'
2489	CHECK_BUILD="#"
2490else
2491	ADAGEN_LDFLAGS='$(NATIVE_LDFLAGS)'
2492	CHECK_BUILD=
2493fi
2494AC_SUBST(ADAGEN_LDFLAGS)
2495AC_SUBST(CHECK_BUILD)
2496AC_SUBST(PRIVATE_LIBS)
2497
2498# This is used for the *-config script and *.pc data files.
2499CF_LD_SEARCHPATH
2500
2501AC_DEFINE(HAVE_CURSES_DATA_BOOLNAMES,1,[definition needed for in-tree build of tack])
2502
2503AC_OUTPUT( \
2504	include/MKterm.h.awk \
2505	include/curses.head:include/curses.h.in \
2506	include/ncurses_dll.h \
2507	include/termcap.h \
2508	include/unctrl.h \
2509	$SUB_MAKEFILES \
2510	Makefile,[
2511if test "x$cf_with_tests" != xno ; then
2512	CF_PRG_RULES(["$srcdir/test/mk-test.awk" INSTALL=no ECHO_LINK="$ECHO_LD"], test)
2513fi
2514CF_LIB_RULES($SRC_SUBDIRS)
2515
2516if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = "xyes"; then
2517if test -z "$USE_OLD_MAKERULES" ; then
2518	$AWK -f "$srcdir/Ada95/mk-1st.awk" <"$srcdir/Ada95/src/modules" >>Ada95/src/Makefile
2519fi
2520fi
2521],[
2522### Special initialization commands, used to pass information from the
2523### configuration-run into config.status
2524
2525ALTERNATE_SYMS="$ALTERNATE_SYMS"
2526AWK="$AWK"
2527CXX_NAME="$CXX_NAME"
2528DFT_ARG_SUFFIX="$DFT_ARG_SUFFIX"
2529DFT_LWR_MODEL="$DFT_LWR_MODEL"
2530ECHO_LD="$ECHO_LD"
2531EXTRA_SUFFIX="$EXTRA_SUFFIX"
2532FORM_NAME="$FORM_NAME"
2533LDCONFIG="$LDCONFIG"
2534LIBTOOL_VERSION="$LIBTOOL_VERSION"
2535LIB_NAME="$LIB_NAME"
2536LIB_PREFIX="$LIB_PREFIX"
2537LIB_SUBSETS="$LIB_SUBSETS"
2538LIB_SUFFIX="$LIB_SUFFIX"
2539LIB_TRACING="$LIB_TRACING"
2540LN_S="$LN_S"
2541MAKE_TERMINFO="$MAKE_TERMINFO"
2542MENU_NAME="$MENU_NAME"
2543NCURSES_MAJOR="$NCURSES_MAJOR"
2544NCURSES_MINOR="$NCURSES_MINOR"
2545NCURSES_OSPEED="$NCURSES_OSPEED"
2546NCURSES_PATCH="$NCURSES_PATCH"
2547PANEL_NAME="$PANEL_NAME"
2548SRC_SUBDIRS="$SRC_SUBDIRS"
2549TERMINFO="$TERMINFO"
2550TICS_ARG_SUFFIX="$TICS_ARG_SUFFIX"
2551TICS_LIB_SUFFIX="$TICS_LIB_SUFFIX"
2552TICS_NAME="$TICS_NAME"
2553TICS_SUFFIX="$TICS_SUFFIX"
2554TIC_PATH="$TIC_PATH"
2555TINFO_ARG_SUFFIX="$TINFO_ARG_SUFFIX"
2556TINFO_LIB_SUFFIX="$TINFO_LIB_SUFFIX"
2557TINFO_NAME="$TINFO_NAME"
2558TINFO_SUFFIX="$TINFO_SUFFIX"
2559UNALTERED_SYMS="$UNALTERED_SYMS"
2560USE_ARG_SUFFIX="$USE_ARG_SUFFIX"
2561USE_CFG_SUFFIX="$USE_CFG_SUFFIX"
2562USE_LIB_SUFFIX="$USE_LIB_SUFFIX"
2563USE_OLD_MAKERULES="$USE_OLD_MAKERULES"
2564WILDCARD_SYMS="$WILDCARD_SYMS"
2565WITH_CURSES_H="$with_curses_h"
2566WITH_ECHO="${enable_echo:=yes}"
2567WITH_OVERWRITE="$with_overwrite"
2568cf_LIST_MODELS="$cf_list_models"
2569cf_cv_VERSION_GNATMAKE=$cf_cv_VERSION_GNATMAKE
2570cf_cv_VERSION_GPRBUILD=$cf_cv_VERSION_GPRBUILD
2571cf_cv_abi_version="$cf_cv_abi_version"
2572cf_cv_do_relink="$cf_cv_do_relink"
2573cf_cv_do_reranlib="$cf_cv_do_reranlib"
2574cf_cv_do_symlinks="$cf_cv_do_symlinks"
2575cf_cv_enable_lp64="$cf_cv_enable_lp64"
2576cf_cv_enable_opaque="$cf_cv_enable_opaque"
2577cf_cv_make_PHONY="$cf_cv_make_PHONY"
2578cf_cv_prog_CC_c_o=$cf_cv_prog_CC_c_o
2579cf_cv_prog_CXX_c_o=$cf_cv_prog_CXX_c_o
2580cf_cv_prog_gnat_correct=$cf_cv_prog_gnat_correct
2581cf_cv_rel_version="$cf_cv_rel_version"
2582cf_cv_rm_so_locs="$cf_cv_rm_so_locs"
2583cf_cv_shared_soname='$cf_cv_shared_soname'
2584cf_cv_shlib_version="$cf_cv_shlib_version"
2585cf_cv_shlib_version_infix="$cf_cv_shlib_version_infix"
2586cf_cv_system_name="$cf_cv_system_name"
2587cf_cv_term_driver="$with_term_driver"
2588cf_with_ada="$cf_with_ada"
2589cf_with_cxx_binding="$cf_with_cxx_binding"
2590cf_with_db_install="$cf_with_db_install"
2591cf_with_manpages="$cf_with_manpages"
2592cf_with_tests="$cf_with_tests"
2593host="$host"
2594target="$target"
2595with_shared_cxx="$with_shared_cxx"
2596
2597],cat)dnl
2598${MAKE:-make} preinstall
2599