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