1dnl***************************************************************************
2dnl Copyright (c) 1998-2004,2005 Free Software Foundation, Inc.              *
3dnl                                                                          *
4dnl Permission is hereby granted, free of charge, to any person obtaining a  *
5dnl copy of this software and associated documentation files (the            *
6dnl "Software"), to deal in the Software without restriction, including      *
7dnl without limitation the rights to use, copy, modify, merge, publish,      *
8dnl distribute, distribute with modifications, sublicense, and/or sell       *
9dnl copies of the Software, and to permit persons to whom the Software is    *
10dnl furnished to do so, subject to the following conditions:                 *
11dnl                                                                          *
12dnl The above copyright notice and this permission notice shall be included  *
13dnl in all copies or substantial portions of the Software.                   *
14dnl                                                                          *
15dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22dnl                                                                          *
23dnl Except as contained in this notice, the name(s) of the above copyright   *
24dnl holders shall not be used in advertising or otherwise to promote the     *
25dnl sale, use or other dealings in this Software without prior written       *
26dnl authorization.                                                           *
27dnl***************************************************************************
28dnl
29dnl Author: Thomas E. Dickey 1995-on
30dnl
31dnl $Id: configure.in,v 1.351 2005/09/17 22:41:48 tom Exp $
32dnl Process this file with autoconf to produce a configure script.
33dnl
34dnl See http://invisible-island.net/autoconf/ for additional information.
35dnl
36dnl ---------------------------------------------------------------------------
37AC_PREREQ(2.13.20020210)
38AC_REVISION($Revision: 1.351 $)
39AC_INIT(ncurses/base/lib_initscr.c)
40AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin)
41
42CF_SUBST_NCURSES_VERSION
43
44CF_WITH_REL_VERSION(NCURSES)
45CF_WITH_ABI_VERSION
46
47CF_CHECK_CACHE([AC_CANONICAL_SYSTEM])
48AC_ARG_WITH(system-type,
49[  --with-system-type=XXX  test: override derived host system-type],
50[AC_MSG_WARN(overriding system type to $withval)
51 cf_cv_system_name=$withval])
52
53###	Save the given $CFLAGS to allow user-override.
54cf_user_CFLAGS="$CFLAGS"
55
56###	Default install-location
57CF_CFG_DEFAULTS
58
59###	Checks for programs.
60AC_PROG_CC
61CF_GCC_VERSION
62
63AC_PROG_CPP
64AC_PROG_GCC_TRADITIONAL
65CF_PROG_CC_C_O(CC)
66AC_ISC_POSIX
67CF_ANSI_CC_REQD
68CF_PROG_EXT
69CF_PROG_LDCONFIG
70
71dnl DEFECT in autoconf 2.12:	an attempt to set policy, this breaks the
72dnl				configure script by not letting us test if C++
73dnl				is present, making this option necessary.
74AC_MSG_CHECKING(if you want to ensure bool is consistent with C++)
75AC_ARG_WITH(cxx,
76	[  --without-cxx           do not adjust ncurses bool to match C++],
77	[cf_with_cxx=$withval],
78	[cf_with_cxx=yes])
79AC_MSG_RESULT($cf_with_cxx)
80if test "X$cf_with_cxx" = Xno ; then
81	CXX=""
82	GXX=""
83else
84	# with autoconf 2.13, we can change the error to a warning:
85	pushdef([AC_MSG_ERROR],
86		[AC_MSG_RESULT(no)
87		 AC_MSG_WARN([You don't have any C++ compiler, too bad])
88		cf_with_cxx=no; CXX=""; GXX="";])dnl
89	AC_PROG_CXX
90	popdef([AC_MSG_ERROR])dnl
91	# autoconf 2.5x removed the error - by hardcoding it to g++.
92	if test "$CXX" = "g++" ; then
93		AC_PATH_PROG(CXX,g++)
94	fi
95	if test "$CXX" = "g++" ; then
96		AC_MSG_WARN(ignoring hardcoded g++)
97		cf_with_cxx=no; CXX=""; GXX="";
98	fi
99fi
100
101CF_GXX_VERSION
102case $GXX_VERSION in
1031*|2.[[0-6]]*)
104	GXX=""; CXX=""; ac_cv_prog_gxx=no
105	cf_cxx_library=no
106	AC_MSG_WARN(templates do not work)
107	;;
108esac
109
110AC_MSG_CHECKING(if you want to build C++ binding and demo)
111AC_ARG_WITH(cxx-binding,
112	[  --without-cxx-binding   do not build C++ binding and demo],
113	[cf_with_cxx_binding=$withval],
114	[cf_with_cxx_binding=$cf_with_cxx])
115AC_MSG_RESULT($cf_with_cxx_binding)
116
117AC_MSG_CHECKING(if you want to build with Ada95)
118AC_ARG_WITH(ada,
119	[  --without-ada           suppress check for Ada95, don't build demo],
120	[cf_with_ada=$withval],
121	[cf_with_ada=yes])
122AC_MSG_RESULT($cf_with_ada)
123
124AC_MSG_CHECKING(if you want to build programs such as tic)
125AC_ARG_WITH(progs,
126	[  --without-progs         suppress build with programs (e.g., tic)],
127	[cf_with_progs=$withval],
128	[cf_with_progs=yes])
129AC_MSG_RESULT($cf_with_progs)
130
131AC_MSG_CHECKING(if you wish to install curses.h)
132AC_ARG_WITH(curses-h,
133	[  --without-curses-h      install curses.h as ncurses.h only],
134	[with_curses_h=$withval],
135	[with_curses_h=yes])
136AC_MSG_RESULT($with_curses_h)
137
138modules_to_build="ncurses"
139if test "X$cf_with_progs" != Xno ; then
140modules_to_build="$modules_to_build progs tack"
141fi
142modules_to_build="$modules_to_build panel menu form"
143
144AC_ARG_PROGRAM
145AC_PROG_AWK
146AC_PROG_MAKE_SET
147CF_PROG_INSTALL
148AC_SYS_LONG_FILE_NAMES
149CF_MIXEDCASE_FILENAMES
150AC_PROG_LN_S
151CF_MAKE_TAGS
152AC_CHECK_PROGS(LINT, tdlint lint alint)
153AC_CHECK_PROGS(MAN, man man_db)
154AC_SUBST(LINT_OPTS)
155
156dnl These are standard among *NIX systems, but not when cross-compiling
157AC_CHECK_TOOL(RANLIB, ranlib, ':')
158AC_CHECK_TOOL(LD, ld, ld)
159AC_CHECK_TOOL(AR, ar, ar)
160CF_SUBST(archiver options,AR_OPTS,rv)
161
162CF_MAKEFLAGS
163
164dnl Special option for use by system-builders: the install-prefix is used to
165dnl adjust the location into which the actual install is done, so that an
166dnl archive can be built without modifying the host system's configuration.
167AC_MSG_CHECKING(if you have specified an install-prefix)
168AC_ARG_WITH(install-prefix,
169	[  --with-install-prefix   prefixes actual install-location ($DESTDIR)],
170	[case "$withval" in #(vi
171	yes|no) #(vi
172		;;
173	*)	DESTDIR="$withval"
174		;;
175	esac])
176AC_MSG_RESULT($DESTDIR)
177AC_SUBST(DESTDIR)
178
179###############################################################################
180CF_HELP_MESSAGE(Build-Tools Needed to Compile Temporary Applications for Cross-compiling:)
181# If we're cross-compiling, allow the user to override the tools and their
182# options.  The configure script is oriented toward identifying the host
183# compiler, etc., but we need a build compiler to generate parts of the source.
184CF_BUILD_CC
185
186###############################################################################
187CF_HELP_MESSAGE(Options to Specify the Libraries Built/Used:)
188
189### Options to allow the user to specify the set of libraries which are used.
190### Use "--without-normal --with-shared" to allow the default model to be
191### shared, for example.
192cf_list_models=""
193AC_SUBST(cf_list_models)dnl	the complete list of models ("normal debug")
194
195CF_WITH_LIBTOOL
196if test "$with_libtool" != "no" ; then
197
198cf_list_models="$cf_list_models libtool"
199
200else
201
202AC_MSG_CHECKING(if you want to build shared libraries)
203AC_ARG_WITH(shared,
204	[  --with-shared           generate shared-libraries],
205	[with_shared=$withval],
206	[with_shared=no])
207AC_MSG_RESULT($with_shared)
208test "$with_shared" = "yes" && cf_list_models="$cf_list_models shared"
209
210AC_MSG_CHECKING(if you want to build static libraries)
211AC_ARG_WITH(normal,
212	[  --with-normal           generate normal-libraries (default)],
213	[with_normal=$withval],
214	[with_normal=yes])
215AC_MSG_RESULT($with_normal)
216test "$with_normal" = "yes" && cf_list_models="$cf_list_models normal"
217
218AC_MSG_CHECKING(if you want to build debug libraries)
219AC_ARG_WITH(debug,
220	[  --with-debug            generate debug-libraries (default)],
221	[with_debug=$withval],
222	[with_debug=yes])
223AC_MSG_RESULT($with_debug)
224test "$with_debug" = "yes" && cf_list_models="$cf_list_models debug"
225
226AC_MSG_CHECKING(if you want to build profiling libraries)
227AC_ARG_WITH(profile,
228	[  --with-profile          generate profile-libraries],
229	[with_profile=$withval],
230	[with_profile=no])
231AC_MSG_RESULT($with_profile)
232test "$with_profile" = "yes" && cf_list_models="$cf_list_models profile"
233
234fi
235
236###############################################################################
237
238AC_MSG_CHECKING(for specified models)
239test -z "$cf_list_models" && cf_list_models=normal
240dnl If we use libtool to generate libraries, then it must be the only
241dnl specified model.
242test "$with_libtool" != "no" && cf_list_models=libtool
243AC_MSG_RESULT($cf_list_models)
244
245### Use the first model as the default, and save its suffix for use in building
246### up test-applications.
247AC_MSG_CHECKING(for default model)
248DFT_LWR_MODEL=`echo "$cf_list_models" | $AWK '{print $1}'`
249AC_MSG_RESULT($DFT_LWR_MODEL)
250
251CF_UPPER(DFT_UPR_MODEL,$DFT_LWR_MODEL)dnl
252
253AC_SUBST(DFT_LWR_MODEL)dnl	the default model ("normal")
254AC_SUBST(DFT_UPR_MODEL)dnl	the default model ("NORMAL")
255
256TINFO_NAME=tinfo
257AC_SUBST(TINFO_NAME)
258
259LIB_NAME=ncurses
260AC_SUBST(LIB_NAME)
261
262LIB_DIR=../lib
263LIB_2ND=../../lib
264
265CF_LIB_PREFIX(cf_prefix)
266LIB_PREFIX=$cf_prefix
267AC_SUBST(LIB_PREFIX)
268
269LIB_SUFFIX=
270AC_SUBST(LIB_SUFFIX)
271
272###############################################################################
273
274AC_MSG_CHECKING(if you want to build a separate terminfo library)
275AC_ARG_WITH(termlib,
276	[  --with-termlib          generate separate terminfo library],
277	[with_termlib=$withval],
278	[with_termlib=no])
279AC_MSG_RESULT($with_termlib)
280
281### Checks for special libraries, must be done up-front.
282CF_WITH_DBMALLOC
283CF_WITH_DMALLOC
284
285SHLIB_LIST=""
286CF_WITH_GPM
287if test "$with_gpm" = yes ; then
288	CF_FUNC_DLSYM
289	CF_LIB_SONAME([#include <gpm.h>],[if (Gpm_Open(0,0)) Gpm_Close();],gpm)
290	test "$cf_cv_gpm_soname" != "unknown" && AC_DEFINE_UNQUOTED(LIBGPM_SONAME,"$cf_cv_gpm_soname")
291	SHLIB_LIST="-ldl $SHLIB_LIST"
292	AC_DEFINE(HAVE_LIBGPM)
293	AC_CHECK_LIB(gpm,Gpm_Wgetch,[
294		AC_MSG_WARN(GPM library is already linked with curses - read the FAQ)
295	])
296fi
297
298CF_WITH_SYSMOUSE
299
300dnl Not all ports of gcc support the -g option
301
302if test X"$CC_G_OPT" = X"" ; then
303	CC_G_OPT='-g'
304	test -n "$GCC" && test "${ac_cv_prog_cc_g}" != yes && CC_G_OPT=''
305fi
306AC_SUBST(CC_G_OPT)
307
308if test X"$CXX_G_OPT" = X"" ; then
309	CXX_G_OPT='-g'
310	test -n "$GXX" && test "${ac_cv_prog_cxx_g}" != yes && CXX_G_OPT=''
311fi
312AC_SUBST(CXX_G_OPT)
313
314AC_MSG_CHECKING(for default loader flags)
315case $DFT_LWR_MODEL in
316libtool) LD_MODEL=''   ;;
317normal)  LD_MODEL=''   ;;
318debug)   LD_MODEL=$CC_G_OPT ;;
319profile) LD_MODEL='-pg';;
320shared)  LD_MODEL=''   ;;
321esac
322AC_SUBST(LD_MODEL)dnl		the type of link (e.g., -g or -pg)
323AC_MSG_RESULT($LD_MODEL)
324
325AC_MSG_CHECKING(if rpath option should be used)
326AC_ARG_ENABLE(rpath,
327[  --enable-rpath          use rpath option when generating shared libraries],
328[cf_cv_ld_rpath=$enableval],
329[cf_cv_ld_rpath=no])
330AC_MSG_RESULT($cf_cv_ld_rpath)
331
332CF_SHARED_OPTS
333if test "$CC_SHARED_OPTS" = "unknown"; then
334	for model in $cf_list_models; do
335		if test "$model" = "shared"; then
336			AC_ERROR(Shared libraries are not supported in this version)
337		fi
338	done
339fi
340
341###############################################################################
342CF_HELP_MESSAGE(Fine-Tuning Your Configuration:)
343
344###	use option --disable-overwrite to leave out the link to -lcurses
345AC_MSG_CHECKING(if you wish to install ncurses overwriting curses)
346AC_ARG_ENABLE(overwrite,
347	[  --disable-overwrite     leave out the link to -lcurses],
348	[with_overwrite=$enableval],
349	[if test "$prefix" = "/usr" ; then with_overwrite=yes; else with_overwrite=no; fi])
350AC_MSG_RESULT($with_overwrite)
351
352AC_MSG_CHECKING(if external terminfo-database is used)
353AC_ARG_ENABLE(database,
354	[  --disable-database      do not use terminfo, only fallbacks/termcap],
355	[use_database=$enableval],
356	[use_database=yes])
357AC_MSG_RESULT($use_database)
358
359case $host_os in #(vi
360os2*) #(vi
361	TERMINFO_SRC='${top_srcdir}/misc/emx.src'
362	;;
363*) #(vi
364	TERMINFO_SRC='${top_srcdir}/misc/terminfo.src'
365	;;
366esac
367AC_SUBST(TERMINFO_SRC)
368
369CF_PATHSEP
370if test "$use_database" != no ; then
371	AC_DEFINE(USE_DATABASE)
372	AC_MSG_CHECKING(which terminfo source-file will be installed)
373	AC_ARG_ENABLE(database,
374		[  --with-database=XXX     specify terminfo source to install],
375		[TERMINFO_SRC=$withval])
376	AC_MSG_RESULT($TERMINFO_SRC)
377fi
378
379AC_MSG_CHECKING(for list of fallback descriptions)
380AC_ARG_WITH(fallbacks,
381	[  --with-fallbacks=XXX    specify list of fallback terminal descriptions],
382	[with_fallback=$withval],
383	[with_fallback=])
384AC_MSG_RESULT($with_fallback)
385FALLBACK_LIST=`echo "$with_fallback" | sed -e 's/,/ /g'`
386AC_SUBST(FALLBACK_LIST)
387
388AC_MSG_CHECKING(if you want modern xterm or antique)
389AC_ARG_WITH(xterm-new,
390	[  --without-xterm-new     specify if xterm terminfo should be old version],
391	[with_xterm_new=$withval],
392	[with_xterm_new=yes])
393case $with_xterm_new in
394no)	with_xterm_new=xterm-old;;
395*)	with_xterm_new=xterm-new;;
396esac
397AC_MSG_RESULT($with_xterm_new)
398WHICH_XTERM=$with_xterm_new
399AC_SUBST(WHICH_XTERM)
400
401MAKE_TERMINFO=
402if test "$use_database" = no ; then
403	TERMINFO="${datadir}/terminfo"
404	MAKE_TERMINFO="#"
405else
406
407AC_MSG_CHECKING(for list of terminfo directories)
408CF_WITH_PATHLIST(terminfo-dirs,
409	[  --with-terminfo-dirs=XXX specify list of terminfo directories],
410	TERMINFO_DIRS,
411	DATADIR/terminfo,
412	${datadir}/terminfo)
413AC_MSG_RESULT($TERMINFO_DIRS)
414test -n "$TERMINFO_DIRS" && AC_DEFINE_UNQUOTED(TERMINFO_DIRS,"$TERMINFO_DIRS")
415
416AC_MSG_CHECKING(for default terminfo directory)
417CF_WITH_PATH(default-terminfo-dir,
418	[  --with-default-terminfo-dir=DIR default terminfo directory],
419	TERMINFO,
420	DATADIR/terminfo,
421	${datadir}/terminfo)
422AC_MSG_RESULT($TERMINFO)
423AC_DEFINE_UNQUOTED(TERMINFO,"$TERMINFO")
424
425fi
426
427AC_SUBST(TERMINFO)
428AC_SUBST(MAKE_TERMINFO)
429
430###	use option --disable-big-core to make tic run on small machines
431###	We need 4Mb, check if we can allocate 50% more than that.
432AC_MSG_CHECKING(if big-core option selected)
433AC_ARG_ENABLE(big-core,
434	[  --disable-big-core      assume machine has little memory],
435	[with_big_core=$enableval],
436	[AC_TRY_RUN([
437#include <stdlib.h>
438#include <string.h>
439int main() {
440	unsigned long n = 6000000L;
441	char *s = malloc(n);
442	if (s != 0)
443		s[0] = s[n-1] = 0;
444	exit(s == 0);
445}],
446	[with_big_core=yes],
447	[with_big_core=no],
448	[with_big_core=no])])
449AC_MSG_RESULT($with_big_core)
450test "$with_big_core" = "yes" && AC_DEFINE(HAVE_BIG_CORE)
451
452###	use option --enable-termcap to compile in the termcap fallback support
453AC_MSG_CHECKING(if you want termcap-fallback support)
454AC_ARG_ENABLE(termcap,
455	[  --enable-termcap        compile in termcap fallback support],
456	[with_termcap=$enableval],
457	[with_termcap=no])
458AC_MSG_RESULT($with_termcap)
459
460if test "$with_termcap" != "yes" ; then
461	if test "$use_database" = no ; then
462		if test -z "$with_fallback" ; then
463			AC_ERROR(You have disabled the database w/o specifying fallbacks)
464		fi
465	fi
466	AC_DEFINE(PURE_TERMINFO)
467else
468
469AC_DEFINE(USE_TERMCAP)
470AC_MSG_CHECKING(for list of termcap files)
471CF_WITH_PATHLIST(termpath,
472	[  --with-termpath=XXX     specify list of termcap files],
473	TERMPATH,
474	/etc/termcap:/usr/share/misc/termcap)
475AC_MSG_RESULT($TERMPATH)
476test -n "$TERMPATH" && AC_DEFINE_UNQUOTED(TERMPATH,"$TERMPATH")
477
478###	use option --enable-getcap to use a hacked getcap for reading termcaps
479AC_MSG_CHECKING(if fast termcap-loader is needed)
480AC_ARG_ENABLE(getcap,
481	[  --enable-getcap         fast termcap load, no xrefs to terminfo],
482	[with_getcap=$enableval],
483	[with_getcap=no])
484AC_MSG_RESULT($with_getcap)
485test "$with_getcap" = "yes" && AC_DEFINE(USE_GETCAP)
486
487AC_MSG_CHECKING(if translated termcaps will be cached in ~/.terminfo)
488AC_ARG_ENABLE(getcap-cache,
489	[  --enable-getcap-cache   cache translated termcaps in ~/.terminfo],
490	[with_getcap_cache=$enableval],
491	[with_getcap_cache=no])
492AC_MSG_RESULT($with_getcap_cache)
493test "$with_getcap_cache" = "yes" && AC_DEFINE(USE_GETCAP_CACHE)
494
495fi
496
497###   Use option --disable-home-terminfo to completely remove ~/.terminfo
498AC_MSG_CHECKING(if ~/.terminfo is wanted)
499AC_ARG_ENABLE(home-terminfo,
500	[  --disable-home-terminfo drop ~/.terminfo from terminfo search-path],
501	[with_home_terminfo=$enableval],
502	[with_home_terminfo=yes])
503AC_MSG_RESULT($with_home_terminfo)
504test "$with_home_terminfo" = "yes" && AC_DEFINE(USE_HOME_TERMINFO)
505
506AC_MSG_CHECKING(if you want to use restrict environment when running as root)
507AC_ARG_ENABLE(root-environ,
508	[  --disable-root-environ  limit environment when running as root],
509	[with_root_environ=$enableval],
510	[with_root_environ=yes])
511AC_MSG_RESULT($with_root_environ)
512test "$with_root_environ" = yes && AC_DEFINE(USE_ROOT_ENVIRON)
513
514###   Use option --enable-symlinks to make tic use symlinks, not hard links
515###   to reduce storage requirements for the terminfo database.
516CF_LINK_FUNCS
517
518with_links=no
519with_symlinks=no
520
521if test "$ac_cv_func_link" != yes ; then
522    AC_MSG_CHECKING(if tic should use symbolic links)
523    if test "$ac_cv_func_symlink" = yes ; then
524    	with_symlinks=yes
525    else
526    	with_symlinks=no
527    fi
528    AC_MSG_RESULT($with_symlinks)
529elif test "$ac_cv_func_symlink" != yes ; then
530    AC_MSG_CHECKING(if tic should use hard links)
531    if test "$ac_cv_func_link" = yes ; then
532    	with_links=yes
533    else
534    	with_links=no
535    fi
536    AC_MSG_RESULT($with_links)
537else
538    AC_MSG_CHECKING(if tic should use symbolic links)
539    AC_ARG_ENABLE(symlinks,
540	[  --enable-symlinks       make tic use symbolic links not hard links],
541	[with_symlinks=$enableval],
542	[with_symlinks=no])
543    AC_MSG_RESULT($with_symlinks)
544fi
545
546test "$with_links" = yes && AC_DEFINE(USE_LINKS)
547test "$with_symlinks" = yes && AC_DEFINE(USE_SYMLINKS)
548
549###   use option --enable-broken-linker to force on use of broken-linker support
550AC_MSG_CHECKING(if you want broken-linker support code)
551AC_ARG_ENABLE(broken_linker,
552	[  --enable-broken_linker  compile with broken-linker support code],
553	[with_broken_linker=$enableval],
554	[with_broken_linker=${BROKEN_LINKER-no}])
555AC_MSG_RESULT($with_broken_linker)
556
557BROKEN_LINKER=0
558if test "$with_broken_linker" = yes ; then
559	AC_DEFINE(BROKEN_LINKER)
560	BROKEN_LINKER=1
561elif test "$DFT_LWR_MODEL" = shared ; then
562	case $cf_cv_system_name in #(vi
563	cygwin*)
564		AC_DEFINE(BROKEN_LINKER)
565		BROKEN_LINKER=1
566		CF_VERBOSE(cygwin linker is broken anyway)
567		;;
568	esac
569fi
570AC_SUBST(BROKEN_LINKER)
571
572###   use option --enable-widec to turn on use of wide-character support
573NCURSES_CH_T=chtype
574NCURSES_LIBUTF8=0
575
576NEED_WCHAR_H=0
577NCURSES_MBSTATE_T=0
578NCURSES_WCHAR_T=0
579NCURSES_WINT_T=0
580
581# Check to define _XOPEN_SOURCE "automatically"
582CF_XOPEN_SOURCE
583
584# Checks for CODESET support.
585AM_LANGINFO_CODESET
586
587# use these variables to work around a defect in gcc's fixincludes.
588NCURSES_OK_WCHAR_T=
589NCURSES_OK_WINT_T=
590
591AC_MSG_CHECKING(if you want wide-character code)
592AC_ARG_ENABLE(widec,
593	[  --enable-widec          compile with wide-char/UTF-8 code],
594	[with_widec=$enableval],
595	[with_widec=no])
596AC_MSG_RESULT($with_widec)
597if test "$with_widec" = yes ; then
598	LIB_SUFFIX="w${LIB_SUFFIX}"
599	AC_DEFINE(USE_WIDEC_SUPPORT)
600	CF_PREDEFINE(_XOPEN_SOURCE_EXTENDED)
601	# with_overwrite=no
602	NCURSES_CH_T=cchar_t
603	AC_CHECK_FUNCS(putwc btowc wctob mbtowc wctomb mblen mbrlen mbrtowc)
604	if test "$ac_cv_func_putwc" != yes ; then
605		CF_LIBUTF8
606		if test "$cf_cv_libutf8" = yes ; then
607			NCURSES_LIBUTF8=1
608		fi
609	fi
610	CF_WCHAR_TYPE(mbstate_t, NCURSES_MBSTATE_T)
611	CF_WCHAR_TYPE(wchar_t,   NCURSES_WCHAR_T,   NCURSES_OK_WCHAR_T)
612	CF_WCHAR_TYPE(wint_t,    NCURSES_WINT_T,    NCURSES_OK_WINT_T)
613
614	if test "$NCURSES_MBSTATE_T" != 0; then
615		AC_DEFINE(NEED_MBSTATE_T_DEF)
616	fi
617fi
618AC_SUBST(NCURSES_CH_T)
619AC_SUBST(NCURSES_LIBUTF8)
620
621AC_SUBST(NEED_WCHAR_H)
622AC_SUBST(NCURSES_MBSTATE_T)
623AC_SUBST(NCURSES_WCHAR_T)
624AC_SUBST(NCURSES_WINT_T)
625
626AC_SUBST(NCURSES_OK_WCHAR_T)
627AC_SUBST(NCURSES_OK_WINT_T)
628
629###   use option --disable-lp64 to allow long chtype
630case $cf_cv_abi_version in
631[[345]]*)
632	default_with_lp64=no
633	;;
634*)
635	default_with_lp64=yes
636	;;
637esac
638
639AC_MSG_CHECKING(whether to enable _LP64 definition in curses.h)
640AC_ARG_ENABLE(lp64,
641	[  --disable-lp64          allow chtype to be long (ignore _LP64)],
642	[with_lp64=$enableval],
643	[with_lp64=$default_with_lp64])
644AC_MSG_RESULT($with_lp64)
645
646if test "$with_lp64" = yes ; then
647	cf_cv_enable_lp64=1
648else
649	cf_cv_enable_lp64=0
650fi
651AC_SUBST(cf_cv_enable_lp64)
652
653CF_LARGEFILE
654
655###   use option --with-bool to override bool's type
656AC_MSG_CHECKING(for type of bool)
657AC_ARG_WITH(bool,
658	[  --with-bool=TYPE        override fallback type of bool variable],
659	[NCURSES_BOOL="$withval"],
660	[NCURSES_BOOL=auto])
661AC_MSG_RESULT($NCURSES_BOOL)
662AC_SUBST(NCURSES_BOOL)
663
664AC_MSG_CHECKING(for alternate terminal capabilities file)
665AC_ARG_WITH(caps,
666	[  --with-caps=alt         compile with alternate Caps file],
667	[TERMINFO_CAPS=Caps.$withval],
668	[TERMINFO_CAPS=Caps])
669test -f ${srcdir}/include/${TERMINFO_CAPS} || TERMINFO_CAPS=Caps
670AC_MSG_RESULT($TERMINFO_CAPS)
671AC_SUBST(TERMINFO_CAPS)
672
673###   use option --with-chtype to override chtype's type
674AC_MSG_CHECKING(for type of chtype)
675AC_ARG_WITH(chtype,
676	[  --with-chtype=TYPE      override type of chtype],
677	[NCURSES_CHTYPE="$withval"],
678	[NCURSES_CHTYPE=auto])
679AC_MSG_RESULT($NCURSES_CHTYPE)
680
681###   use option --with-ospeed to override ospeed's type
682AC_MSG_CHECKING(for type of ospeed)
683AC_ARG_WITH(ospeed,
684	[  --with-ospeed=TYPE      override type of ospeed variable],
685	[NCURSES_OSPEED="$withval"],
686	[NCURSES_OSPEED=short])
687AC_MSG_RESULT($NCURSES_OSPEED)
688AC_SUBST(NCURSES_OSPEED)
689
690###   use option --with-mmask-t to override mmask_t's type
691AC_MSG_CHECKING(for type of mmask_t)
692AC_ARG_WITH(mmask-t,
693	[  --with-mmask-t=TYPE     override type of mmask_t],
694	[NCURSES_MMASK_T="$withval"],
695	[NCURSES_MMASK_T=auto])
696AC_MSG_RESULT($NCURSES_MMASK_T)
697
698###   use option --enable-bsdpad to have tputs process BSD-style prefix padding
699AC_MSG_CHECKING(if tputs should process BSD-style prefix padding)
700AC_ARG_ENABLE(bsdpad,
701	[  --enable-bsdpad         recognize BSD-style prefix padding],
702	[with_bsdpad=$enableval],
703	[with_bsdpad=no])
704AC_MSG_RESULT($with_bsdpad)
705test "$with_bsdpad" = yes && AC_DEFINE(BSD_TPUTS)
706
707### Enable compiling-in rcs id's
708AC_MSG_CHECKING(if RCS identifiers should be compiled-in)
709AC_ARG_WITH(rcs-ids,
710	[  --with-rcs-ids          compile-in RCS identifiers],
711	[with_rcs_ids=$withval],
712	[with_rcs_ids=no])
713AC_MSG_RESULT($with_rcs_ids)
714test "$with_rcs_ids" = yes && AC_DEFINE(USE_RCS_IDS)
715
716###############################################################################
717CF_MAN_PAGES([ captoinfo clear infocmp infotocap tic toe tput ])
718
719###############################################################################
720CF_HELP_MESSAGE(Extensions:)
721
722### Note that some functions (such as const) are normally disabled anyway.
723AC_MSG_CHECKING(if you want to build with function extensions)
724AC_ARG_ENABLE(ext-funcs,
725	[  --disable-ext-funcs     disable function-extensions],
726	[with_ext_funcs=$enableval],
727	[with_ext_funcs=yes])
728AC_MSG_RESULT($with_ext_funcs)
729if test "$with_ext_funcs" = yes ; then
730	NCURSES_EXT_FUNCS=1
731	AC_DEFINE(HAVE_CURSES_VERSION)
732	AC_DEFINE(HAVE_HAS_KEY)
733	AC_DEFINE(HAVE_RESIZETERM)
734	AC_DEFINE(HAVE_RESIZE_TERM)
735	AC_DEFINE(HAVE_USE_DEFAULT_COLORS)
736	AC_DEFINE(HAVE_WRESIZE)
737	AC_DEFINE(NCURSES_EXT_FUNCS)
738else
739	NCURSES_EXT_FUNCS=0
740fi
741AC_SUBST(NCURSES_EXT_FUNCS)
742
743###   use option --enable-const to turn on use of const beyond that in XSI.
744AC_MSG_CHECKING(for extended use of const keyword)
745AC_ARG_ENABLE(const,
746	[  --enable-const          compile with extra/non-standard const],
747	[with_ext_const=$enableval],
748	[with_ext_const=no])
749AC_MSG_RESULT($with_ext_const)
750NCURSES_CONST='/*nothing*/'
751if test "$with_ext_const" = yes ; then
752	NCURSES_CONST=const
753fi
754AC_SUBST(NCURSES_CONST)
755
756AC_MSG_CHECKING(if you want \$NCURSES_NO_PADDING code)
757AC_ARG_ENABLE(no-padding,
758	[  --enable-no-padding     compile with $NCURSES_NO_PADDING code],
759	[with_no_padding=$enableval],
760	[with_no_padding=$with_ext_funcs])
761AC_MSG_RESULT($with_no_padding)
762test "$with_no_padding" = yes && AC_DEFINE(NCURSES_NO_PADDING)
763
764###   use option --enable-sigwinch to turn on use of SIGWINCH logic
765AC_MSG_CHECKING(if you want SIGWINCH handler)
766AC_ARG_ENABLE(sigwinch,
767	[  --enable-sigwinch       compile with SIGWINCH handler],
768	[with_sigwinch=$enableval],
769	[with_sigwinch=$with_ext_funcs])
770AC_MSG_RESULT($with_sigwinch)
771test "$with_sigwinch" = yes && AC_DEFINE(USE_SIGWINCH)
772
773###   use option --enable-tcap-names to allow user to define new capabilities
774AC_MSG_CHECKING(if you want user-definable terminal capabilities like termcap)
775AC_ARG_ENABLE(tcap-names,
776	[  --enable-tcap-names     compile with user-definable terminal capabilities],
777	[with_tcap_names=$enableval],
778	[with_tcap_names=$with_ext_funcs])
779AC_MSG_RESULT($with_tcap_names)
780NCURSES_XNAMES=0
781test "$with_tcap_names" = yes && NCURSES_XNAMES=1
782AC_SUBST(NCURSES_XNAMES)
783
784###############################################################################
785# These options are relatively safe to experiment with.
786CF_HELP_MESSAGE(Development Code:)
787AC_MSG_CHECKING(if you want all development code)
788AC_ARG_WITH(develop,
789	[  --with-develop          enable all development options],
790	[with_develop=$withval],
791	[with_develop=no])
792AC_MSG_RESULT($with_develop)
793
794###   use option --enable-hard-tabs to turn on use of hard-tabs optimize
795AC_MSG_CHECKING(if you want hard-tabs code)
796AC_ARG_ENABLE(hard-tabs,
797	[  --enable-hard-tabs      compile with hard-tabs code],
798	[with_hardtabs=$enableval],
799	[with_hardtabs=$with_develop])
800AC_MSG_RESULT($with_hardtabs)
801test "$with_hardtabs" = yes && AC_DEFINE(USE_HARD_TABS)
802
803###   use option --enable-xmc-glitch to turn on use of magic-cookie optimize
804AC_MSG_CHECKING(if you want limited support for xmc)
805AC_ARG_ENABLE(xmc-glitch,
806	[  --enable-xmc-glitch     compile with limited support for xmc],
807	[with_xmc_glitch=$enableval],
808	[with_xmc_glitch=$with_develop])
809AC_MSG_RESULT($with_xmc_glitch)
810test "$with_xmc_glitch" = yes && AC_DEFINE(USE_XMC_SUPPORT)
811
812###############################################################################
813# These are just experimental, probably should not be in a package:
814CF_HELP_MESSAGE(Experimental Code:)
815
816AC_MSG_CHECKING(if you do not want to assume colors are white-on-black)
817AC_ARG_ENABLE(assumed-color,
818	[  --disable-assumed-color do not assume anything about default-colors],
819	[with_assumed_color=$enableval],
820	[with_assumed_color=yes])
821AC_MSG_RESULT($with_assumed_color)
822test "$with_assumed_color" = yes && AC_DEFINE(USE_ASSUMED_COLOR)
823
824###   use option --enable-hashmap to turn on use of hashmap scrolling logic
825AC_MSG_CHECKING(if you want hashmap scrolling-optimization code)
826AC_ARG_ENABLE(hashmap,
827	[  --disable-hashmap       compile without hashmap scrolling-optimization],
828	[with_hashmap=$enableval],
829	[with_hashmap=yes])
830AC_MSG_RESULT($with_hashmap)
831test "$with_hashmap" = yes && AC_DEFINE(USE_HASHMAP)
832
833###   use option --enable-colorfgbg to turn on use of $COLORFGBG environment
834AC_MSG_CHECKING(if you want colorfgbg code)
835AC_ARG_ENABLE(colorfgbg,
836	[  --enable-colorfgbg      compile with $COLORFGBG code],
837	[with_colorfgbg=$enableval],
838	[with_colorfgbg=no])
839AC_MSG_RESULT($with_colorfgbg)
840test "$with_colorfgbg" = yes && AC_DEFINE(USE_COLORFGBG)
841
842###   use option --enable-ext-colors to turn on use of colors beyond 16.
843AC_MSG_CHECKING(if you want to use experimental extended colors)
844AC_ARG_ENABLE(ext-colors,
845	[  --enable-ext-colors     compile for experimental 256-color support],
846	[with_ext_colors=$enableval],
847	[with_ext_colors=no])
848AC_MSG_RESULT($with_ext_colors)
849NCURSES_EXT_COLORS=0
850if test "$with_ext_colors" = yes ; then
851	if test "$with_widec" != yes ; then
852		AC_MSG_WARN(This option applies only to wide-character library)
853	else
854		# cannot be ABI 5 since it changes sizeof(cchar_t)
855		CF_NCURSES_ABI_6
856	fi
857	NCURSES_EXT_COLORS=1
858	AC_DEFINE(NCURSES_EXT_COLORS)
859fi
860AC_SUBST(NCURSES_EXT_COLORS)
861
862###   use option --enable-ext-mouse to modify coding to support 5-button mice
863AC_MSG_CHECKING(if you want to use experimental extended mouse encoding)
864AC_ARG_ENABLE(ext-mouse,
865	[  --enable-ext-mouse      compile for experimental mouse-encoding],
866	[with_ext_mouse=$enableval],
867	[with_ext_mouse=no])
868AC_MSG_RESULT($with_ext_mouse)
869NCURSES_MOUSE_VERSION=1
870if test "$with_ext_mouse" = yes ; then
871	NCURSES_MOUSE_VERSION=2
872	CF_NCURSES_ABI_6
873fi
874AC_SUBST(NCURSES_MOUSE_VERSION)
875
876AC_MSG_CHECKING(if you want experimental safe-sprintf code)
877AC_ARG_ENABLE(safe-sprintf,
878	[  --enable-safe-sprintf   compile with experimental safe-sprintf code],
879	[with_safe_sprintf=$enableval],
880	[with_safe_sprintf=no])
881AC_MSG_RESULT($with_safe_sprintf)
882test "$with_safe_sprintf" = yes && AC_DEFINE(USE_SAFE_SPRINTF)
883
884###   use option --disable-scroll-hints to turn off use of scroll-hints scrolling logic
885# when hashmap is used scroll hints are useless
886if test "$with_hashmap" = no ; then
887AC_MSG_CHECKING(if you want to experiment without scrolling-hints code)
888AC_ARG_ENABLE(scroll-hints,
889	[  --disable-scroll-hints  compile without scroll-hints code],
890	[with_scroll_hints=$enableval],
891	[with_scroll_hints=yes])
892AC_MSG_RESULT($with_scroll_hints)
893test "$with_scroll_hints" = yes && AC_DEFINE(USE_SCROLL_HINTS)
894fi
895
896###############################################################################
897CF_HELP_MESSAGE(Testing/development Options:)
898
899###	use option --disable-echo to suppress full display compiling commands
900AC_MSG_CHECKING(if you want to display full commands during build)
901AC_ARG_ENABLE(echo,
902	[  --enable-echo           build: display "compiling" commands (default)],
903	[with_echo=$enableval],
904	[with_echo=yes])
905if test "$with_echo" = yes; then
906	ECHO_LINK=
907else
908	ECHO_LINK='@ echo linking $@ ... ;'
909	test -n "$LIBTOOL" && LIBTOOL="$LIBTOOL --silent"
910fi
911AC_MSG_RESULT($with_echo)
912AC_SUBST(ECHO_LINK)
913
914###	use option --enable-warnings to turn on all gcc warnings
915AC_MSG_CHECKING(if you want to see compiler warnings)
916AC_ARG_ENABLE(warnings,
917	[  --enable-warnings       build: turn on GCC compiler warnings],
918	[with_warnings=$enableval])
919AC_MSG_RESULT($with_warnings)
920
921if test -n "$with_warnings"; then
922 	ADAFLAGS="$ADAFLAGS -gnatg"
923	CF_GCC_WARNINGS
924	if test "$cf_with_cxx" = yes ; then
925		CF_GXX_WARNINGS(Wno-unused)
926	fi
927fi
928CF_GCC_ATTRIBUTES
929
930###	use option --enable-assertions to turn on generation of assertion code
931AC_MSG_CHECKING(if you want to enable runtime assertions)
932AC_ARG_ENABLE(assertions,
933	[  --enable-assertions     test: turn on generation of assertion code],
934	[with_assertions=$enableval],
935	[with_assertions=no])
936AC_MSG_RESULT($with_assertions)
937if test -n "$GCC"
938then
939	if test "$with_assertions" = no
940	then
941		AC_DEFINE(NDEBUG)
942		CPPFLAGS="$CPPFLAGS -DNDEBUG"
943	else
944		ADAFLAGS="$ADAFLAGS -gnata"
945	fi
946fi
947
948###	use option --disable-leaks to suppress "permanent" leaks, for testing
949AC_ARG_ENABLE(leaks,
950	[  --disable-leaks         test: suppress permanent memory-leaks],
951	[test "$enableval" = no && AC_DEFINE(NO_LEAKS)])
952AC_DEFINE(HAVE_NC_ALLOC_H)
953
954###	use option --enable-expanded to generate certain macros as functions
955AC_ARG_ENABLE(expanded,
956	[  --enable-expanded       test: generate functions for certain macros],
957	[test "$enableval" = yes && AC_DEFINE(NCURSES_EXPANDED)])
958
959###	use option --disable-macros to suppress macros in favor of functions
960AC_ARG_ENABLE(macros,
961	[  --disable-macros        test: use functions rather than macros],
962	[test "$enableval" = no && AC_DEFINE(NCURSES_NOMACROS)])
963
964# Normally we only add trace() to the debug-library.  Allow this to be
965# extended to all models of the ncurses library:
966cf_all_traces=no
967case "$CFLAGS $CPPFLAGS" in
968*-DTRACE*)
969	cf_all_traces=yes
970	;;
971esac
972
973AC_MSG_CHECKING(whether to add trace feature to all models)
974AC_ARG_WITH(trace,
975[  --with-trace            test: add trace() function to all models of ncurses],
976[cf_with_trace=$withval],
977[cf_with_trace=$cf_all_traces])
978AC_MSG_RESULT($cf_with_trace)
979
980if test "$cf_with_trace" = yes ; then
981	LIB_TRACING=all
982	ADA_TRACE=TRUE
983	CF_ADD_CFLAGS(-DTRACE)
984else
985	LIB_TRACING=DEBUG
986	ADA_TRACE=FALSE
987fi
988
989AC_SUBST(ADA_TRACE)
990
991###	Checks for libraries.
992AC_CHECK_FUNC(gettimeofday,
993	AC_DEFINE(HAVE_GETTIMEOFDAY),[
994
995AC_CHECK_LIB(bsd, gettimeofday,
996	AC_DEFINE(HAVE_GETTIMEOFDAY)
997	LIBS="$LIBS -lbsd")])dnl CLIX: bzero, select, gettimeofday
998
999CF_MATH_LIB(MATH_LIB,sin(x))
1000AC_SUBST(MATH_LIB)
1001
1002###	Checks for header files.
1003AC_STDC_HEADERS
1004AC_HEADER_DIRENT
1005AC_HEADER_TIME
1006CF_REGEX
1007
1008dnl These are some other potentially nonportable headers.
1009AC_CHECK_HEADERS( \
1010fcntl.h \
1011getopt.h \
1012limits.h \
1013locale.h \
1014poll.h \
1015sys/bsdtypes.h \
1016sys/ioctl.h \
1017sys/param.h \
1018sys/poll.h \
1019sys/select.h \
1020sys/time.h \
1021sys/times.h \
1022ttyent.h \
1023unistd.h \
1024wctype.h \
1025)
1026
1027# check for ISC (this may also define _POSIX_SOURCE)
1028# Note: even non-Posix ISC needs <sys/bsdtypes.h> to declare fd_set
1029if test "$ISC" = yes ; then
1030	AC_CHECK_LIB(cposix,main)
1031	AC_CHECK_LIB(inet,bzero,LIBS="$LIBS -linet")dnl also 'select()'
1032fi
1033
1034CF_SYS_TIME_SELECT
1035
1036###	checks for compiler characteristics
1037AC_LANG_C
1038AC_C_CONST
1039AC_C_INLINE
1040test "$ac_cv_c_inline" != no && AC_DEFINE(CC_HAS_INLINE_FUNCS)
1041
1042if test $NCURSES_CHTYPE = auto ; then
1043	CF_TYPEOF_CHTYPE
1044else
1045	cf_cv_typeof_chtype=$NCURSES_CHTYPE
1046fi
1047AC_SUBST(cf_cv_typeof_chtype)
1048
1049CF_UNSIGNED_LITERALS
1050cf_cv_1UL="1"
1051test "$cf_cv_unsigned_literals" = yes && cf_cv_1UL="${cf_cv_1UL}U"
1052test "$cf_cv_typeof_chtype"    = long && cf_cv_1UL="${cf_cv_1UL}L"
1053AC_SUBST(cf_cv_1UL)
1054
1055if test $NCURSES_MMASK_T = auto ; then
1056	cf_cv_typeof_mmask_t=long
1057else
1058	cf_cv_typeof_mmask_t=$NCURSES_MMASK_T
1059fi
1060AC_SUBST(cf_cv_typeof_mmask_t)
1061
1062###	Checks for external-data
1063CF_ERRNO
1064CF_LINK_DATAONLY
1065
1066###	Checks for library functions.
1067AC_CHECK_FUNCS( \
1068getcwd \
1069getegid \
1070geteuid \
1071getttynam \
1072issetugid \
1073poll \
1074remove \
1075select \
1076setbuf \
1077setbuffer \
1078setvbuf \
1079sigaction \
1080sigvec \
1081strdup \
1082strstr \
1083tcgetpgrp \
1084times \
1085vsnprintf \
1086)
1087if test "$with_getcap" = "yes" ; then
1088	CF_CGETENT
1089fi
1090
1091CF_ISASCII
1092CF_STRUCT_SIGACTION
1093CF_FUNC_NANOSLEEP
1094CF_FUNC_TERMIOS
1095CF_FUNC_VSSCANF
1096CF_MKSTEMP
1097
1098# setup for prototype of fallback for vsscanf()
1099if test "$cf_cv_func_vsscanf" = vsscanf ; then
1100	HAVE_VSSCANF=1
1101else
1102	HAVE_VSSCANF=0
1103fi
1104AC_SUBST(HAVE_VSSCANF)
1105
1106dnl FIXME (may need this) AC_SYS_RESTARTABLE_SYSCALLS
1107if test "$cross_compiling" = yes ; then
1108	AC_MSG_WARN(cross compiling: assume setvbuf params not reversed)
1109else
1110	AC_FUNC_SETVBUF_REVERSED
1111fi
1112AC_TYPE_SIGNAL
1113CF_TYPE_SIGACTION
1114CF_SIZECHANGE
1115CF_FUNC_MEMMOVE
1116CF_FUNC_POLL
1117
1118dnl We'll do our own -g libraries, unless the user's overridden via $CFLAGS
1119if test -z "$cf_user_CFLAGS" ; then
1120	CF_STRIP_G_OPT(CFLAGS)
1121	CF_STRIP_G_OPT(CXXFLAGS)
1122fi
1123
1124# Just in case, check if the C compiler has a bool type.
1125CF_BOOL_DECL(cf_cv_cc_bool_type)
1126
1127# Check for C++ compiler characteristics (and ensure that it's there!)
1128if test -n "$CXX" ; then
1129	AC_LANG_CPLUSPLUS
1130	CF_STDCPP_LIBRARY
1131	CF_PROG_CC_C_O(CXX)
1132
1133	case $GXX_VERSION in
1134	1*|2.[0-6]*)
1135		cf_cxx_library=yes
1136		;;
1137	*-2.7*|2.7*)
1138		CF_GPP_LIBRARY
1139		;;
1140	*)
1141		cf_cxx_library=no
1142		;;
1143	esac
1144
1145	AC_CHECK_HEADERS(typeinfo)
1146
1147	CF_BOOL_DECL
1148	CF_BOOL_SIZE
1149	CF_ETIP_DEFINES
1150	CF_CPP_PARAM_INIT
1151	CF_CPP_STATIC_CAST
1152	CF_CPP_VSCAN_FUNC
1153
1154	CXX_AR='$(AR)'
1155	CXX_AR_OPTS='$(AR_OPTS)'
1156	case $cf_cv_system_name in #(vi
1157	irix*) #(vi
1158	    if test "$GXX" != yes ; then
1159		CXX_AR='$(CXX)'
1160		CXX_AR_OPTS='-ar -o'
1161	    fi
1162	    ;;
1163	sco3.2v5*) #(vi
1164	    CXXLDFLAGS="-u main"
1165	    ;;
1166	solaris2*)
1167	    if test "$GXX" != yes ; then
1168		CXX_AR='$(CXX)'
1169		CXX_AR_OPTS='-xar -o'
1170	    fi
1171	    ;;
1172	esac
1173	AC_SUBST(CXXLDFLAGS)
1174	AC_SUBST(CXX_AR)
1175	AC_SUBST(CXX_AR_OPTS)
1176else
1177	cf_cxx_library=no
1178	cf_cv_builtin_bool=1
1179
1180	# Just because we are not configuring against C++ right now does not
1181	# mean that a user will not want to use C++.  Some distributors disable
1182	# the C++ portion of this configuration as a shortcut (or just to avoid
1183	# compiling the demo in the c++ directory).  So we need a reasonable
1184	# default for the 'bool' type.
1185	#
1186	# Caveat: since the storage of the bool type is not standardized, it
1187	# may change.
1188
1189	if test "$NCURSES_BOOL" != auto ; then
1190		cf_cv_type_of_bool=$NCURSES_AUTO
1191	else
1192		if test "$cf_cv_header_stdbool_h" = 1 ; then
1193			CF_BOOL_SIZE
1194		else
1195			AC_MSG_CHECKING(for fallback type of bool)
1196			case "$host_cpu" in #(vi
1197			i?86)	cf_cv_type_of_bool=char	;; #(vi
1198			*)	cf_cv_type_of_bool=int	;;
1199			esac
1200			AC_MSG_RESULT($cf_cv_type_of_bool)
1201		fi
1202	fi
1203fi
1204AC_SUBST(CXXLIBS)
1205
1206# If the C compiler did not declare bool, and we did not determine that the C++
1207# compiler does not declare bool, turn on an ifdef in curses.h that makes the
1208# ncurses library use the same type as C++ bool.  Note that this allows one to
1209# specify the type of bool in a configure-script option and postpone
1210# integration with the C++ compiler provided that the types are compatible.
1211USE_CXX_BOOL=1
1212if test $cf_cv_cc_bool_type = 1
1213then
1214	# oops: C has a bool.  Unlikely, but C++ could differ.
1215	USE_CXX_BOOL=0
1216elif test $cf_cv_builtin_bool = 0
1217then
1218	# C++ has no bool
1219	USE_CXX_BOOL=0
1220else
1221	# this is the normal case
1222	USE_CXX_BOOL='defined(__cplusplus)'
1223fi
1224AC_SUBST(USE_CXX_BOOL)
1225
1226CF_HELP_MESSAGE(Ada95 Binding Options:)
1227
1228dnl Check for availability of GNU Ada Translator (GNAT).
1229dnl At the moment we support no other Ada95 compiler.
1230if test "$cf_with_ada" != "no" ; then
1231cf_ada_make=gnatmake
1232AC_CHECK_PROG(gnat_exists, $cf_ada_make, yes, no)
1233if test "$ac_cv_prog_gnat_exists" = no; then
1234   cf_ada_make=
1235else
1236   CF_GNAT_VERSION
1237   AC_CHECK_PROG(M4_exists, m4, yes, no)
1238   if test "$ac_cv_prog_M4_exists" = no; then
1239      cf_cv_prog_gnat_correct=no
1240      echo Ada95 binding required program m4 not found. Ada95 binding disabled.
1241   fi
1242   if test "$cf_cv_prog_gnat_correct" = yes; then
1243      AC_MSG_CHECKING(if GNAT works)
1244      CF_GNAT_TRY_RUN([procedure conftest;],
1245[with Text_IO;
1246with GNAT.OS_Lib;
1247procedure conftest is
1248begin
1249   Text_IO.Put ("Hello World");
1250   Text_IO.New_Line;
1251   GNAT.OS_Lib.OS_Exit (0);
1252end conftest;],[cf_cv_prog_gnat_correct=yes],[cf_cv_prog_gnat_correct=no])
1253      AC_MSG_RESULT($cf_cv_prog_gnat_correct)
1254   fi
1255fi
1256if test	"$cf_cv_prog_gnat_correct" = yes; then
1257   ADAFLAGS="-O3 -gnatpn $ADAFLAGS"
1258
1259   AC_MSG_CHECKING(if GNAT pragma Unreferenced works)
1260   CF_GNAT_TRY_LINK([procedure conftest;],
1261[with Text_IO;
1262with GNAT.OS_Lib;
1263procedure conftest is
1264   test : Integer;
1265   pragma Unreferenced (test);
1266begin
1267   test := 1;
1268   Text_IO.Put ("Hello World");
1269   Text_IO.New_Line;
1270   GNAT.OS_Lib.OS_Exit (0);
1271end conftest;],[cf_cv_pragma_unreferenced=yes],[cf_cv_pragma_unreferenced=no])
1272   AC_MSG_RESULT($cf_cv_pragma_unreferenced)
1273
1274   # if the pragma is supported, use it (needed in the Trace code).
1275   if test $cf_cv_pragma_unreferenced = yes ; then
1276      PRAGMA_UNREF=TRUE
1277   else
1278      PRAGMA_UNREF=FALSE
1279   fi
1280
1281   AC_ARG_WITH(ada-compiler,
1282	[  --with-ada-compiler=CMD specify Ada95 compiler command (default gnatmake)],
1283	[cf_ada_compiler=$withval],
1284	[cf_ada_compiler=gnatmake])
1285
1286   cf_ada_package=terminal_interface
1287
1288   AC_SUBST(cf_ada_make)
1289   AC_SUBST(cf_ada_compiler)
1290   AC_SUBST(cf_ada_package)
1291   AC_SUBST(ADAFLAGS)
1292   AC_SUBST(cf_compile_generics)
1293   AC_SUBST(cf_generic_objects)
1294   AC_SUBST(PRAGMA_UNREF)
1295
1296   CF_WITH_PATH(ada-include,
1297       [  --with-ada-include=DIR  Ada includes are in DIR],
1298       ADA_INCLUDE,
1299       PREFIX/lib/ada/adainclude,
1300       [$]prefix/lib/ada/adainclude)
1301   AC_SUBST(ADA_INCLUDE)
1302
1303   CF_WITH_PATH(ada-objects,
1304       [  --with-ada-objects=DIR  Ada objects are in DIR],
1305       ADA_OBJECTS,
1306       PREFIX/lib/ada/adalib,
1307       [$]prefix/lib/ada/adalib)
1308   AC_SUBST(ADA_OBJECTS)
1309
1310fi
1311fi
1312
1313### Construct the library-subsets, if any, from this set of keywords:
1314### none, base, ext_funcs, ext_tinfo, termlib, widechar (see CF_LIB_RULES).
1315AC_MSG_CHECKING(for library subsets)
1316if test "$with_termlib" != no ; then
1317	LIB_SUBSETS="termlib"
1318	test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_tinfo"
1319	LIB_SUBSETS="${LIB_SUBSETS} "
1320else
1321	LIB_SUBSETS="termlib+"
1322	test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}ext_tinfo+"
1323fi
1324LIB_SUBSETS="${LIB_SUBSETS}base"
1325test "$with_widec"     = yes && LIB_SUBSETS="${LIB_SUBSETS}+widechar"
1326test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs"
1327AC_MSG_RESULT($LIB_SUBSETS)
1328
1329### Construct the list of include-directories to be generated
1330CF_INCLUDE_DIRS
1331CF_ADA_INCLUDE_DIRS
1332
1333### Build up pieces for makefile rules
1334AC_MSG_CHECKING(default library suffix)
1335CF_LIB_TYPE($DFT_LWR_MODEL,DFT_ARG_SUFFIX)dnl
1336AC_SUBST(DFT_ARG_SUFFIX)dnl the string to append to "-lncurses" ("")
1337AC_MSG_RESULT($DFT_ARG_SUFFIX)
1338
1339AC_MSG_CHECKING(default library-dependency suffix)
1340CF_LIB_SUFFIX($DFT_LWR_MODEL,DFT_DEP_SUFFIX)dnl
1341if test $DFT_LWR_MODEL = shared ; then
1342	case $cf_cv_system_name in #(vi
1343	cygwin*)
1344		DFT_DEP_SUFFIX=".dll.a"
1345		;;
1346	esac
1347fi
1348AC_SUBST(DFT_DEP_SUFFIX)dnl the corresponding library-suffix (".a")
1349AC_MSG_RESULT($DFT_DEP_SUFFIX)
1350
1351AC_MSG_CHECKING(default object directory)
1352CF_OBJ_SUBDIR($DFT_LWR_MODEL,DFT_OBJ_SUBDIR)dnl
1353AC_SUBST(DFT_OBJ_SUBDIR)dnl the default object-directory ("obj")
1354AC_MSG_RESULT($DFT_OBJ_SUBDIR)
1355
1356# libtool thinks it can make c++ shared libraries (perhaps only g++)
1357if test "$cf_with_cxx" = yes ; then
1358AC_MSG_CHECKING(c++ library-dependency suffix)
1359if test "$with_libtool" != "no"; then
1360	CXX_LIB_SUFFIX=$DFT_DEP_SUFFIX
1361else
1362	CF_LIB_SUFFIX(normal,CXX_LIB_SUFFIX)dnl we normally make a static library
1363fi
1364AC_MSG_RESULT($CXX_LIB_SUFFIX)
1365AC_SUBST(CXX_LIB_SUFFIX)
1366fi
1367
1368### Set up low-level terminfo dependencies for makefiles.
1369TINFO_LIST="$SHLIB_LIST"
1370if test "$with_termlib" != no ; then
1371
1372	if test "$with_termlib" != yes ; then
1373		TINFO_NAME=$with_termlib
1374		TINFO_ARG_SUFFIX="${with_termlib}`echo ${DFT_ARG_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
1375		TINFO_DEP_SUFFIX="${with_termlib}`echo ${DFT_DEP_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
1376		TINFO_LIB_SUFFIX="${with_termlib}"
1377	else
1378		TINFO_ARG_SUFFIX="${TINFO_NAME}${DFT_ARG_SUFFIX}"
1379		TINFO_DEP_SUFFIX="${TINFO_NAME}${DFT_DEP_SUFFIX}"
1380		TINFO_LIB_SUFFIX="${TINFO_NAME}${LIB_SUFFIX}"
1381	fi
1382
1383	TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${TINFO_DEP_SUFFIX}"
1384	TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${TINFO_DEP_SUFFIX}"
1385	if test "$DFT_LWR_MODEL" = "libtool"; then
1386		TEST_ARGS="${TEST_DEPS}"
1387		TEST_ARG2="${TEST_DEP2}"
1388		TINFO_ARGS="-L${LIB_DIR} $TEST_ARGS"
1389	else
1390		TEST_ARGS="-l${TINFO_ARG_SUFFIX}"
1391		TEST_ARG2="-l${TINFO_ARG_SUFFIX}"
1392		TINFO_ARGS="-L${LIB_DIR} $TEST_ARGS"
1393		SHLIB_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}"
1394	fi
1395else
1396	TINFO_ARGS="-L${LIB_DIR} -l${LIB_NAME}${DFT_ARG_SUFFIX}"
1397fi
1398AC_SUBST(TINFO_ARG_SUFFIX)
1399AC_SUBST(TINFO_DEP_SUFFIX)
1400AC_SUBST(TINFO_LIB_SUFFIX)
1401AC_SUBST(TINFO_ARGS)
1402
1403# needed for Ada95
1404TINFO_ARGS2=`echo "$TINFO_ARGS" | sed -e 's,-L\.\./,-L../../,'`
1405AC_SUBST(TINFO_ARGS2)
1406
1407AC_MSG_CHECKING(where we will install curses.h)
1408test "$with_overwrite" = no && \
1409test "x$includedir" = 'x${prefix}/include' && \
1410	includedir='$(prefix)/include/ncurses'${LIB_SUFFIX}
1411AC_MSG_RESULT($includedir)
1412
1413### Resolve a conflict between normal and wide-curses by forcing applications
1414### that will need libutf8 to add it to their configure script.
1415if test "$with_overwrite" != no ; then
1416if test "$NCURSES_LIBUTF8" = 1 ; then
1417	NCURSES_LIBUTF8='defined(HAVE_LIBUTF8_H)'
1418	AC_MSG_WARN(Wide-character applications must define HAVE_LIBUTF8_H to include curses.h)
1419fi
1420fi
1421
1422AC_SUBST(TINFO_LIST)
1423AC_SUBST(SHLIB_LIST)
1424
1425### predefined stuff for the test programs
1426AC_DEFINE(HAVE_SLK_COLOR)
1427
1428### Construct the list of subdirectories for which we'll customize makefiles
1429### with the appropriate compile-rules.
1430
1431CF_SRC_MODULES($modules_to_build)
1432CF_DIRS_TO_MAKE
1433
1434AC_DEFINE_UNQUOTED(NCURSES_PATHSEP,'$PATHSEP')
1435
1436AC_DEFINE_UNQUOTED(NCURSES_VERSION_STRING, "${NCURSES_MAJOR}.${NCURSES_MINOR}.${NCURSES_PATCH}")
1437
1438### Now that we're done running tests, add the compiler-warnings, if any
1439CF_ADD_CFLAGS($EXTRA_CFLAGS)
1440
1441################################################################################
1442test "$use_database" = yes && SUB_MAKEFILES="$SUB_MAKEFILES misc/run_tic.sh:misc/run_tic.in"
1443AC_OUTPUT( \
1444	include/MKterm.h.awk \
1445	include/curses.head:include/curses.h.in \
1446	include/termcap.h \
1447	include/unctrl.h \
1448	$SUB_MAKEFILES \
1449	Makefile,[
1450CF_LIB_RULES
1451],[
1452### Special initialization commands, used to pass information from the
1453### configuration-run into config.status
1454
1455AWK="$AWK"
1456CF_LIST_MODELS="$cf_list_models"
1457DFT_ARG_SUFFIX="$DFT_ARG_SUFFIX"
1458DFT_LWR_MODEL="$DFT_LWR_MODEL"
1459LDCONFIG="$LDCONFIG"
1460LIB_NAME="$LIB_NAME"
1461LIB_SUBSETS="$LIB_SUBSETS"
1462LIB_SUFFIX="$LIB_SUFFIX"
1463LIB_TRACING="$LIB_TRACING"
1464MAKE_TERMINFO="$MAKE_TERMINFO"
1465NCURSES_OSPEED="$NCURSES_OSPEED"
1466SRC_SUBDIRS="$SRC_SUBDIRS"
1467TERMINFO="$TERMINFO"
1468TINFO_ARG_SUFFIX="$TINFO_ARG_SUFFIX"
1469TINFO_LIB_SUFFIX="$TINFO_LIB_SUFFIX"
1470TINFO_NAME="$TINFO_NAME"
1471WITH_CURSES_H="$with_curses_h"
1472WITH_ECHO="$with_echo"
1473WITH_OVERWRITE="$with_overwrite"
1474cf_cv_abi_version="$cf_cv_abi_version"
1475cf_cv_do_symlinks="$cf_cv_do_symlinks"
1476cf_cv_enable_lp64="$cf_cv_enable_lp64"
1477cf_cv_prog_CC_c_o=$cf_cv_prog_CC_c_o
1478cf_cv_prog_CXX_c_o=$cf_cv_prog_CXX_c_o
1479cf_cv_rel_version="$cf_cv_rel_version"
1480cf_cv_rm_so_locs="$cf_cv_rm_so_locs"
1481cf_cv_shlib_version="$cf_cv_shlib_version"
1482cf_cv_shlib_version_infix="$cf_cv_shlib_version_infix"
1483cf_cv_system_name="$cf_cv_system_name"
1484cf_with_cxx_binding="$cf_with_cxx_binding"
1485host="$host"
1486target="$target"
1487
1488],cat)dnl
1489${MAKE-make} preinstall
1490