43a8e10ab4a6656f38e840d5f24097d8e8ebe86c
[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.550 2012/05/05 20:54:32 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.550 $)
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                 CPPFLAGS="$CPPFLAGS -DNDEBUG"
1266         else
1267                 CF_ADD_ADAFLAGS(-gnata)
1268         fi
1269 fi
1270
1271 ###     use option --disable-leaks to suppress "permanent" leaks, for testing
1272 CF_DISABLE_LEAKS
1273 AC_DEFINE(HAVE_NC_ALLOC_H)
1274
1275 ###     use option --enable-expanded to generate certain macros as functions
1276 AC_ARG_ENABLE(expanded,
1277         [  --enable-expanded       test: generate functions for certain macros],
1278         [test "$enableval" = yes && AC_DEFINE(NCURSES_EXPANDED)])
1279
1280 ###     use option --disable-macros to suppress macros in favor of functions
1281 AC_ARG_ENABLE(macros,
1282         [  --disable-macros        test: use functions rather than macros],
1283         [test "$enableval" = no && AC_DEFINE(NCURSES_NOMACROS)])
1284
1285 # Normally we only add trace() to the debug-library.  Allow this to be
1286 # extended to all models of the ncurses library:
1287 cf_all_traces=no
1288 case "$CFLAGS $CPPFLAGS" in
1289 *-DTRACE*)
1290         cf_all_traces=yes
1291         ;;
1292 esac
1293
1294 AC_MSG_CHECKING(whether to add trace feature to all models)
1295 AC_ARG_WITH(trace,
1296 [  --with-trace            test: add trace() function to all models of ncurses],
1297 [cf_with_trace=$withval],
1298 [cf_with_trace=$cf_all_traces])
1299 AC_MSG_RESULT($cf_with_trace)
1300
1301 if test "$cf_with_trace" = yes ; then
1302         LIB_TRACING=all
1303         ADA_TRACE=TRUE
1304         CF_ADD_CFLAGS(-DTRACE)
1305 else
1306         LIB_TRACING=DEBUG
1307         ADA_TRACE=FALSE
1308 fi
1309
1310 AC_SUBST(ADA_TRACE)
1311
1312 ###     Checks for libraries.
1313 case $cf_cv_system_name in #(vi
1314 *mingw32*) #(vi
1315         ;;
1316 *)
1317 AC_CHECK_FUNC(gettimeofday,
1318         AC_DEFINE(HAVE_GETTIMEOFDAY),[
1319
1320 AC_CHECK_LIB(bsd, gettimeofday,
1321         AC_DEFINE(HAVE_GETTIMEOFDAY)
1322         CF_ADD_LIB(bsd))])dnl CLIX: bzero, select, gettimeofday
1323         ;;
1324 esac
1325
1326 CF_MATH_LIB(MATH_LIB,sin(x))
1327 AC_SUBST(MATH_LIB)
1328
1329 ###     Checks for header files.
1330 AC_STDC_HEADERS
1331 AC_HEADER_DIRENT
1332 AC_HEADER_TIME
1333 CF_REGEX
1334
1335 dnl These are some other potentially nonportable headers.
1336 AC_CHECK_HEADERS( \
1337 fcntl.h \
1338 getopt.h \
1339 limits.h \
1340 locale.h \
1341 math.h \
1342 poll.h \
1343 sys/bsdtypes.h \
1344 sys/ioctl.h \
1345 sys/param.h \
1346 sys/poll.h \
1347 sys/select.h \
1348 sys/time.h \
1349 sys/times.h \
1350 ttyent.h \
1351 unistd.h \
1352 wctype.h \
1353 )
1354
1355 CF_GETOPT_HEADER
1356
1357 # check for ISC (this may also define _POSIX_SOURCE)
1358 # Note: even non-Posix ISC needs <sys/bsdtypes.h> to declare fd_set
1359 if test "$ISC" = yes ; then
1360         AC_CHECK_LIB(cposix,main)
1361         AC_CHECK_LIB(inet,bzero,CF_ADD_LIB(inet))dnl also 'select()'
1362 fi
1363
1364 CF_SYS_TIME_SELECT
1365
1366 ###     checks for compiler characteristics
1367 AC_LANG_C
1368 AC_C_CONST
1369 CF_C_INLINE(NCURSES_INLINE,1200)
1370 CF_SIG_ATOMIC_T
1371
1372 if test $NCURSES_CHTYPE = auto ; then
1373         CF_TYPEOF_CHTYPE
1374 else
1375         cf_cv_typeof_chtype=$NCURSES_CHTYPE
1376 fi
1377 test "$cf_cv_typeof_chtype" = unsigned && cf_cv_typeof_chtype=""
1378 AC_SUBST(cf_cv_typeof_chtype)
1379
1380 CF_UNSIGNED_LITERALS
1381 cf_cv_1UL="1"
1382 test ".$cf_cv_unsigned_literals" = .yes && cf_cv_1UL="${cf_cv_1UL}U"
1383 test ".$cf_cv_typeof_chtype"    = .long && cf_cv_1UL="${cf_cv_1UL}L"
1384 AC_SUBST(cf_cv_1UL)
1385
1386 if test $NCURSES_MMASK_T = auto ; then
1387         cf_cv_typeof_mmask_t=long
1388 else
1389         cf_cv_typeof_mmask_t=$NCURSES_MMASK_T
1390 fi
1391 test "$cf_cv_typeof_mmask_t" = unsigned && cf_cv_typeof_mmask_t=""
1392 AC_SUBST(cf_cv_typeof_mmask_t)
1393
1394 ###     Checks for external-data
1395 CF_ERRNO
1396 CF_LINK_DATAONLY
1397
1398 ###     Checks for library functions.
1399 AC_CHECK_FUNCS( \
1400 getcwd \
1401 getegid \
1402 geteuid \
1403 getttynam \
1404 issetugid \
1405 poll \
1406 remove \
1407 select \
1408 setbuf \
1409 setbuffer \
1410 setvbuf \
1411 sigaction \
1412 sigvec \
1413 strdup \
1414 strstr \
1415 tcgetpgrp \
1416 times \
1417 vsnprintf \
1418 )
1419 if test "$with_getcap" = "yes" ; then
1420         CF_CGETENT
1421 fi
1422
1423 CF_ISASCII
1424 CF_STRUCT_SIGACTION
1425 CF_FUNC_NANOSLEEP
1426 CF_FUNC_TERMIOS
1427 CF_FUNC_VSSCANF
1428 CF_MKSTEMP
1429
1430 # setup for prototype of fallback for vsscanf()
1431 CF_SUBST_IF(["$cf_cv_func_vsscanf" = vsscanf], HAVE_VSSCANF, 1, 0)
1432
1433 dnl FIXME (may need this) AC_SYS_RESTARTABLE_SYSCALLS
1434 if test "$cross_compiling" = yes ; then
1435         AC_MSG_WARN(cross compiling: assume setvbuf params not reversed)
1436 else
1437         AC_FUNC_SETVBUF_REVERSED
1438 fi
1439 AC_TYPE_SIGNAL
1440 AC_CHECK_TYPE(intptr_t, long)
1441 CF_TYPE_SIGACTION
1442 CF_SIZECHANGE
1443 CF_FUNC_MEMMOVE
1444 CF_FUNC_POLL
1445 CF_VA_COPY
1446 AC_FUNC_VFORK
1447
1448 # special check for test/ditto.c
1449 CF_FUNC_OPENPTY
1450 if test "$cf_cv_func_openpty" != no ; then
1451     AC_DEFINE_UNQUOTED(USE_OPENPTY_HEADER,<$cf_cv_func_openpty>)
1452     AC_DEFINE(USE_XTERM_PTY)
1453     if test "$cf_cv_lib_util" = yes ; then
1454         CF_ADD_LIB(util,TEST_LIBS)
1455     fi
1456 fi
1457 AC_SUBST(TEST_LIBS)
1458 AC_SUBST(TEST_LIBS2)
1459
1460 if test "$with_hashed_db" != no ; then
1461         AC_DEFINE(USE_HASHED_DB)
1462         CF_HASHED_DB($with_hashed_db)
1463 fi
1464
1465 dnl We'll do our own -g libraries, unless the user's overridden via $CFLAGS
1466 if test -z "$cf_user_CFLAGS" && test "$with_no_leaks" = no ; then
1467         CF_STRIP_G_OPT(CFLAGS)
1468         CF_STRIP_G_OPT(CXXFLAGS)
1469 fi
1470
1471 # Just in case, check if the C compiler has a bool type.
1472 CF_BOOL_DECL(cf_cv_cc_bool_type)
1473
1474 # Check for C++ compiler characteristics (and ensure that it's there!)
1475 if test -n "$CXX" ; then
1476         AC_LANG_CPLUSPLUS
1477         CF_STDCPP_LIBRARY
1478         CF_PROG_CC_C_O(CXX)
1479
1480         case $GXX_VERSION in
1481         1*|2.[0-6]*)
1482                 cf_cxx_library=yes
1483                 ;;
1484         *-2.7*|2.7*)
1485                 CF_GPP_LIBRARY
1486                 ;;
1487         *)
1488                 cf_cxx_library=no
1489                 ;;
1490         esac
1491
1492         AC_CHECK_HEADERS(typeinfo)
1493         CF_CXX_IOSTREAM_NAMESPACE
1494         CF_BOOL_DECL
1495         CF_BOOL_SIZE
1496         CF_ETIP_DEFINES
1497         CF_CPP_PARAM_INIT
1498         CF_CPP_STATIC_CAST
1499         CF_CXX_AR_FLAGS
1500 else
1501         cf_cxx_library=no
1502         cf_cv_builtin_bool=1
1503
1504         # Just because we are not configuring against C++ right now does not
1505         # mean that a user will not want to use C++.  Some distributors disable
1506         # the C++ portion of this configuration as a shortcut (or just to avoid
1507         # compiling the demo in the c++ directory).  So we need a reasonable
1508         # default for the 'bool' type.
1509         #
1510         # Caveat: since the storage of the bool type is not standardized, it
1511         # may change.
1512
1513         if test "$NCURSES_BOOL" != auto ; then
1514                 cf_cv_type_of_bool=$NCURSES_BOOL
1515                 cf_cv_header_stdbool_h=0
1516         else
1517                 if test "$cf_cv_header_stdbool_h" = 1 ; then
1518                         CF_BOOL_SIZE
1519                 else
1520                         AC_MSG_CHECKING(for fallback type of bool)
1521                         case "$host_cpu" in #(vi
1522                         i?86)   cf_cv_type_of_bool=char ;; #(vi
1523                         *)      cf_cv_type_of_bool=int  ;;
1524                         esac
1525                         AC_MSG_RESULT($cf_cv_type_of_bool)
1526                 fi
1527         fi
1528 fi
1529 AC_SUBST(CXXLIBS)
1530
1531 # If the C compiler did not declare bool, and we did not determine that the C++
1532 # compiler does not declare bool, turn on an ifdef in curses.h that makes the
1533 # ncurses library use the same type as C++ bool.  Note that this allows one to
1534 # specify the type of bool in a configure-script option and postpone
1535 # integration with the C++ compiler provided that the types are compatible.
1536 USE_CXX_BOOL=1
1537 if test $cf_cv_cc_bool_type = 1
1538 then
1539         # oops: C has a bool.  Unlikely, but C++ could differ.
1540         USE_CXX_BOOL=0
1541 elif test $cf_cv_builtin_bool = 0
1542 then
1543         # C++ has no bool
1544         USE_CXX_BOOL=0
1545 else
1546         # this is the normal case
1547         USE_CXX_BOOL='defined(__cplusplus)'
1548 fi
1549 AC_SUBST(USE_CXX_BOOL)
1550
1551 CF_HELP_MESSAGE(Ada95 Binding Options:)
1552
1553 dnl If the Ada95 source-tree is present, add that to the build unless it will
1554 dnl not work, or was not requested.
1555 if test -f "${srcdir}/Ada95/Makefile.in" ; then
1556
1557 dnl libtool does not know anything about GNAT, though a change made in 1998
1558 dnl provided for it "someday".  Disable the ada subtree if we are using
1559 dnl libtool -TD 20070714
1560         if test "$cf_with_ada" != "no" ; then
1561                 if test "$with_libtool" != "no"; then
1562                         AC_MSG_WARN(libtool does not support Ada - disabling feature)
1563                         cf_with_ada=no
1564                 fi
1565         fi
1566
1567 dnl Check for availability of GNU Ada Translator (GNAT).
1568 dnl At the moment we support no other Ada95 compiler.
1569         if test "$cf_with_ada" != "no" ; then
1570                 CF_PROG_GNAT
1571                 if test "$cf_cv_prog_gnat_correct" = yes; then
1572                         CF_ADD_ADAFLAGS(-gnatpn)
1573                         CF_FIXUP_ADAFLAGS
1574
1575                         CF_GNAT_GENERICS
1576                         CF_GNAT_SIGINT
1577                         CF_GNAT_PRAGMA_UNREF
1578                         CF_GNAT_PROJECTS
1579
1580                         CF_WITH_ADA_COMPILER
1581
1582                         cf_ada_package=terminal_interface
1583                         AC_SUBST(cf_ada_package)
1584
1585                         CF_WITH_ADA_INCLUDE
1586                         CF_WITH_ADA_OBJECTS
1587                         CF_WITH_ADA_SHAREDLIB
1588                 fi
1589         fi
1590 else
1591         cf_with_ada=no
1592 fi
1593
1594 ### Construct the ncurses library-subsets, if any, from this set of keywords:
1595 ###     none, base, ext_funcs, ext_tinfo, ticlib, termlib, widechar
1596 ###
1597 ### ticlib modules may be a separate library, otherwise contained in termlib.
1598 ### termlib modules may be a separate library, otherwise contained in ncurses.
1599 ###
1600 ### The of "+" or " " between the tokens controls the way the script
1601 ### chooses to split module lists into libraries.
1602 ###
1603 ### (see CF_LIB_RULES).
1604 AC_MSG_CHECKING(for library subsets)
1605 LIB_SUBSETS=
1606
1607 if test "$cf_with_progs" = yes || test "$with_ticlib" != no || test "$with_termcap" != no; then
1608         LIB_SUBSETS="${LIB_SUBSETS}ticlib"
1609         if test "$with_ticlib" != no ; then
1610                 LIB_SUBSETS="${LIB_SUBSETS} "
1611         else
1612                 LIB_SUBSETS="${LIB_SUBSETS}+"
1613         fi
1614 fi
1615
1616 LIB_SUBSETS="${LIB_SUBSETS}termlib"
1617 test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_tinfo"
1618
1619 if test "$with_termlib" != no ; then
1620         LIB_SUBSETS="${LIB_SUBSETS} "
1621 else
1622         LIB_SUBSETS="${LIB_SUBSETS}+"
1623 fi
1624
1625 LIB_SUBSETS="${LIB_SUBSETS}base"
1626
1627 # Most term-driver calls are to tinfo, but some like init_pair are to the
1628 # base library (so it resides in base).
1629 if test "$with_term_driver" != no ; then
1630         LIB_SUBSETS="${LIB_SUBSETS}+port_drivers"
1631         case $cf_cv_system_name in #(vi
1632         *mingw32*) #(vi
1633                 LIB_SUBSETS="${LIB_SUBSETS}+port_tinfo+port_win32con"
1634                 ;;
1635         *) #(vi
1636                 LIB_SUBSETS="${LIB_SUBSETS}+port_tinfo"
1637                 ;;
1638         esac
1639 fi
1640
1641 test "$with_widec"     = yes && LIB_SUBSETS="${LIB_SUBSETS}+widechar"
1642 test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs"
1643
1644 AC_MSG_RESULT($LIB_SUBSETS)
1645
1646 ### Construct the list of include-directories to be generated
1647 CF_INCLUDE_DIRS
1648 CF_ADA_INCLUDE_DIRS
1649
1650 ### Build up pieces for makefile rules
1651 AC_MSG_CHECKING(default library suffix)
1652 CF_LIB_TYPE($DFT_LWR_MODEL,DFT_ARG_SUFFIX)dnl
1653 AC_SUBST(DFT_ARG_SUFFIX)dnl the string to append to "-lncurses" ("")
1654 AC_MSG_RESULT($DFT_ARG_SUFFIX)
1655
1656 AC_MSG_CHECKING(default library-dependency suffix)
1657 CF_LIB_SUFFIX($DFT_LWR_MODEL,DFT_LIB_SUFFIX,DFT_DEP_SUFFIX)dnl
1658 AC_SUBST(DFT_DEP_SUFFIX)dnl the corresponding library-suffix (".a")
1659 AC_MSG_RESULT($DFT_DEP_SUFFIX)
1660
1661 AC_MSG_CHECKING(default object directory)
1662 CF_OBJ_SUBDIR($DFT_LWR_MODEL,DFT_OBJ_SUBDIR)dnl
1663 AC_SUBST(DFT_OBJ_SUBDIR)dnl the default object-directory ("obj")
1664 AC_MSG_RESULT($DFT_OBJ_SUBDIR)
1665
1666 # libtool thinks it can make c++ shared libraries (perhaps only g++)
1667 if test "$cf_with_cxx" = yes ; then
1668 AC_MSG_CHECKING(c++ library-dependency suffix)
1669 if test "$with_libtool" != "no"; then
1670         CXX_LIB_SUFFIX=$DFT_DEP_SUFFIX
1671 else
1672         CF_LIB_SUFFIX(normal,CXX_LIB_SUFFIX,CXX_DEP_SUFFIX)dnl we normally make a static library
1673 fi
1674 AC_MSG_RESULT($CXX_LIB_SUFFIX)
1675 AC_SUBST(CXX_LIB_SUFFIX)
1676 fi
1677
1678 # do not want -ldl in build except as needed for -lncurses dependency
1679 if test "$with_dlsym" = yes ; then
1680 if test $DFT_LWR_MODEL = shared || \
1681    test $DFT_LWR_MODEL = libtool ; then
1682         CF_REMOVE_LIB(LIBS,$LIBS,dl)
1683 fi
1684 fi
1685 ### Set up low-level terminfo dependencies for makefiles.
1686
1687 # TICS_LIST and TINFO_LIST are needed to build libtic.so and libterm.so, but
1688 # do not need libdl
1689 TICS_LIST=
1690 if test "$with_dlsym" = yes ; then
1691         CF_REMOVE_LIB(TINFO_LIST,$SHLIB_LIST,dl)
1692 fi
1693
1694 if test "$with_ticlib" != no ; then
1695
1696         if test "$with_ticlib" != yes ; then
1697                 TICS_NAME=$with_ticlib
1698                 TICS_ARG_SUFFIX="${with_ticlib}`echo ${DFT_ARG_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
1699                 TICS_DEP_SUFFIX="${with_ticlib}`echo ${DFT_DEP_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
1700                 TICS_LIB_SUFFIX="${with_ticlib}"
1701         else
1702                 TICS_ARG_SUFFIX="${TICS_NAME}${DFT_ARG_SUFFIX}"
1703                 TICS_DEP_SUFFIX="${TICS_NAME}${DFT_DEP_SUFFIX}"
1704                 TICS_LIB_SUFFIX="${TICS_NAME}${LIB_SUFFIX}"
1705         fi
1706         TICS_LDFLAGS="-L${LIB_DIR}"
1707         TICS_LIBS="-l${TICS_LIB_SUFFIX}"
1708 else
1709         TICS_LDFLAGS="-L${LIB_DIR}"
1710         TICS_LIBS="-l${LIB_NAME}${DFT_ARG_SUFFIX}"
1711 fi
1712 AC_SUBST(TICS_ARG_SUFFIX)
1713 AC_SUBST(TICS_DEP_SUFFIX)
1714 AC_SUBST(TICS_LIB_SUFFIX)
1715 AC_SUBST(TICS_LDFLAGS)
1716 AC_SUBST(TICS_LIBS)
1717
1718 if test "$with_termlib" != no ; then
1719
1720         if test "$with_termlib" != yes ; then
1721                 TINFO_NAME=$with_termlib
1722                 TINFO_SUFFIX="`echo ${DFT_LIB_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
1723                 TINFO_ARG_SUFFIX="${with_termlib}`echo ${DFT_ARG_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
1724                 TINFO_DEP_SUFFIX="${with_termlib}`echo ${DFT_DEP_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
1725                 TINFO_LIB_SUFFIX="${with_termlib}"
1726         else
1727                 TINFO_SUFFIX=${DFT_LIB_SUFFIX}
1728                 TINFO_ARG_SUFFIX="${TINFO_NAME}${DFT_ARG_SUFFIX}"
1729                 TINFO_DEP_SUFFIX="${TINFO_NAME}${DFT_DEP_SUFFIX}"
1730                 TINFO_LIB_SUFFIX="${TINFO_NAME}${LIB_SUFFIX}"
1731         fi
1732
1733         TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${TINFO_DEP_SUFFIX}"
1734         TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${TINFO_DEP_SUFFIX}"
1735         if test "$DFT_LWR_MODEL" = "libtool"; then
1736                 TEST_ARGS="${TEST_DEPS}"
1737                 TEST_ARG2="${TEST_DEP2}"
1738                 TINFO_LDFLAGS="-L${LIB_DIR}"
1739                 TINFO_LIBS="$TEST_ARGS"
1740                 TICS_LIST="$SHLIB_LIST $TEST_ARGS"
1741                 SHLIB_LIST="${SHLIB_LIST} $TEST_ARGS"
1742         else
1743                 TEST_ARGS="-l${TINFO_ARG_SUFFIX}"
1744                 TEST_ARG2="-l${TINFO_ARG_SUFFIX}"
1745                 if test "x$with_term_driver" != xno ; then
1746                         TICS_LIST="$SHLIB_LIST -l${LIB_NAME}${DFT_ARG_SUFFIX}"
1747                         TICS_LIBS="$TICS_LIBS -l${LIB_NAME}${DFT_ARG_SUFFIX}"
1748                         TINFO_LIBS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS"
1749                 else
1750                         TICS_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}"
1751                         TINFO_LIBS="$TEST_ARGS"
1752                 fi
1753                 TINFO_LDFLAGS="-L${LIB_DIR}"
1754                 SHLIB_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}"
1755         fi
1756 else
1757         # the next lines are needed for linking libtic over libncurses
1758         TINFO_NAME=${LIB_NAME}
1759         TINFO_SUFFIX=${DFT_LIB_SUFFIX}
1760         TINFO_ARG_SUFFIX=${LIB_NAME}${DFT_ARG_SUFFIX}
1761         if test "$with_tic_depends" = yes ; then
1762                 TICS_LIST="$SHLIB_LIST -l${LIB_NAME}${DFT_ARG_SUFFIX}"
1763         else
1764                 TICS_LIST="$SHLIB_LIST"
1765         fi
1766
1767         TINFO_LDFLAGS="-L${LIB_DIR}"
1768         TINFO_LIBS="-l${LIB_NAME}${DFT_ARG_SUFFIX}"
1769 fi
1770
1771 if test "$DFT_LWR_MODEL" = shared ; then
1772         case $cf_cv_system_name in #(vi
1773         cygwin*)
1774                 # "lib" files have ".dll.a" suffix, "cyg" files have ".dll"
1775                 TINFO_SUFFIX=.dll
1776                 ;;
1777         esac
1778 fi
1779
1780 AC_SUBST(TINFO_ARG_SUFFIX)
1781 AC_SUBST(TINFO_DEP_SUFFIX)
1782 AC_SUBST(TINFO_LIB_SUFFIX)
1783 AC_SUBST(TINFO_LDFLAGS)
1784 AC_SUBST(TINFO_LIBS)
1785
1786 if test "$with_dlsym" = yes ; then
1787         CF_REMOVE_LIB(TICS_LIST,$TICS_LIST,dl)
1788 fi
1789
1790 if test "$DFT_LWR_MODEL" = "libtool"; then
1791     OBJEXT=lo
1792 fi
1793
1794 # needed for Ada95
1795 TINFO_LDFLAGS2=`echo "$TINFO_LDFLAGS" | sed -e 's,-L\.\./,-L../../,'`
1796 AC_SUBST(TINFO_LDFLAGS2)
1797
1798 case $DFT_LWR_MODEL in
1799 normal|debug|profile)
1800         CF_LDFLAGS_STATIC
1801         ;;
1802 esac
1803
1804 AC_MSG_CHECKING(where we will install curses.h)
1805 test "$with_overwrite" = no && \
1806 test "x$includedir" = 'x${prefix}/include' && \
1807         includedir='${prefix}/include/ncurses'${LIB_SUFFIX}
1808 AC_MSG_RESULT($includedir)
1809
1810 ### Resolve a conflict between normal and wide-curses by forcing applications
1811 ### that will need libutf8 to add it to their configure script.
1812 if test "$with_overwrite" != no ; then
1813 if test "$NCURSES_LIBUTF8" = 1 ; then
1814         NCURSES_LIBUTF8='defined(HAVE_LIBUTF8_H)'
1815         AC_MSG_WARN(Wide-character applications must define HAVE_LIBUTF8_H to include curses.h)
1816 fi
1817 fi
1818 WITH_OVERWRITE=$with_overwrite
1819
1820 AC_SUBST(WITH_OVERWRITE)
1821 AC_SUBST(TICS_LIST)
1822 AC_SUBST(TINFO_LIST)
1823 AC_SUBST(SHLIB_LIST)
1824
1825 # used to separate tack out of the tree
1826 NCURSES_TREE=
1827 AC_SUBST(NCURSES_TREE)
1828
1829 ### predefined stuff for the test programs
1830 AC_DEFINE(HAVE_SLK_COLOR)
1831
1832 ### Construct the list of subdirectories for which we'll customize makefiles
1833 ### with the appropriate compile-rules.
1834
1835 CF_SRC_MODULES($modules_to_build)
1836
1837 if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = "xyes"; then
1838    SUB_MAKEFILES="$SUB_MAKEFILES Ada95/gen/adacurses${DFT_ARG_SUFFIX}-config:Ada95/gen/adacurses-config.in"
1839    SUB_MAKEFILES="$SUB_MAKEFILES man/adacurses${DFT_ARG_SUFFIX}-config.1:man/MKada_config.in"
1840 fi
1841
1842 CF_DIRS_TO_MAKE
1843
1844 # symbols that differ when compiling Ada95 by itself.
1845 NCURSES_SHLIB2='sh $(top_srcdir)/misc/shlib'
1846 AC_SUBST(NCURSES_SHLIB2)
1847
1848 # values to use as strings
1849 AC_DEFINE_UNQUOTED(NCURSES_PATHSEP,'$PATH_SEPARATOR')
1850
1851 AC_DEFINE_UNQUOTED(NCURSES_VERSION_STRING, "${NCURSES_MAJOR}.${NCURSES_MINOR}.${NCURSES_PATCH}")
1852
1853 ### Now that we're done running tests, add the compiler-warnings, if any
1854 CF_ADD_CFLAGS($EXTRA_CFLAGS)
1855
1856 ### Define substitutions for header files to avoid name-pollution
1857 CF_SUBST_IF(["$cf_cv_have_tcgetattr" = yes], HAVE_TCGETATTR, 1, 0)
1858 CF_SUBST_IF(["$ac_cv_header_termio_h" = yes], HAVE_TERMIO_H, 1, 0)
1859 CF_SUBST_IF(["$ac_cv_header_termios_h" = yes], HAVE_TERMIOS_H, 1, 0)
1860
1861 ################################################################################
1862 test "$use_database" = yes && \
1863 SUB_MAKEFILES="$SUB_MAKEFILES misc/run_tic.sh:misc/run_tic.in"
1864
1865 SUB_MAKEFILES="$SUB_MAKEFILES misc/ncurses-config:misc/ncurses-config.in"
1866 SUB_MAKEFILES="$SUB_MAKEFILES man/ncurses${DFT_ARG_SUFFIX}${cf_cv_abi_version}-config.1:man/MKncu_config.in"
1867
1868 if test x"$enable_pc_files" = xyes ; then \
1869 SUB_MAKEFILES="$SUB_MAKEFILES misc/gen-pkgconfig:misc/gen-pkgconfig.in"
1870 MAKE_PC_FILES=
1871 else
1872 MAKE_PC_FILES="#"
1873 fi
1874 AC_SUBST(MAKE_PC_FILES)
1875 AC_SUBST(cross_compiling)
1876
1877 AC_PATH_PROG(TIC_PATH,tic,unknown,$PATH:/usr/local/ncurses/bin)
1878 if test -n "$FALLBACK_LIST"
1879 then
1880         if test "$TIC_PATH" = unknown
1881         then
1882                 AC_MSG_WARN(no tic program found for fallbacks)
1883         fi
1884 fi
1885 AC_SUBST(TIC_PATH)
1886
1887 if test "x$cf_with_tests" != xno ; then
1888         MAKE_TESTS=
1889 else
1890         MAKE_TESTS="#"
1891 fi
1892 AC_SUBST(MAKE_TESTS)
1893
1894 ADAHTML_DIR=../../doc/html/ada
1895 AC_SUBST(ADAHTML_DIR)
1896
1897 SUB_SCRIPTS=
1898
1899 AC_OUTPUT( \
1900         include/MKterm.h.awk \
1901         include/curses.head:include/curses.h.in \
1902         include/ncurses_dll.h \
1903         include/termcap.h \
1904         include/unctrl.h \
1905         $SUB_SCRIPTS \
1906         $SUB_MAKEFILES \
1907         Makefile,[
1908 if test "x$cf_with_tests" != xno ; then
1909         CF_PRG_RULES([$srcdir/test/mk-test.awk INSTALL=no ECHO_LINK="$ECHO_LD"], test)
1910 fi
1911 CF_LIB_RULES($SRC_SUBDIRS)
1912
1913 if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = "xyes"; then
1914 if test -z "$USE_OLD_MAKERULES" ; then
1915         $AWK -f $srcdir/Ada95/mk-1st.awk <$srcdir/Ada95/src/modules >>Ada95/src/Makefile
1916 fi
1917 fi
1918 ],[
1919 ### Special initialization commands, used to pass information from the
1920 ### configuration-run into config.status
1921
1922 AWK="$AWK"
1923 DFT_ARG_SUFFIX="$DFT_ARG_SUFFIX"
1924 DFT_LWR_MODEL="$DFT_LWR_MODEL"
1925 ECHO_LD="$ECHO_LD"
1926 LDCONFIG="$LDCONFIG"
1927 LIBTOOL_VERSION="$LIBTOOL_VERSION"
1928 LIB_NAME="$LIB_NAME"
1929 LIB_PREFIX="$LIB_PREFIX"
1930 LIB_SUBSETS="$LIB_SUBSETS"
1931 LIB_SUFFIX="$LIB_SUFFIX"
1932 LIB_TRACING="$LIB_TRACING"
1933 LN_S="$LN_S"
1934 MAKE_TERMINFO="$MAKE_TERMINFO"
1935 NCURSES_MAJOR="$NCURSES_MAJOR"
1936 NCURSES_MINOR="$NCURSES_MINOR"
1937 NCURSES_OSPEED="$NCURSES_OSPEED"
1938 NCURSES_PATCH="$NCURSES_PATCH"
1939 SRC_SUBDIRS="$SRC_SUBDIRS"
1940 TERMINFO="$TERMINFO"
1941 TICS_ARG_SUFFIX="$TICS_ARG_SUFFIX"
1942 TICS_LIB_SUFFIX="$TICS_LIB_SUFFIX"
1943 TICS_NAME="$TICS_NAME"
1944 TIC_PATH="$TIC_PATH"
1945 TINFO_ARG_SUFFIX="$TINFO_ARG_SUFFIX"
1946 TINFO_LIB_SUFFIX="$TINFO_LIB_SUFFIX"
1947 TINFO_NAME="$TINFO_NAME"
1948 TINFO_SUFFIX="$TINFO_SUFFIX"
1949 USE_OLD_MAKERULES="$USE_OLD_MAKERULES"
1950 WITH_CURSES_H="$with_curses_h"
1951 WITH_ECHO="$with_echo"
1952 WITH_OVERWRITE="$with_overwrite"
1953 cf_LIST_MODELS="$cf_list_models"
1954 cf_cv_abi_version="$cf_cv_abi_version"
1955 cf_cv_do_relink="$cf_cv_do_relink"
1956 cf_cv_do_symlinks="$cf_cv_do_symlinks"
1957 cf_cv_enable_lp64="$cf_cv_enable_lp64"
1958 cf_cv_enable_opaque="$cf_cv_enable_opaque"
1959 cf_cv_prog_CC_c_o=$cf_cv_prog_CC_c_o
1960 cf_cv_prog_CXX_c_o=$cf_cv_prog_CXX_c_o
1961 cf_cv_prog_gnat_correct=$cf_cv_prog_gnat_correct
1962 cf_cv_rel_version="$cf_cv_rel_version"
1963 cf_cv_rm_so_locs="$cf_cv_rm_so_locs"
1964 cf_cv_shared_soname='$cf_cv_shared_soname'
1965 cf_cv_shlib_version="$cf_cv_shlib_version"
1966 cf_cv_shlib_version_infix="$cf_cv_shlib_version_infix"
1967 cf_cv_system_name="$cf_cv_system_name"
1968 cf_cv_term_driver="$with_term_driver"
1969 cf_with_ada="$cf_with_ada"
1970 cf_with_cxx_binding="$cf_with_cxx_binding"
1971 cf_with_manpages="$cf_with_manpages"
1972 cf_with_tests="$cf_with_tests"
1973 host="$host"
1974 target="$target"
1975
1976 ],cat)dnl
1977 ${MAKE:-make} preinstall