ncurses 5.9 - patch 20120331
[ncurses.git] / configure.in
1 dnl***************************************************************************
2 dnl Copyright (c) 1998-2011,2012 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.549 2012/04/01 00:09:52 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.549 $)
39 AC_INIT(ncurses/base/lib_initscr.c)
40 AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin)
41
42 CF_TOP_BUILDDIR
43 CF_SUBST_NCURSES_VERSION
44
45 CF_WITH_REL_VERSION(NCURSES)
46 CF_WITH_ABI_VERSION
47
48 CF_CHECK_CACHE([AC_CANONICAL_SYSTEM])
49 AC_ARG_WITH(system-type,
50 [  --with-system-type=XXX  test: override derived host system-type],
51 [AC_MSG_WARN(overriding system type to $withval)
52  cf_cv_system_name=$withval])
53
54 ###     Save the given $CFLAGS to allow user-override.
55 cf_user_CFLAGS="$CFLAGS"
56
57 ###     Default install-location
58 CF_CFG_DEFAULTS
59
60 ###     Checks for programs.
61 AC_ARG_WITH(ada,
62         [  --without-ada           suppress check for Ada95, don't build demo],
63         [cf_with_ada=$withval],
64         [cf_with_ada=yes])
65 if test x"$cf_with_ada" = xyes
66 then
67         cf_PROG_CC="gnatgcc gcc cc"
68 else
69         cf_PROG_CC="gcc cc"
70 fi
71
72 AC_PROG_CC($cf_PROG_CC)
73 CF_GCC_VERSION
74
75 AC_PROG_CPP
76 AC_PROG_GCC_TRADITIONAL
77 CF_PROG_CC_C_O(CC)
78 AC_ISC_POSIX
79 CF_ANSI_CC_REQD
80 CF_PROG_EXT
81 CF_PROG_LDCONFIG
82
83 dnl DEFECT in autoconf 2.12:    an attempt to set policy, this breaks the
84 dnl                             configure script by not letting us test if C++
85 dnl                             is present, making this option necessary.
86 AC_MSG_CHECKING(if you want to ensure bool is consistent with C++)
87 AC_ARG_WITH(cxx,
88         [  --without-cxx           do not adjust ncurses bool to match C++],
89         [cf_with_cxx=$withval],
90         [cf_with_cxx=yes])
91 AC_MSG_RESULT($cf_with_cxx)
92 if test "X$cf_with_cxx" = Xno ; then
93         CXX=""
94         GXX=""
95 else
96         # with autoconf 2.13, we can change the error to a warning:
97         pushdef([AC_MSG_ERROR],
98                 [AC_MSG_RESULT(no)
99                  AC_MSG_WARN([You don't have any C++ compiler, too bad])
100                 cf_with_cxx=no; CXX=""; GXX="";])dnl
101         AC_PROG_CXX
102         popdef([AC_MSG_ERROR])dnl
103         # autoconf 2.5x removed the error (hardcoding it to g++, or just blank)
104         if test "$CXX" = "g++" ; then
105                 AC_PATH_PROG(CXX,g++)
106         fi
107         case "x$CXX" in #(vi
108         x|xg++)
109                 AC_MSG_WARN([You don't have any C++ compiler, too bad])
110                 cf_with_cxx=no; CXX=""; GXX="";
111                 ;;
112         esac
113 fi
114
115 CF_GXX_VERSION
116 case $GXX_VERSION in
117 1*|2.[[0-6]]*)
118         # GXX=""; CXX=""; ac_cv_prog_gxx=no
119         # cf_cxx_library=no
120         AC_MSG_WARN(templates do not work)
121         ;;
122 esac
123
124 AC_MSG_CHECKING(if you want to build C++ binding and demo)
125 AC_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])
129 AC_MSG_RESULT($cf_with_cxx_binding)
130
131 AC_MSG_CHECKING(if you want to build with Ada95)
132 AC_MSG_RESULT($cf_with_ada)
133
134 AC_MSG_CHECKING(if you want to install manpages)
135 AC_ARG_WITH(manpages,
136         [  --without-manpages      suppress install of manpages],
137         [cf_with_manpages=$withval],
138         [cf_with_manpages=yes])
139 AC_MSG_RESULT($cf_with_manpages)
140
141 AC_MSG_CHECKING(if you want to build programs such as tic)
142 AC_ARG_WITH(progs,
143         [  --without-progs         suppress build with programs (e.g., tic)],
144         [cf_with_progs=$withval],
145         [cf_with_progs=yes])
146 AC_MSG_RESULT($cf_with_progs)
147
148 AC_MSG_CHECKING(if you want to build test-programs)
149 AC_ARG_WITH(tests,
150         [  --without-tests         suppress build with test-programs],
151         [cf_with_tests=$withval],
152         [cf_with_tests=yes])
153 AC_MSG_RESULT($cf_with_tests)
154
155 AC_MSG_CHECKING(if you wish to install curses.h)
156 AC_ARG_WITH(curses-h,
157         [  --without-curses-h      install curses.h as ncurses.h only],
158         [with_curses_h=$withval],
159         [with_curses_h=yes])
160 AC_MSG_RESULT($with_curses_h)
161
162 modules_to_build="ncurses"
163 if test "X$cf_with_progs" != Xno ; then
164 modules_to_build="$modules_to_build progs tack"
165 fi
166 modules_to_build="$modules_to_build panel menu form"
167
168 AC_ARG_PROGRAM
169
170 CF_PROG_AWK
171 CF_PROG_EGREP
172 CF_PROG_INSTALL
173 CF_PROG_LINT
174 CF_PROG_LN_S
175
176 AC_SYS_LONG_FILE_NAMES
177
178 # if we find pkg-config, check if we should install the ".pc" files.
179 CF_PKG_CONFIG
180 CF_WITH_PKG_CONFIG_LIBDIR
181 CF_ENABLE_PC_FILES
182
183 AC_MSG_CHECKING(if we should assume mixed-case filenames)
184 AC_ARG_ENABLE(mixed-case,
185         [  --enable-mixed-case     tic should assume mixed-case filenames],
186         [enable_mixedcase=$enableval],
187         [enable_mixedcase=auto])
188 AC_MSG_RESULT($enable_mixedcase)
189 if test "$enable_mixedcase" = "auto" ; then
190     CF_MIXEDCASE_FILENAMES
191 else
192     cf_cv_mixedcase=$enable_mixedcase
193     if test "$enable_mixedcase" = "yes" ; then
194         AC_DEFINE(MIXEDCASE_FILENAMES)
195     fi
196 fi
197
198 # do this after mixed-case option (tags/TAGS is not as important as tic).
199 AC_PROG_MAKE_SET
200 CF_MAKE_TAGS
201 CF_MAKEFLAGS
202
203 dnl These are standard among *NIX systems, but not when cross-compiling
204 AC_CHECK_TOOL(RANLIB, ranlib, ':')
205 AC_CHECK_TOOL(LD, ld, ld)
206 AC_CHECK_TOOL(AR, ar, ar)
207 CF_AR_FLAGS
208
209 dnl Special option for use by system-builders: the install-prefix is used to
210 dnl adjust the location into which the actual install is done, so that an
211 dnl archive can be built without modifying the host system's configuration.
212 AC_MSG_CHECKING(if you have specified an install-prefix)
213 AC_ARG_WITH(install-prefix,
214         [  --with-install-prefix   prefixes actual install-location ($DESTDIR)],
215         [case "$withval" in #(vi
216         yes|no) #(vi
217                 ;;
218         *)      DESTDIR="$withval"
219                 ;;
220         esac])
221 AC_MSG_RESULT($DESTDIR)
222 AC_SUBST(DESTDIR)
223
224 ###############################################################################
225 CF_HELP_MESSAGE(Build-Tools Needed to Compile Temporary Applications for Cross-compiling:)
226 # If we're cross-compiling, allow the user to override the tools and their
227 # options.  The configure script is oriented toward identifying the host
228 # compiler, etc., but we need a build compiler to generate parts of the source.
229 CF_BUILD_CC
230
231 ###############################################################################
232 CF_HELP_MESSAGE(Options to Specify the Libraries Built/Used:)
233
234 ### Options to allow the user to specify the set of libraries which are used.
235 ### Use "--without-normal --with-shared" to allow the default model to be
236 ### shared, for example.
237 cf_list_models=""
238 AC_SUBST(cf_list_models)dnl     the complete list of models ("normal debug")
239
240 CF_WITH_LIBTOOL
241 if test "$with_libtool" != "no" ; then
242
243 cf_list_models="$cf_list_models libtool"
244
245 else
246
247 AC_MSG_CHECKING(if you want to build shared libraries)
248 AC_ARG_WITH(shared,
249         [  --with-shared           generate shared-libraries],
250         [with_shared=$withval],
251         [with_shared=no])
252 AC_MSG_RESULT($with_shared)
253 test "$with_shared" = "yes" && cf_list_models="$cf_list_models shared"
254
255 AC_MSG_CHECKING(if you want to build static libraries)
256 AC_ARG_WITH(normal,
257         [  --with-normal           generate normal-libraries (default)],
258         [with_normal=$withval],
259         [with_normal=yes])
260 AC_MSG_RESULT($with_normal)
261 test "$with_normal" = "yes" && cf_list_models="$cf_list_models normal"
262
263 AC_MSG_CHECKING(if you want to build debug libraries)
264 AC_ARG_WITH(debug,
265         [  --with-debug            generate debug-libraries (default)],
266         [with_debug=$withval],
267         [with_debug=yes])
268 AC_MSG_RESULT($with_debug)
269 test "$with_debug" = "yes" && cf_list_models="$cf_list_models debug"
270
271 AC_MSG_CHECKING(if you want to build profiling libraries)
272 AC_ARG_WITH(profile,
273         [  --with-profile          generate profile-libraries],
274         [with_profile=$withval],
275         [with_profile=no])
276 AC_MSG_RESULT($with_profile)
277 test "$with_profile" = "yes" && cf_list_models="$cf_list_models profile"
278
279 fi
280
281 ###############################################################################
282
283 AC_MSG_CHECKING(for specified models)
284 test -z "$cf_list_models" && cf_list_models=normal
285 dnl If we use libtool to generate libraries, then it must be the only
286 dnl specified model.
287 test "$with_libtool" != "no" && cf_list_models=libtool
288 AC_MSG_RESULT($cf_list_models)
289
290 ### Use the first model as the default, and save its suffix for use in building
291 ### up test-applications.
292 AC_MSG_CHECKING(for default model)
293 DFT_LWR_MODEL=`echo "$cf_list_models" | $AWK '{print $1}'`
294 AC_MSG_RESULT($DFT_LWR_MODEL)
295
296 CF_UPPER(DFT_UPR_MODEL,$DFT_LWR_MODEL)dnl
297
298 AC_SUBST(DFT_LWR_MODEL)dnl      the default model ("normal")
299 AC_SUBST(DFT_UPR_MODEL)dnl      the default model ("NORMAL")
300
301 TICS_NAME=tic
302 AC_SUBST(TICS_NAME)
303
304 TINFO_NAME=tinfo
305 AC_SUBST(TINFO_NAME)
306
307 LIB_NAME=ncurses
308 AC_SUBST(LIB_NAME)
309
310 LIB_DIR=../lib
311 LIB_2ND=../../lib
312
313 CF_WITH_LIB_PREFIX(cf_prefix)
314
315 LIB_SUFFIX=
316 AC_SUBST(LIB_SUFFIX)
317
318 ###############################################################################
319
320 AC_MSG_CHECKING(if you want to build a separate terminfo library)
321 AC_ARG_WITH(termlib,
322         [  --with-termlib          generate separate terminfo library],
323         [with_termlib=$withval],
324         [with_termlib=no])
325 AC_MSG_RESULT($with_termlib)
326
327 AC_MSG_CHECKING(if you want to build a separate tic library)
328 AC_ARG_WITH(ticlib,
329         [  --with-ticlib           generate separate tic library],
330         [with_ticlib=$withval],
331         [with_ticlib=no])
332 AC_MSG_RESULT($with_ticlib)
333
334 ### Checks for special libraries, must be done up-front.
335 SHLIB_LIST=""
336 CF_WITH_GPM
337 if test "$with_gpm" != no ; then
338         AC_MSG_CHECKING(if you want to load GPM dynamically)
339         AC_ARG_WITH(dlsym,
340                 [  --without-dlsym         do not use dlsym() to load GPM dynamically],
341                 [with_dlsym=$withval],
342                 [with_dlsym=yes])
343         AC_MSG_RESULT($with_dlsym)
344         if test "$with_dlsym" = yes ; then
345                 CF_FUNC_DLSYM
346                 if test "$with_gpm" != yes ; then
347                         CF_VERBOSE(assuming soname for gpm is $with_gpm)
348                         cf_cv_gpm_soname="$with_gpm"
349                 else
350                         CF_LIB_SONAME([#include <gpm.h>],[if (Gpm_Open(0,0)) Gpm_Close();],gpm)
351                 fi
352                 test "$cf_cv_gpm_soname" != "unknown" && AC_DEFINE_UNQUOTED(LIBGPM_SONAME,"$cf_cv_gpm_soname")
353                 SHLIB_LIST="-ldl $SHLIB_LIST"
354         else
355                 SHLIB_LIST="-lgpm $SHLIB_LIST"
356                 CF_ADD_LIB(gpm,TEST_LIBS)
357         fi
358         AC_DEFINE(HAVE_LIBGPM)
359         CF_CHECK_GPM_WGETCH
360 fi
361
362 CF_WITH_SYSMOUSE
363
364 dnl Not all ports of gcc support the -g option
365
366 if test X"$CC_G_OPT" = X"" ; then
367         CC_G_OPT='-g'
368         test -n "$GCC" && test "${ac_cv_prog_cc_g}" != yes && CC_G_OPT=''
369 fi
370 AC_SUBST(CC_G_OPT)
371
372 if test X"$CXX_G_OPT" = X"" ; then
373         CXX_G_OPT='-g'
374         test -n "$GXX" && test "${ac_cv_prog_cxx_g}" != yes && CXX_G_OPT=''
375 fi
376 AC_SUBST(CXX_G_OPT)
377
378 AC_MSG_CHECKING(for default loader flags)
379 case $DFT_LWR_MODEL in
380 libtool) LD_MODEL=''   ;;
381 normal)  LD_MODEL=''   ;;
382 debug)   LD_MODEL=$CC_G_OPT ;;
383 profile) LD_MODEL='-pg';;
384 shared)  LD_MODEL=''   ;;
385 esac
386 AC_SUBST(LD_MODEL)dnl           the type of link (e.g., -g or -pg)
387 AC_MSG_RESULT($LD_MODEL)
388
389 case $DFT_LWR_MODEL in
390 shared)
391 CF_ENABLE_RPATH
392 AC_MSG_CHECKING(if shared libraries should be relinked during install)
393 AC_ARG_ENABLE(relink,
394 [  --disable-relink        relink shared libraries during install],
395 [cf_cv_do_relink=$enableval],
396 [cf_cv_do_relink=yes])
397 AC_MSG_RESULT($cf_cv_do_relink)
398         ;;
399 esac
400
401 CF_SHARED_OPTS
402 if test "$CC_SHARED_OPTS" = "unknown"; then
403         for model in $cf_list_models; do
404                 if test "$model" = "shared"; then
405                         AC_ERROR(Shared libraries are not supported in this version)
406                 fi
407         done
408 fi
409
410 ### If we're building with rpath, try to link non-standard libs that way too.
411 if test "$DFT_LWR_MODEL" = "shared"; then
412         CF_DISABLE_RPATH_HACK
413 fi
414
415 ###############################################################################
416 CF_HELP_MESSAGE(Fine-Tuning Your Configuration:)
417
418 ###     use option --disable-overwrite to leave out the link to -lcurses
419 AC_MSG_CHECKING(if you wish to install ncurses overwriting curses)
420 AC_ARG_ENABLE(overwrite,
421         [  --disable-overwrite     leave out the link to -lcurses],
422         [with_overwrite=$enableval],
423         [if test "$prefix" = "/usr" ; then with_overwrite=yes; else with_overwrite=no; fi])
424 AC_MSG_RESULT($with_overwrite)
425
426 AC_MSG_CHECKING(if external terminfo-database is used)
427 AC_ARG_ENABLE(database,
428         [  --disable-database      do not use terminfo, only fallbacks/termcap],
429         [use_database=$enableval],
430         [use_database=yes])
431 AC_MSG_RESULT($use_database)
432
433 case $host_os in #(vi
434 os2*) #(vi
435         TERMINFO_SRC='${top_srcdir}/misc/emx.src'
436         ;;
437 *) #(vi
438         TERMINFO_SRC='${top_srcdir}/misc/terminfo.src'
439         ;;
440 esac
441 AC_SUBST(TERMINFO_SRC)
442
443 if test "$use_database" != no ; then
444         AC_DEFINE(USE_DATABASE)
445
446         AC_MSG_CHECKING(which terminfo source-file will be installed)
447         AC_ARG_WITH(database,
448                 [  --with-database=XXX     specify terminfo source to install],
449                 [TERMINFO_SRC=$withval])
450         AC_MSG_RESULT($TERMINFO_SRC)
451
452         AC_MSG_CHECKING(whether to use hashed database instead of directory/tree)
453         AC_ARG_WITH(hashed-db,
454                 [  --with-hashed-db        specify hashed-database library],,
455                 [with_hashed_db=no])
456         AC_MSG_RESULT($with_hashed_db)
457 else
458         with_hashed_db=no
459 fi
460
461 AC_MSG_CHECKING(for list of fallback descriptions)
462 AC_ARG_WITH(fallbacks,
463         [  --with-fallbacks=XXX    specify list of fallback terminal descriptions],
464         [with_fallback=$withval],
465         [with_fallback=])
466 AC_MSG_RESULT($with_fallback)
467 FALLBACK_LIST=`echo "$with_fallback" | sed -e 's/,/ /g'`
468 AC_SUBST(FALLBACK_LIST)
469
470 AC_MSG_CHECKING(if you want modern xterm or antique)
471 AC_ARG_WITH(xterm-new,
472         [  --without-xterm-new     specify if xterm terminfo should be old version],
473         [with_xterm_new=$withval],
474         [with_xterm_new=yes])
475 case $with_xterm_new in
476 no)     with_xterm_new=xterm-old;;
477 *)      with_xterm_new=xterm-new;;
478 esac
479 AC_MSG_RESULT($with_xterm_new)
480 WHICH_XTERM=$with_xterm_new
481 AC_SUBST(WHICH_XTERM)
482
483 AC_MSG_CHECKING(if xterm backspace sends BS or DEL)
484 AC_ARG_WITH(xterm-kbs,
485         [  --with-xterm-kbs=XXX     specify if xterm backspace sends BS or DEL],
486         [with_xterm_kbs=$withval],
487         [with_xterm_kbs=BS])
488 case x$with_xterm_kbs in
489 xyes|xno|xBS|xbs|x8)
490         with_xterm_kbs=BS
491         ;;
492 xDEL|xdel|x127)
493         with_xterm_kbs=DEL
494         ;;
495 *)
496         with_xterm_kbs=$withval
497         ;;
498 esac
499 AC_MSG_RESULT($with_xterm_kbs)
500 XTERM_KBS=$with_xterm_kbs
501 AC_SUBST(XTERM_KBS)
502
503 MAKE_TERMINFO=
504 if test "$use_database" = no ; then
505         TERMINFO="${datadir}/terminfo"
506         MAKE_TERMINFO="#"
507 else
508
509 AC_MSG_CHECKING(for list of terminfo directories)
510 CF_WITH_PATHLIST(terminfo-dirs,
511         [  --with-terminfo-dirs=XXX specify list of terminfo directories],
512         TERMINFO_DIRS,
513         DATADIR/terminfo,
514         ${datadir}/terminfo)
515 AC_MSG_RESULT($TERMINFO_DIRS)
516 test -n "$TERMINFO_DIRS" && AC_DEFINE_UNQUOTED(TERMINFO_DIRS,"$TERMINFO_DIRS")
517
518 AC_MSG_CHECKING(for default terminfo directory)
519 CF_WITH_PATH(default-terminfo-dir,
520         [  --with-default-terminfo-dir=DIR default terminfo directory],
521         TERMINFO,
522         DATADIR/terminfo,
523         ${datadir}/terminfo)
524 AC_MSG_RESULT($TERMINFO)
525 AC_DEFINE_UNQUOTED(TERMINFO,"$TERMINFO")
526
527 fi
528
529 AC_SUBST(TERMINFO)
530 AC_SUBST(MAKE_TERMINFO)
531
532 ###     use option --disable-big-core to make tic run on small machines
533 ###     We need 4Mb, check if we can allocate 50% more than that.
534 AC_MSG_CHECKING(if big-core option selected)
535 AC_ARG_ENABLE(big-core,
536         [  --disable-big-core      assume machine has little memory],
537         [with_big_core=$enableval],
538         [AC_TRY_RUN([
539 #include <stdlib.h>
540 #include <string.h>
541 int main() {
542         unsigned long n = 6000000L;
543         char *s = malloc(n);
544         if (s != 0)
545                 s[0] = s[n-1] = 0;
546         ${cf_cv_main_return:-return}(s == 0);
547 }],
548         [with_big_core=yes],
549         [with_big_core=no],
550         [with_big_core=no])])
551 AC_MSG_RESULT($with_big_core)
552 test "$with_big_core" = "yes" && AC_DEFINE(HAVE_BIG_CORE)
553
554 ### ISO C only guarantees 512-char strings, we have tables which load faster
555 ### when constructed using "big" strings.  More than the C compiler, the awk
556 ### program is a limit on most vendor UNIX systems.  Check that we can build.
557 AC_MSG_CHECKING(if big-strings option selected)
558 AC_ARG_ENABLE(big-strings,
559         [  --disable-big-strings   assume compiler has only standard-size strings],
560         [with_big_strings=$enableval],
561         [CF_AWK_BIG_PRINTF(12000,with_big_strings)])
562 AC_MSG_RESULT($with_big_strings)
563
564 USE_BIG_STRINGS=0
565 test "$with_big_strings" = "yes" && USE_BIG_STRINGS=1
566 AC_SUBST(USE_BIG_STRINGS)
567
568 ###     use option --enable-termcap to compile in the termcap fallback support
569 AC_MSG_CHECKING(if you want termcap-fallback support)
570 AC_ARG_ENABLE(termcap,
571         [  --enable-termcap        compile in termcap fallback support],
572         [with_termcap=$enableval],
573         [with_termcap=no])
574 AC_MSG_RESULT($with_termcap)
575
576 if test "$with_termcap" != "yes" ; then
577         if test "$use_database" = no ; then
578                 if test -z "$with_fallback" ; then
579                         AC_ERROR(You have disabled the database w/o specifying fallbacks)
580                 fi
581         fi
582         AC_DEFINE(PURE_TERMINFO)
583 else
584
585 if test "$with_ticlib" != no ; then
586         AC_ERROR(Options --with-ticlib and --enable-termcap cannot be combined)
587 fi
588
589 AC_DEFINE(USE_TERMCAP)
590 AC_MSG_CHECKING(for list of termcap files)
591 CF_WITH_PATHLIST(termpath,
592         [  --with-termpath=XXX     specify list of termcap files],
593         TERMPATH,
594         /etc/termcap:/usr/share/misc/termcap)
595 AC_MSG_RESULT($TERMPATH)
596 test -n "$TERMPATH" && AC_DEFINE_UNQUOTED(TERMPATH,"$TERMPATH")
597
598 ###     use option --enable-getcap to use a hacked getcap for reading termcaps
599 AC_MSG_CHECKING(if fast termcap-loader is needed)
600 AC_ARG_ENABLE(getcap,
601         [  --enable-getcap         fast termcap load, no xrefs to terminfo],
602         [with_getcap=$enableval],
603         [with_getcap=no])
604 AC_MSG_RESULT($with_getcap)
605 test "$with_getcap" = "yes" && AC_DEFINE(USE_GETCAP)
606
607 AC_MSG_CHECKING(if translated termcaps will be cached in ~/.terminfo)
608 AC_ARG_ENABLE(getcap-cache,
609         [  --enable-getcap-cache   cache translated termcaps in ~/.terminfo],
610         [with_getcap_cache=$enableval],
611         [with_getcap_cache=no])
612 AC_MSG_RESULT($with_getcap_cache)
613 test "$with_getcap_cache" = "yes" && AC_DEFINE(USE_GETCAP_CACHE)
614
615 fi
616
617 ###   Use option --disable-home-terminfo to completely remove ~/.terminfo
618 AC_MSG_CHECKING(if ~/.terminfo is wanted)
619 AC_ARG_ENABLE(home-terminfo,
620         [  --disable-home-terminfo drop ~/.terminfo from terminfo search-path],
621         [with_home_terminfo=$enableval],
622         [with_home_terminfo=yes])
623 AC_MSG_RESULT($with_home_terminfo)
624 test "$with_home_terminfo" = "yes" && AC_DEFINE(USE_HOME_TERMINFO)
625
626 AC_MSG_CHECKING(if you want to use restricted environment when running as root)
627 AC_ARG_ENABLE(root-environ,
628         [  --disable-root-environ  restrict environment when running as root],
629         [with_root_environ=$enableval],
630         [with_root_environ=yes])
631 AC_MSG_RESULT($with_root_environ)
632 test "$with_root_environ" = yes && AC_DEFINE(USE_ROOT_ENVIRON)
633
634 ###   Use option --enable-symlinks to make tic use symlinks, not hard links
635 ###   to reduce storage requirements for the terminfo database.
636 CF_LINK_FUNCS
637
638 with_links=no
639 with_symlinks=no
640
641 # soft links (symbolic links) are useful for some systems where hard links do
642 # not work, or to make it simpler to copy terminfo trees around.
643 if test "$ac_cv_func_symlink" = yes ; then
644     AC_MSG_CHECKING(if tic should use symbolic links)
645     AC_ARG_ENABLE(symlinks,
646         [  --enable-symlinks       make tic use symbolic links not hard links],
647         [with_symlinks=$enableval],
648         [with_symlinks=no])
649     AC_MSG_RESULT($with_symlinks)
650 fi
651
652 # If we have hard links and did not choose to use soft links instead, there is
653 # no reason to make this choice optional - use the hard links.
654 if test "$with_symlinks" = no ; then
655     AC_MSG_CHECKING(if tic should use hard links)
656     if test "$ac_cv_func_link" = yes ; then
657         with_links=yes
658     else
659         with_links=no
660     fi
661     AC_MSG_RESULT($with_links)
662 fi
663
664 test "$with_links" = yes && AC_DEFINE(USE_LINKS)
665 test "$with_symlinks" = yes && AC_DEFINE(USE_SYMLINKS)
666
667 ###   use option --enable-broken-linker to force on use of broken-linker support
668 AC_MSG_CHECKING(if you want broken-linker support code)
669 AC_ARG_ENABLE(broken_linker,
670         [  --enable-broken_linker  compile with broken-linker support code],
671         [with_broken_linker=$enableval],
672         [with_broken_linker=${BROKEN_LINKER:-no}])
673 AC_MSG_RESULT($with_broken_linker)
674
675 BROKEN_LINKER=0
676 if test "$with_broken_linker" = yes ; then
677         AC_DEFINE(BROKEN_LINKER)
678         BROKEN_LINKER=1
679 elif test "$DFT_LWR_MODEL" = shared ; then
680         case $cf_cv_system_name in #(vi
681         cygwin*)
682                 AC_DEFINE(BROKEN_LINKER)
683                 BROKEN_LINKER=1
684                 CF_VERBOSE(cygwin linker is broken anyway)
685                 ;;
686         esac
687 fi
688 AC_SUBST(BROKEN_LINKER)
689
690 ###   use option --enable-bsdpad to have tputs process BSD-style prefix padding
691 AC_MSG_CHECKING(if tputs should process BSD-style prefix padding)
692 AC_ARG_ENABLE(bsdpad,
693         [  --enable-bsdpad         recognize BSD-style prefix padding],
694         [with_bsdpad=$enableval],
695         [with_bsdpad=no])
696 AC_MSG_RESULT($with_bsdpad)
697 test "$with_bsdpad" = yes && AC_DEFINE(BSD_TPUTS)
698
699 ###   use option --enable-widec to turn on use of wide-character support
700 NCURSES_CH_T=chtype
701 NCURSES_LIBUTF8=0
702
703 NEED_WCHAR_H=0
704 NCURSES_MBSTATE_T=0
705 NCURSES_WCHAR_T=0
706 NCURSES_WINT_T=0
707
708 # Check to define _XOPEN_SOURCE "automatically"
709 CF_XOPEN_SOURCE(500)
710
711 # Work around breakage on OS X
712 CF_SIGWINCH
713
714 # Checks for CODESET support.
715 AM_LANGINFO_CODESET
716
717 # use these variables to work around a defect in gcc's fixincludes.
718 NCURSES_OK_WCHAR_T=
719 NCURSES_OK_WINT_T=
720
721 AC_MSG_CHECKING(if you want wide-character code)
722 AC_ARG_ENABLE(widec,
723         [  --enable-widec          compile with wide-char/UTF-8 code],
724         [with_widec=$enableval],
725         [with_widec=no])
726 AC_MSG_RESULT($with_widec)
727 if test "$with_widec" = yes ; then
728         LIB_SUFFIX="w${LIB_SUFFIX}"
729         AC_DEFINE(USE_WIDEC_SUPPORT)
730         AC_DEFINE(NCURSES_WIDECHAR)
731
732         CF_CHECK_WCHAR_H
733
734         # with_overwrite=no
735         NCURSES_CH_T=cchar_t
736         AC_CHECK_FUNCS(putwc btowc wctob mbtowc wctomb mblen mbrlen mbrtowc wcsrtombs mbsrtowcs wcstombs mbstowcs)
737         if test "$ac_cv_func_putwc" != yes ; then
738                 CF_UTF8_LIB
739                 if test "$cf_cv_utf8_lib" != no ; then
740                         NCURSES_LIBUTF8=1
741                 fi
742         fi
743         CF_WCHAR_TYPE(mbstate_t, NCURSES_MBSTATE_T)
744         CF_WCHAR_TYPE(wchar_t,   NCURSES_WCHAR_T,   NCURSES_OK_WCHAR_T)
745         CF_WCHAR_TYPE(wint_t,    NCURSES_WINT_T,    NCURSES_OK_WINT_T)
746
747         if test "$NCURSES_MBSTATE_T" != 0; then
748                 AC_DEFINE(NEED_MBSTATE_T_DEF)
749         fi
750 fi
751 AC_SUBST(NCURSES_CH_T)
752 AC_SUBST(NCURSES_LIBUTF8)
753
754 AC_SUBST(NEED_WCHAR_H)
755 AC_SUBST(NCURSES_MBSTATE_T)
756 AC_SUBST(NCURSES_WCHAR_T)
757 AC_SUBST(NCURSES_WINT_T)
758
759 AC_SUBST(NCURSES_OK_WCHAR_T)
760 AC_SUBST(NCURSES_OK_WINT_T)
761
762 ###   use option --disable-lp64 to allow long chtype
763 case $cf_cv_abi_version in
764 [[345]]*)
765         default_with_lp64=no
766         ;;
767 *)
768         default_with_lp64=yes
769         ;;
770 esac
771
772 AC_MSG_CHECKING(whether to enable _LP64 definition in curses.h)
773 AC_ARG_ENABLE(lp64,
774         [  --disable-lp64          allow chtype to be long (ignore _LP64)],
775         [with_lp64=$enableval],
776         [with_lp64=$default_with_lp64])
777 AC_MSG_RESULT($with_lp64)
778
779 if test "$with_lp64" = yes ; then
780         cf_cv_enable_lp64=1
781 else
782         cf_cv_enable_lp64=0
783 fi
784 AC_SUBST(cf_cv_enable_lp64)
785
786 CF_LARGEFILE
787
788 ###   use option --disable-tparm-varargs to make tparm() conform to X/Open
789 AC_MSG_CHECKING(if you want tparm not to use X/Open fixed-parameter list)
790 AC_ARG_ENABLE(tparm-varargs,
791         [  --disable-tparm-varargs compile tparm() without varargs interface],
792         [with_tparm_varargs=$enableval],
793         [with_tparm_varargs=yes])
794 AC_MSG_RESULT($with_tparm_varargs)
795 NCURSES_TPARM_VARARGS=0
796 test "$with_tparm_varargs" = yes && NCURSES_TPARM_VARARGS=1
797 AC_SUBST(NCURSES_TPARM_VARARGS)
798
799 ###   use option --disable-tic-depends to make libtic not explicitly depend on ncurses/ncursesw
800 if test "$with_ticlib" != no ; then
801 AC_MSG_CHECKING(if you want tic library to use explicit dependency on ncurses$LIB_SUFFIX library)
802 AC_ARG_ENABLE(tic-depends,
803         [  --disable-tic-depends   link tic library without explicit dependency on ncurses library],
804         [with_tic_depends=$enableval],
805         [with_tic_depends=yes])
806 AC_MSG_RESULT($with_tic_depends)
807 else
808         with_tic_depends=no
809 fi
810
811 ###   use option --with-bool to override bool's type
812 AC_MSG_CHECKING(for type of bool)
813 AC_ARG_WITH(bool,
814         [  --with-bool=TYPE        override fallback type of bool variable],
815         [NCURSES_BOOL="$withval"],
816         [NCURSES_BOOL=auto])
817 AC_MSG_RESULT($NCURSES_BOOL)
818 AC_SUBST(NCURSES_BOOL)
819
820 AC_MSG_CHECKING(for alternate terminal capabilities file)
821 AC_ARG_WITH(caps,
822         [  --with-caps=alt         compile with alternate Caps file],
823         [TERMINFO_CAPS=Caps.$withval],
824         [TERMINFO_CAPS=Caps])
825 test -f "${srcdir}/include/${TERMINFO_CAPS}" || TERMINFO_CAPS=Caps
826 AC_MSG_RESULT($TERMINFO_CAPS)
827 AC_SUBST(TERMINFO_CAPS)
828
829 ###   use option --with-chtype to override chtype's type
830 AC_MSG_CHECKING(for type of chtype)
831 AC_ARG_WITH(chtype,
832         [  --with-chtype=TYPE      override type of chtype],
833         [NCURSES_CHTYPE="$withval"],
834         [NCURSES_CHTYPE=auto])
835 AC_MSG_RESULT($NCURSES_CHTYPE)
836
837 ###   use option --with-ospeed to override ospeed's type
838 AC_MSG_CHECKING(for type of ospeed)
839 AC_ARG_WITH(ospeed,
840         [  --with-ospeed=TYPE      override type of ospeed variable],
841         [NCURSES_OSPEED="$withval"],
842         [NCURSES_OSPEED=short])
843 AC_MSG_RESULT($NCURSES_OSPEED)
844 AC_SUBST(NCURSES_OSPEED)
845
846 ###   use option --with-mmask-t to override mmask_t's type
847 AC_MSG_CHECKING(for type of mmask_t)
848 AC_ARG_WITH(mmask-t,
849         [  --with-mmask-t=TYPE     override type of mmask_t],
850         [NCURSES_MMASK_T="$withval"],
851         [NCURSES_MMASK_T=auto])
852 AC_MSG_RESULT($NCURSES_MMASK_T)
853
854 ###   use option --with-ccharw-max to override CCHARW_MAX size
855 AC_MSG_CHECKING(for size CCHARW_MAX)
856 AC_ARG_WITH(ccharw-max,
857         [  --with-ccharw-max=XXX   override size CCHARW_MAX],
858         [NCURSES_CCHARW_MAX="$withval"],
859         [NCURSES_CCHARW_MAX=5])
860 AC_MSG_RESULT($NCURSES_CCHARW_MAX)
861 AC_SUBST(NCURSES_CCHARW_MAX)
862
863 ###   use option --with-tparm-arg to override tparm's argument type
864 AC_MSG_CHECKING(for type of tparm args)
865 AC_ARG_WITH(tparm-arg,
866         [  --with-tparm-arg=TYPE   override parameter type of tparm],
867         [NCURSES_TPARM_ARG="$withval"],
868         [NCURSES_TPARM_ARG=long])
869 AC_MSG_RESULT($NCURSES_TPARM_ARG)
870 AC_SUBST(NCURSES_TPARM_ARG)
871
872 ### Enable compiling-in rcs id's
873 AC_MSG_CHECKING(if RCS identifiers should be compiled-in)
874 AC_ARG_WITH(rcs-ids,
875         [  --with-rcs-ids          compile-in RCS identifiers],
876         [with_rcs_ids=$withval],
877         [with_rcs_ids=no])
878 AC_MSG_RESULT($with_rcs_ids)
879 test "$with_rcs_ids" = yes && AC_DEFINE(USE_RCS_IDS)
880
881 ###############################################################################
882 CF_MAN_PAGES([ captoinfo clear infocmp infotocap tabs tic toe tput tset ])
883
884 ###############################################################################
885 CF_HELP_MESSAGE(Extensions:)
886
887 ### Note that some functions (such as const) are normally disabled anyway.
888 AC_MSG_CHECKING(if you want to build with function extensions)
889 AC_ARG_ENABLE(ext-funcs,
890         [  --disable-ext-funcs     disable function-extensions],
891         [with_ext_funcs=$enableval],
892         [with_ext_funcs=yes])
893 AC_MSG_RESULT($with_ext_funcs)
894 if test "$with_ext_funcs" = yes ; then
895         NCURSES_EXT_FUNCS=1
896         AC_DEFINE(HAVE_ASSUME_DEFAULT_COLORS)
897         AC_DEFINE(HAVE_CURSES_VERSION)
898         AC_DEFINE(HAVE_HAS_KEY)
899         AC_DEFINE(HAVE_RESIZETERM)
900         AC_DEFINE(HAVE_RESIZE_TERM)
901         AC_DEFINE(HAVE_TERM_ENTRY_H)
902         AC_DEFINE(HAVE_USE_DEFAULT_COLORS)
903         AC_DEFINE(HAVE_USE_SCREEN)
904         AC_DEFINE(HAVE_USE_WINDOW)
905         AC_DEFINE(HAVE_WRESIZE)
906         AC_DEFINE(NCURSES_EXT_FUNCS)
907         GENERATED_EXT_FUNCS=generated
908 else
909         NCURSES_EXT_FUNCS=0
910         GENERATED_EXT_FUNCS=
911 fi
912 AC_SUBST(NCURSES_EXT_FUNCS)
913 AC_SUBST(GENERATED_EXT_FUNCS)
914
915 AC_MSG_CHECKING(if you want to build with experimental SCREEN extensions)
916 AC_ARG_ENABLE(sp-funcs,
917         [  --enable-sp-funcs       enable experimental SCREEN-extensions],
918         [with_sp_funcs=$enableval],
919         [with_sp_funcs=no])
920 AC_MSG_RESULT($with_sp_funcs)
921 if test "$with_sp_funcs" = yes ; then
922         NCURSES_SP_FUNCS=1
923         AC_DEFINE(NCURSES_SP_FUNCS)
924         GENERATED_SP_FUNCS=generated
925 else
926         NCURSES_SP_FUNCS=0
927         GENERATED_SP_FUNCS=
928 fi
929 AC_SUBST(NCURSES_SP_FUNCS)
930 AC_SUBST(GENERATED_SP_FUNCS)
931
932 AC_MSG_CHECKING(if you want to build with experimental terminal-driver)
933 AC_ARG_ENABLE(term-driver,
934         [  --enable-term-driver    enable experimental terminal-driver],
935         [with_term_driver=$enableval],
936         [with_term_driver=no])
937 AC_MSG_RESULT($with_term_driver)
938 if test "$with_term_driver" = yes ; then
939         AC_DEFINE(USE_TERM_DRIVER)
940         if test "$with_sp_funcs" != yes ; then
941                 AC_MSG_ERROR(The term-driver option relies upon sp-funcs)
942         fi
943 fi
944
945 ###   use option --enable-const to turn on use of const beyond that in XSI.
946 AC_MSG_CHECKING(for extended use of const keyword)
947 AC_ARG_ENABLE(const,
948         [  --enable-const          compile with extra/non-standard const],
949         [with_ext_const=$enableval],
950         [with_ext_const=no])
951 AC_MSG_RESULT($with_ext_const)
952 NCURSES_CONST='/*nothing*/'
953 if test "$with_ext_const" = yes ; then
954         NCURSES_CONST=const
955 fi
956 AC_SUBST(NCURSES_CONST)
957
958 ###   use option --enable-ext-colors to turn on use of colors beyond 16.
959 AC_MSG_CHECKING(if you want to use extended colors)
960 AC_ARG_ENABLE(ext-colors,
961         [  --enable-ext-colors     compile for 256-color support],
962         [with_ext_colors=$enableval],
963         [with_ext_colors=no])
964 AC_MSG_RESULT($with_ext_colors)
965 NCURSES_EXT_COLORS=0
966 if test "$with_ext_colors" = yes ; then
967         if test "$with_widec" != yes ; then
968                 AC_MSG_ERROR(This option applies only to wide-character library)
969         else
970                 # cannot be ABI 5 since it changes sizeof(cchar_t)
971                 CF_NCURSES_ABI_6
972         fi
973         NCURSES_EXT_COLORS=1
974         AC_DEFINE(NCURSES_EXT_COLORS)
975 fi
976 AC_SUBST(NCURSES_EXT_COLORS)
977
978 ###   use option --enable-ext-mouse to modify coding to support 5-button mice
979 AC_MSG_CHECKING(if you want to use extended mouse encoding)
980 AC_ARG_ENABLE(ext-mouse,
981         [  --enable-ext-mouse      compile for extended mouse-encoding],
982         [with_ext_mouse=$enableval],
983         [with_ext_mouse=no])
984 AC_MSG_RESULT($with_ext_mouse)
985 NCURSES_MOUSE_VERSION=1
986 if test "$with_ext_mouse" = yes ; then
987         NCURSES_MOUSE_VERSION=2
988         CF_NCURSES_ABI_6
989 fi
990 AC_SUBST(NCURSES_MOUSE_VERSION)
991
992 AC_MSG_CHECKING(if you want \$NCURSES_NO_PADDING code)
993 AC_ARG_ENABLE(no-padding,
994         [  --enable-no-padding     compile with $NCURSES_NO_PADDING code],
995         [with_no_padding=$enableval],
996         [with_no_padding=$with_ext_funcs])
997 AC_MSG_RESULT($with_no_padding)
998 test "$with_no_padding" = yes && AC_DEFINE(NCURSES_NO_PADDING)
999
1000 AC_CHECK_SIZEOF([signed char], 0)
1001 if test "$ac_cv_sizeof_signed_char" = 1 ; then
1002         NCURSES_SBOOL="signed char"
1003 else
1004         NCURSES_SBOOL="char"
1005 fi
1006 AC_MSG_CHECKING(if you want to use signed Boolean array in term.h)
1007 AC_ARG_ENABLE(signed-char,
1008         [  --enable-signed-char    compile using signed Boolean's in term.h],
1009         [with_signed_char=$enableval],
1010         [with_signed_char=no])
1011 AC_MSG_RESULT($with_signed_char)
1012 test "$with_signed_char" != yes && NCURSES_SBOOL="char"
1013 AC_SUBST(NCURSES_SBOOL)
1014
1015 ###   use option --enable-sigwinch to turn on use of SIGWINCH logic
1016 AC_MSG_CHECKING(if you want SIGWINCH handler)
1017 AC_ARG_ENABLE(sigwinch,
1018         [  --enable-sigwinch       compile with SIGWINCH handler],
1019         [with_sigwinch=$enableval],
1020         [with_sigwinch=$with_ext_funcs])
1021 AC_MSG_RESULT($with_sigwinch)
1022 test "$with_sigwinch" = yes && AC_DEFINE(USE_SIGWINCH)
1023
1024 ###   use option --enable-tcap-names to allow user to define new capabilities
1025 AC_MSG_CHECKING(if you want user-definable terminal capabilities like termcap)
1026 AC_ARG_ENABLE(tcap-names,
1027         [  --enable-tcap-names     compile with user-definable terminal capabilities],
1028         [with_tcap_names=$enableval],
1029         [with_tcap_names=$with_ext_funcs])
1030 AC_MSG_RESULT($with_tcap_names)
1031 NCURSES_XNAMES=0
1032 test "$with_tcap_names" = yes && NCURSES_XNAMES=1
1033 AC_SUBST(NCURSES_XNAMES)
1034
1035 ###############################################################################
1036 # These options are relatively safe to experiment with.
1037 CF_HELP_MESSAGE(Development Code:)
1038 AC_MSG_CHECKING(if you want all development code)
1039 AC_ARG_WITH(develop,
1040         [  --without-develop       disable development options],
1041         [with_develop=$withval],
1042         [with_develop=no])
1043 AC_MSG_RESULT($with_develop)
1044
1045 ###   use option --enable-hard-tabs to turn on use of hard-tabs optimize
1046 AC_MSG_CHECKING(if you want hard-tabs code)
1047 AC_ARG_ENABLE(hard-tabs,
1048         [  --enable-hard-tabs      compile with hard-tabs code],,
1049         [enable_hard_tabs=$with_develop])
1050 AC_MSG_RESULT($enable_hard_tabs)
1051 test "$enable_hard_tabs" = yes && AC_DEFINE(USE_HARD_TABS)
1052
1053 ###   use option --enable-xmc-glitch to turn on use of magic-cookie optimize
1054 AC_MSG_CHECKING(if you want limited support for xmc)
1055 AC_ARG_ENABLE(xmc-glitch,
1056         [  --enable-xmc-glitch     compile with support for xmc (magic-cookie)],,
1057         [enable_xmc_glitch=$with_develop])
1058 AC_MSG_RESULT($enable_xmc_glitch)
1059 test "$enable_xmc_glitch" = yes && AC_DEFINE(USE_XMC_SUPPORT)
1060
1061 ###############################################################################
1062 # These are just experimental, probably should not be in a package:
1063 CF_HELP_MESSAGE(Experimental Code:)
1064
1065 AC_MSG_CHECKING(if you do not want to assume colors are white-on-black)
1066 AC_ARG_ENABLE(assumed-color,
1067         [  --disable-assumed-color do not assume anything about default-colors],
1068         [with_assumed_color=$enableval],
1069         [with_assumed_color=yes])
1070 AC_MSG_RESULT($with_assumed_color)
1071 test "$with_assumed_color" = yes && AC_DEFINE(USE_ASSUMED_COLOR)
1072
1073 ###   use option --enable-hashmap to turn on use of hashmap scrolling logic
1074 AC_MSG_CHECKING(if you want hashmap scrolling-optimization code)
1075 AC_ARG_ENABLE(hashmap,
1076         [  --disable-hashmap       compile without hashmap scrolling-optimization],
1077         [with_hashmap=$enableval],
1078         [with_hashmap=yes])
1079 AC_MSG_RESULT($with_hashmap)
1080 test "$with_hashmap" = yes && AC_DEFINE(USE_HASHMAP)
1081
1082 ###   use option --enable-colorfgbg to turn on use of $COLORFGBG environment
1083 AC_MSG_CHECKING(if you want colorfgbg code)
1084 AC_ARG_ENABLE(colorfgbg,
1085         [  --enable-colorfgbg      compile-in experimental $COLORFGBG code],
1086         [with_colorfgbg=$enableval],
1087         [with_colorfgbg=no])
1088 AC_MSG_RESULT($with_colorfgbg)
1089 test "$with_colorfgbg" = yes && AC_DEFINE(USE_COLORFGBG)
1090
1091 ###   use option --enable-interop to turn on use of bindings used for interop
1092 AC_MSG_CHECKING(if you want interop bindings)
1093 AC_ARG_ENABLE(interop,
1094         [  --enable-interop        compile-in experimental interop bindings],
1095         [with_exp_interop=$enableval],
1096         [with_exp_interop=no])
1097 AC_MSG_RESULT($with_exp_interop)
1098
1099 NCURSES_INTEROP_FUNCS=0
1100 test "$with_exp_interop" = yes && NCURSES_INTEROP_FUNCS=1
1101 AC_SUBST(NCURSES_INTEROP_FUNCS)
1102
1103 # This is still experimental (20080329), but should ultimately be moved to
1104 # the script-block --with-normal, etc.
1105 CF_WITH_PTHREAD
1106
1107 if test "x$with_pthread" != xno; then
1108         AC_CHECK_FUNC(pthread_kill,[
1109                 AC_MSG_CHECKING(if you want to allow EINTR in wgetch with pthreads)
1110                 AC_ARG_ENABLE(pthreads-eintr,
1111                         [  --enable-pthreads-eintr enable EINTR in wgetch with pthreads],
1112                         [use_pthreads_eintr=$enableval],
1113                         [use_pthreads_eintr=no])
1114                 AC_MSG_RESULT($use_pthreads_eintr)
1115                 if test $use_pthreads_eintr = yes ; then
1116                         AC_DEFINE(USE_PTHREADS_EINTR)
1117                 fi])
1118
1119         AC_MSG_CHECKING(if you want to use weak-symbols for pthreads)
1120         AC_ARG_ENABLE(weak-symbols,
1121                 [  --enable-weak-symbols   enable weak-symbols for pthreads],
1122                 [use_weak_symbols=$enableval],
1123                 [use_weak_symbols=no])
1124         AC_MSG_RESULT($use_weak_symbols)
1125         if test "$use_weak_symbols" = yes ; then
1126                 CF_WEAK_SYMBOLS
1127         else
1128                 cf_cv_weak_symbols=no
1129         fi
1130
1131         if test $cf_cv_weak_symbols = yes ; then
1132                 AC_DEFINE(USE_WEAK_SYMBOLS)
1133         fi
1134 fi
1135
1136 PTHREAD=
1137 if test "$with_pthread" = "yes" ; then
1138     AC_DEFINE(USE_PTHREADS)
1139     enable_reentrant=yes
1140     if test $cf_cv_weak_symbols = yes ; then
1141         PTHREAD=-lpthread
1142     fi
1143 fi
1144 AC_SUBST(PTHREAD)
1145
1146 # Reentrant code has to be opaque; there's little advantage to making ncurses
1147 # opaque outside of that, so there is no --enable-opaque option.  We can use
1148 # this option without --with-pthreads, but this will be always set for
1149 # pthreads.
1150 AC_MSG_CHECKING(if you want experimental reentrant code)
1151 AC_ARG_ENABLE(reentrant,
1152         [  --enable-reentrant      compile with experimental reentrant code],
1153         [with_reentrant=$enableval],
1154         [with_reentrant=no])
1155 AC_MSG_RESULT($with_reentrant)
1156 if test "$with_reentrant" = yes ; then
1157         cf_cv_enable_reentrant=1
1158         cf_cv_enable_opaque="NCURSES_INTERNALS"
1159         NCURSES_OPAQUE=1
1160         NCURSES_SIZE_T=int
1161         if test $cf_cv_weak_symbols = yes ; then
1162                 CF_REMOVE_LIB(LIBS,$LIBS,pthread)
1163                 CF_ADD_LIB(pthread,TEST_LIBS)
1164                 CF_ADD_LIB(pthread,TEST_LIBS2)
1165         else
1166                 LIB_SUFFIX="t${LIB_SUFFIX}"
1167         fi
1168         AC_DEFINE(USE_REENTRANT)
1169         CF_NCURSES_ABI_6
1170 else
1171         cf_cv_enable_reentrant=0
1172         cf_cv_enable_opaque="NCURSES_OPAQUE"
1173         NCURSES_OPAQUE=0
1174         NCURSES_SIZE_T=short
1175 fi
1176 AC_SUBST(cf_cv_enable_reentrant)
1177 AC_SUBST(cf_cv_enable_opaque)
1178 AC_SUBST(NCURSES_OPAQUE)
1179 AC_SUBST(NCURSES_SIZE_T)
1180
1181 ### Allow using a different wrap-prefix
1182 if test "$cf_cv_enable_reentrant" != 0 || test "$BROKEN_LINKER" = 1 ; then
1183         AC_MSG_CHECKING(for prefix used to wrap public variables)
1184         AC_ARG_WITH(wrap-prefix,
1185                 [  --with-wrap-prefix=XXX  override prefix used for public variables],
1186                 [NCURSES_WRAP_PREFIX=$withval],
1187                 [NCURSES_WRAP_PREFIX=_nc_])
1188         AC_MSG_RESULT($NCURSES_WRAP_PREFIX)
1189 else
1190         NCURSES_WRAP_PREFIX=_nc_
1191 fi
1192 AC_SUBST(NCURSES_WRAP_PREFIX)
1193 AC_DEFINE_UNQUOTED(NCURSES_WRAP_PREFIX,"$NCURSES_WRAP_PREFIX")
1194
1195 AC_MSG_CHECKING(if you want experimental safe-sprintf code)
1196 AC_ARG_ENABLE(safe-sprintf,
1197         [  --enable-safe-sprintf   compile with experimental safe-sprintf code],
1198         [with_safe_sprintf=$enableval],
1199         [with_safe_sprintf=no])
1200 AC_MSG_RESULT($with_safe_sprintf)
1201 test "$with_safe_sprintf" = yes && AC_DEFINE(USE_SAFE_SPRINTF)
1202
1203 ###   use option --disable-scroll-hints to turn off use of scroll-hints scrolling logic
1204 # when hashmap is used scroll hints are useless
1205 if test "$with_hashmap" = no ; then
1206 AC_MSG_CHECKING(if you want to experiment without scrolling-hints code)
1207 AC_ARG_ENABLE(scroll-hints,
1208         [  --disable-scroll-hints  compile without scroll-hints code],
1209         [with_scroll_hints=$enableval],
1210         [with_scroll_hints=yes])
1211 AC_MSG_RESULT($with_scroll_hints)
1212 test "$with_scroll_hints" = yes && AC_DEFINE(USE_SCROLL_HINTS)
1213 fi
1214
1215 AC_MSG_CHECKING(if you want experimental wgetch-events code)
1216 AC_ARG_ENABLE(wgetch-events,
1217         [  --enable-wgetch-events  compile with experimental wgetch-events code],
1218         [with_wgetch_events=$enableval],
1219         [with_wgetch_events=no])
1220 AC_MSG_RESULT($with_wgetch_events)
1221 test "$with_wgetch_events" = yes && AC_DEFINE(NCURSES_WGETCH_EVENTS)
1222
1223 ###############################################################################
1224 CF_HELP_MESSAGE(Testing/development Options:)
1225
1226 ###     use option --disable-echo to suppress full display compiling commands
1227 CF_DISABLE_ECHO
1228 if test "$enable_echo" = yes; then
1229         ECHO_LINK=
1230 else
1231         ECHO_LINK='@ echo linking $@ ... ;'
1232         test -n "$LIBTOOL" && LIBTOOL="$LIBTOOL --silent"
1233         test -n "$LIBTOOL_CXX" && LIBTOOL_CXX="$LIBTOOL_CXX --silent"
1234 fi
1235 AC_SUBST(ECHO_LINK)
1236
1237 ###     use option --enable-warnings to turn on all gcc warnings
1238 AC_MSG_CHECKING(if you want to see compiler warnings)
1239 AC_ARG_ENABLE(warnings,
1240         [  --enable-warnings       build: turn on GCC compiler warnings],
1241         [with_warnings=$enableval])
1242 AC_MSG_RESULT($with_warnings)
1243
1244 if test "x$with_warnings" = "xyes"; then
1245         CF_ADD_ADAFLAGS(-gnatg)
1246         CF_GCC_WARNINGS(Wdeclaration-after-statement Wextra Wno-unknown-pragmas Wswitch-enum)
1247         if test "$cf_with_cxx" = yes ; then
1248                 CF_GXX_WARNINGS(Wno-unused)
1249         fi
1250 fi
1251 CF_GCC_ATTRIBUTES
1252 CF_ENABLE_STRING_HACKS
1253
1254 ###     use option --enable-assertions to turn on generation of assertion code
1255 AC_MSG_CHECKING(if you want to enable runtime assertions)
1256 AC_ARG_ENABLE(assertions,
1257         [  --enable-assertions     test: turn on generation of assertion code],
1258         [with_assertions=$enableval],
1259         [with_assertions=no])
1260 AC_MSG_RESULT($with_assertions)
1261 if test -n "$GCC"
1262 then
1263         if test "$with_assertions" = no
1264         then
1265                 AC_DEFINE(NDEBUG)
1266                 CPPFLAGS="$CPPFLAGS -DNDEBUG"
1267         else
1268                 CF_ADD_ADAFLAGS(-gnata)
1269         fi
1270 fi
1271
1272 ###     use option --disable-leaks to suppress "permanent" leaks, for testing
1273 CF_DISABLE_LEAKS
1274 AC_DEFINE(HAVE_NC_ALLOC_H)
1275
1276 ###     use option --enable-expanded to generate certain macros as functions
1277 AC_ARG_ENABLE(expanded,
1278         [  --enable-expanded       test: generate functions for certain macros],
1279         [test "$enableval" = yes && AC_DEFINE(NCURSES_EXPANDED)])
1280
1281 ###     use option --disable-macros to suppress macros in favor of functions
1282 AC_ARG_ENABLE(macros,
1283         [  --disable-macros        test: use functions rather than macros],
1284         [test "$enableval" = no && AC_DEFINE(NCURSES_NOMACROS)])
1285
1286 # Normally we only add trace() to the debug-library.  Allow this to be
1287 # extended to all models of the ncurses library:
1288 cf_all_traces=no
1289 case "$CFLAGS $CPPFLAGS" in
1290 *-DTRACE*)
1291         cf_all_traces=yes
1292         ;;
1293 esac
1294
1295 AC_MSG_CHECKING(whether to add trace feature to all models)
1296 AC_ARG_WITH(trace,
1297 [  --with-trace            test: add trace() function to all models of ncurses],
1298 [cf_with_trace=$withval],
1299 [cf_with_trace=$cf_all_traces])
1300 AC_MSG_RESULT($cf_with_trace)
1301
1302 if test "$cf_with_trace" = yes ; then
1303         LIB_TRACING=all
1304         ADA_TRACE=TRUE
1305         CF_ADD_CFLAGS(-DTRACE)
1306 else
1307         LIB_TRACING=DEBUG
1308         ADA_TRACE=FALSE
1309 fi
1310
1311 AC_SUBST(ADA_TRACE)
1312
1313 ###     Checks for libraries.
1314 case $cf_cv_system_name in #(vi
1315 *mingw32*) #(vi
1316         ;;
1317 *)
1318 AC_CHECK_FUNC(gettimeofday,
1319         AC_DEFINE(HAVE_GETTIMEOFDAY),[
1320
1321 AC_CHECK_LIB(bsd, gettimeofday,
1322         AC_DEFINE(HAVE_GETTIMEOFDAY)
1323         CF_ADD_LIB(bsd))])dnl CLIX: bzero, select, gettimeofday
1324         ;;
1325 esac
1326
1327 CF_MATH_LIB(MATH_LIB,sin(x))
1328 AC_SUBST(MATH_LIB)
1329
1330 ###     Checks for header files.
1331 AC_STDC_HEADERS
1332 AC_HEADER_DIRENT
1333 AC_HEADER_TIME
1334 CF_REGEX
1335
1336 dnl These are some other potentially nonportable headers.
1337 AC_CHECK_HEADERS( \
1338 fcntl.h \
1339 getopt.h \
1340 limits.h \
1341 locale.h \
1342 math.h \
1343 poll.h \
1344 sys/bsdtypes.h \
1345 sys/ioctl.h \
1346 sys/param.h \
1347 sys/poll.h \
1348 sys/select.h \
1349 sys/time.h \
1350 sys/times.h \
1351 ttyent.h \
1352 unistd.h \
1353 wctype.h \
1354 )
1355
1356 CF_GETOPT_HEADER
1357
1358 # check for ISC (this may also define _POSIX_SOURCE)
1359 # Note: even non-Posix ISC needs <sys/bsdtypes.h> to declare fd_set
1360 if test "$ISC" = yes ; then
1361         AC_CHECK_LIB(cposix,main)
1362         AC_CHECK_LIB(inet,bzero,CF_ADD_LIB(inet))dnl also 'select()'
1363 fi
1364
1365 CF_SYS_TIME_SELECT
1366
1367 ###     checks for compiler characteristics
1368 AC_LANG_C
1369 AC_C_CONST
1370 CF_C_INLINE(NCURSES_INLINE,1200)
1371 CF_SIG_ATOMIC_T
1372
1373 if test $NCURSES_CHTYPE = auto ; then
1374         CF_TYPEOF_CHTYPE
1375 else
1376         cf_cv_typeof_chtype=$NCURSES_CHTYPE
1377 fi
1378 test "$cf_cv_typeof_chtype" = unsigned && cf_cv_typeof_chtype=""
1379 AC_SUBST(cf_cv_typeof_chtype)
1380
1381 CF_UNSIGNED_LITERALS
1382 cf_cv_1UL="1"
1383 test ".$cf_cv_unsigned_literals" = .yes && cf_cv_1UL="${cf_cv_1UL}U"
1384 test ".$cf_cv_typeof_chtype"    = .long && cf_cv_1UL="${cf_cv_1UL}L"
1385 AC_SUBST(cf_cv_1UL)
1386
1387 if test $NCURSES_MMASK_T = auto ; then
1388         cf_cv_typeof_mmask_t=long
1389 else
1390         cf_cv_typeof_mmask_t=$NCURSES_MMASK_T
1391 fi
1392 test "$cf_cv_typeof_mmask_t" = unsigned && cf_cv_typeof_mmask_t=""
1393 AC_SUBST(cf_cv_typeof_mmask_t)
1394
1395 ###     Checks for external-data
1396 CF_ERRNO
1397 CF_LINK_DATAONLY
1398
1399 ###     Checks for library functions.
1400 AC_CHECK_FUNCS( \
1401 getcwd \
1402 getegid \
1403 geteuid \
1404 getttynam \
1405 issetugid \
1406 poll \
1407 remove \
1408 select \
1409 setbuf \
1410 setbuffer \
1411 setvbuf \
1412 sigaction \
1413 sigvec \
1414 strdup \
1415 strstr \
1416 tcgetpgrp \
1417 times \
1418 vsnprintf \
1419 )
1420 if test "$with_getcap" = "yes" ; then
1421         CF_CGETENT
1422 fi
1423
1424 CF_ISASCII
1425 CF_STRUCT_SIGACTION
1426 CF_FUNC_NANOSLEEP
1427 CF_FUNC_TERMIOS
1428 CF_FUNC_VSSCANF
1429 CF_MKSTEMP
1430
1431 # setup for prototype of fallback for vsscanf()
1432 CF_SUBST_IF(["$cf_cv_func_vsscanf" = vsscanf], HAVE_VSSCANF, 1, 0)
1433
1434 dnl FIXME (may need this) AC_SYS_RESTARTABLE_SYSCALLS
1435 if test "$cross_compiling" = yes ; then
1436         AC_MSG_WARN(cross compiling: assume setvbuf params not reversed)
1437 else
1438         AC_FUNC_SETVBUF_REVERSED
1439 fi
1440 AC_TYPE_SIGNAL
1441 AC_CHECK_TYPE(intptr_t, long)
1442 CF_TYPE_SIGACTION
1443 CF_SIZECHANGE
1444 CF_FUNC_MEMMOVE
1445 CF_FUNC_POLL
1446 CF_VA_COPY
1447 AC_FUNC_VFORK
1448
1449 # special check for test/ditto.c
1450 CF_FUNC_OPENPTY
1451 if test "$cf_cv_func_openpty" != no ; then
1452     AC_DEFINE_UNQUOTED(USE_OPENPTY_HEADER,<$cf_cv_func_openpty>)
1453     AC_DEFINE(USE_XTERM_PTY)
1454     if test "$cf_cv_lib_util" = yes ; then
1455         CF_ADD_LIB(util,TEST_LIBS)
1456     fi
1457 fi
1458 AC_SUBST(TEST_LIBS)
1459 AC_SUBST(TEST_LIBS2)
1460
1461 if test "$with_hashed_db" != no ; then
1462         AC_DEFINE(USE_HASHED_DB)
1463         CF_HASHED_DB($with_hashed_db)
1464 fi
1465
1466 dnl We'll do our own -g libraries, unless the user's overridden via $CFLAGS
1467 if test -z "$cf_user_CFLAGS" && test "$with_no_leaks" = no ; then
1468         CF_STRIP_G_OPT(CFLAGS)
1469         CF_STRIP_G_OPT(CXXFLAGS)
1470 fi
1471
1472 # Just in case, check if the C compiler has a bool type.
1473 CF_BOOL_DECL(cf_cv_cc_bool_type)
1474
1475 # Check for C++ compiler characteristics (and ensure that it's there!)
1476 if test -n "$CXX" ; then
1477         AC_LANG_CPLUSPLUS
1478         CF_STDCPP_LIBRARY
1479         CF_PROG_CC_C_O(CXX)
1480
1481         case $GXX_VERSION in
1482         1*|2.[0-6]*)
1483                 cf_cxx_library=yes
1484                 ;;
1485         *-2.7*|2.7*)
1486                 CF_GPP_LIBRARY
1487                 ;;
1488         *)
1489                 cf_cxx_library=no
1490                 ;;
1491         esac
1492
1493         AC_CHECK_HEADERS(typeinfo)
1494         CF_CXX_IOSTREAM_NAMESPACE
1495         CF_BOOL_DECL
1496         CF_BOOL_SIZE
1497         CF_ETIP_DEFINES
1498         CF_CPP_PARAM_INIT
1499         CF_CPP_STATIC_CAST
1500         CF_CXX_AR_FLAGS
1501 else
1502         cf_cxx_library=no
1503         cf_cv_builtin_bool=1
1504
1505         # Just because we are not configuring against C++ right now does not
1506         # mean that a user will not want to use C++.  Some distributors disable
1507         # the C++ portion of this configuration as a shortcut (or just to avoid
1508         # compiling the demo in the c++ directory).  So we need a reasonable
1509         # default for the 'bool' type.
1510         #
1511         # Caveat: since the storage of the bool type is not standardized, it
1512         # may change.
1513
1514         if test "$NCURSES_BOOL" != auto ; then
1515                 cf_cv_type_of_bool=$NCURSES_BOOL
1516                 cf_cv_header_stdbool_h=0
1517         else
1518                 if test "$cf_cv_header_stdbool_h" = 1 ; then
1519                         CF_BOOL_SIZE
1520                 else
1521                         AC_MSG_CHECKING(for fallback type of bool)
1522                         case "$host_cpu" in #(vi
1523                         i?86)   cf_cv_type_of_bool=char ;; #(vi
1524                         *)      cf_cv_type_of_bool=int  ;;
1525                         esac
1526                         AC_MSG_RESULT($cf_cv_type_of_bool)
1527                 fi
1528         fi
1529 fi
1530 AC_SUBST(CXXLIBS)
1531
1532 # If the C compiler did not declare bool, and we did not determine that the C++
1533 # compiler does not declare bool, turn on an ifdef in curses.h that makes the
1534 # ncurses library use the same type as C++ bool.  Note that this allows one to
1535 # specify the type of bool in a configure-script option and postpone
1536 # integration with the C++ compiler provided that the types are compatible.
1537 USE_CXX_BOOL=1
1538 if test $cf_cv_cc_bool_type = 1
1539 then
1540         # oops: C has a bool.  Unlikely, but C++ could differ.
1541         USE_CXX_BOOL=0
1542 elif test $cf_cv_builtin_bool = 0
1543 then
1544         # C++ has no bool
1545         USE_CXX_BOOL=0
1546 else
1547         # this is the normal case
1548         USE_CXX_BOOL='defined(__cplusplus)'
1549 fi
1550 AC_SUBST(USE_CXX_BOOL)
1551
1552 CF_HELP_MESSAGE(Ada95 Binding Options:)
1553
1554 dnl If the Ada95 source-tree is present, add that to the build unless it will
1555 dnl not work, or was not requested.
1556 if test -f "${srcdir}/Ada95/Makefile.in" ; then
1557
1558 dnl libtool does not know anything about GNAT, though a change made in 1998
1559 dnl provided for it "someday".  Disable the ada subtree if we are using
1560 dnl libtool -TD 20070714
1561         if test "$cf_with_ada" != "no" ; then
1562                 if test "$with_libtool" != "no"; then
1563                         AC_MSG_WARN(libtool does not support Ada - disabling feature)
1564                         cf_with_ada=no
1565                 fi
1566         fi
1567
1568 dnl Check for availability of GNU Ada Translator (GNAT).
1569 dnl At the moment we support no other Ada95 compiler.
1570         if test "$cf_with_ada" != "no" ; then
1571                 CF_PROG_GNAT
1572                 if test "$cf_cv_prog_gnat_correct" = yes; then
1573                         CF_ADD_ADAFLAGS(-gnatpn)
1574                         CF_FIXUP_ADAFLAGS
1575
1576                         CF_GNAT_GENERICS
1577                         CF_GNAT_SIGINT
1578                         CF_GNAT_PRAGMA_UNREF
1579                         CF_GNAT_PROJECTS
1580
1581                         CF_WITH_ADA_COMPILER
1582
1583                         cf_ada_package=terminal_interface
1584                         AC_SUBST(cf_ada_package)
1585
1586                         CF_WITH_ADA_INCLUDE
1587                         CF_WITH_ADA_OBJECTS
1588                         CF_WITH_ADA_SHAREDLIB
1589                 fi
1590         fi
1591 else
1592         cf_with_ada=no
1593 fi
1594
1595 ### Construct the ncurses library-subsets, if any, from this set of keywords:
1596 ###     none, base, ext_funcs, ext_tinfo, ticlib, termlib, widechar
1597 ###
1598 ### ticlib modules may be a separate library, otherwise contained in termlib.
1599 ### termlib modules may be a separate library, otherwise contained in ncurses.
1600 ###
1601 ### The of "+" or " " between the tokens controls the way the script
1602 ### chooses to split module lists into libraries.
1603 ###
1604 ### (see CF_LIB_RULES).
1605 AC_MSG_CHECKING(for library subsets)
1606 LIB_SUBSETS=
1607
1608 if test "$cf_with_progs" = yes || test "$with_ticlib" != no || test "$with_termcap" != no; then
1609         LIB_SUBSETS="${LIB_SUBSETS}ticlib"
1610         if test "$with_ticlib" != no ; then
1611                 LIB_SUBSETS="${LIB_SUBSETS} "
1612         else
1613                 LIB_SUBSETS="${LIB_SUBSETS}+"
1614         fi
1615 fi
1616
1617 LIB_SUBSETS="${LIB_SUBSETS}termlib"
1618 test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_tinfo"
1619
1620 if test "$with_termlib" != no ; then
1621         LIB_SUBSETS="${LIB_SUBSETS} "
1622 else
1623         LIB_SUBSETS="${LIB_SUBSETS}+"
1624 fi
1625
1626 LIB_SUBSETS="${LIB_SUBSETS}base"
1627
1628 # Most term-driver calls are to tinfo, but some like init_pair are to the
1629 # base library (so it resides in base).
1630 if test "$with_term_driver" != no ; then
1631         LIB_SUBSETS="${LIB_SUBSETS}+port_drivers"
1632         case $cf_cv_system_name in #(vi
1633         *mingw32*) #(vi
1634                 LIB_SUBSETS="${LIB_SUBSETS}+port_tinfo+port_win32con"
1635                 ;;
1636         *) #(vi
1637                 LIB_SUBSETS="${LIB_SUBSETS}+port_tinfo"
1638                 ;;
1639         esac
1640 fi
1641
1642 test "$with_widec"     = yes && LIB_SUBSETS="${LIB_SUBSETS}+widechar"
1643 test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs"
1644
1645 AC_MSG_RESULT($LIB_SUBSETS)
1646
1647 ### Construct the list of include-directories to be generated
1648 CF_INCLUDE_DIRS
1649 CF_ADA_INCLUDE_DIRS
1650
1651 ### Build up pieces for makefile rules
1652 AC_MSG_CHECKING(default library suffix)
1653 CF_LIB_TYPE($DFT_LWR_MODEL,DFT_ARG_SUFFIX)dnl
1654 AC_SUBST(DFT_ARG_SUFFIX)dnl the string to append to "-lncurses" ("")
1655 AC_MSG_RESULT($DFT_ARG_SUFFIX)
1656
1657 AC_MSG_CHECKING(default library-dependency suffix)
1658 CF_LIB_SUFFIX($DFT_LWR_MODEL,DFT_LIB_SUFFIX,DFT_DEP_SUFFIX)dnl
1659 AC_SUBST(DFT_DEP_SUFFIX)dnl the corresponding library-suffix (".a")
1660 AC_MSG_RESULT($DFT_DEP_SUFFIX)
1661
1662 AC_MSG_CHECKING(default object directory)
1663 CF_OBJ_SUBDIR($DFT_LWR_MODEL,DFT_OBJ_SUBDIR)dnl
1664 AC_SUBST(DFT_OBJ_SUBDIR)dnl the default object-directory ("obj")
1665 AC_MSG_RESULT($DFT_OBJ_SUBDIR)
1666
1667 # libtool thinks it can make c++ shared libraries (perhaps only g++)
1668 if test "$cf_with_cxx" = yes ; then
1669 AC_MSG_CHECKING(c++ library-dependency suffix)
1670 if test "$with_libtool" != "no"; then
1671         CXX_LIB_SUFFIX=$DFT_DEP_SUFFIX
1672 else
1673         CF_LIB_SUFFIX(normal,CXX_LIB_SUFFIX,CXX_DEP_SUFFIX)dnl we normally make a static library
1674 fi
1675 AC_MSG_RESULT($CXX_LIB_SUFFIX)
1676 AC_SUBST(CXX_LIB_SUFFIX)
1677 fi
1678
1679 # do not want -ldl in build except as needed for -lncurses dependency
1680 if test "$with_dlsym" = yes ; then
1681 if test $DFT_LWR_MODEL = shared || \
1682    test $DFT_LWR_MODEL = libtool ; then
1683         CF_REMOVE_LIB(LIBS,$LIBS,dl)
1684 fi
1685 fi
1686 ### Set up low-level terminfo dependencies for makefiles.
1687
1688 # TICS_LIST and TINFO_LIST are needed to build libtic.so and libterm.so, but
1689 # do not need libdl
1690 TICS_LIST=
1691 if test "$with_dlsym" = yes ; then
1692         CF_REMOVE_LIB(TINFO_LIST,$SHLIB_LIST,dl)
1693 fi
1694
1695 if test "$with_ticlib" != no ; then
1696
1697         if test "$with_ticlib" != yes ; then
1698                 TICS_NAME=$with_ticlib
1699                 TICS_ARG_SUFFIX="${with_ticlib}`echo ${DFT_ARG_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
1700                 TICS_DEP_SUFFIX="${with_ticlib}`echo ${DFT_DEP_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
1701                 TICS_LIB_SUFFIX="${with_ticlib}"
1702         else
1703                 TICS_ARG_SUFFIX="${TICS_NAME}${DFT_ARG_SUFFIX}"
1704                 TICS_DEP_SUFFIX="${TICS_NAME}${DFT_DEP_SUFFIX}"
1705                 TICS_LIB_SUFFIX="${TICS_NAME}${LIB_SUFFIX}"
1706         fi
1707         TICS_LDFLAGS="-L${LIB_DIR}"
1708         TICS_LIBS="-l${TICS_LIB_SUFFIX}"
1709 else
1710         TICS_LDFLAGS="-L${LIB_DIR}"
1711         TICS_LIBS="-l${LIB_NAME}${DFT_ARG_SUFFIX}"
1712 fi
1713 AC_SUBST(TICS_ARG_SUFFIX)
1714 AC_SUBST(TICS_DEP_SUFFIX)
1715 AC_SUBST(TICS_LIB_SUFFIX)
1716 AC_SUBST(TICS_LDFLAGS)
1717 AC_SUBST(TICS_LIBS)
1718
1719 if test "$with_termlib" != no ; then
1720
1721         if test "$with_termlib" != yes ; then
1722                 TINFO_NAME=$with_termlib
1723                 TINFO_SUFFIX="`echo ${DFT_LIB_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
1724                 TINFO_ARG_SUFFIX="${with_termlib}`echo ${DFT_ARG_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
1725                 TINFO_DEP_SUFFIX="${with_termlib}`echo ${DFT_DEP_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
1726                 TINFO_LIB_SUFFIX="${with_termlib}"
1727         else
1728                 TINFO_SUFFIX=${DFT_LIB_SUFFIX}
1729                 TINFO_ARG_SUFFIX="${TINFO_NAME}${DFT_ARG_SUFFIX}"
1730                 TINFO_DEP_SUFFIX="${TINFO_NAME}${DFT_DEP_SUFFIX}"
1731                 TINFO_LIB_SUFFIX="${TINFO_NAME}${LIB_SUFFIX}"
1732         fi
1733
1734         TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${TINFO_DEP_SUFFIX}"
1735         TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${TINFO_DEP_SUFFIX}"
1736         if test "$DFT_LWR_MODEL" = "libtool"; then
1737                 TEST_ARGS="${TEST_DEPS}"
1738                 TEST_ARG2="${TEST_DEP2}"
1739                 TINFO_LDFLAGS="-L${LIB_DIR}"
1740                 TINFO_LIBS="$TEST_ARGS"
1741                 TICS_LIST="$SHLIB_LIST $TEST_ARGS"
1742                 SHLIB_LIST="${SHLIB_LIST} $TEST_ARGS"
1743         else
1744                 TEST_ARGS="-l${TINFO_ARG_SUFFIX}"
1745                 TEST_ARG2="-l${TINFO_ARG_SUFFIX}"
1746                 if test "x$with_term_driver" != xno ; then
1747                         TICS_LIST="$SHLIB_LIST -l${LIB_NAME}${DFT_ARG_SUFFIX}"
1748                         TICS_LIBS="$TICS_LIBS -l${LIB_NAME}${DFT_ARG_SUFFIX}"
1749                         TINFO_LIBS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS"
1750                 else
1751                         TICS_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}"
1752                         TINFO_LIBS="$TEST_ARGS"
1753                 fi
1754                 TINFO_LDFLAGS="-L${LIB_DIR}"
1755                 SHLIB_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}"
1756         fi
1757 else
1758         # the next lines are needed for linking libtic over libncurses
1759         TINFO_NAME=${LIB_NAME}
1760         TINFO_SUFFIX=${DFT_LIB_SUFFIX}
1761         TINFO_ARG_SUFFIX=${LIB_NAME}${DFT_ARG_SUFFIX}
1762         if test "$with_tic_depends" = yes ; then
1763                 TICS_LIST="$SHLIB_LIST -l${LIB_NAME}${DFT_ARG_SUFFIX}"
1764         else
1765                 TICS_LIST="$SHLIB_LIST"
1766         fi
1767
1768         TINFO_LDFLAGS="-L${LIB_DIR}"
1769         TINFO_LIBS="-l${LIB_NAME}${DFT_ARG_SUFFIX}"
1770 fi
1771
1772 if test "$DFT_LWR_MODEL" = shared ; then
1773         case $cf_cv_system_name in #(vi
1774         cygwin*)
1775                 # "lib" files have ".dll.a" suffix, "cyg" files have ".dll"
1776                 TINFO_SUFFIX=.dll
1777                 ;;
1778         esac
1779 fi
1780
1781 AC_SUBST(TINFO_ARG_SUFFIX)
1782 AC_SUBST(TINFO_DEP_SUFFIX)
1783 AC_SUBST(TINFO_LIB_SUFFIX)
1784 AC_SUBST(TINFO_LDFLAGS)
1785 AC_SUBST(TINFO_LIBS)
1786
1787 if test "$with_dlsym" = yes ; then
1788         CF_REMOVE_LIB(TICS_LIST,$TICS_LIST,dl)
1789 fi
1790
1791 if test "$DFT_LWR_MODEL" = "libtool"; then
1792     OBJEXT=lo
1793 fi
1794
1795 # needed for Ada95
1796 TINFO_LDFLAGS2=`echo "$TINFO_LDFLAGS" | sed -e 's,-L\.\./,-L../../,'`
1797 AC_SUBST(TINFO_LDFLAGS2)
1798
1799 case $DFT_LWR_MODEL in
1800 normal|debug|profile)
1801         CF_LDFLAGS_STATIC
1802         ;;
1803 esac
1804
1805 AC_MSG_CHECKING(where we will install curses.h)
1806 test "$with_overwrite" = no && \
1807 test "x$includedir" = 'x${prefix}/include' && \
1808         includedir='${prefix}/include/ncurses'${LIB_SUFFIX}
1809 AC_MSG_RESULT($includedir)
1810
1811 ### Resolve a conflict between normal and wide-curses by forcing applications
1812 ### that will need libutf8 to add it to their configure script.
1813 if test "$with_overwrite" != no ; then
1814 if test "$NCURSES_LIBUTF8" = 1 ; then
1815         NCURSES_LIBUTF8='defined(HAVE_LIBUTF8_H)'
1816         AC_MSG_WARN(Wide-character applications must define HAVE_LIBUTF8_H to include curses.h)
1817 fi
1818 fi
1819 WITH_OVERWRITE=$with_overwrite
1820
1821 AC_SUBST(WITH_OVERWRITE)
1822 AC_SUBST(TICS_LIST)
1823 AC_SUBST(TINFO_LIST)
1824 AC_SUBST(SHLIB_LIST)
1825
1826 # used to separate tack out of the tree
1827 NCURSES_TREE=
1828 AC_SUBST(NCURSES_TREE)
1829
1830 ### predefined stuff for the test programs
1831 AC_DEFINE(HAVE_SLK_COLOR)
1832
1833 ### Construct the list of subdirectories for which we'll customize makefiles
1834 ### with the appropriate compile-rules.
1835
1836 CF_SRC_MODULES($modules_to_build)
1837
1838 if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = "xyes"; then
1839    SUB_MAKEFILES="$SUB_MAKEFILES Ada95/gen/adacurses${DFT_ARG_SUFFIX}-config:Ada95/gen/adacurses-config.in"
1840    SUB_MAKEFILES="$SUB_MAKEFILES man/adacurses${DFT_ARG_SUFFIX}-config.1:man/MKada_config.in"
1841 fi
1842
1843 CF_DIRS_TO_MAKE
1844
1845 # symbols that differ when compiling Ada95 by itself.
1846 NCURSES_SHLIB2='sh $(top_srcdir)/misc/shlib'
1847 AC_SUBST(NCURSES_SHLIB2)
1848
1849 # values to use as strings
1850 AC_DEFINE_UNQUOTED(NCURSES_PATHSEP,'$PATH_SEPARATOR')
1851
1852 AC_DEFINE_UNQUOTED(NCURSES_VERSION_STRING, "${NCURSES_MAJOR}.${NCURSES_MINOR}.${NCURSES_PATCH}")
1853
1854 ### Now that we're done running tests, add the compiler-warnings, if any
1855 CF_ADD_CFLAGS($EXTRA_CFLAGS)
1856
1857 ### Define substitutions for header files to avoid name-pollution
1858 CF_SUBST_IF(["$cf_cv_have_tcgetattr" = yes], HAVE_TCGETATTR, 1, 0)
1859 CF_SUBST_IF(["$ac_cv_header_termio_h" = yes], HAVE_TERMIO_H, 1, 0)
1860 CF_SUBST_IF(["$ac_cv_header_termios_h" = yes], HAVE_TERMIOS_H, 1, 0)
1861
1862 ################################################################################
1863 test "$use_database" = yes && \
1864 SUB_MAKEFILES="$SUB_MAKEFILES misc/run_tic.sh:misc/run_tic.in"
1865
1866 SUB_MAKEFILES="$SUB_MAKEFILES misc/ncurses-config:misc/ncurses-config.in"
1867 SUB_MAKEFILES="$SUB_MAKEFILES man/ncurses${DFT_ARG_SUFFIX}${cf_cv_abi_version}-config.1:man/MKncu_config.in"
1868
1869 if test x"$enable_pc_files" = xyes ; then \
1870 SUB_MAKEFILES="$SUB_MAKEFILES misc/gen-pkgconfig:misc/gen-pkgconfig.in"
1871 MAKE_PC_FILES=
1872 else
1873 MAKE_PC_FILES="#"
1874 fi
1875 AC_SUBST(MAKE_PC_FILES)
1876 AC_SUBST(cross_compiling)
1877
1878 AC_PATH_PROG(TIC_PATH,tic,unknown,$PATH:/usr/local/ncurses/bin)
1879 if test -n "$FALLBACK_LIST"
1880 then
1881         if test "$TIC_PATH" = unknown
1882         then
1883                 AC_MSG_WARN(no tic program found for fallbacks)
1884         fi
1885 fi
1886 AC_SUBST(TIC_PATH)
1887
1888 if test "x$cf_with_tests" != xno ; then
1889         MAKE_TESTS=
1890 else
1891         MAKE_TESTS="#"
1892 fi
1893 AC_SUBST(MAKE_TESTS)
1894
1895 ADAHTML_DIR=../../doc/html/ada
1896 AC_SUBST(ADAHTML_DIR)
1897
1898 SUB_SCRIPTS=
1899
1900 AC_OUTPUT( \
1901         include/MKterm.h.awk \
1902         include/curses.head:include/curses.h.in \
1903         include/ncurses_dll.h \
1904         include/termcap.h \
1905         include/unctrl.h \
1906         $SUB_SCRIPTS \
1907         $SUB_MAKEFILES \
1908         Makefile,[
1909 if test "x$cf_with_tests" != xno ; then
1910         CF_PRG_RULES([$srcdir/test/mk-test.awk INSTALL=no ECHO_LINK="$ECHO_LD"], test)
1911 fi
1912 CF_LIB_RULES($SRC_SUBDIRS)
1913
1914 if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = "xyes"; then
1915 if test -z "$USE_OLD_MAKERULES" ; then
1916         $AWK -f $srcdir/Ada95/mk-1st.awk <$srcdir/Ada95/src/modules >>Ada95/src/Makefile
1917 fi
1918 fi
1919 ],[
1920 ### Special initialization commands, used to pass information from the
1921 ### configuration-run into config.status
1922
1923 AWK="$AWK"
1924 DFT_ARG_SUFFIX="$DFT_ARG_SUFFIX"
1925 DFT_LWR_MODEL="$DFT_LWR_MODEL"
1926 ECHO_LD="$ECHO_LD"
1927 LDCONFIG="$LDCONFIG"
1928 LIBTOOL_VERSION="$LIBTOOL_VERSION"
1929 LIB_NAME="$LIB_NAME"
1930 LIB_PREFIX="$LIB_PREFIX"
1931 LIB_SUBSETS="$LIB_SUBSETS"
1932 LIB_SUFFIX="$LIB_SUFFIX"
1933 LIB_TRACING="$LIB_TRACING"
1934 LN_S="$LN_S"
1935 MAKE_TERMINFO="$MAKE_TERMINFO"
1936 NCURSES_MAJOR="$NCURSES_MAJOR"
1937 NCURSES_MINOR="$NCURSES_MINOR"
1938 NCURSES_OSPEED="$NCURSES_OSPEED"
1939 NCURSES_PATCH="$NCURSES_PATCH"
1940 SRC_SUBDIRS="$SRC_SUBDIRS"
1941 TERMINFO="$TERMINFO"
1942 TICS_ARG_SUFFIX="$TICS_ARG_SUFFIX"
1943 TICS_LIB_SUFFIX="$TICS_LIB_SUFFIX"
1944 TICS_NAME="$TICS_NAME"
1945 TIC_PATH="$TIC_PATH"
1946 TINFO_ARG_SUFFIX="$TINFO_ARG_SUFFIX"
1947 TINFO_LIB_SUFFIX="$TINFO_LIB_SUFFIX"
1948 TINFO_NAME="$TINFO_NAME"
1949 TINFO_SUFFIX="$TINFO_SUFFIX"
1950 USE_OLD_MAKERULES="$USE_OLD_MAKERULES"
1951 WITH_CURSES_H="$with_curses_h"
1952 WITH_ECHO="$with_echo"
1953 WITH_OVERWRITE="$with_overwrite"
1954 cf_LIST_MODELS="$cf_list_models"
1955 cf_cv_abi_version="$cf_cv_abi_version"
1956 cf_cv_do_relink="$cf_cv_do_relink"
1957 cf_cv_do_symlinks="$cf_cv_do_symlinks"
1958 cf_cv_enable_lp64="$cf_cv_enable_lp64"
1959 cf_cv_enable_opaque="$cf_cv_enable_opaque"
1960 cf_cv_prog_CC_c_o=$cf_cv_prog_CC_c_o
1961 cf_cv_prog_CXX_c_o=$cf_cv_prog_CXX_c_o
1962 cf_cv_prog_gnat_correct=$cf_cv_prog_gnat_correct
1963 cf_cv_rel_version="$cf_cv_rel_version"
1964 cf_cv_rm_so_locs="$cf_cv_rm_so_locs"
1965 cf_cv_shared_soname='$cf_cv_shared_soname'
1966 cf_cv_shlib_version="$cf_cv_shlib_version"
1967 cf_cv_shlib_version_infix="$cf_cv_shlib_version_infix"
1968 cf_cv_system_name="$cf_cv_system_name"
1969 cf_cv_term_driver="$with_term_driver"
1970 cf_with_ada="$cf_with_ada"
1971 cf_with_cxx_binding="$cf_with_cxx_binding"
1972 cf_with_manpages="$cf_with_manpages"
1973 cf_with_tests="$cf_with_tests"
1974 host="$host"
1975 target="$target"
1976
1977 ],cat)dnl
1978 ${MAKE:-make} preinstall