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