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