xref: /freebsd/contrib/ncurses/configure.in (revision 77a0943ded95b9e6438f7db70c4a28e4d93946d4)
1dnl***************************************************************************
2dnl Copyright (c) 1998,1999,2000 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 <dickey@clark.net> 1996,1997
30dnl
31dnl $Id: configure.in,v 1.217 2000/10/08 01:02:43 tom Exp $
32dnl Process this file with autoconf to produce a configure script.
33dnl
34dnl See http://dickey.his.com/autoconf/ for additional information.
35dnl
36dnl ---------------------------------------------------------------------------
37AC_PREREQ(2.13.20000819)
38AC_REVISION($Revision: 1.217 $)
39AC_INIT(ncurses/base/lib_initscr.c)
40AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin)
41
42CF_SUBST_NCURSES_VERSION
43CF_CHECK_CACHE([AC_CANONICAL_SYSTEM])
44AC_ARG_WITH(system-type,
45[  --with-system-type=XXX  test: override derived host system-type],
46[AC_MSG_WARN(overriding system type to $withval)
47 cf_cv_system_name=$withval])
48
49# We need a configure script only when compiling as part of GNU C library.
50# Here we have to generate one of the files we need while compiling.
51#
52# The only problem is that users of the package might think they have to
53# run configure themself and find it irritating when nothing happens.
54#
55# So we try here to find out whether we are called from the glibc configure
56# or by a user.
57#
58dnl Check if we are a drop-in addition to glibc.
59AC_ARG_ENABLE(add-ons, dnl
60[  --enable-add-ons=DIR... used to check if we are a glibc add-on.],
61		[glibc_add_on=yes],
62		[glibc_add_on=])
63
64dnl We need to use [ and ] for other purposes for a while now.
65changequote(,)dnl
66if test x"$glibc_add_on" = "xyes" ; then
67  rm -f $srcdir/Banner
68  # We are in glibc.
69  rm -f $srcdir/Makefile
70  cp $srcdir/Makefile.glibc $srcdir/Makefile
71  echo "ncurses `grep \"^[ 	]*ncurses-version[ 	]*=.*$\" \
72		$srcdir/Makefile | sed -e \
73		's/^[ 	]*ncurses-version[ 	]*=[ 	]*\([^	^ ]*\)[ 	]*$/\1/'`" > $srcdir/Banner
74  exit 0
75fi
76changequote([,])dnl
77
78###	Save the given $CFLAGS to allow user-override.
79cf_user_CFLAGS="$CFLAGS"
80
81###	Default install-location
82CF_CFG_DEFAULTS
83
84###	Checks for programs.
85AC_PROG_CC
86if test "$GCC" = yes ; then
87	AC_MSG_CHECKING(version of gcc)
88	eval "$CC --version"
89fi
90if test "$host" != $build; then
91	AC_CHECK_PROGS(BUILD_CC, $CC gcc cc)
92else
93	BUILD_CC="$CC"
94fi
95AC_SUBST(BUILD_CC)
96AC_PROG_CPP
97AC_PROG_GCC_TRADITIONAL
98AC_ISC_POSIX
99CF_ANSI_CC_REQD
100CF_PROG_EXT
101
102case "$cf_cv_system_name" in
103freebsd*) #(vi
104  test -z "$LDCONFIG" && LDCONFIG="/sbin/ldconfig -R"
105  ;;
106*) LDPATH=$PATH:/sbin:/usr/sbin
107  AC_PATH_PROG(LDCONFIG,ldconfig,,$LDPATH)
108  ;;
109esac
110AC_SUBST(LDCONFIG)
111
112dnl DEFECT in autoconf 2.12:	an attempt to set policy, this breaks the
113dnl				configure script by not letting us test if C++
114dnl				is present, making this option necessary.
115AC_MSG_CHECKING(if you want to ensure bool is consistent with C++)
116AC_ARG_WITH(cxx,
117	[  --without-cxx           do not adjust ncurses bool to match C++],
118	[cf_with_cxx=$withval],
119	[cf_with_cxx=yes])
120AC_MSG_RESULT($cf_with_cxx)
121if test "X$cf_with_cxx" = Xno ; then
122	CXX=""
123	GXX=""
124else
125	pushdef([AC_MSG_ERROR],
126		[AC_MSG_RESULT([You don't have any C++ compiler, too bad]); dnl
127		cf_with_cxx=no; CXX=""; GXX="";])dnl
128	AC_PROG_CXX
129	popdef([AC_MSG_ERROR])dnl
130fi
131
132changequote(,)dnl
133if test "$GXX" = yes; then
134	case "`${CXX-g++} --version`" in
135	1*|2.[0-6]*)
136		GXX=""; CXX=""; ac_cv_prog_gxx=no
137		cf_cxx_library=no
138		echo No: templates do not work
139		;;
140	esac
141fi
142changequote([,])dnl
143
144AC_MSG_CHECKING(if you want to build C++ binding and demo)
145AC_ARG_WITH(cxx-binding,
146	[  --without-cxx-binding   do not build C++ binding and demo],
147	[cf_with_cxx_binding=$withval],
148	[cf_with_cxx_binding=$cf_with_cxx])
149AC_MSG_RESULT($cf_with_cxx_binding)
150
151AC_MSG_CHECKING(if you want to build with Ada95)
152AC_ARG_WITH(ada,
153	[  --without-ada           suppress check for Ada95, don't build demo],
154	[cf_with_ada=$withval],
155	[cf_with_ada=yes])
156AC_MSG_RESULT($cf_with_ada)
157
158AC_MSG_CHECKING(if you want to build programs such as tic)
159AC_ARG_WITH(progs,
160	[  --without-progs         suppress build with programs (e.g., tic)],
161	[cf_with_progs=$withval],
162	[cf_with_progs=yes])
163AC_MSG_RESULT($cf_with_progs)
164
165modules_to_build="ncurses"
166if test "X$cf_with_progs" != Xno ; then
167modules_to_build="$modules_to_build progs tack"
168fi
169modules_to_build="$modules_to_build panel menu form"
170
171AC_ARG_PROGRAM
172AC_PROG_AWK
173AC_PROG_MAKE_SET
174CF_PROG_INSTALL
175AC_SYS_LONG_FILE_NAMES
176CF_MIXEDCASE_FILENAMES
177AC_PROG_LN_S
178AC_PROG_RANLIB
179CF_MAKE_TAGS
180AC_CHECK_PROGS(LINT, tdlint lint alint)
181AC_CHECK_PROGS(MAN, man man_db)
182AC_SUBST(LINT_OPTS)
183
184dnl These are standard among *NIX systems, but not when cross-compiling
185CF_SUBST(loader,LD,ld)
186CF_SUBST(archiver,AR,ar)
187CF_SUBST(archiver options,AR_OPTS,rv)
188
189CF_MAKEFLAGS
190
191dnl Special option for use by system-builders: the install-prefix is used to
192dnl adjust the location into which the actual install is done, so that an
193dnl archive can be built without modifying the host system's configuration.
194AC_MSG_CHECKING(if you have specified an install-prefix)
195AC_ARG_WITH(install-prefix,
196	[  --with-install-prefix   prefixes actual install-location],
197	[case "$withval" in #(vi
198	yes|no) #(vi
199		;;
200	*)	DESTDIR="$withval"
201		;;
202	esac])
203AC_MSG_RESULT($DESTDIR)
204AC_SUBST(DESTDIR)
205
206###############################################################################
207CF_HELP_MESSAGE(Options to Specify the Libraries Built/Used:)
208
209### Options to allow the user to specify the set of libraries which are used.
210### Use "--without-normal --with-shared" to allow the default model to be
211### shared, for example.
212cf_list_models=""
213AC_SUBST(cf_list_models)dnl	the complete list of models ("normal debug")
214
215AC_MSG_CHECKING(if you want to build shared libraries)
216AC_ARG_WITH(shared,
217	[  --with-shared           generate shared-libraries],
218	[with_shared=$withval],
219	[with_shared=no])
220AC_MSG_RESULT($with_shared)
221test "$with_shared" = "yes" && cf_list_models="$cf_list_models shared"
222
223AC_MSG_CHECKING(if you want to build static libraries)
224AC_ARG_WITH(normal,
225	[  --with-normal           generate normal-libraries (default)],
226	[with_normal=$withval],
227	[with_normal=yes])
228AC_MSG_RESULT($with_normal)
229test "$with_normal" = "yes" && cf_list_models="$cf_list_models normal"
230
231AC_MSG_CHECKING(if you want to build debug libraries)
232AC_ARG_WITH(debug,
233	[  --with-debug            generate debug-libraries (default)],
234	[with_debug=$withval],
235	[with_debug=yes])
236AC_MSG_RESULT($with_debug)
237test "$with_debug" = "yes" && cf_list_models="$cf_list_models debug"
238
239AC_MSG_CHECKING(if you want to build profiling libraries)
240AC_ARG_WITH(profile,
241	[  --with-profile          generate profile-libraries],
242	[with_profile=$withval],
243	[with_profile=no])
244AC_MSG_RESULT($with_profile)
245test "$with_profile" = "yes" && cf_list_models="$cf_list_models profile"
246
247###############################################################################
248
249AC_MSG_CHECKING(for specified models)
250test -z "$cf_list_models" && cf_list_models=normal
251AC_MSG_RESULT($cf_list_models)
252
253### Use the first model as the default, and save its suffix for use in building
254### up test-applications.
255AC_MSG_CHECKING(for default model)
256DFT_LWR_MODEL=`echo $cf_list_models | $AWK '{print $1}'`
257AC_MSG_RESULT($DFT_LWR_MODEL)
258
259CF_UPPER(DFT_UPR_MODEL,$DFT_LWR_MODEL)dnl
260
261AC_SUBST(DFT_LWR_MODEL)dnl	the default model ("normal")
262AC_SUBST(DFT_UPR_MODEL)dnl	the default model ("NORMAL")
263
264TINFO_NAME=tinfo
265AC_SUBST(TINFO_NAME)
266
267LIB_NAME=ncurses
268AC_SUBST(LIB_NAME)
269
270LIB_DIR=../lib
271CF_LIB_PREFIX(cf_prefix)
272LIB_PREFIX=$cf_prefix
273AC_SUBST(LIB_PREFIX)
274
275LIB_SUFFIX=
276AC_SUBST(LIB_SUFFIX)
277
278###############################################################################
279
280AC_MSG_CHECKING(if you want to build a separate terminfo library)
281AC_ARG_WITH(termlib,
282	[  --with-termlib          generate separate terminfo library],
283	[with_termlib=$withval],
284	[with_termlib=no])
285AC_MSG_RESULT($with_termlib)
286
287### Checks for special libraries, must be done up-front.
288AC_MSG_CHECKING(if you want to link with dbmalloc for testing)
289AC_ARG_WITH(dbmalloc,
290	[  --with-dbmalloc         test: use Conor Cahill's dbmalloc library],
291	[with_dbmalloc=$withval],
292	[with_dbmalloc=no])
293AC_MSG_RESULT($with_dbmalloc)
294if test "$with_dbmalloc" = yes ; then
295	AC_CHECK_LIB(dbmalloc,debug_malloc)
296fi
297
298AC_MSG_CHECKING(if you want to link with dmalloc for testing)
299AC_ARG_WITH(dmalloc,
300	[  --with-dmalloc          test: use Gray Watson's dmalloc library],
301	[with_dmalloc=$withval],
302	[with_dmalloc=no])
303AC_MSG_RESULT($with_dmalloc)
304if test "$with_dmalloc" = yes ; then
305	AC_CHECK_LIB(dmalloc,dmalloc_debug)
306fi
307
308SHLIB_LIST=""
309AC_MSG_CHECKING(if you want to link with the gpm mouse library)
310AC_ARG_WITH(gpm,
311	[  --with-gpm              use Alessandro Rubini's GPM library],
312	[with_gpm=$withval],
313	[with_gpm=no])
314AC_MSG_RESULT($with_gpm)
315if test "$with_gpm" = yes ; then
316	AC_CHECK_LIB(gpm,Gpm_Open,[
317		EXTRA_LIBS="-lgpm -lncurses $EXTRA_LIBS"
318		SHLIB_LIST="-lgpm $SHLIB_LIST"
319		AC_DEFINE(HAVE_LIBGPM)
320		AC_CHECK_HEADERS(gpm.h)
321	],AC_MSG_WARN(Cannot link with gpm library - read the FAQ))
322fi
323
324dnl Not all ports of gcc support the -g option
325
326if test X"$CC_G_OPT" = X"" ; then
327	CC_G_OPT='-g'
328	test -n "$GCC" && test "${ac_cv_prog_cc_g}" != yes && CC_G_OPT=''
329fi
330AC_SUBST(CC_G_OPT)
331
332if test X"$CXX_G_OPT" = X"" ; then
333	CXX_G_OPT='-g'
334	test -n "$GXX" && test "${ac_cv_prog_cxx_g}" != yes && CXX_G_OPT=''
335fi
336AC_SUBST(CXX_G_OPT)
337
338AC_MSG_CHECKING(for default loader flags)
339case $DFT_LWR_MODEL in
340normal)  LD_MODEL=''   ;;
341debug)   LD_MODEL=$CC_G_OPT ;;
342profile) LD_MODEL='-pg';;
343shared)  LD_MODEL=''   ;;
344esac
345AC_SUBST(LD_MODEL)dnl		the type of link (e.g., -g or -pg)
346AC_MSG_RESULT($LD_MODEL)
347
348AC_MSG_CHECKING(if rpath option should be used)
349AC_ARG_ENABLE(rpath,
350[  --enable-rpath          use rpath option when generating shared libraries],
351[cf_cv_ld_rpath=$enableval],
352[cf_cv_ld_rpath=no])
353AC_MSG_RESULT($cf_cv_ld_rpath)
354
355CF_SHARED_OPTS
356if test "$CC_SHARED_OPTS" = "unknown"; then
357	for model in $cf_list_models; do
358		if test "$model" = "shared"; then
359			AC_ERROR(Shared libraries are not supported in this version)
360		fi
361	done
362fi
363
364###############################################################################
365CF_HELP_MESSAGE(Fine-Tuning Your Configuration:)
366
367###	use option --disable-overwrite to leave out the link to -lcurses
368AC_MSG_CHECKING(if you wish to install ncurses overwriting curses)
369AC_ARG_ENABLE(overwrite,
370	[  --disable-overwrite     leave out the link to -lcurses],
371	[with_overwrite=$enableval],
372	[with_overwrite=yes])
373AC_MSG_RESULT($with_overwrite)
374
375AC_MSG_CHECKING(if external terminfo-database is used)
376AC_ARG_ENABLE(database,
377	[  --disable-database      use only built-in data],
378	[use_database=$enableval],
379	[use_database=yes])
380AC_MSG_RESULT($use_database)
381
382case $host_os in #(vi
383os2*) #(vi
384	TERMINFO_SRC='${top_srcdir}/misc/emx.src'
385	;;
386*) #(vi
387	TERMINFO_SRC='${top_srcdir}/misc/terminfo.src'
388	;;
389esac
390AC_SUBST(TERMINFO_SRC)
391
392if test "$use_database" != no ; then
393	AC_DEFINE(USE_DATABASE)
394	AC_MSG_CHECKING(which terminfo source-file will be installed)
395	AC_ARG_ENABLE(database,
396		[  --with-database=XXX     specify terminfo source to install],
397		[TERMINFO_SRC=$withval])
398	AC_MSG_RESULT($TERMINFO_SRC)
399fi
400
401AC_MSG_CHECKING(for list of fallback descriptions)
402AC_ARG_WITH(fallbacks,
403	[  --with-fallbacks=XXX    specify list of fallback terminal descriptions],
404	[with_fallback=$withval],
405	[with_fallback=])
406AC_MSG_RESULT($with_fallback)
407FALLBACK_LIST=`echo $with_fallback|sed -e 's/,/ /g'`
408AC_SUBST(FALLBACK_LIST)
409
410if test "$use_database" = no ; then
411	if test -z $with_fallback ; then
412		AC_ERROR(You have disabled the database w/o specifying fallbacks)
413	fi
414	TERMINFO="${datadir}/terminfo"
415else
416
417AC_MSG_CHECKING(for list of terminfo directories)
418CF_WITH_PATHLIST(terminfo-dirs,
419	[  --with-terminfo-dirs=XXX specify list of terminfo directories],
420	TERMINFO_DIRS,
421	DATADIR/terminfo,
422	${datadir}/terminfo)
423AC_MSG_RESULT($TERMINFO_DIRS)
424test -n "$TERMINFO_DIRS" && AC_DEFINE_UNQUOTED(TERMINFO_DIRS,"$TERMINFO_DIRS")
425
426AC_MSG_CHECKING(for default terminfo directory)
427CF_WITH_PATH(default-terminfo-dir,
428	[  --with-default-terminfo-dir=DIR default terminfo directory],
429	TERMINFO,
430	DATADIR/terminfo,
431	${datadir}/terminfo)
432AC_MSG_RESULT($TERMINFO)
433AC_DEFINE_UNQUOTED(TERMINFO,"$TERMINFO")
434
435fi
436
437AC_SUBST(TERMINFO)
438
439###	use option --disable-big-core to make tic run on small machines
440###	We need 4Mb, check if we can allocate 50% more than that.
441AC_MSG_CHECKING(if big-core option selected)
442AC_ARG_ENABLE(big-core,
443	[  --disable-big-core      assume machine has little memory],
444	[with_big_core=$enableval],
445	[AC_TRY_RUN([
446#include <stdlib.h>
447#include <string.h>
448int main() {
449	unsigned long n = 6000000L;
450	char *s = malloc(n);
451	if (s != 0)
452		s[0] = s[n-1] = 0;
453	exit(s == 0);
454}],
455	[with_big_core=yes],
456	[with_big_core=no],
457	[with_big_core=no])])
458AC_MSG_RESULT($with_big_core)
459test "$with_big_core" = "yes" && AC_DEFINE(HAVE_BIG_CORE)
460
461###	use option --enable-termcap to compile in the termcap fallback support
462AC_MSG_CHECKING(if you want termcap-fallback support)
463AC_ARG_ENABLE(termcap,
464	[  --enable-termcap        compile in termcap fallback support],
465	[with_termcap=$enableval],
466	[with_termcap=no])
467AC_MSG_RESULT($with_termcap)
468
469if test "$with_termcap" != "yes" ; then
470	AC_DEFINE(PURE_TERMINFO)
471else
472
473###	use option --enable-getcap to use a hacked getcap for reading termcaps
474AC_MSG_CHECKING(if fast termcap-loader is needed)
475AC_ARG_ENABLE(getcap,
476	[  --enable-getcap         fast termcap load, no xrefs to terminfo],
477	[with_getcap=$enableval],
478	[with_getcap=no])
479AC_MSG_RESULT($with_getcap)
480test "$with_getcap" = "yes" && AC_DEFINE(USE_GETCAP)
481
482AC_MSG_CHECKING(if translated termcaps will be cached in ~/.terminfo)
483AC_ARG_ENABLE(getcap-cache,
484	[  --enable-getcap-cache   cache translated termcaps in ~/.terminfo],
485	[with_getcap_cache=$enableval],
486	[with_getcap_cache=no])
487AC_MSG_RESULT($with_getcap_cache)
488test "$with_getcap_cache" = "yes" && AC_DEFINE(USE_GETCAP_CACHE)
489
490fi
491
492###   Use option --enable-symlinks to make tic use symlinks, not hard links
493###   to reduce storage requirements for the terminfo database.
494CF_LINK_FUNCS
495
496with_links=no
497with_symlinks=no
498
499if test "$ac_cv_func_link" != yes ; then
500    AC_MSG_CHECKING(if tic should use symbolic links)
501    if test "$ac_cv_func_symlink" = yes ; then
502    	with_symlinks=yes
503    else
504    	with_symlinks=no
505    fi
506    AC_MSG_RESULT($with_symlinks)
507elif test "$ac_cv_func_symlink" != yes ; then
508    AC_MSG_CHECKING(if tic should use hard links)
509    if test "$ac_cv_func_link" = yes ; then
510    	with_links=yes
511    else
512    	with_links=no
513    fi
514    AC_MSG_RESULT($with_links)
515else
516    AC_MSG_CHECKING(if tic should use symbolic links)
517    AC_ARG_ENABLE(symlinks,
518	[  --enable-symlinks       make tic use symbolic links not hard links],
519	[with_symlinks=$enableval],
520	[with_symlinks=no])
521    AC_MSG_RESULT($with_symlinks)
522fi
523
524test "$with_links" = yes && AC_DEFINE(USE_LINKS)
525test "$with_symlinks" = yes && AC_DEFINE(USE_SYMLINKS)
526
527###   use option --enable-broken-linker to force on use of broken-linker support
528AC_MSG_CHECKING(if you want broken-linker support code)
529AC_ARG_ENABLE(broken_linker,
530	[  --enable-broken_linker  compile with broken-linker support code],
531	[with_broken_linker=$enableval],
532	[with_broken_linker=$BROKEN_LINKER])
533AC_MSG_RESULT($with_broken_linker)
534test "$with_broken_linker" = yes && AC_DEFINE(BROKEN_LINKER)
535
536###   use option --enable-bsdpad to have tputs process BSD-style prefix padding
537AC_MSG_CHECKING(if tputs should process BSD-style prefix padding)
538AC_ARG_ENABLE(bsdpad,
539	[  --enable-bsdpad         recognize BSD-style prefix padding],
540	[with_bsdpad=$enableval],
541	[with_bsdpad=no])
542AC_MSG_RESULT($with_bsdpad)
543test "$with_bsdpad" = yes && AC_DEFINE(BSD_TPUTS)
544
545### Enable compiling-in rcs id's
546AC_MSG_CHECKING(if RCS identifiers should be compiled-in)
547AC_ARG_WITH(rcs-ids,
548	[  --with-rcs-ids          compile-in RCS identifiers],
549	[with_rcs_ids=$withval],
550	[with_rcs_ids=no])
551AC_MSG_RESULT($with_rcs_ids)
552test "$with_rcs_ids" = yes && AC_DEFINE(USE_RCS_IDS)
553
554###############################################################################
555CF_MAN_PAGES([ captoinfo clear infocmp infotocap tic toe tput ])
556
557###############################################################################
558CF_HELP_MESSAGE(Extensions:)
559
560### Note that some functions (such as const) are normally disabled anyway.
561AC_MSG_CHECKING(if you want to build with function extensions)
562AC_ARG_ENABLE(ext-funcs,
563	[  --disable-ext-funcs     disable function-extensions],
564	[with_ext_funcs=$enableval],
565	[with_ext_funcs=yes])
566AC_MSG_RESULT($with_ext_funcs)
567if test "$with_ext_funcs" = yes ; then
568	AC_DEFINE(HAVE_CURSES_VERSION)
569	AC_DEFINE(HAVE_HAS_KEY)
570	AC_DEFINE(HAVE_RESIZETERM)
571	AC_DEFINE(HAVE_USE_DEFAULT_COLORS)
572	AC_DEFINE(HAVE_WRESIZE)
573	AC_DEFINE(NCURSES_EXT_FUNCS)
574fi
575
576###   use option --enable-const to turn on use of const beyond that in XSI.
577AC_MSG_CHECKING(for extended use of const keyword)
578AC_ARG_ENABLE(const,
579	[  --enable-const          compile with extra/non-standard const],
580	[with_ext_const=$enableval],
581	[with_ext_const=no])
582AC_MSG_RESULT($with_ext_const)
583NCURSES_CONST='/*nothing*/'
584if test "$with_ext_const" = yes ; then
585	NCURSES_CONST=const
586fi
587AC_SUBST(NCURSES_CONST)
588
589AC_MSG_CHECKING(if you want \$NCURSES_NO_PADDING code)
590AC_ARG_ENABLE(no-padding,
591	[  --enable-no-padding     compile with \$NCURSES_NO_PADDING code],
592	[with_no_padding=$enableval],
593	[with_no_padding=$with_ext_funcs])
594AC_MSG_RESULT($with_no_padding)
595test "$with_no_padding" = yes && AC_DEFINE(NCURSES_NO_PADDING)
596
597###   use option --enable-sigwinch to turn on use of SIGWINCH logic
598AC_MSG_CHECKING(if you want SIGWINCH handler)
599AC_ARG_ENABLE(sigwinch,
600	[  --enable-sigwinch       compile with SIGWINCH handler],
601	[with_sigwinch=$enableval],
602	[with_sigwinch=$with_ext_funcs])
603AC_MSG_RESULT($with_sigwinch)
604test "$with_sigwinch" = yes && AC_DEFINE(USE_SIGWINCH)
605
606###   use option --enable-tcap-names to allow user to define new capabilities
607AC_MSG_CHECKING(if you want user-definable terminal capabilities like termcap)
608AC_ARG_ENABLE(tcap-names,
609	[  --enable-tcap-names     compile with user-definable terminal capabilities],
610	[with_tcap_names=$enableval],
611	[with_tcap_names=$with_ext_funcs])
612AC_MSG_RESULT($with_tcap_names)
613NCURSES_XNAMES=0
614test "$with_tcap_names" = yes && NCURSES_XNAMES=1
615AC_SUBST(NCURSES_XNAMES)
616
617###############################################################################
618# These options are relatively safe to experiment with.
619CF_HELP_MESSAGE(Development Code:)
620AC_MSG_CHECKING(if you want all development code)
621AC_ARG_WITH(develop,
622	[  --with-develop          enable all development options],
623	[with_develop=$withval],
624	[with_develop=no])
625AC_MSG_RESULT($with_develop)
626
627###   use option --enable-colorfgbg to turn on use of $COLORFGBG environment
628AC_MSG_CHECKING(if you want colorfgbg code)
629AC_ARG_ENABLE(hard-tabs,
630	[  --enable-colorfgbg      compile with \$COLORFGBG code],
631	[with_colorfgbg=$enableval],
632	[with_colorfgbg=$with_develop])
633AC_MSG_RESULT($with_colorfgbg)
634test "$with_colorfgbg" = yes && AC_DEFINE(USE_COLORFGBG)
635
636###   use option --enable-hard-tabs to turn on use of hard-tabs optimize
637AC_MSG_CHECKING(if you want hard-tabs code)
638AC_ARG_ENABLE(hard-tabs,
639	[  --enable-hard-tabs      compile with hard-tabs code],
640	[with_hardtabs=$enableval],
641	[with_hardtabs=$with_develop])
642AC_MSG_RESULT($with_hardtabs)
643test "$with_hardtabs" = yes && AC_DEFINE(USE_HARD_TABS)
644
645AC_MSG_CHECKING(if you want to use restrict environment when running as root)
646AC_ARG_ENABLE(root-environ,
647	[  --disable-root-environ  limit environment when running as root],
648	[with_root_environ=$enableval],
649	[with_root_environ=yes])
650AC_MSG_RESULT($with_root_environ)
651test "$with_root_environ" = yes && AC_DEFINE(USE_ROOT_ENVIRON)
652
653###   use option --enable-xmc-glitch to turn on use of magic-cookie optimize
654AC_MSG_CHECKING(if you want limited support for xmc)
655AC_ARG_ENABLE(xmc-glitch,
656	[  --enable-xmc-glitch     compile with limited support for xmc],
657	[with_xmc_glitch=$enableval],
658	[with_xmc_glitch=$with_develop])
659AC_MSG_RESULT($with_xmc_glitch)
660test "$with_xmc_glitch" = yes && AC_DEFINE(USE_XMC_SUPPORT)
661
662###############################################################################
663# These are just experimental, probably should not be in a package:
664CF_HELP_MESSAGE(Experimental Code:)
665
666AC_MSG_CHECKING(if you do not want to assume colors are white-on-black)
667AC_ARG_ENABLE(assumed-color,
668	[  --disable-assumed-color do not assume anything about default-colors],
669	[with_assumed_color=$enableval],
670	[with_assumed_color=yes])
671AC_MSG_RESULT($with_assumed_color)
672test "$with_assumed_color" = yes && AC_DEFINE(USE_ASSUMED_COLOR)
673
674###   use option --enable-hashmap to turn on use of hashmap scrolling logic
675AC_MSG_CHECKING(if you want hashmap scrolling-optimization code)
676AC_ARG_ENABLE(hashmap,
677	[  --disable-hashmap       compile without hashmap scrolling-optimization],
678	[with_hashmap=$enableval],
679	[with_hashmap=yes])
680AC_MSG_RESULT($with_hashmap)
681test "$with_hashmap" = yes && AC_DEFINE(USE_HASHMAP)
682
683AC_MSG_CHECKING(if you want experimental safe-sprintf code)
684AC_ARG_ENABLE(safe-sprintf,
685	[  --enable-safe-sprintf   compile with experimental safe-sprintf code],
686	[with_safe_sprintf=$enableval],
687	[with_safe_sprintf=no])
688AC_MSG_RESULT($with_safe_sprintf)
689test "$with_safe_sprintf" = yes && AC_DEFINE(USE_SAFE_SPRINTF)
690
691###   use option --disable-scroll-hints to turn off use of scroll-hints scrolling logic
692# when hashmap is used scroll hints are useless
693if test "$with_hashmap" = no ; then
694AC_MSG_CHECKING(if you want to experiment without scrolling-hints code)
695AC_ARG_ENABLE(scroll-hints,
696	[  --disable-scroll-hints  compile without scroll-hints code],
697	[with_scroll_hints=$enableval],
698	[with_scroll_hints=yes])
699AC_MSG_RESULT($with_scroll_hints)
700test "$with_scroll_hints" = yes && AC_DEFINE(USE_SCROLL_HINTS)
701fi
702
703###   use option --enable-widec to turn on use of wide-character support
704AC_MSG_CHECKING(if you want experimental wide-character code)
705AC_ARG_ENABLE(widec,
706	[  --enable-widec          compile with experimental wide-char/UTF-8 code],
707	[with_widec=$enableval],
708	[with_widec=no])
709AC_MSG_RESULT($with_widec)
710if test "$with_widec" = yes ; then
711	LIB_SUFFIX="w${LIB_SUFFIX}"
712	AC_DEFINE(USE_WIDEC_SUPPORT)
713fi
714
715###############################################################################
716CF_HELP_MESSAGE(Testing/development Options:)
717
718###	use option --disable-echo to suppress full display compiling commands
719AC_MSG_CHECKING(if you want to display full commands during build)
720AC_ARG_ENABLE(echo,
721	[  --enable-echo           build: display "compiling" commands (default)],
722	[with_echo=$enableval],
723	[with_echo=yes])
724if test "$with_echo" = yes; then
725	ECHO_LINK=
726else
727	ECHO_LINK='@ echo linking $@ ... ;'
728fi
729AC_MSG_RESULT($with_echo)
730AC_SUBST(ECHO_LINK)
731
732###	use option --enable-warnings to turn on all gcc warnings
733AC_MSG_CHECKING(if you want to see compiler warnings)
734AC_ARG_ENABLE(warnings,
735	[  --enable-warnings       build: turn on GCC compiler warnings],
736	[with_warnings=$enableval])
737if test -n "$with_warnings"; then
738 	ADAFLAGS="$ADAFLAGS -gnatg"
739	CF_GCC_WARNINGS
740fi
741AC_MSG_RESULT($with_warnings)
742CF_GCC_ATTRIBUTES
743
744###	use option --enable-assertions to turn on generation of assertion code
745AC_MSG_CHECKING(if you want to enable runtime assertions)
746AC_ARG_ENABLE(assertions,
747	[  --enable-assertions     test: turn on generation of assertion code],
748	[with_assertions=$enableval],
749	[with_assertions=no])
750AC_MSG_RESULT($with_assertions)
751if test -n "$GCC"
752then
753	if test "$with_assertions" = no
754	then
755		AC_DEFINE(NDEBUG)
756		CPPFLAGS="$CPPFLAGS -DNDEBUG"
757	else
758		ADAFLAGS="$ADAFLAGS -gnata"
759	fi
760fi
761
762###	use option --disable-leaks to suppress "permanent" leaks, for testing
763AC_ARG_ENABLE(leaks,
764	[  --disable-leaks         test: suppress permanent memory-leaks],
765	[test "$enableval" = no && AC_DEFINE(NO_LEAKS)])
766AC_DEFINE(HAVE_NC_ALLOC_H)
767
768###	use option --enable-expanded to generate certain macros as functions
769AC_ARG_ENABLE(expanded,
770	[  --enable-expanded       test: generate functions for certain macros],
771	[test "$enableval" = yes && AC_DEFINE(NCURSES_EXPANDED)])
772
773###	use option --disable-macros to suppress macros in favor of functions
774AC_ARG_ENABLE(macros,
775	[  --disable-macros        test: use functions rather than macros],
776	[test "$enableval" = no && AC_DEFINE(NCURSES_NOMACROS)])
777
778###	Checks for libraries.
779AC_CHECK_FUNC(gettimeofday,
780	AC_DEFINE(HAVE_GETTIMEOFDAY),[
781
782AC_CHECK_LIB(bsd, gettimeofday,
783	AC_DEFINE(HAVE_GETTIMEOFDAY)
784	LIBS="$LIBS -lbsd")])dnl CLIX: bzero, select, gettimeofday
785
786CF_MATH_LIB(MATH_LIB,sin(x))
787AC_SUBST(MATH_LIB)
788
789###	Checks for header files.
790AC_STDC_HEADERS
791AC_HEADER_DIRENT
792CF_REGEX
793
794dnl These are some other potentially nonportable headers.
795AC_CHECK_HEADERS( \
796fcntl.h \
797getopt.h \
798libc.h \
799limits.h \
800locale.h \
801poll.h \
802sys/bsdtypes.h \
803sys/ioctl.h \
804sys/param.h \
805sys/poll.h \
806sys/select.h \
807sys/time.h \
808sys/times.h \
809ttyent.h \
810unistd.h \
811)
812
813# check for ISC (this may also define _POSIX_SOURCE)
814# Note: even non-Posix ISC needs <sys/bsdtypes.h> to declare fd_set
815if test "$ISC" = yes ; then
816	AC_CHECK_LIB(cposix,main)
817	AC_CHECK_LIB(inet,bzero,LIBS="$LIBS -linet")dnl also 'select()'
818fi
819
820CF_SYS_TIME_SELECT
821
822###	checks for compiler characteristics
823AC_LANG_C
824AC_C_CONST
825AC_C_INLINE
826test "$ac_cv_c_inline" != no && AC_DEFINE(CC_HAS_INLINE_FUNCS)
827
828CF_TYPEOF_CHTYPE
829CF_WIDEC_SHIFT
830
831###	Checks for external-data
832CF_ERRNO
833CF_LINK_DATAONLY
834
835###	Checks for library functions.
836AC_CHECK_FUNCS( \
837getcwd \
838getegid \
839geteuid \
840getttynam \
841issetugid \
842memccpy \
843mkstemp \
844nanosleep \
845poll \
846remove \
847select \
848setbuf \
849setbuffer \
850setvbuf \
851sigaction \
852sigvec \
853strdup \
854strstr \
855tcgetpgrp \
856times \
857vfscanf \
858vsnprintf \
859vsscanf \
860)
861if test "$with_getcap" = "yes" ; then
862	CF_CGETENT
863fi
864
865CF_ISASCII
866CF_STRUCT_SIGACTION
867CF_FUNC_TERMIOS
868
869dnl FIXME (may need this) AC_SYS_RESTARTABLE_SYSCALLS
870if test "$cross_compiling" = yes ; then
871	AC_MSG_WARN(cross compiling: assume setvbuf params not reversed)
872else
873	AC_FUNC_SETVBUF_REVERSED
874fi
875AC_TYPE_SIGNAL
876CF_TYPE_SIGACTION
877CF_SIZECHANGE
878CF_FUNC_MEMMOVE
879CF_FUNC_POLL
880
881dnl We'll do our own -g libraries, unless the user's overridden via $CFLAGS
882if test -z "$cf_user_CFLAGS" ; then
883	CF_STRIP_G_OPT(CFLAGS)
884	CF_STRIP_G_OPT(CXXFLAGS)
885fi
886
887dnl Check for C++ compiler characteristics (and ensure that it's there!)
888CF_BOOL_DECL(cf_cv_cc_bool_type)
889if test -n "$CXX" ; then
890	AC_LANG_CPLUSPLUS
891	CF_STDCPP_LIBRARY
892	if test "$GXX" = yes; then
893		case "`${CXX-g++} --version`" in
894		1*|2.[0-6]*)
895			cf_cxx_library=yes
896			;;
897		2.7*)
898			CF_GPP_LIBRARY
899			;;
900		*)
901			cf_cxx_library=no
902			;;
903		esac
904	else
905		cf_cxx_library=no
906	fi
907	AC_CHECK_HEADERS(typeinfo)
908	CF_BOOL_DECL
909	CF_BOOL_SIZE
910	CF_ETIP_DEFINES
911	CF_CPP_PARAM_INIT
912	case $cf_cv_system_name in #(vi
913	sco3.2v5*)
914	    CXXLDFLAGS="-u main"
915	    ;;
916	esac
917	AC_SUBST(CXXLDFLAGS)
918else
919	cf_cxx_library=no
920	cf_cv_builtin_bool=1
921
922	# Just because we are not configuring against C++ right now does not
923	# mean that a user will not want to use C++.  Some distributors disable
924	# the C++ portion of this configuration as a shortcut (or just to avoid
925	# compiling the demo in the c++ directory).  So we need a reasonable
926	# default for the 'bool' type.
927	#
928	# Caveat: since the storage of the bool type is not standardized, it
929	# may change.
930
931	AC_MSG_CHECKING(for fallback type of bool)
932	case "$host_cpu" in #(vi
933	i?86)	cf_cv_type_of_bool=char	;; #(vi
934	*)	cf_cv_type_of_bool=int	;;
935	esac
936	AC_MSG_RESULT($cf_cv_type_of_bool)
937fi
938AC_SUBST(CXXLIBS)
939
940CF_HELP_MESSAGE(Ada95 Binding Options:)
941
942dnl Check for availability of GNU Ada Translator (GNAT).
943dnl At the moment we support no other Ada95 compiler.
944if test "$cf_with_ada" != "no" ; then
945cf_ada_make=gnatmake
946AC_CHECK_PROG(gnat_exists, $cf_ada_make, yes, no)
947if test "$ac_cv_prog_gnat_exists" = no; then
948   cf_ada_make=
949else
950   CF_GNAT_VERSION
951   AC_CHECK_PROG(M4_exists, m4, yes, no)
952   if test "$ac_cv_prog_M4_exists" = no; then
953      cf_cv_prog_gnat_correct=no
954      echo Ada95 binding required program m4 not found. Ada95 binding disabled.
955   fi
956   if test "$cf_cv_prog_gnat_correct" = yes; then
957      AC_MSG_CHECKING(if GNAT works)
958      CF_GNAT_TRY_RUN([procedure conftest;],
959[with Text_IO;
960with GNAT.OS_Lib;
961procedure conftest is
962begin
963   Text_IO.Put ("Hello World");
964   Text_IO.New_Line;
965   GNAT.OS_Lib.OS_Exit (0);
966end conftest;],[cf_cv_prog_gnat_correct=yes],[cf_cv_prog_gnat_correct=no])
967      AC_MSG_RESULT($cf_cv_prog_gnat_correct)
968   fi
969fi
970if test	"$cf_cv_prog_gnat_correct" = yes; then
971   ADAFLAGS="-O3 -gnatpn $ADAFLAGS"
972
973   AC_ARG_WITH(ada-compiler,
974	[  --with-ada-compiler=CMD specify Ada95 compiler command (default gnatmake)],
975	[cf_ada_compiler=$withval],
976	[cf_ada_compiler=gnatmake])
977
978   cf_ada_package=terminal_interface
979
980   AC_SUBST(cf_ada_make)
981   AC_SUBST(cf_ada_compiler)
982   AC_SUBST(cf_ada_package)
983   AC_SUBST(ADAFLAGS)
984   AC_SUBST(cf_compile_generics)
985   AC_SUBST(cf_generic_objects)
986
987   CF_WITH_PATH(ada-include,
988       [  --with-ada-include=DIR  Ada includes are in DIR],
989       ADA_INCLUDE,
990       PREFIX/lib/ada/adainclude,
991       [$]prefix/lib/ada/adainclude)
992   AC_SUBST(ADA_INCLUDE)
993
994   CF_WITH_PATH(ada-objects,
995       [  --with-ada-objects=DIR  Ada objects are in DIR],
996       ADA_OBJECTS,
997       PREFIX/lib/ada/adalib,
998       [$]prefix/lib/ada/adalib)
999   AC_SUBST(ADA_OBJECTS)
1000
1001fi
1002fi
1003
1004### It's not possible to appease gcc 2.6.3's conversion-warnings if we're
1005### using a 'char' for bools.  gcc 2.7.0's conversion-warnings are broken too
1006### badly to consider using for development purposes, but 2.5.8 is okay.
1007if test -n "$with_warnings"; then
1008	if test "$GCC" = yes; then
1009		case "`$CC --version`" in
1010		2.6.3)
1011			if test "$cf_cv_type_of_bool" != "char"; then
1012				EXTRA_CFLAGS="$EXTRA_CFLAGS -Wconversion"
1013			fi
1014			;;
1015		2.5*)
1016			EXTRA_CFLAGS="$EXTRA_CFLAGS -Wconversion"
1017			;;
1018		esac
1019	fi
1020fi
1021
1022### Construct the library-subsets, if any, from this set of keywords:
1023### none, base, ext_funcs, termlib.
1024AC_MSG_CHECKING(for library subsets)
1025if test "$with_termlib" = yes ; then
1026	LIB_SUBSETS="termlib "
1027else
1028	LIB_SUBSETS="termlib+"
1029fi
1030LIB_SUBSETS="${LIB_SUBSETS}base"
1031test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs"
1032AC_MSG_RESULT($LIB_SUBSETS)
1033
1034LIB_TRACING=DEBUG
1035case "$CFLAGS" in
1036*-DTRACE*)
1037	LIB_TRACING=all
1038	;;
1039esac
1040
1041### Construct the list of include-directories to be generated
1042CF_INCLUDE_DIRS
1043CF_ADA_INCLUDE_DIRS
1044
1045### Build up pieces for makefile rules
1046AC_MSG_CHECKING(default library suffix)
1047CF_LIB_TYPE($DFT_LWR_MODEL,DFT_ARG_SUFFIX)dnl
1048AC_SUBST(DFT_ARG_SUFFIX)dnl the string to append to "-lncurses" ("")
1049AC_MSG_RESULT($DFT_ARG_SUFFIX)
1050
1051AC_MSG_CHECKING(default library-dependency suffix)
1052CF_LIB_SUFFIX($DFT_LWR_MODEL,DFT_DEP_SUFFIX)dnl
1053AC_SUBST(DFT_DEP_SUFFIX)dnl the corresponding library-suffix (".a")
1054AC_MSG_RESULT($DFT_DEP_SUFFIX)
1055
1056AC_MSG_CHECKING(default object directory)
1057CF_OBJ_SUBDIR($DFT_LWR_MODEL,DFT_OBJ_SUBDIR)dnl
1058AC_SUBST(DFT_OBJ_SUBDIR)dnl the default object-directory ("obj")
1059AC_MSG_RESULT($DFT_OBJ_SUBDIR)
1060
1061TINFO_LIST="$SHLIB_LIST"
1062test "$with_termlib" = yes && SHLIB_LIST="$SHLIB_LIST -ltinfo${LIB_SUFFIX}"
1063
1064AC_MSG_CHECKING(where we will install curses.h)
1065test "$with_overwrite" = no && \
1066test "x$includedir" = 'x${prefix}/include' && \
1067	includedir='$(prefix)/include/ncurses'${LIB_SUFFIX}
1068AC_MSG_RESULT($includedir)
1069
1070AC_SUBST(EXTRA_LIBS)
1071AC_SUBST(TINFO_LIST)
1072AC_SUBST(SHLIB_LIST)
1073
1074### Set up low-level terminfo dependencies for makefiles.  Note that we
1075### could override this.
1076if test "$with_termlib" = yes ; then
1077	TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${TINFO_NAME}${DFT_DEP_SUFFIX}"
1078	TEST_ARGS="-l${TINFO_NAME}${DFT_ARG_SUFFIX}"
1079fi
1080PROG_DEPS="$TEST_DEPS"
1081PROG_ARGS="$TEST_ARGS"
1082
1083### Construct the list of subdirectories for which we'll customize makefiles
1084### with the appropriate compile-rules.
1085
1086CF_SRC_MODULES($modules_to_build)
1087CF_DIRS_TO_MAKE
1088
1089### Now that we're done running tests, add the compiler-warnings, if any
1090CFLAGS="$CFLAGS $EXTRA_CFLAGS"
1091
1092################################################################################
1093AC_OUTPUT( \
1094	include/MKterm.h.awk \
1095	include/curses.h \
1096	include/termcap.h \
1097	include/unctrl.h \
1098	misc/run_tic.sh:misc/run_tic.in \
1099	$SUB_MAKEFILES \
1100	Makefile,[
1101CF_LIB_RULES
1102],[
1103### Special initialization commands, used to pass information from the
1104### configuration-run into config.status
1105
1106AWK="$AWK"
1107CF_LIST_MODELS="$cf_list_models"
1108DFT_LWR_MODEL="$DFT_LWR_MODEL"
1109LDCONFIG="$LDCONFIG"
1110LIB_NAME="$LIB_NAME"
1111LIB_SUFFIX="$LIB_SUFFIX"
1112LIB_SUBSETS="$LIB_SUBSETS"
1113LIB_TRACING="$LIB_TRACING"
1114SRC_SUBDIRS="$SRC_SUBDIRS"
1115TERMINFO="$TERMINFO"
1116TINFO_NAME="$TINFO_NAME"
1117WITH_ECHO="$with_echo"
1118WITH_OVERWRITE="$with_overwrite"
1119cf_cv_abi_version="$cf_cv_abi_version"
1120cf_cv_do_symlinks="$cf_cv_do_symlinks"
1121cf_cv_rel_version="$cf_cv_rel_version"
1122cf_cv_rm_so_locs="$cf_cv_rm_so_locs"
1123cf_cv_system_name="$cf_cv_system_name"
1124cf_with_cxx_binding="$cf_with_cxx_binding"
1125cf_cv_shlib_version="$cf_cv_shlib_version"
1126target="$target"
1127
1128],sort)dnl
1129${MAKE-make} preinstall
1130