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