ncurses 6.1 - patch 20200118
[ncurses.git] / configure.in
1 dnl***************************************************************************
2 dnl Copyright (c) 1998-2019,2020 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.693 2020/01/11 23:27:16 tom Exp $
32 dnl Process this file with autoconf to produce a configure script.
33 dnl
34 dnl For additional information, see
35 dnl     https://invisible-island.net/autoconf/
36 dnl     https://invisible-island.net/autoconf/my-autoconf.html
37 dnl
38 dnl ---------------------------------------------------------------------------
39 AC_PREREQ(2.52.20200111)
40 AC_REVISION($Revision: 1.693 $)
41 AC_INIT(ncurses/base/lib_initscr.c)
42 AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin)
43
44 AC_DEFUN([AC_PATH_XTRA],[])dnl ignore dependencies on this
45
46 CF_TOP_BUILDDIR
47 CF_SUBST_NCURSES_VERSION
48 CF_VERSION_INFO(NCURSES,ncurses)
49
50 CF_WITH_REL_VERSION(NCURSES)
51 CF_NCURSES_WITH_ABI_VERSION
52
53 CF_WITH_SYSTYPE
54
55 ###     Save the given $CFLAGS to allow user-override.
56 cf_user_CFLAGS="$CFLAGS"
57
58 ###     Default install-location
59 CF_CFG_DEFAULTS
60 ### Defaults for ncurses ABI
61 CF_ABI_DEFAULTS
62
63 ###     Checks for programs.
64 AC_ARG_WITH(ada,
65         [  --without-ada           suppress check for Ada compiler, don't build demo],
66         [cf_with_ada=$withval],
67         [cf_with_ada=yes])
68
69 if test "x$cf_with_ada" = xyes
70 then
71         cf_prog_cc="gnatgcc gcc cc"
72 else
73         cf_prog_cc="gcc cc"
74 fi
75 CF_PROG_CC($cf_prog_cc)
76
77 AC_PROG_CPP
78 AC_PROG_GCC_TRADITIONAL
79 CF_PROG_CC_C_O(CC,[$CFLAGS $CPPFLAGS])
80 CF_PROG_LDCONFIG
81
82 dnl DEFECT in autoconf 2.12:    an attempt to set policy, this breaks the
83 dnl                             configure script by not letting us test if C++
84 dnl                             is present, making this option necessary.
85 AC_MSG_CHECKING(if you want to ensure bool is consistent with C++)
86 AC_ARG_WITH(cxx,
87         [  --without-cxx           do not adjust ncurses bool to match C++],
88         [cf_with_cxx=$withval],
89         [cf_with_cxx=yes])
90 AC_MSG_RESULT($cf_with_cxx)
91 if test "X$cf_with_cxx" = Xno ; then
92         CXX=""
93         GXX=""
94 else
95         # with autoconf 2.13, we can change the error to a warning:
96         pushdef([AC_MSG_ERROR],
97                 [AC_MSG_RESULT(no)
98                  AC_MSG_WARN([You don't have any C++ compiler, too bad])
99                 cf_with_cxx=no; CXX=""; GXX="";])dnl
100         AC_PROG_CXX
101         popdef([AC_MSG_ERROR])dnl
102
103         AC_LANG_PUSH(C++)
104         if test "x$cf_with_cxx" != xno
105         then
106                 # Several of the C++ configurations do not work, particularly when
107                 # cross-compiling (20140913 -TD)
108                 AC_MSG_CHECKING(if $CXX works)
109
110                 save_CPPFLAGS="$CPPFLAGS"
111                 eval cf_includedir=${includedir}
112                 CPPFLAGS="$CPPFLAGS -I${cf_includedir}"
113                 AC_TRY_COMPILE([
114 #include <stdlib.h>
115 #include <stdio.h>
116 ],
117                 [
118                 printf("Hello world!\n")
119                 ],
120                 [cf_cxx_works=yes],
121                 [cf_cxx_works=no])
122                 CPPFLAGS="$save_CPPFLAGS"
123
124                 AC_MSG_RESULT($cf_cxx_works)
125                 if test "x$cf_cxx_works" = xno
126                 then
127                         AC_MSG_WARN([Ignore $CXX, since it cannot compile hello-world.])
128                         cf_with_cxx=no; CXX=""; GXX="";
129                 fi
130         fi
131         AC_LANG_POP
132
133         # autoconf 2.5x removed the error (hardcoding it to g++, or just blank)
134         if test "$CXX" = "g++" ; then
135                 AC_PATH_PROG(CXX,g++)
136         fi
137         case "x$CXX" in
138         (x|xg++)
139                 AC_MSG_WARN([You don't have any C++ compiler, too bad])
140                 cf_with_cxx=no; CXX=""; GXX="";
141                 ;;
142         esac
143 fi
144
145 CF_GXX_VERSION
146 case $GXX_VERSION in
147 (1*|2.[[0-6]]*)
148         # GXX=""; CXX=""; ac_cv_prog_gxx=no
149         # cf_cxx_library=no
150         AC_MSG_WARN(templates do not work)
151         ;;
152 esac
153
154 AC_MSG_CHECKING(if you want to build C++ binding and demo)
155 AC_ARG_WITH(cxx-binding,
156         [  --without-cxx-binding   do not build C++ binding and demo],
157         [cf_with_cxx_binding=$withval],
158         [cf_with_cxx_binding=$cf_with_cxx])
159 AC_MSG_RESULT($cf_with_cxx_binding)
160
161 AC_MSG_CHECKING(if you want to build with Ada)
162 AC_MSG_RESULT($cf_with_ada)
163
164 AC_MSG_CHECKING(if you want to install terminal database)
165 AC_ARG_ENABLE(db-install,
166         [  --disable-db-install    suppress install of terminal database],
167         [cf_with_db_install=$enableval],
168         [cf_with_db_install=yes])
169 AC_MSG_RESULT($cf_with_db_install)
170
171 AC_MSG_CHECKING(if you want to install manpages)
172 AC_ARG_WITH(manpages,
173         [  --without-manpages      suppress install of manpages],
174         [cf_with_manpages=$withval],
175         [cf_with_manpages=yes])
176 AC_MSG_RESULT($cf_with_manpages)
177
178 AC_MSG_CHECKING(if you want to build programs such as tic)
179 AC_ARG_WITH(progs,
180         [  --without-progs         suppress build/install with programs (e.g., tic)],
181         [cf_with_progs=$withval],
182         [cf_with_progs=yes])
183 AC_MSG_RESULT($cf_with_progs)
184
185 if test -f $srcdir/tack/tack.h; then
186         if test "x$cross_compiling" = xyes ; then
187                 CF_VERBOSE(ignoring tack because we are cross-compiling)
188                 cf_with_tack=no
189         else
190                 AC_MSG_CHECKING(if you want to build the tack program)
191                 AC_ARG_WITH(tack,
192                         [  --without-tack          suppress build/install with tack program],
193                         [cf_with_tack=$withval],
194                         [cf_with_tack=$cf_with_progs])
195                 AC_MSG_RESULT($cf_with_tack)
196         fi
197 else
198         cf_with_tack=no
199 fi
200
201 AC_MSG_CHECKING(if you want to build test-programs)
202 AC_ARG_WITH(tests,
203         [  --without-tests         suppress build/install with test-programs],
204         [cf_with_tests=$withval],
205         [cf_with_tests=yes])
206 AC_MSG_RESULT($cf_with_tests)
207
208 AC_MSG_CHECKING(if you wish to install curses.h)
209 AC_ARG_WITH(curses-h,
210         [  --without-curses-h      install curses.h as ncurses.h only],
211         [with_curses_h=$withval],
212         [with_curses_h=yes])
213 AC_MSG_RESULT($with_curses_h)
214
215 modules_to_build="ncurses"
216 test "X$cf_with_progs" != Xno && modules_to_build="$modules_to_build progs"
217 test "X$cf_with_tack"  != Xno && modules_to_build="$modules_to_build tack"
218 modules_to_build="$modules_to_build panel menu form"
219
220 AC_ARG_PROGRAM
221
222 CF_PROG_AWK
223 CF_PROG_EGREP
224 CF_PROG_INSTALL
225 CF_PROG_LINT
226 CF_PROG_LN_S
227
228 AC_SYS_LONG_FILE_NAMES
229
230 # Provide for renaming "ncurses5-config" to "ncurses5X-config", etc., in case
231 # of package conflict.
232 cf_config_suffix=
233 AC_ARG_WITH(config-suffix,
234         [  --with-config-suffix=X  suffixes ncursesXX-config file],
235         [case "x$withval" in
236         (xyes|xno)
237                 AC_MSG_WARN(expected a value for config-suffix option)
238                 ;;
239         (*)     cf_config_suffix="$withval"
240                 ;;
241         esac])
242 AC_SUBST(cf_config_suffix)
243
244 # If we find pkg-config, check if we should install the ".pc" files.
245 CF_PKG_CONFIG
246 CF_WITH_PKG_CONFIG_LIBDIR
247 CF_ENABLE_PC_FILES
248 if test -z "$MAKE_PC_FILES"
249 then
250         AC_MSG_CHECKING(for suffix to add to pc-files)
251 AC_ARG_WITH(pc-suffix,
252         [  --with-pc-suffix        suffixes pc-files],
253         [case "x$withval" in
254         (xyes|xno)
255                 PC_MODULE_SUFFIX=
256                 ;;
257         (*)     PC_MODULE_SUFFIX="$withval"
258                 ;;
259         esac])
260         test -z "$PC_MODULE_SUFFIX" && PC_MODULE_SUFFIX=none
261         AC_MSG_RESULT($PC_MODULE_SUFFIX)
262         test "$PC_MODULE_SUFFIX" = none && PC_MODULE_SUFFIX=
263         AC_SUBST(PC_MODULE_SUFFIX)
264 fi
265
266 AC_MSG_CHECKING(if we should assume mixed-case filenames)
267 AC_ARG_ENABLE(mixed-case,
268         [  --enable-mixed-case     tic should assume mixed-case filenames],
269         [enable_mixedcase=$enableval],
270         [enable_mixedcase=auto])
271 AC_MSG_RESULT($enable_mixedcase)
272 if test "$enable_mixedcase" = "auto" ; then
273         CF_MIXEDCASE_FILENAMES
274 else
275         cf_cv_mixedcase=$enable_mixedcase
276         if test "x$enable_mixedcase" = "xyes" ; then
277                 AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if tic should assume mixed-case filenames])
278         fi
279 fi
280
281 # do this after mixed-case option (tags/TAGS is not as important as tic).
282 AC_PROG_MAKE_SET
283 CF_MAKE_TAGS
284 CF_MAKEFLAGS
285
286 dnl These are standard among *NIX systems, but not when cross-compiling
287 AC_CHECK_TOOL(RANLIB, ranlib, ':')
288 AC_CHECK_TOOL(LD, ld, ld)
289 AC_CHECK_TOOL(AR, ar, ar)
290 AC_CHECK_TOOL(NM, nm, nm)
291 CF_AR_FLAGS
292
293 dnl Special option for use by system-builders: the install-prefix is used to
294 dnl adjust the location into which the actual install is done, so that an
295 dnl archive can be built without modifying the host system's configuration.
296 AC_MSG_CHECKING(if you have specified an install-prefix)
297 AC_ARG_WITH(install-prefix,
298         [  --with-install-prefix   prefixes actual install-location ($DESTDIR)],
299         [case "x$withval" in
300         (xyes|xno)
301                 ;;
302         (*)     DESTDIR="$withval"
303                 ;;
304         esac])
305 AC_MSG_RESULT($DESTDIR)
306 AC_SUBST(DESTDIR)
307
308 ###############################################################################
309 CF_HELP_MESSAGE(Build-Tools Needed to Compile Temporary Applications for Cross-compiling:)
310 # If we're cross-compiling, allow the user to override the tools and their
311 # options.  The configure script is oriented toward identifying the host
312 # compiler, etc., but we need a build compiler to generate parts of the source.
313 CF_BUILD_CC
314
315 ###############################################################################
316 CF_HELP_MESSAGE(Options to Specify the Libraries Built/Used:)
317
318 ### Options to allow the user to specify the set of libraries which are used.
319 ### Use "--without-normal --with-shared" to allow the default model to be
320 ### shared, for example.
321 cf_list_models=""
322 AC_SUBST(cf_list_models)dnl     the complete list of models ("normal debug")
323
324 CF_WITH_LIBTOOL
325 if test "$with_libtool" != "no" ; then
326
327 cf_list_models="$cf_list_models libtool"
328
329 else
330
331 AC_MSG_CHECKING(if you want to build shared libraries)
332 AC_ARG_WITH(shared,
333         [  --with-shared           generate shared-libraries],
334         [with_shared=$withval],
335         [with_shared=no])
336 AC_MSG_RESULT($with_shared)
337 test "x$with_shared" = "xyes" && cf_list_models="$cf_list_models shared"
338
339 AC_MSG_CHECKING(if you want to build static libraries)
340 AC_ARG_WITH(normal,
341         [  --with-normal           generate normal-libraries (default)],
342         [with_normal=$withval],
343         [with_normal=yes])
344 AC_MSG_RESULT($with_normal)
345 test "x$with_normal" = "xyes" && cf_list_models="$cf_list_models normal"
346
347 AC_MSG_CHECKING(if you want to build debug libraries)
348 AC_ARG_WITH(debug,
349         [  --with-debug            generate debug-libraries (default)],
350         [with_debug=$withval],
351         [with_debug=yes])
352 AC_MSG_RESULT($with_debug)
353 test "x$with_debug" = "xyes" && cf_list_models="$cf_list_models debug"
354
355 AC_MSG_CHECKING(if you want to build profiling libraries)
356 AC_ARG_WITH(profile,
357         [  --with-profile          generate profile-libraries],
358         [with_profile=$withval],
359         [with_profile=no])
360 AC_MSG_RESULT($with_profile)
361 test "x$with_profile" = "xyes" && cf_list_models="$cf_list_models profile"
362
363 fi
364
365 if test "X$cf_with_cxx_binding" != Xno; then
366 if test "x$with_shared" = "xyes"; then
367 AC_MSG_CHECKING(if you want to build C++ shared libraries)
368 AC_ARG_WITH(cxx-shared,
369         [  --with-cxx-shared       generate C++ shared-libraries],
370         [with_shared_cxx=$withval],
371         [with_shared_cxx=no])
372 AC_MSG_RESULT($with_shared_cxx)
373 fi
374 fi
375
376 ###############################################################################
377
378 AC_MSG_CHECKING(for specified models)
379 test -z "$cf_list_models" && cf_list_models=normal
380 dnl If we use libtool to generate libraries, then it must be the only
381 dnl specified model.
382 test "$with_libtool" != "no" && cf_list_models=libtool
383 AC_MSG_RESULT($cf_list_models)
384
385 ### Use the first model as the default, and save its suffix for use in building
386 ### up test-applications.
387 AC_MSG_CHECKING(for default model)
388 DFT_LWR_MODEL=`echo "$cf_list_models" | $AWK '{print $1}'`
389 AC_MSG_RESULT($DFT_LWR_MODEL)
390
391 CF_UPPER(DFT_UPR_MODEL,$DFT_LWR_MODEL)dnl
392
393 AC_SUBST(DFT_LWR_MODEL)dnl      the default model ("normal")
394 AC_SUBST(DFT_UPR_MODEL)dnl      the default model ("NORMAL")
395
396 TICS_NAME=tic
397 AC_SUBST(TICS_NAME)
398
399 TINFO_NAME=tinfo
400 AC_SUBST(TINFO_NAME)
401
402 LIB_NAME=ncurses
403 AC_SUBST(LIB_NAME)
404
405 LIB_DIR=../lib
406 LIB_2ND=../../lib
407
408 CF_WITH_LIB_PREFIX(cf_prefix)
409
410 LIB_SUFFIX=
411 AC_SUBST(LIB_SUFFIX)
412 CF_PATHSEP
413
414 ###############################################################################
415
416 AC_MSG_CHECKING(if you want to build a separate terminfo library)
417 AC_ARG_WITH(termlib,
418         [  --with-termlib          generate separate terminfo library],
419         [with_termlib=$withval],
420         [with_termlib=no])
421 AC_MSG_RESULT($with_termlib)
422
423 AC_MSG_CHECKING(if you want to build a separate tic library)
424 AC_ARG_WITH(ticlib,
425         [  --with-ticlib           generate separate tic library],
426         [with_ticlib=$withval],
427         [with_ticlib=no])
428 AC_MSG_RESULT($with_ticlib)
429
430 dnl Not all ports of gcc support the -g option
431
432 if test X"$CC_G_OPT" = X"" ; then
433         CC_G_OPT='-g'
434         test -n "$GCC" && test "x${ac_cv_prog_cc_g}" != xyes && CC_G_OPT=''
435 fi
436 AC_SUBST(CC_G_OPT)
437
438 if test X"$CXX_G_OPT" = X"" ; then
439         CXX_G_OPT='-g'
440         test -n "$GXX" && test "x${ac_cv_prog_cxx_g}" != xyes && CXX_G_OPT=''
441 fi
442 AC_SUBST(CXX_G_OPT)
443
444 AC_MSG_CHECKING(for default loader flags)
445 case $DFT_LWR_MODEL in
446 (libtool) LD_MODEL=''   ;;
447 (normal)  LD_MODEL=''   ;;
448 (debug)   LD_MODEL=$CC_G_OPT ;;
449 (profile) LD_MODEL='-pg';;
450 (shared)  LD_MODEL=''   ;;
451 esac
452 AC_SUBST(LD_MODEL)dnl           the type of link (e.g., -g or -pg)
453 AC_MSG_RESULT($LD_MODEL)
454
455 case $DFT_LWR_MODEL in
456 (shared)
457 CF_ENABLE_RPATH
458 AC_MSG_CHECKING(if shared libraries should be relinked during install)
459 AC_ARG_ENABLE(relink,
460 [  --disable-relink        relink shared libraries during install],
461 [cf_cv_do_relink=$enableval],
462 [cf_cv_do_relink=yes])
463 AC_MSG_RESULT($cf_cv_do_relink)
464         ;;
465 esac
466
467 # we will build libraries one-level down.
468 rel_builddir=..
469 CF_SHARED_OPTS
470 for model in $cf_list_models; do
471         case $model in
472         (libtool)
473                 CF_WITH_LIBTOOL_OPTS
474                 CF_WITH_EXPORT_SYMS
475                 ;;
476         (shared)
477                 if test "$CC_SHARED_OPTS" = "unknown"; then
478                         AC_ERROR(Shared libraries are not supported in this version)
479                 fi
480                 # workaround for inept transition to PIE vs PIC...
481                 AC_MSG_CHECKING(if current CFLAGS link properly)
482                 AC_TRY_LINK(
483                         [#include <stdio.h>],
484                         [printf("Hello work\n");],
485                         [cf_cflags_work=yes],
486                         [cf_cflags_work=no])
487                 AC_MSG_RESULT($cf_cflags_work)
488                 if test "$cf_cflags_work" = no
489                 then
490                         CF_VERBOSE(try to work around by appending shared-options)
491                         CFLAGS="$CFLAGS $CC_SHARED_OPTS"
492                 fi
493                 CF_WITH_VERSIONED_SYMS
494                 ;;
495         esac
496 done
497
498 ### Checks for special libraries, must be done up-front.
499 SHLIB_LIST=""
500 CF_WITH_GPM
501 if test "$with_gpm" != no ; then
502         AC_MSG_CHECKING(if you want to load GPM dynamically)
503         AC_ARG_WITH(dlsym,
504                 [  --without-dlsym         do not use dlsym() to load GPM dynamically],
505                 [with_dlsym=$withval],
506                 [with_dlsym=yes])
507         AC_MSG_RESULT($with_dlsym)
508         if test "x$with_dlsym" = xyes ; then
509                 CF_FUNC_DLSYM
510                 if test "x$with_gpm" != xyes ; then
511                         CF_VERBOSE(assuming soname for gpm is $with_gpm)
512                         cf_cv_gpm_soname="$with_gpm"
513                 else
514                         CF_LIB_SONAME([#include <gpm.h>],[if (Gpm_Open(0,0)) Gpm_Close();],gpm)
515                 fi
516                 test "$cf_cv_gpm_soname" != "unknown" && AC_DEFINE_UNQUOTED(LIBGPM_SONAME,"$cf_cv_gpm_soname",[Define as needed to set the gpm share library soname])
517                 SHLIB_LIST="-ldl $SHLIB_LIST"
518                 CF_ADD_LIB(dl,PRIVATE_LIBS)
519         else
520                 SHLIB_LIST="-lgpm $SHLIB_LIST"
521                 CF_ADD_LIB(gpm,TEST_LIBS)
522                 CF_ADD_LIB(gpm,PRIVATE_LIBS)
523         fi
524         AC_DEFINE(HAVE_LIBGPM,1,[Define to 1 if we have the gpm library])
525         CF_CHECK_GPM_WGETCH
526 fi
527
528 CF_WITH_PCRE2
529 CF_WITH_SYSMOUSE
530
531 # pretend that ncurses==ncursesw==ncursest
532 AC_MSG_CHECKING(if you want to disable library suffixes)
533 CF_ARG_DISABLE(lib-suffixes,
534         [  --disable-lib-suffixes  disable library suffixes],
535         [disable_lib_suffixes=yes],
536         [disable_lib_suffixes=no],
537         no)
538 AC_MSG_RESULT($disable_lib_suffixes)
539
540 ### If we're building with rpath, try to link non-standard libs that way too.
541 if test "$DFT_LWR_MODEL" = "shared" && test "x$cf_cv_enable_rpath" != xno; then
542         CF_DISABLE_RPATH_HACK
543 fi
544
545 ###############################################################################
546 CF_HELP_MESSAGE(Fine-Tuning Your Configuration:)
547
548 ###     use option --with-extra-suffix to append suffix to headers and libraries
549 AC_MSG_CHECKING(if you wish to append extra suffix to header/library paths)
550 EXTRA_SUFFIX=
551 AC_ARG_WITH(extra-suffix,
552         [  --with-extra-suffix=X   append extra suffix to header/library paths],
553         [case x$withval in
554         (no)
555                 ;;
556         (xyes|x)
557                 EXTRA_SUFFIX=$cf_cv_abi_version
558                 ;;
559         (*)
560                 EXTRA_SUFFIX=$withval
561                 ;;
562         esac
563         ])
564 AC_MSG_RESULT($EXTRA_SUFFIX)
565 AC_SUBST(EXTRA_SUFFIX)
566
567 ###     use option --disable-overwrite to leave out the link to -lcurses
568 AC_MSG_CHECKING(if you wish to install ncurses overwriting curses)
569 AC_ARG_ENABLE(overwrite,
570         [  --disable-overwrite     put headers in subdir, omit link to -lcurses],
571         [with_overwrite=$enableval],
572         [if test "$prefix" = "/usr" ; then with_overwrite=yes; else with_overwrite=no; fi])
573 AC_MSG_RESULT($with_overwrite)
574
575 AC_MSG_CHECKING(if external terminfo-database is used)
576 AC_ARG_ENABLE(database,
577         [  --disable-database      do not use terminfo, only fallbacks/termcap],
578         [use_database=$enableval],
579         [use_database=yes])
580 AC_MSG_RESULT($use_database)
581
582 case $host_os in
583 (os2*)
584         TERMINFO_SRC='${top_srcdir}/misc/emx.src'
585         ;;
586 (*)
587         TERMINFO_SRC='${top_srcdir}/misc/terminfo.src'
588         ;;
589 esac
590 AC_SUBST(TERMINFO_SRC)
591
592 NCURSES_USE_DATABASE=0
593 if test "$use_database" != no ; then
594         NCURSES_USE_DATABASE=1
595
596         AC_MSG_CHECKING(which terminfo source-file will be installed)
597         AC_ARG_WITH(database,
598                 [  --with-database=XXX     specify terminfo source to install],
599                 [TERMINFO_SRC=$withval])
600         AC_MSG_RESULT($TERMINFO_SRC)
601
602         AC_MSG_CHECKING(whether to use hashed database instead of directory/tree)
603         AC_ARG_WITH(hashed-db,
604                 [  --with-hashed-db        specify hashed-database library],,
605                 [with_hashed_db=no])
606         AC_MSG_RESULT($with_hashed_db)
607 else
608         with_hashed_db=no
609 fi
610 AC_SUBST(NCURSES_USE_DATABASE)
611
612 AC_MSG_CHECKING(for list of fallback descriptions)
613 AC_ARG_WITH(fallbacks,
614         [  --with-fallbacks=XXX    specify list of fallback terminal descriptions],
615         [with_fallback=$withval],
616         [with_fallback=])
617 AC_MSG_RESULT($with_fallback)
618
619 case ".$with_fallback" in
620 (.|.no)
621         FALLBACK_LIST=
622         ;;
623 (.yes)
624         AC_MSG_WARN(expected a list of terminal descriptions)
625         ;;
626 (*)
627         FALLBACK_LIST=`echo "$with_fallback" | sed -e 's/,/ /g'`
628         ;;
629 esac
630
631 USE_FALLBACKS=
632 test -z "$FALLBACK_LIST" && USE_FALLBACKS="#"
633 AC_SUBST(FALLBACK_LIST)
634 AC_SUBST(USE_FALLBACKS)
635
636 # The fallback feature in ncurses relies upon tic/infocmp outside the build
637 # tree for generating the terminal descriptions that will be compiled into the
638 # library.  If your toolchain is old, it may not handle current terminal
639 # databases.  Use configure-options to point to the tools which will be used,
640 # rather than the first ones found on the $PATH.
641 if test -n "$FALLBACK_LIST"
642 then
643         CF_WITH_PATH_PROG(TIC,     tic,     [for fallbacks], $PATH:/usr/local/ncurses/bin)
644         CF_WITH_PATH_PROG(INFOCMP, infocmp, [for fallbacks], $PATH:/usr/local/ncurses/bin)
645 else
646         : ${TIC:=tic}
647         : ${INFOCMP:=infocmp}
648 fi
649 AC_SUBST(TIC)
650 AC_SUBST(INFOCMP)
651
652 AC_MSG_CHECKING(if you want modern xterm or antique)
653 AC_ARG_WITH(xterm-new,
654         [  --without-xterm-new     specify if xterm terminfo should be old version],
655         [with_xterm_new=$withval],
656         [with_xterm_new=yes])
657 case $with_xterm_new in
658 (no) with_xterm_new=xterm-old;;
659 (*)      with_xterm_new=xterm-new;;
660 esac
661 AC_MSG_RESULT($with_xterm_new)
662 WHICH_XTERM=$with_xterm_new
663 AC_SUBST(WHICH_XTERM)
664
665 AC_MSG_CHECKING(if xterm backspace sends BS or DEL)
666 AC_ARG_WITH(xterm-kbs,
667         [  --with-xterm-kbs=XXX    specify if xterm backspace sends BS or DEL],
668         [with_xterm_kbs=$withval],
669         [with_xterm_kbs=BS])
670 case x$with_xterm_kbs in
671 (xyes|xno|xBS|xbs|x8)
672         with_xterm_kbs=BS
673         ;;
674 (xDEL|xdel|x127)
675         with_xterm_kbs=DEL
676         ;;
677 (*)
678         with_xterm_kbs=$withval
679         ;;
680 esac
681 AC_MSG_RESULT($with_xterm_kbs)
682 XTERM_KBS=$with_xterm_kbs
683 AC_SUBST(XTERM_KBS)
684
685 MAKE_TERMINFO=
686 if test "$use_database" = no ; then
687         TERMINFO="${datadir}/terminfo"
688         MAKE_TERMINFO="#"
689 else
690
691 AC_MSG_CHECKING(for list of terminfo directories)
692 CF_WITH_PATHLIST(terminfo-dirs,
693         [  --with-terminfo-dirs=XXX specify list of terminfo directories],
694         TERMINFO_DIRS,
695         DATADIR/terminfo,
696         ${datadir}/terminfo)
697 AC_MSG_RESULT($TERMINFO_DIRS)
698 test -n "$TERMINFO_DIRS" && AC_DEFINE_UNQUOTED(TERMINFO_DIRS,"$TERMINFO_DIRS",[Define as needed to predefine the TERMINFO_DIR searchlist])
699
700 case "x$TERMINFO" in
701 x???:*)
702         AC_MSG_WARN(ignoring non-directory/file TERMINFO value)
703         unset TERMINFO
704         ;;
705 esac
706
707 AC_MSG_CHECKING(for default terminfo directory)
708 CF_WITH_PATH(default-terminfo-dir,
709         [  --with-default-terminfo-dir=DIR default terminfo directory],
710         TERMINFO,
711         DATADIR/terminfo,
712         ${datadir}/terminfo)
713 AC_MSG_RESULT($TERMINFO)
714 AC_DEFINE_UNQUOTED(TERMINFO,"$TERMINFO",[Define to set the default terminal database path])
715
716 fi
717
718 AC_SUBST(TERMINFO)
719 AC_SUBST(MAKE_TERMINFO)
720
721 ###     use option --disable-big-core to make tic run on small machines
722 ###     We need 4Mb, check if we can allocate 50% more than that.
723 AC_MSG_CHECKING(if big-core option selected)
724 AC_ARG_ENABLE(big-core,
725         [  --disable-big-core      assume machine has little memory],
726         [with_big_core=$enableval],
727         [AC_TRY_RUN([
728 #include <stdlib.h>
729 #include <string.h>
730 int main() {
731         unsigned long n = 6000000L;
732         char *s = malloc(n);
733         if (s != 0)
734                 s[0] = s[n-1] = 0;
735         ${cf_cv_main_return:-return}(s == 0);
736 }],
737         [with_big_core=yes],
738         [with_big_core=no],
739         [with_big_core=no])])
740 AC_MSG_RESULT($with_big_core)
741 test "x$with_big_core" = "xyes" && AC_DEFINE(HAVE_BIG_CORE,1,[Define to 1 if machine has ample memory for tic])
742
743 ### ISO C only guarantees 512-char strings, we have tables which load faster
744 ### when constructed using "big" strings.  More than the C compiler, the awk
745 ### program is a limit on most vendor UNIX systems.  Check that we can build.
746 AC_MSG_CHECKING(if big-strings option selected)
747 AC_ARG_ENABLE(big-strings,
748         [  --disable-big-strings   assume compiler has only standard-size strings],
749         [with_big_strings=$enableval],
750         [CF_AWK_BIG_PRINTF(12000,with_big_strings)])
751 AC_MSG_RESULT($with_big_strings)
752
753 USE_BIG_STRINGS=0
754 test "x$with_big_strings" = "xyes" && USE_BIG_STRINGS=1
755 AC_SUBST(USE_BIG_STRINGS)
756
757 ###     use option --enable-termcap to compile in the termcap fallback support
758 AC_MSG_CHECKING(if you want termcap-fallback support)
759 AC_ARG_ENABLE(termcap,
760         [  --enable-termcap        compile in termcap fallback support],
761         [with_termcap=$enableval],
762         [with_termcap=no])
763 AC_MSG_RESULT($with_termcap)
764
765 NCURSES_USE_TERMCAP=0
766 if test "x$with_termcap" != "xyes" ; then
767         if test "$use_database" = no ; then
768                 if test -z "$with_fallback" ; then
769                         AC_ERROR(You have disabled the database w/o specifying fallbacks)
770                 fi
771         fi
772         AC_DEFINE(PURE_TERMINFO,1,[Define to 1 if we should support only terminfo])
773 else
774
775         if test "$with_ticlib" != no ; then
776                 AC_ERROR(Options --with-ticlib and --enable-termcap cannot be combined)
777         fi
778
779         NCURSES_USE_TERMCAP=1
780         AC_MSG_CHECKING(for list of termcap files)
781         CF_WITH_PATHLIST(termpath,
782                 [  --with-termpath=XXX     specify list of termcap files],
783                 TERMPATH,
784                 /etc/termcap:/usr/share/misc/termcap)
785         AC_MSG_RESULT($TERMPATH)
786         test -n "$TERMPATH" && AC_DEFINE_UNQUOTED(TERMPATH,"$TERMPATH",[Define to set the termcap searchlist])
787
788         ###     use option --enable-getcap to use a hacked getcap for reading termcaps
789         AC_MSG_CHECKING(if fast termcap-loader is needed)
790         AC_ARG_ENABLE(getcap,
791                 [  --enable-getcap         fast termcap load, no xrefs to terminfo],
792                 [with_getcap=$enableval],
793                 [with_getcap=no])
794         AC_MSG_RESULT($with_getcap)
795         test "x$with_getcap" = "xyes" && AC_DEFINE(USE_GETCAP,1,[Define to 1 to use fast termcap-loader])
796
797         AC_MSG_CHECKING(if translated termcaps will be cached in ~/.terminfo)
798         AC_ARG_ENABLE(getcap-cache,
799                 [  --enable-getcap-cache   cache translated termcaps in ~/.terminfo],
800                 [with_getcap_cache=$enableval],
801                 [with_getcap_cache=no])
802         AC_MSG_RESULT($with_getcap_cache)
803         test "x$with_getcap_cache" = "xyes" && AC_DEFINE(USE_GETCAP_CACHE,1,[Define to 1 if translated termcap should be stored in $HOME/.terminfo])
804
805 fi
806 AC_SUBST(NCURSES_USE_TERMCAP)
807
808 ###   Use option --disable-home-terminfo to completely remove ~/.terminfo
809 AC_MSG_CHECKING(if ~/.terminfo is wanted)
810 AC_ARG_ENABLE(home-terminfo,
811         [  --disable-home-terminfo drop ~/.terminfo from terminfo search-path],
812         [with_home_terminfo=$enableval],
813         [with_home_terminfo=yes])
814 AC_MSG_RESULT($with_home_terminfo)
815 test "x$with_home_terminfo" = "xyes" && AC_DEFINE(USE_HOME_TERMINFO,1,[Define to 1 if $HOME/.terminfo feature is wanted])
816
817 AC_MSG_CHECKING(if you want to use restricted environment when running as root)
818 AC_ARG_ENABLE(root-environ,
819         [  --disable-root-environ  restrict environment when running as root],
820         [with_root_environ=$enableval],
821         [with_root_environ=yes])
822 AC_MSG_RESULT($with_root_environ)
823 test "x$with_root_environ" = xyes && AC_DEFINE(USE_ROOT_ENVIRON,1,[Define to 1 if environment should be restricted for root user])
824
825 ###   Use option --enable-symlinks to make tic use symlinks, not hard links
826 ###   to reduce storage requirements for the terminfo database.
827 CF_LINK_FUNCS
828
829 with_links=no
830 with_symlinks=no
831
832 # soft links (symbolic links) are useful for some systems where hard links do
833 # not work, or to make it simpler to copy terminfo trees around.
834 if test "x$ac_cv_func_symlink" = xyes ; then
835         AC_MSG_CHECKING(if tic should use symbolic links)
836         AC_ARG_ENABLE(symlinks,
837         [  --enable-symlinks       make tic use symbolic links not hard links],
838         [with_symlinks=$enableval],
839         [with_symlinks=no])
840         AC_MSG_RESULT($with_symlinks)
841 fi
842
843 # If we have hard links and did not choose to use soft links instead, there is
844 # no reason to make this choice optional - use the hard links.
845 if test "$with_symlinks" = no ; then
846         AC_MSG_CHECKING(if tic should use hard links)
847         if test "x$ac_cv_func_link" = xyes ; then
848                 with_links=yes
849         else
850                 with_links=no
851         fi
852         AC_MSG_RESULT($with_links)
853 fi
854
855 test "x$with_links" = xyes && AC_DEFINE(USE_LINKS,1,[Define to 1 if hardlinks should be used in terminfo database])
856 test "x$with_symlinks" = xyes && AC_DEFINE(USE_SYMLINKS,1,[Define to 1 if symbolic links should be used in terminfo database])
857
858 ###   use option --enable-broken-linker to force on use of broken-linker support
859 AC_MSG_CHECKING(if you want broken-linker support code)
860 AC_ARG_ENABLE(broken_linker,
861         [  --enable-broken_linker  compile with broken-linker support code],
862         [with_broken_linker=$enableval],
863         [with_broken_linker=${BROKEN_LINKER:-no}])
864 AC_MSG_RESULT($with_broken_linker)
865
866 BROKEN_LINKER=0
867 if test "x$with_broken_linker" = xyes ; then
868         AC_DEFINE(BROKEN_LINKER,1,[Define to 1 to work around linkers which cannot link data-only modules])
869         BROKEN_LINKER=1
870 elif test "$DFT_LWR_MODEL" = shared ; then
871         case $cf_cv_system_name in
872         (cygwin*)
873                 AC_DEFINE(BROKEN_LINKER,1,[Define to 1 to work around linkers which cannot link data-only modules])
874                 BROKEN_LINKER=1
875                 CF_VERBOSE(cygwin linker is broken anyway)
876                 ;;
877         esac
878 fi
879 AC_SUBST(BROKEN_LINKER)
880
881 ###   use option --enable-bsdpad to have tputs process BSD-style prefix padding
882 AC_MSG_CHECKING(if tputs should process BSD-style prefix padding)
883 AC_ARG_ENABLE(bsdpad,
884         [  --enable-bsdpad         recognize BSD-style prefix padding],
885         [with_bsdpad=$enableval],
886         [with_bsdpad=no])
887 AC_MSG_RESULT($with_bsdpad)
888 test "x$with_bsdpad" = xyes && AC_DEFINE(BSD_TPUTS,1,[Define to 1 to recognize BSD-style prefix padding])
889
890 ###   use option --enable-widec to turn on use of wide-character support
891 NCURSES_CH_T=chtype
892 NCURSES_LIBUTF8=0
893
894 NEED_WCHAR_H=0
895 NCURSES_MBSTATE_T=0
896 NCURSES_WCHAR_T=0
897 NCURSES_WINT_T=0
898
899 # Check to define _XOPEN_SOURCE "automatically"
900 CPPFLAGS_before_XOPEN="$CPPFLAGS"
901 CF_XOPEN_SOURCE(600)
902 CPPFLAGS_after_XOPEN="$CPPFLAGS"
903
904 # Work around breakage on OS X
905 CF_SIGWINCH
906
907 # Checks for CODESET support.
908 AM_LANGINFO_CODESET
909
910 # use these variables to work around a defect in gcc's fixincludes.
911 NCURSES_OK_WCHAR_T=
912 NCURSES_OK_WINT_T=
913
914 AC_MSG_CHECKING(if you want wide-character code)
915 AC_ARG_ENABLE(widec,
916         [  --enable-widec          compile with wide-char/UTF-8 code],
917         [with_widec=$enableval],
918         [with_widec=no])
919 AC_MSG_RESULT($with_widec)
920
921 NCURSES_WCWIDTH_GRAPHICS=1
922 AC_SUBST(NCURSES_WCWIDTH_GRAPHICS)
923
924 if test "x$with_widec" = xyes ; then
925         if test "x$disable_lib_suffixes" = xno ; then
926                 LIB_SUFFIX="w${LIB_SUFFIX}"
927         fi
928         AC_DEFINE(USE_WIDEC_SUPPORT,1,[Define to 1 to compile with wide-char/UTF-8 code])
929         AC_DEFINE(NCURSES_WIDECHAR,1,[Define to 1 to compile with wide-char/UTF-8 code])
930
931         CF_CHECK_WCHAR_H
932         CF_CHECK_WCWIDTH_GRAPHICS
933         test "$cf_cv_wcwidth_graphics" = no && NCURSES_WCWIDTH_GRAPHICS=0
934
935         # with_overwrite=no
936         NCURSES_CH_T=cchar_t
937         AC_CHECK_FUNCS(putwc btowc wctob mbtowc wctomb mblen mbrlen mbrtowc wcsrtombs mbsrtowcs wcstombs mbstowcs)
938         if test "x$ac_cv_func_putwc" != xyes ; then
939                 CF_UTF8_LIB
940                 if test "$cf_cv_utf8_lib" != no ; then
941                         NCURSES_LIBUTF8=1
942                 fi
943         fi
944         CF_WCHAR_TYPE(mbstate_t, NCURSES_MBSTATE_T)
945         CF_WCHAR_TYPE(wchar_t,   NCURSES_WCHAR_T,   NCURSES_OK_WCHAR_T)
946         CF_WCHAR_TYPE(wint_t,    NCURSES_WINT_T,    NCURSES_OK_WINT_T)
947
948         if test "$NCURSES_MBSTATE_T" != 0; then
949                 AC_DEFINE(NEED_MBSTATE_T_DEF,1,[Define to 1 if we must declare mbstate_t])
950         fi
951 fi
952 AC_SUBST(NCURSES_CH_T)
953 AC_SUBST(NCURSES_LIBUTF8)
954
955 AC_SUBST(NEED_WCHAR_H)
956 AC_SUBST(NCURSES_MBSTATE_T)
957 AC_SUBST(NCURSES_WCHAR_T)
958 AC_SUBST(NCURSES_WINT_T)
959
960 AC_SUBST(NCURSES_OK_WCHAR_T)
961 AC_SUBST(NCURSES_OK_WINT_T)
962
963 ###   use option --disable-lp64 to allow long chtype
964 AC_MSG_CHECKING(whether to enable _LP64 definition in curses.h)
965 AC_ARG_ENABLE(lp64,
966         [  --disable-lp64          allow chtype to be long (ignore _LP64)],
967         [with_lp64=$enableval],
968         [with_lp64=$cf_dft_with_lp64])
969 AC_MSG_RESULT($with_lp64)
970
971 if test "x$with_lp64" = xyes ; then
972         cf_cv_enable_lp64=1
973 else
974         cf_cv_enable_lp64=0
975 fi
976 AC_SUBST(cf_cv_enable_lp64)
977
978 CF_LARGEFILE
979
980 ###   use option --disable-tparm-varargs to make tparm() conform to X/Open
981 AC_MSG_CHECKING(if you want tparm not to use X/Open fixed-parameter list)
982 AC_ARG_ENABLE(tparm-varargs,
983         [  --disable-tparm-varargs compile tparm() without varargs interface],
984         [with_tparm_varargs=$enableval],
985         [with_tparm_varargs=yes])
986 AC_MSG_RESULT($with_tparm_varargs)
987 NCURSES_TPARM_VARARGS=0
988 test "x$with_tparm_varargs" = xyes && NCURSES_TPARM_VARARGS=1
989 AC_SUBST(NCURSES_TPARM_VARARGS)
990
991 ###   use option --disable-tic-depends to make libtic not explicitly depend on ncurses/ncursesw
992 if test "$with_ticlib" != no ; then
993 AC_MSG_CHECKING(if you want tic library to use explicit dependency on ncurses$LIB_SUFFIX library)
994 AC_ARG_ENABLE(tic-depends,
995         [  --disable-tic-depends   link tic library without explicit dependency on ncurses library],
996         [with_tic_depends=$enableval],
997         [with_tic_depends=yes])
998 AC_MSG_RESULT($with_tic_depends)
999 else
1000         with_tic_depends=no
1001 fi
1002
1003 ###   use option --disable-wattr-macros to suppress wattr* macros from curses.h
1004 AC_MSG_CHECKING(if you want to suppress wattr* macros to help with ncurses5/ncurses6 transition)
1005 AC_ARG_ENABLE(wattr-macros,
1006         [  --disable-wattr-macros  suppress wattr* macros to help with ncurses5/ncurses6 transition],
1007         [with_wattr_macros=$enableval],
1008         [with_wattr_macros=yes])
1009 if [[ "x$with_wattr_macros" != xyes ]]; then
1010         NCURSES_WATTR_MACROS=0
1011         AC_MSG_RESULT(yes)
1012 else
1013         NCURSES_WATTR_MACROS=1
1014         AC_MSG_RESULT(no)
1015 fi
1016 AC_SUBST(NCURSES_WATTR_MACROS)
1017
1018 CF_WITH_X11_RGB
1019
1020 ###   use option --with-bool to override bool's type
1021 AC_MSG_CHECKING(for type of bool)
1022 AC_ARG_WITH(bool,
1023         [  --with-bool=TYPE        override fallback type of bool variable],
1024         [NCURSES_BOOL="$withval"],
1025         [NCURSES_BOOL=auto])
1026 AC_MSG_RESULT($NCURSES_BOOL)
1027 AC_SUBST(NCURSES_BOOL)
1028
1029 AC_MSG_CHECKING(for alternate terminal capabilities file)
1030 AC_ARG_WITH(caps,
1031         [  --with-caps=alt         compile with alternate Caps file],
1032         [TERMINFO_CAPS=Caps.$withval],
1033         [TERMINFO_CAPS=Caps])
1034 test -f "${srcdir}/include/${TERMINFO_CAPS}" || TERMINFO_CAPS=Caps
1035 AC_MSG_RESULT($TERMINFO_CAPS)
1036 AC_SUBST(TERMINFO_CAPS)
1037
1038 ###   use option --with-chtype to override chtype's type
1039 AC_MSG_CHECKING(for type of chtype)
1040 AC_ARG_WITH(chtype,
1041         [  --with-chtype=TYPE      override type of chtype],
1042         [NCURSES_CHTYPE="$withval"],
1043         [NCURSES_CHTYPE=$cf_dft_chtype])
1044 AC_MSG_RESULT($NCURSES_CHTYPE)
1045
1046 ###   use option --with-ospeed to override ospeed's type
1047 AC_MSG_CHECKING(for type of ospeed)
1048 AC_ARG_WITH(ospeed,
1049         [  --with-ospeed=TYPE      override type of ospeed variable],
1050         [NCURSES_OSPEED="$withval"],
1051         [NCURSES_OSPEED=short])
1052 AC_MSG_RESULT($NCURSES_OSPEED)
1053 AC_SUBST(NCURSES_OSPEED)
1054
1055 ###   use option --with-mmask-t to override mmask_t's type
1056 AC_MSG_CHECKING(for type of mmask_t)
1057 AC_ARG_WITH(mmask-t,
1058         [  --with-mmask-t=TYPE     override type of mmask_t],
1059         [NCURSES_MMASK_T="$withval"],
1060         [NCURSES_MMASK_T=$cf_dft_mmask_t])
1061 AC_MSG_RESULT($NCURSES_MMASK_T)
1062
1063 ###   use option --with-ccharw-max to override CCHARW_MAX size
1064 AC_MSG_CHECKING(for size CCHARW_MAX)
1065 AC_ARG_WITH(ccharw-max,
1066         [  --with-ccharw-max=XXX   override size CCHARW_MAX],
1067         [NCURSES_CCHARW_MAX="$withval"],
1068         [NCURSES_CCHARW_MAX=5])
1069 AC_MSG_RESULT($NCURSES_CCHARW_MAX)
1070 AC_SUBST(NCURSES_CCHARW_MAX)
1071
1072 AC_CHECK_SIZEOF([signed char], 0)
1073 if test "$ac_cv_sizeof_signed_char" = 1 ; then
1074         NCURSES_SBOOL="signed char"
1075 else
1076         NCURSES_SBOOL="char"
1077 fi
1078 AC_MSG_CHECKING(if you want to use signed Boolean array in term.h)
1079 AC_ARG_ENABLE(signed-char,
1080         [  --enable-signed-char    compile using signed Boolean's in term.h],
1081         [with_signed_char=$enableval],
1082         [with_signed_char=no])
1083 AC_MSG_RESULT($with_signed_char)
1084 test "x$with_signed_char" != xyes && NCURSES_SBOOL="char"
1085 AC_SUBST(NCURSES_SBOOL)
1086
1087 ###   use option --with-tparm-arg to override tparm's argument type
1088 AC_MSG_CHECKING(for type of tparm args)
1089 AC_ARG_WITH(tparm-arg,
1090         [  --with-tparm-arg=TYPE   override parameter type of tparm],
1091         [NCURSES_TPARM_ARG="$withval"],
1092         [NCURSES_TPARM_ARG=$cf_dft_tparm_arg])
1093 AC_MSG_RESULT($NCURSES_TPARM_ARG)
1094 AC_SUBST(NCURSES_TPARM_ARG)
1095
1096 ### Enable compiling-in rcs id's
1097 AC_MSG_CHECKING(if RCS identifiers should be compiled-in)
1098 AC_ARG_WITH(rcs-ids,
1099         [  --with-rcs-ids          compile-in RCS identifiers],
1100         [with_rcs_ids=$withval],
1101         [with_rcs_ids=no])
1102 AC_MSG_RESULT($with_rcs_ids)
1103 test "x$with_rcs_ids" = xyes && AC_DEFINE(USE_RCS_IDS,1,[Define to 1 to compile-in RCS identifiers])
1104
1105 ###############################################################################
1106 CF_MAN_PAGES([ captoinfo clear infocmp infotocap reset tabs tic toe tput tset ])
1107
1108 ###############################################################################
1109 CF_HELP_MESSAGE(Extensions:)
1110
1111 ### Note that some functions (such as const) are normally disabled anyway.
1112 AC_MSG_CHECKING(if you want to build with function extensions)
1113 AC_ARG_ENABLE(ext-funcs,
1114         [  --disable-ext-funcs     disable function-extensions],
1115         [with_ext_funcs=$enableval],
1116         [with_ext_funcs=yes])
1117 AC_MSG_RESULT($with_ext_funcs)
1118 if test "x$with_ext_funcs" = xyes ; then
1119         NCURSES_EXT_FUNCS=1
1120         AC_DEFINE(NCURSES_EXT_FUNCS,1,[Define to 1 to enable ncurses extended functions])
1121         AC_DEFINE(HAVE_ASSUME_DEFAULT_COLORS,1,[Define to 1 to enable assume_default_colors() function in test-programs])
1122         AC_DEFINE(HAVE_CURSES_VERSION,1,[Define to 1 to enable curses_version() function in test-programs])
1123         AC_DEFINE(HAVE_HAS_KEY,1,[Define to 1 to enable has_key() function in test-programs])
1124         AC_DEFINE(HAVE_RESIZETERM,1,[Define to 1 to enable resizeterm() function in test-programs])
1125         AC_DEFINE(HAVE_RESIZE_TERM,1,[Define to 1 to enable resize_term() function in test-programs])
1126         AC_DEFINE(HAVE_TERM_ENTRY_H,1,[Define to 1 to enable term_entry() function in test-programs])
1127         AC_DEFINE(HAVE_USE_DEFAULT_COLORS,1,[Define to 1 to enable use_default_colors() function in test-programs])
1128         AC_DEFINE(HAVE_USE_EXTENDED_NAMES,1,[Define to 1 to enable use_extended_names() function in test-programs])
1129         AC_DEFINE(HAVE_USE_SCREEN,1,[Define to 1 to enable use_screen() function in test-programs])
1130         AC_DEFINE(HAVE_USE_WINDOW,1,[Define to 1 to enable use_window() function in test-programs])
1131         AC_DEFINE(HAVE_WRESIZE,1,[Define to 1 to enable wresize() function in test-programs])
1132         GENERATED_EXT_FUNCS=generated
1133         test "x$with_ext_funcs" = xyes || cf_dft_ext_spfuncs=no
1134 else
1135         NCURSES_EXT_FUNCS=0
1136         GENERATED_EXT_FUNCS=
1137 fi
1138 AC_SUBST(NCURSES_EXT_FUNCS)
1139 AC_SUBST(GENERATED_EXT_FUNCS)
1140
1141 AC_MSG_CHECKING(if you want to build with SCREEN extensions)
1142 AC_ARG_ENABLE(sp-funcs,
1143         [  --enable-sp-funcs       enable SCREEN-extensions],
1144         [with_sp_funcs=$enableval],
1145         [with_sp_funcs=$cf_dft_ext_spfuncs])
1146 AC_MSG_RESULT($with_sp_funcs)
1147 if test "x$with_sp_funcs" = xyes ; then
1148         NCURSES_SP_FUNCS=1
1149         AC_DEFINE(NCURSES_SP_FUNCS,1,[Define to 1 to enable SCREEN-extensions])
1150         AC_DEFINE(HAVE_TPUTS_SP,1,[Define to 1 to enable tputs_sp() function in test-programs])
1151         GENERATED_SP_FUNCS=generated
1152 else
1153         NCURSES_SP_FUNCS=0
1154         GENERATED_SP_FUNCS=
1155 fi
1156 AC_SUBST(NCURSES_SP_FUNCS)
1157 AC_SUBST(GENERATED_SP_FUNCS)
1158
1159 AC_MSG_CHECKING(if you want to build with terminal-driver)
1160 AC_ARG_ENABLE(term-driver,
1161         [  --enable-term-driver    enable terminal-driver],
1162         [with_term_driver=$enableval],
1163         [with_term_driver=no])
1164 AC_MSG_RESULT($with_term_driver)
1165 if test "x$with_term_driver" = xyes ; then
1166         AC_DEFINE(USE_TERM_DRIVER,1,[Define to 1 to enable terminal-driver])
1167         if test "x$with_termlib" != xno ; then
1168                 AC_MSG_ERROR(The term-driver option conflicts with the termlib option)
1169         fi
1170         if test "x$with_sp_funcs" != xyes ; then
1171                 AC_MSG_ERROR(The term-driver option relies upon sp-funcs)
1172         fi
1173 fi
1174
1175 ###   use option --enable-const to turn on use of const beyond that in XSI.
1176 AC_MSG_CHECKING(for extended use of const keyword)
1177 AC_ARG_ENABLE(const,
1178         [  --enable-const          compile with extra/non-standard const],
1179         [with_ext_const=$enableval],
1180         [with_ext_const=$cf_dft_ext_const])
1181 AC_MSG_RESULT($with_ext_const)
1182 NCURSES_CONST='/*nothing*/'
1183 if test "x$with_ext_const" = xyes ; then
1184         NCURSES_CONST=const
1185 fi
1186 AC_SUBST(NCURSES_CONST)
1187
1188 ###   use option --enable-ext-colors to turn on use of colors beyond 16.
1189 AC_MSG_CHECKING(if you want to use extended colors)
1190 AC_ARG_ENABLE(ext-colors,
1191         [  --enable-ext-colors     compile for 256-color support],
1192         [with_ext_colors=$enableval],
1193         [with_ext_colors=$cf_dft_ext_colors])
1194 AC_MSG_RESULT($with_ext_colors)
1195 NCURSES_EXT_COLORS=0
1196 if test "x$with_ext_colors" = xyes ; then
1197         if test "x$with_widec" != xyes ; then
1198                 AC_MSG_WARN(This option applies only to wide-character library)
1199         else
1200                 # cannot be ABI 5 since it changes sizeof(cchar_t)
1201                 CF_NCURSES_ABI_6
1202                 NCURSES_EXT_COLORS=1
1203                 AC_DEFINE(NCURSES_EXT_COLORS,1,[Define to 1 to compile for 256-color support])
1204                 AC_DEFINE(HAVE_ALLOC_PAIR,1,[Define to 1 to enable alloc_pair() function])
1205                 AC_DEFINE(HAVE_INIT_EXTENDED_COLOR,1,[Define to 1 to enable init_extended_color() function in test-programs])
1206                 AC_DEFINE(HAVE_RESET_COLOR_PAIRS,1,[Define to 1 to enable reset_color_pairs() function in test-programs])
1207         fi
1208 fi
1209 AC_SUBST(NCURSES_EXT_COLORS)
1210
1211 ###   use option --enable-ext-mouse to modify coding to support 5-button mice
1212 AC_MSG_CHECKING(if you want to use extended mouse encoding)
1213 AC_ARG_ENABLE(ext-mouse,
1214         [  --enable-ext-mouse      compile for extended mouse-encoding],
1215         [with_ext_mouse=$enableval],
1216         [with_ext_mouse=$cf_dft_ext_mouse])
1217 AC_MSG_RESULT($with_ext_mouse)
1218 NCURSES_MOUSE_VERSION=1
1219 if test "x$with_ext_mouse" = xyes ; then
1220         NCURSES_MOUSE_VERSION=2
1221         CF_NCURSES_ABI_6
1222 fi
1223 AC_SUBST(NCURSES_MOUSE_VERSION)
1224
1225 ###   use option --enable-ext-putwin to turn on extended screendumps
1226 AC_MSG_CHECKING(if you want to use extended putwin/screendump)
1227 AC_ARG_ENABLE(ext-putwin,
1228         [  --enable-ext-putwin     compile with extended putwin/screendump],
1229         [with_ext_putwin=$enableval],
1230         [with_ext_putwin=$cf_dft_ext_putwin])
1231 AC_MSG_RESULT($with_ext_putwin)
1232 if test "x$with_ext_putwin" = xyes ; then
1233         AC_DEFINE(NCURSES_EXT_PUTWIN,1,[Define to 1 to compile with extended putwin/screendump])
1234 fi
1235
1236 AC_MSG_CHECKING(if you want \$NCURSES_NO_PADDING code)
1237 AC_ARG_ENABLE(no-padding,
1238         [  --enable-no-padding     compile with $NCURSES_NO_PADDING code],
1239         [with_no_padding=$enableval],
1240         [with_no_padding=$with_ext_funcs])
1241 AC_MSG_RESULT($with_no_padding)
1242 test "x$with_no_padding" = xyes && AC_DEFINE(NCURSES_NO_PADDING,1,[Define to 1 to compile with $NCURSES_NO_PADDING code])
1243
1244 ###   use option --enable-sigwinch to turn on use of SIGWINCH logic
1245 AC_MSG_CHECKING(if you want SIGWINCH handler)
1246 AC_ARG_ENABLE(sigwinch,
1247         [  --enable-sigwinch       compile with SIGWINCH handler],
1248         [with_sigwinch=$enableval],
1249         [with_sigwinch=$with_ext_funcs])
1250 AC_MSG_RESULT($with_sigwinch)
1251 test "x$with_sigwinch" = xyes && AC_DEFINE(USE_SIGWINCH,1,[Define to 1 to compile with SIGWINCH handler])
1252
1253 ###   use option --enable-tcap-names to allow user to define new capabilities
1254 AC_MSG_CHECKING(if you want user-definable terminal capabilities like termcap)
1255 AC_ARG_ENABLE(tcap-names,
1256         [  --enable-tcap-names     compile with user-definable terminal capabilities],
1257         [with_tcap_names=$enableval],
1258         [with_tcap_names=$with_ext_funcs])
1259 AC_MSG_RESULT($with_tcap_names)
1260 NCURSES_XNAMES=0
1261 test "x$with_tcap_names" = xyes && NCURSES_XNAMES=1
1262 AC_SUBST(NCURSES_XNAMES)
1263
1264 ##############################################################################
1265 CF_HELP_MESSAGE(Reentrant Code:)
1266 CF_WITH_PTHREAD
1267
1268 if test "x$with_pthread" != xno; then
1269         AC_CHECK_FUNC(pthread_kill,[
1270                 AC_MSG_CHECKING(if you want to allow EINTR in wgetch with pthreads)
1271                 AC_ARG_ENABLE(pthreads-eintr,
1272                         [  --enable-pthreads-eintr enable EINTR in wgetch with pthreads],
1273                         [use_pthreads_eintr=$enableval],
1274                         [use_pthreads_eintr=no])
1275                 AC_MSG_RESULT($use_pthreads_eintr)
1276                 if test "x$use_pthreads_eintr" = xyes ; then
1277                         AC_DEFINE(USE_PTHREADS_EINTR,1,[Define to 1 to enable EINTR in wgetch with pthreads])
1278                 fi])
1279
1280         AC_MSG_CHECKING(if you want to use weak-symbols for pthreads)
1281         AC_ARG_ENABLE(weak-symbols,
1282                 [  --enable-weak-symbols   enable weak-symbols for pthreads],
1283                 [use_weak_symbols=$enableval],
1284                 [use_weak_symbols=no])
1285         AC_MSG_RESULT($use_weak_symbols)
1286         if test "x$use_weak_symbols" = xyes ; then
1287                 CF_WEAK_SYMBOLS
1288         else
1289                 cf_cv_weak_symbols=no
1290         fi
1291
1292         if test "x$cf_cv_weak_symbols" = xyes ; then
1293                 AC_DEFINE(USE_WEAK_SYMBOLS,1,[Define to 1 to enable weak-symbols for pthreads])
1294         fi
1295 fi
1296
1297 PTHREAD=
1298 if test "x$with_pthread" = "xyes" ; then
1299         AC_DEFINE(USE_PTHREADS,1,[Define to 1 to use pthreads feature])
1300         enable_reentrant=yes
1301         if test "x$cf_cv_weak_symbols" = xyes ; then
1302                 PTHREAD=-lpthread
1303                 CF_ADD_LIB(pthread,PRIVATE_LIBS)
1304         fi
1305 fi
1306 AC_SUBST(PTHREAD)
1307
1308 # Reentrant code has to be opaque; there's little advantage to making ncurses
1309 # opaque outside of that, so there is no --enable-opaque option.  We can use
1310 # this option without --with-pthreads, but this will be always set for
1311 # pthreads.
1312 AC_MSG_CHECKING(if you want reentrant code)
1313 AC_ARG_ENABLE(reentrant,
1314         [  --enable-reentrant      compile with reentrant code],
1315         [with_reentrant=$enableval],
1316         [with_reentrant=no])
1317 AC_MSG_RESULT($with_reentrant)
1318 if test "x$with_reentrant" = xyes ; then
1319         cf_cv_enable_reentrant=1
1320         cf_cv_enable_opaque="NCURSES_INTERNALS"
1321         NCURSES_SIZE_T=int
1322         if test "x$cf_cv_weak_symbols" = xyes ; then
1323                 CF_REMOVE_LIB(LIBS,$LIBS,pthread)
1324                 CF_ADD_LIB(pthread,TEST_LIBS)
1325                 CF_ADD_LIB(pthread,TEST_LIBS2)
1326                 CF_ADD_LIB(pthread,PRIVATE_LIBS)
1327         else
1328                 # when not using weak symbols but with_reentrant,
1329                 # add 't' to the library suffix on all platforms
1330                 # except cygwin, where we only do that if ALSO
1331                 # compiling with full thread support.
1332                 case "$host" in
1333                 (*cygwin* | *msys*)
1334                         if test "$with_pthread" = "yes" ; then
1335                                 if test "x$disable_lib_suffixes" = "xno" ; then
1336                                         LIB_SUFFIX="t${LIB_SUFFIX}"
1337                                 fi
1338                         fi ;;
1339                 (*)
1340                         if test "x$disable_lib_suffixes" = "xno" ; then
1341                                 LIB_SUFFIX="t${LIB_SUFFIX}"
1342                         fi
1343                         ;;
1344                 esac
1345         fi
1346         AC_DEFINE(USE_REENTRANT,1,[Define to 1 to use reentrant feature])
1347         CF_NCURSES_ABI_6
1348 else
1349         cf_cv_enable_reentrant=0
1350         cf_cv_enable_opaque="NCURSES_OPAQUE"
1351         NCURSES_SIZE_T=short
1352 fi
1353 AC_SUBST(cf_cv_enable_reentrant)
1354 AC_SUBST(cf_cv_enable_opaque)
1355
1356 AC_SUBST(NCURSES_SIZE_T)
1357
1358 AC_MSG_CHECKING(if you want opaque curses-library structures)
1359 CF_ARG_ENABLE(opaque-curses,
1360         [  --enable-opaque-curses  make curses WINDOW, etc., "opaque"],
1361         [enable_opaque_curses=yes],[
1362          test "$cf_cv_enable_reentrant" = 1 && enable_opaque_curses=yes
1363          test "$cf_cv_enable_reentrant" = 1 || enable_opaque_curses=no
1364         ])
1365 AC_MSG_RESULT($enable_opaque_curses)
1366
1367 test "$cf_cv_enable_reentrant" = 1 && \
1368 test "$enable_opaque_curses" = no && \
1369 AC_MSG_ERROR(reentrant configuration requires opaque library)
1370
1371 AC_MSG_CHECKING(if you want opaque form-library structures)
1372 AC_ARG_ENABLE(opaque-form,
1373         [  --enable-opaque-form    make form-library structures "opaque"],
1374         [enable_opaque_form=yes],[enable_opaque_form=no])
1375 AC_MSG_RESULT($enable_opaque_form)
1376
1377 AC_MSG_CHECKING(if you want opaque menu-library structures)
1378 AC_ARG_ENABLE(opaque-menu,
1379         [  --enable-opaque-menu    make menu-library structures "opaque"],
1380         [enable_opaque_menu=yes],[enable_opaque_menu=no])
1381 AC_MSG_RESULT($enable_opaque_menu)
1382
1383 AC_MSG_CHECKING(if you want opaque panel-library structures)
1384 AC_ARG_ENABLE(opaque-panel,
1385         [  --enable-opaque-panel   make panel-library structures "opaque"],
1386         [enable_opaque_panel=yes],[enable_opaque_panel=no])
1387 AC_MSG_RESULT($enable_opaque_panel)
1388
1389 NCURSES_OPAQUE=0;               test "$enable_opaque_curses" = yes && NCURSES_OPAQUE=1
1390 NCURSES_OPAQUE_FORM=0;  test "$enable_opaque_form"   = yes && NCURSES_OPAQUE_FORM=1
1391 NCURSES_OPAQUE_MENU=0;  test "$enable_opaque_menu"   = yes && NCURSES_OPAQUE_MENU=1
1392 NCURSES_OPAQUE_PANEL=0; test "$enable_opaque_panel"  = yes && NCURSES_OPAQUE_PANEL=1
1393
1394 AC_SUBST(NCURSES_OPAQUE)
1395 AC_SUBST(NCURSES_OPAQUE_FORM)
1396 AC_SUBST(NCURSES_OPAQUE_MENU)
1397 AC_SUBST(NCURSES_OPAQUE_PANEL)
1398
1399 ### Allow using a different wrap-prefix
1400 if test "$cf_cv_enable_reentrant" != 0 || test "$BROKEN_LINKER" = 1 ; then
1401         AC_MSG_CHECKING(for prefix used to wrap public variables)
1402         AC_ARG_WITH(wrap-prefix,
1403                 [  --with-wrap-prefix=XXX  override prefix used for public variables],
1404                 [NCURSES_WRAP_PREFIX=$withval],
1405                 [NCURSES_WRAP_PREFIX=_nc_])
1406         AC_MSG_RESULT($NCURSES_WRAP_PREFIX)
1407 else
1408         NCURSES_WRAP_PREFIX=_nc_
1409 fi
1410 AC_SUBST(NCURSES_WRAP_PREFIX)
1411 AC_DEFINE_UNQUOTED(NCURSES_WRAP_PREFIX,"$NCURSES_WRAP_PREFIX",[Define to override _nc_ prefix])
1412
1413 ###############################################################################
1414 # These options are relatively safe to experiment with.
1415 CF_HELP_MESSAGE(Development Code:)
1416 AC_MSG_CHECKING(if you want all development code)
1417 AC_ARG_WITH(develop,
1418         [  --without-develop       disable development options],
1419         [with_develop=$withval],
1420         [with_develop=no])
1421 AC_MSG_RESULT($with_develop)
1422
1423 ###   use option --enable-hard-tabs to turn on use of hard-tabs optimize
1424 AC_MSG_CHECKING(if you want hard-tabs code)
1425 AC_ARG_ENABLE(hard-tabs,
1426         [  --enable-hard-tabs      compile with hard-tabs code],,
1427         [enable_hard_tabs=$with_develop])
1428 AC_MSG_RESULT($enable_hard_tabs)
1429 test "x$enable_hard_tabs" = xyes && AC_DEFINE(USE_HARD_TABS,1,[Define to 1 to compile with hard-tabs code])
1430
1431 ###   use option --enable-xmc-glitch to turn on use of magic-cookie optimize
1432 AC_MSG_CHECKING(if you want limited support for xmc)
1433 AC_ARG_ENABLE(xmc-glitch,
1434         [  --enable-xmc-glitch     compile with support for xmc (magic-cookie)],,
1435         [enable_xmc_glitch=$with_develop])
1436 AC_MSG_RESULT($enable_xmc_glitch)
1437 test "x$enable_xmc_glitch" = xyes && AC_DEFINE(USE_XMC_SUPPORT,1,[Define to 1 to compile with support for xmc (magic-cookie)])
1438
1439 ###############################################################################
1440 # These are just experimental, probably should not be in a package:
1441 CF_HELP_MESSAGE(Experimental Code:)
1442
1443 AC_MSG_CHECKING(if you do not want to assume colors are white-on-black)
1444 AC_ARG_ENABLE(assumed-color,
1445         [  --disable-assumed-color do not assume anything about default-colors],
1446         [with_assumed_color=$enableval],
1447         [with_assumed_color=yes])
1448 AC_MSG_RESULT($with_assumed_color)
1449 test "x$with_assumed_color" = xyes && AC_DEFINE(USE_ASSUMED_COLOR,1,[Define to 1 to assume things about default-colors])
1450
1451 ###   use option --enable-hashmap to turn on use of hashmap scrolling logic
1452 AC_MSG_CHECKING(if you want hashmap scrolling-optimization code)
1453 AC_ARG_ENABLE(hashmap,
1454         [  --disable-hashmap       compile without hashmap scrolling-optimization],
1455         [with_hashmap=$enableval],
1456         [with_hashmap=yes])
1457 AC_MSG_RESULT($with_hashmap)
1458 test "x$with_hashmap" = xyes && AC_DEFINE(USE_HASHMAP,1,[Define to 1 to compile with hashmap scrolling-optimization])
1459
1460 ###   use option --enable-colorfgbg to turn on use of $COLORFGBG environment
1461 AC_MSG_CHECKING(if you want colorfgbg code)
1462 AC_ARG_ENABLE(colorfgbg,
1463         [  --enable-colorfgbg      compile-in experimental $COLORFGBG code],
1464         [with_colorfgbg=$enableval],
1465         [with_colorfgbg=no])
1466 AC_MSG_RESULT($with_colorfgbg)
1467 test "x$with_colorfgbg" = xyes && AC_DEFINE(USE_COLORFGBG,1,[Define to 1 to compile-in experimental $COLORFGBG code])
1468
1469 ###   use option --enable-interop to turn on use of bindings used for interop
1470 AC_MSG_CHECKING(if you want interop bindings)
1471 AC_ARG_ENABLE(interop,
1472         [  --enable-interop        compile-in interop bindings],
1473         [with_exp_interop=$enableval],
1474         [with_exp_interop=$cf_dft_interop])
1475 AC_MSG_RESULT($with_exp_interop)
1476
1477 NCURSES_INTEROP_FUNCS=0
1478 test "x$with_exp_interop" = xyes && NCURSES_INTEROP_FUNCS=1
1479 AC_SUBST(NCURSES_INTEROP_FUNCS)
1480
1481
1482 AC_MSG_CHECKING(if you want experimental safe-sprintf code)
1483 AC_ARG_ENABLE(safe-sprintf,
1484         [  --enable-safe-sprintf   compile with experimental safe-sprintf code],
1485         [with_safe_sprintf=$enableval],
1486         [with_safe_sprintf=no])
1487 AC_MSG_RESULT($with_safe_sprintf)
1488
1489 ###   use option --disable-scroll-hints to turn off use of scroll-hints scrolling logic
1490 # when hashmap is used scroll hints are useless
1491 if test "$with_hashmap" = no ; then
1492 AC_MSG_CHECKING(if you want to experiment without scrolling-hints code)
1493 AC_ARG_ENABLE(scroll-hints,
1494         [  --disable-scroll-hints  compile without scroll-hints code],
1495         [with_scroll_hints=$enableval],
1496         [with_scroll_hints=yes])
1497 AC_MSG_RESULT($with_scroll_hints)
1498 test "x$with_scroll_hints" = xyes && AC_DEFINE(USE_SCROLL_HINTS,1,[Define to 1 to compile without scroll-hints code])
1499 fi
1500
1501 AC_MSG_CHECKING(if you want wgetch-events code)
1502 AC_ARG_ENABLE(wgetch-events,
1503         [  --enable-wgetch-events  compile with wgetch-events code],
1504         [with_wgetch_events=$enableval],
1505         [with_wgetch_events=no])
1506 AC_MSG_RESULT($with_wgetch_events)
1507 test "x$with_wgetch_events" = xyes && AC_DEFINE(NCURSES_WGETCH_EVENTS,1,[Define to 1 to compile with wgetch-events code])
1508
1509 ###############################################################################
1510 CF_HELP_MESSAGE(Testing/development Options:)
1511
1512 ###     use option --disable-echo to suppress full display compiling commands
1513 CF_DISABLE_ECHO
1514 if test "x$enable_echo" = xyes; then
1515         ECHO_LINK=
1516 else
1517         ECHO_LINK='@ echo linking $@ ... ;'
1518         test -n "$LIBTOOL" && LIBTOOL="$LIBTOOL --silent"
1519         test -n "$LIBTOOL_CXX" && LIBTOOL_CXX="$LIBTOOL_CXX --silent"
1520 fi
1521 AC_SUBST(ECHO_LINK)
1522
1523 # --disable-stripping is used for debugging
1524 CF_INSTALL_OPTS
1525
1526 # If we're avoiding relinking of shared libraries during install, that is to
1527 # avoid modifying the build-tree.  For the same reason, avoid doing ranlib if
1528 # the install program has "-p" (for preserving timestamps).
1529 cf_cv_do_reranlib=yes
1530 if test "x$cf_cv_install_p" = xyes
1531 then
1532         if test "x$cf_cv_do_relink" != xyes
1533         then
1534                 cf_cv_do_reranlib=no
1535                 INSTALL_OPT_P="-p"
1536                 INSTALL_LIB="$INSTALL_LIB $INSTALL_OPT_P"
1537         fi
1538 fi
1539 AC_SUBST(INSTALL_OPT_P)
1540
1541 ###     use option --enable-warnings to turn on all gcc warnings
1542 AC_MSG_CHECKING(if you want to see compiler warnings)
1543 AC_ARG_ENABLE(warnings,
1544         [  --enable-warnings       build: turn on GCC compiler warnings],
1545         [with_warnings=$enableval])
1546 AC_MSG_RESULT($with_warnings)
1547
1548 if test "x$with_warnings" = "xyes"; then
1549         CF_ADD_ADAFLAGS(-gnatg)
1550         CF_GCC_WARNINGS(Wno-unknown-pragmas Wswitch-enum)
1551         if test "x$cf_with_cxx" = xyes ; then
1552                 CF_GXX_WARNINGS(Wno-unused)
1553         fi
1554 fi
1555 CF_GCC_ATTRIBUTES
1556 CF_ENABLE_STRING_HACKS
1557
1558 ###     use option --enable-assertions to turn on generation of assertion code
1559 AC_MSG_CHECKING(if you want to enable runtime assertions)
1560 AC_ARG_ENABLE(assertions,
1561         [  --enable-assertions     test: turn on generation of assertion code],
1562         [with_assertions=$enableval],
1563         [with_assertions=no])
1564 AC_MSG_RESULT($with_assertions)
1565 if test -n "$GCC"
1566 then
1567         if test "$with_assertions" = no
1568         then
1569                 CPPFLAGS="$CPPFLAGS -DNDEBUG"
1570         else
1571                 CF_ADD_ADAFLAGS(-gnata)
1572         fi
1573 fi
1574
1575 ###     use option --disable-leaks to suppress "permanent" leaks, for testing
1576 CF_DISABLE_LEAKS
1577 AC_DEFINE(HAVE_NC_ALLOC_H,1,[Define to 1 if we have nc_alloc.h header])
1578
1579 ###     use option --enable-expanded to generate certain macros as functions
1580 AC_ARG_ENABLE(expanded,
1581         [  --enable-expanded       test: generate functions for certain macros],
1582         [test "x$enableval" = xyes && AC_DEFINE(NCURSES_EXPANDED,1,[Define to 1 to generate functions for certain macros])])
1583
1584 ###     use option --disable-macros to suppress macros in favor of functions
1585 AC_ARG_ENABLE(macros,
1586         [  --disable-macros        test: use functions rather than macros],
1587         [test "$enableval" = no && AC_DEFINE(NCURSES_NOMACROS,1,[Define to 1 to use functions rather than macros])])
1588
1589 # Normally we only add trace() to the debug-library.  Allow this to be
1590 # extended to all models of the ncurses library:
1591 cf_all_traces=no
1592 case "$CFLAGS $CPPFLAGS" in
1593 (*-DTRACE*)
1594         cf_all_traces=yes
1595         ;;
1596 esac
1597
1598 AC_MSG_CHECKING(whether to add trace feature to all models)
1599 AC_ARG_WITH(trace,
1600 [  --with-trace            test: add trace() function to all models of ncurses],
1601 [cf_with_trace=$withval],
1602 [cf_with_trace=$cf_all_traces])
1603 AC_MSG_RESULT($cf_with_trace)
1604
1605 if test "x$cf_with_trace" = xyes ; then
1606         LIB_TRACING=all
1607         ADA_TRACE=TRUE
1608         CF_ADD_CFLAGS(-DTRACE)
1609         AC_DEFINE(HAVE__TRACEF,1,[Define to 1 if we have _tracef function])
1610 else
1611         LIB_TRACING=DEBUG
1612         ADA_TRACE=FALSE
1613 fi
1614
1615 AC_SUBST(ADA_TRACE)
1616
1617 CF_DISABLE_GNAT_PROJECTS
1618
1619 ###     Checks for libraries.
1620 case $cf_cv_system_name in
1621 (*mingw32*|*mingw64*)
1622         CPPFLAGS="$CPPFLAGS -DWINVER=0x0501 -DWIN32_LEAN_AND_MEAN"
1623         # Note: WINVER may be a problem with Windows 10
1624         ;;
1625 (*)
1626 AC_CHECK_FUNC(gettimeofday,
1627         AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define to 1 if we have gettimeofday function]),[
1628
1629 AC_CHECK_LIB(bsd, gettimeofday,
1630         AC_DEFINE(HAVE_GETTIMEOFDAY,1,[Define to 1 if we have gettimeofday function])
1631         CF_ADD_LIB(bsd))])dnl CLIX: bzero, select, gettimeofday
1632         ;;
1633 esac
1634
1635 CF_MATH_LIB(MATH_LIB,pow(sin(x),x))
1636 AC_SUBST(MATH_LIB)
1637
1638 ###     Checks for header files.
1639 AC_STDC_HEADERS
1640 AC_HEADER_DIRENT
1641 AC_HEADER_TIME
1642 CF_REGEX
1643
1644 dnl These are some other potentially nonportable headers.
1645 AC_CHECK_HEADERS( \
1646 fcntl.h \
1647 getopt.h \
1648 limits.h \
1649 locale.h \
1650 math.h \
1651 poll.h \
1652 sys/bsdtypes.h \
1653 sys/ioctl.h \
1654 sys/param.h \
1655 sys/poll.h \
1656 sys/select.h \
1657 sys/time.h \
1658 sys/times.h \
1659 ttyent.h \
1660 unistd.h \
1661 wctype.h \
1662 )
1663
1664 CF_GETOPT_HEADER
1665
1666 CF_CHECK_ENVIRON(environ)
1667 CF_CHECK_GETENV
1668 if test "x$cf_cv_consistent_getenv" = xno && \
1669         test "x$cf_with_trace" = xyes
1670 then
1671         AC_MSG_WARN(The NCURSES_TRACE environment variable is not supported with this configuration)
1672 fi
1673
1674 # check for ISC (this may also define _POSIX_SOURCE)
1675 # Note: even non-Posix ISC needs <sys/bsdtypes.h> to declare fd_set
1676 if test "x$ISC" = xyes ; then
1677         AC_CHECK_LIB(cposix,main)
1678         AC_CHECK_LIB(inet,bzero,CF_ADD_LIB(inet))dnl also 'select()'
1679 fi
1680
1681 CF_SYS_TIME_SELECT
1682
1683 ###     checks for compiler characteristics
1684 AC_LANG_C
1685 AC_C_CONST
1686 CF_C_INLINE(NCURSES_INLINE,1200)
1687 CF_SIG_ATOMIC_T
1688
1689 if test $NCURSES_CHTYPE = auto ; then
1690         CF_TYPEOF_CHTYPE
1691 else
1692         cf_cv_typeof_chtype=$NCURSES_CHTYPE
1693 fi
1694 test "$cf_cv_typeof_chtype" = unsigned && cf_cv_typeof_chtype=""
1695 AC_SUBST(cf_cv_typeof_chtype)
1696
1697 CF_UNSIGNED_LITERALS
1698 cf_cv_1UL="1"
1699 test ".$cf_cv_unsigned_literals" = .yes && cf_cv_1UL="${cf_cv_1UL}U"
1700 test ".$cf_cv_typeof_chtype"    = .long && cf_cv_1UL="${cf_cv_1UL}L"
1701 AC_SUBST(cf_cv_1UL)
1702
1703 if test $NCURSES_MMASK_T = auto ; then
1704         cf_cv_typeof_mmask_t=long
1705 else
1706         cf_cv_typeof_mmask_t=$NCURSES_MMASK_T
1707 fi
1708 test "$cf_cv_typeof_mmask_t" = unsigned && cf_cv_typeof_mmask_t=""
1709 AC_SUBST(cf_cv_typeof_mmask_t)
1710
1711 ###     Checks for external-data
1712 CF_ERRNO
1713 CF_LINK_DATAONLY
1714
1715 ###     Checks for library functions.
1716 AC_CHECK_FUNCS( \
1717 getcwd \
1718 getegid \
1719 geteuid \
1720 getopt \
1721 getttynam \
1722 issetugid \
1723 localeconv \
1724 poll \
1725 putenv \
1726 remove \
1727 select \
1728 setbuf \
1729 setbuffer \
1730 setenv \
1731 setvbuf \
1732 sigaction \
1733 sigvec \
1734 strdup \
1735 strstr \
1736 sysconf \
1737 tcgetpgrp \
1738 times \
1739 tsearch \
1740 vsnprintf \
1741 )
1742
1743 if test "x$ac_cv_func_getopt" = xno && \
1744    test "x$cf_with_progs$cf_with_tests" != xnono; then
1745         AC_MSG_ERROR(getopt is required for building programs)
1746 fi
1747
1748 if test "x$with_safe_sprintf" = xyes
1749 then
1750         if test "x$ac_cv_func_vsnprintf" = xyes
1751         then
1752                 AC_MSG_WARN(will use vsnprintf instead of safe-sprintf option)
1753         else
1754                 AC_DEFINE(USE_SAFE_SPRINTF,1,[Define to 1 to compile with experimental safe-sprintf code])
1755         fi
1756 fi
1757
1758 if test "x$with_getcap" = "xyes" ; then
1759         CF_CGETENT
1760 fi
1761
1762 CF_ISASCII
1763 CF_STRUCT_SIGACTION
1764 CF_FUNC_NANOSLEEP
1765 CF_FUNC_TERMIOS
1766 CF_FUNC_VSSCANF
1767 CF_MKSTEMP
1768
1769 # setup for prototype of fallback for vsscanf()
1770 CF_SUBST_IF(["$cf_cv_func_vsscanf" = vsscanf], HAVE_VSSCANF, 1, 0)
1771
1772 dnl FIXME (may need this) AC_SYS_RESTARTABLE_SYSCALLS
1773 if test "x$cross_compiling" = xyes ; then
1774         AC_MSG_WARN(cross compiling: assume setvbuf params not reversed)
1775 else
1776         AC_FUNC_SETVBUF_REVERSED
1777 fi
1778 AC_CHECK_TYPE(intptr_t, long)
1779 AC_CHECK_TYPE(ssize_t, int)
1780 CF_TYPE_SIGACTION
1781 CF_SIZECHANGE
1782 CF_FUNC_MEMMOVE
1783 CF_FUNC_POLL
1784 CF_VA_COPY
1785 AC_FUNC_VFORK
1786 CF_FOPEN_BIN_R
1787
1788 # special check for test/ditto.c
1789 CF_FUNC_OPENPTY
1790 if test "$cf_cv_func_openpty" != no ; then
1791         AC_DEFINE_UNQUOTED(USE_OPENPTY_HEADER,<$cf_cv_func_openpty>,[Define to actual header for openpty function])
1792         AC_DEFINE(USE_XTERM_PTY,1,[Define to 1 if we should assume xterm pseudoterminal interface])
1793         if test "x$cf_cv_lib_util" = xyes ; then
1794                 CF_ADD_LIB(util,TEST_LIBS)
1795         fi
1796 fi
1797 AC_SUBST(TEST_LIBS)
1798 AC_SUBST(TEST_LIBS2)
1799
1800 if test "$with_hashed_db" != no ; then
1801         AC_DEFINE(USE_HASHED_DB,1,[Define to 1 if we should build terminfo in hashed database])
1802         CF_HASHED_DB($with_hashed_db)
1803 fi
1804
1805 dnl We'll do our own -g libraries, unless the user's overridden via $CFLAGS
1806 if test -z "$cf_user_CFLAGS" && test "$with_no_leaks" = no ; then
1807         CF_STRIP_G_OPT(CFLAGS)
1808         CF_STRIP_G_OPT(CXXFLAGS)
1809 fi
1810
1811 # Just in case, check if the C compiler has a bool type.
1812 CF_BOOL_DECL(cf_cv_cc_bool_type)
1813
1814 # Check for C++ compiler characteristics (and ensure that it's there!)
1815 if test -n "$CXX" ; then
1816         AC_LANG_CPLUSPLUS
1817         CF_STDCPP_LIBRARY
1818         CF_PROG_CC_C_O(CXX,[$CXXFLAGS $CPPFLAGS])
1819
1820         case $GXX_VERSION in
1821         (1*|2.[0-6]*)
1822                 cf_cxx_library=yes
1823                 ;;
1824         (*-2.7*|2.7*)
1825                 CF_GPP_LIBRARY
1826                 ;;
1827         (*)
1828                 cf_cxx_library=no
1829                 ;;
1830         esac
1831
1832         AC_CHECK_HEADERS(typeinfo)
1833         CF_CXX_IOSTREAM_NAMESPACE
1834         CF_BOOL_DECL
1835         CF_BOOL_SIZE
1836         CF_ETIP_DEFINES
1837         CF_CPP_PARAM_INIT
1838         CF_CPP_STATIC_CAST
1839         CF_CXX_AR_FLAGS
1840 else
1841         cf_cxx_library=no
1842         cf_cv_builtin_bool=1
1843
1844         # Just because we are not configuring against C++ right now does not
1845         # mean that a user will not want to use C++.  Some distributors disable
1846         # the C++ portion of this configuration as a shortcut (or just to avoid
1847         # compiling the demo in the c++ directory).  So we need a reasonable
1848         # default for the 'bool' type.
1849         #
1850         # Caveat: since the storage of the bool type is not standardized, it
1851         # may change.
1852
1853         if test "$NCURSES_BOOL" != auto ; then
1854                 cf_cv_type_of_bool=$NCURSES_BOOL
1855                 cf_cv_header_stdbool_h=0
1856         else
1857                 if test "$cf_cv_header_stdbool_h" = 1 ; then
1858                         CF_BOOL_SIZE
1859                 else
1860                         AC_MSG_CHECKING(for fallback type of bool)
1861                         case "$host_cpu" in
1862                         (i?86)  cf_cv_type_of_bool=char ;;
1863                         (*)     cf_cv_type_of_bool=int  ;;
1864                         esac
1865                         AC_MSG_RESULT($cf_cv_type_of_bool)
1866                 fi
1867         fi
1868 fi
1869 AC_SUBST(CXXLIBS)
1870
1871 # If the C compiler did not declare bool, and we did not determine that the C++
1872 # compiler does not declare bool, turn on an ifdef in curses.h that makes the
1873 # ncurses library use the same type as C++ bool.  Note that this allows one to
1874 # specify the type of bool in a configure-script option and postpone
1875 # integration with the C++ compiler provided that the types are compatible.
1876 USE_CXX_BOOL=1
1877 if test $cf_cv_cc_bool_type = 1
1878 then
1879         # oops: C has a bool.  Unlikely, but C++ could differ.
1880         USE_CXX_BOOL=0
1881 elif test $cf_cv_builtin_bool = 0
1882 then
1883         # C++ has no bool
1884         USE_CXX_BOOL=0
1885 else
1886         # this is the normal case
1887         USE_CXX_BOOL='defined(__cplusplus)'
1888 fi
1889 AC_SUBST(USE_CXX_BOOL)
1890
1891 CF_HELP_MESSAGE(Ada Binding Options:)
1892
1893 dnl If the Ada95 source-tree is present, add that to the build unless it will
1894 dnl not work, or was not requested.
1895 if test -f "${srcdir}/Ada95/Makefile.in" ; then
1896
1897 dnl libtool does not know anything about GNAT, though a change made in 1998
1898 dnl provided for it "someday".  Disable the ada subtree if we are using
1899 dnl libtool -TD 20070714
1900         if test "$cf_with_ada" != "no" ; then
1901                 if test "$with_libtool" != "no"; then
1902                         AC_MSG_WARN(libtool does not support Ada - disabling feature)
1903                         cf_with_ada=no
1904                 fi
1905         fi
1906
1907 dnl Check for availability of GNU Ada Translator (GNAT).
1908 dnl At the moment we support no other Ada compiler.
1909         if test "$cf_with_ada" != "no" ; then
1910                 CF_PROG_GNAT
1911                 if test "x$cf_cv_prog_gnat_correct" = xyes; then
1912                         CF_ADD_ADAFLAGS(-gnatpn)
1913                         CF_FIXUP_ADAFLAGS
1914
1915                         CF_GNATPREP_OPT_T
1916
1917                         CF_GNAT_GENERICS
1918                         CF_GNAT_SIGINT
1919                         CF_GNAT_PROJECTS
1920
1921                         CF_WITH_ADA_COMPILER
1922
1923                         cf_ada_package=terminal_interface
1924                         AC_SUBST(cf_ada_package)
1925
1926                         CF_WITH_ADA_INCLUDE
1927                         CF_WITH_ADA_OBJECTS
1928                         CF_WITH_ADA_SHAREDLIB
1929
1930                         # allow the Ada binding to be renamed
1931                         CF_WITH_ADA_LIBNAME(AdaCurses)
1932                 fi
1933         fi
1934 else
1935         cf_with_ada=no
1936 fi
1937
1938 # do this "late" to avoid conflict with header-checks
1939 if test "x$with_widec" = xyes ; then
1940         AC_CHECK_SIZEOF(wchar_t)
1941 fi
1942
1943 ### Construct the ncurses library-subsets, if any, from this set of keywords:
1944 ###     none, base, ext_funcs, ext_tinfo, ticlib, termlib, widechar
1945 ###
1946 ### ticlib modules may be a separate library, otherwise contained in termlib.
1947 ### termlib modules may be a separate library, otherwise contained in ncurses.
1948 ###
1949 ### The of "+" or " " between the tokens controls the way the script
1950 ### chooses to split module lists into libraries.
1951 ###
1952 ### (see CF_LIB_RULES).
1953 AC_MSG_CHECKING(for library subsets)
1954 LIB_SUBSETS=
1955
1956 if test "x$cf_with_progs" = xyes || test "$with_ticlib" != no || test "$with_termcap" != no; then
1957         LIB_SUBSETS="${LIB_SUBSETS}ticlib"
1958         if test "$with_ticlib" != no ; then
1959                 LIB_SUBSETS="${LIB_SUBSETS} "
1960         else
1961                 LIB_SUBSETS="${LIB_SUBSETS}+"
1962         fi
1963 fi
1964
1965 LIB_SUBSETS="${LIB_SUBSETS}termlib"
1966 test "x$with_ext_funcs" = xyes && LIB_SUBSETS="${LIB_SUBSETS}+ext_tinfo"
1967
1968 if test "$with_termlib" != no ; then
1969         LIB_SUBSETS="${LIB_SUBSETS} "
1970 else
1971         LIB_SUBSETS="${LIB_SUBSETS}+"
1972 fi
1973
1974 LIB_SUBSETS="${LIB_SUBSETS}base"
1975
1976 # Most term-driver calls are to tinfo, but some like init_pair are to the
1977 # base library (so it resides in base).
1978 if test "$with_term_driver" != no ; then
1979         LIB_SUBSETS="${LIB_SUBSETS}+port_drivers"
1980         case $cf_cv_system_name in
1981         (*mingw32*|*mingw64*)
1982                 LIB_SUBSETS="${LIB_SUBSETS}+port_tinfo+port_win32con"
1983                 CPPFLAGS="$CPPFLAGS -DUSE_WIN32CON_DRIVER"
1984                 ;;
1985         (*)
1986                 LIB_SUBSETS="${LIB_SUBSETS}+port_tinfo"
1987                 ;;
1988         esac
1989 fi
1990
1991 test "x$with_widec"     = xyes && LIB_SUBSETS="${LIB_SUBSETS}+widechar"
1992 test "x$with_ext_funcs" = xyes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs"
1993
1994 AC_MSG_RESULT($LIB_SUBSETS)
1995
1996 ### Construct the list of include-directories to be generated
1997 CF_INCLUDE_DIRS
1998 CF_ADA_INCLUDE_DIRS
1999
2000 ### Build up pieces for makefile rules
2001 AC_MSG_CHECKING(default library suffix)
2002 CF_LIB_TYPE($DFT_LWR_MODEL,DFT_ARG_SUFFIX)dnl
2003 AC_SUBST(DFT_ARG_SUFFIX)dnl the string to append to "-lncurses" ("")
2004 AC_MSG_RESULT($DFT_ARG_SUFFIX)
2005
2006 AC_MSG_CHECKING(default library-dependency suffix)
2007 CF_LIB_SUFFIX($DFT_LWR_MODEL,DFT_LIB_SUFFIX,DFT_DEP_SUFFIX)dnl
2008 AC_SUBST(DFT_DEP_SUFFIX)dnl the corresponding library-suffix (".a")
2009 AC_MSG_RESULT($DFT_DEP_SUFFIX)
2010
2011 AC_MSG_CHECKING(default object directory)
2012 CF_OBJ_SUBDIR($DFT_LWR_MODEL,DFT_OBJ_SUBDIR)dnl
2013 AC_SUBST(DFT_OBJ_SUBDIR)dnl the default object-directory ("obj")
2014 AC_MSG_RESULT($DFT_OBJ_SUBDIR)
2015
2016 if test "x$cf_with_cxx" = xyes ; then
2017 AC_MSG_CHECKING(c++ library-dependency suffix)
2018 if test "$with_libtool" != "no"; then
2019         # libtool thinks it can make c++ shared libraries (perhaps only g++)
2020         CXX_LIB_SUFFIX=$DFT_DEP_SUFFIX
2021 elif test "$with_shared_cxx" != "no"; then
2022         # also for g++ users...
2023         CXX_LIB_SUFFIX=$DFT_DEP_SUFFIX
2024 else
2025         # we normally make a static library because C/C++ library rules differ
2026         CF_LIB_SUFFIX(normal,CXX_LIB_SUFFIX,CXX_DEP_SUFFIX)
2027 fi
2028 AC_MSG_RESULT($CXX_LIB_SUFFIX)
2029 AC_SUBST(CXX_LIB_SUFFIX)
2030 fi
2031
2032 # do not want -ldl in build except as needed for -lncurses dependency
2033 if test "x$with_dlsym" = xyes ; then
2034 if test $DFT_LWR_MODEL = shared || \
2035    test $DFT_LWR_MODEL = libtool ; then
2036         CF_REMOVE_LIB(LIBS,$LIBS,dl)
2037 fi
2038 fi
2039 ### Set up low-level terminfo dependencies for makefiles.
2040
2041 # TICS_LIST and TINFO_LIST are needed to build libtic.so and libterm.so, but
2042 # do not need libdl
2043 TICS_LIST=
2044 if test "x$with_dlsym" = xyes ; then
2045         CF_REMOVE_LIB(TINFO_LIST,$SHLIB_LIST,dl)
2046 fi
2047
2048 USE_ARG_SUFFIX="${DFT_ARG_SUFFIX}${EXTRA_SUFFIX}"
2049 USE_LIB_SUFFIX="${LIB_SUFFIX}${EXTRA_SUFFIX}"
2050 USE_CFG_SUFFIX=${DFT_ARG_SUFFIX}${cf_cv_abi_version}
2051 if test -n "$EXTRA_SUFFIX" && test "x$EXTRA_SUFFIX" != "x${cf_cv_abi_version}"
2052 then
2053         USE_CFG_SUFFIX="${USE_CFG_SUFFIX}${EXTRA_SUFFIX}"
2054 fi
2055 AC_SUBST(USE_ARG_SUFFIX)
2056 AC_SUBST(USE_CFG_SUFFIX)
2057 AC_SUBST(USE_LIB_SUFFIX)
2058
2059 if test "$with_ticlib" != no ; then
2060
2061         if test "x$with_ticlib" != xyes ; then
2062                 TICS_NAME=$with_ticlib
2063                 TICS_SUFFIX="`echo ${DFT_LIB_SUFFIX}|sed -e "s/^${USE_LIB_SUFFIX}//"`"
2064                 TICS_ARG_SUFFIX="${with_ticlib}`echo ${USE_ARG_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
2065                 TICS_DEP_SUFFIX="${with_ticlib}`echo ${DFT_DEP_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
2066                 TICS_LIB_SUFFIX="${with_ticlib}"
2067         else
2068                 TICS_SUFFIX=${DFT_LIB_SUFFIX}
2069                 TICS_ARG_SUFFIX="${TICS_NAME}${USE_ARG_SUFFIX}"
2070                 TICS_DEP_SUFFIX="${TICS_NAME}${DFT_DEP_SUFFIX}"
2071                 TICS_LIB_SUFFIX="${TICS_NAME}${USE_LIB_SUFFIX}"
2072         fi
2073         TICS_LDFLAGS="-L${LIB_DIR}"
2074         TICS_LIBS="-l${TICS_ARG_SUFFIX}"
2075 else
2076         TICS_SUFFIX=${DFT_LIB_SUFFIX}
2077         TICS_LDFLAGS="-L${LIB_DIR}"
2078         TICS_LIBS="-l${LIB_NAME}${USE_ARG_SUFFIX}"
2079 fi
2080 AC_SUBST(TICS_ARG_SUFFIX)
2081 AC_SUBST(TICS_DEP_SUFFIX)
2082 AC_SUBST(TICS_LIB_SUFFIX)
2083 AC_SUBST(TICS_LDFLAGS)
2084 AC_SUBST(TICS_LIBS)
2085
2086 if test "$with_termlib" != no ; then
2087
2088         if test "x$with_termlib" != xyes ; then
2089                 TINFO_NAME=$with_termlib
2090                 TINFO_SUFFIX="`echo ${DFT_LIB_SUFFIX}|sed -e "s/^${USE_LIB_SUFFIX}//"`"
2091                 TINFO_ARG_SUFFIX="${with_termlib}`echo ${USE_ARG_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
2092                 TINFO_DEP_SUFFIX="${with_termlib}`echo ${DFT_DEP_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`"
2093                 TINFO_LIB_SUFFIX="${with_termlib}"
2094         else
2095                 TINFO_SUFFIX=${DFT_LIB_SUFFIX}
2096                 TINFO_ARG_SUFFIX="${TINFO_NAME}${USE_ARG_SUFFIX}"
2097                 TINFO_DEP_SUFFIX="${TINFO_NAME}${DFT_DEP_SUFFIX}"
2098                 TINFO_LIB_SUFFIX="${TINFO_NAME}${USE_LIB_SUFFIX}"
2099         fi
2100
2101         TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${TINFO_DEP_SUFFIX}"
2102         TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${TINFO_DEP_SUFFIX}"
2103         if test "$DFT_LWR_MODEL" = "libtool"; then
2104                 TEST_ARGS="${TEST_DEPS}"
2105                 TEST_ARG2="${TEST_DEP2}"
2106                 TINFO_LDFLAGS="-L${LIB_DIR}"
2107                 TINFO_LIBS="$TEST_ARGS"
2108                 TICS_LIST="$SHLIB_LIST $TEST_ARGS"
2109                 SHLIB_LIST="${SHLIB_LIST} $TEST_ARGS"
2110         else
2111                 TEST_ARGS="-l${TINFO_ARG_SUFFIX}"
2112                 TEST_ARG2="-l${TINFO_ARG_SUFFIX}"
2113                 if test "x$with_term_driver" != xno ; then
2114                         TICS_LIST="$SHLIB_LIST -l${LIB_NAME}${USE_ARG_SUFFIX}"
2115                         TICS_LIBS="$TICS_LIBS -l${LIB_NAME}${USE_ARG_SUFFIX}"
2116                         TINFO_LIBS="-l${LIB_NAME}${USE_ARG_SUFFIX} $TEST_ARGS"
2117                 else
2118                         TICS_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}"
2119                         TINFO_LIBS="$TEST_ARGS"
2120                 fi
2121                 TINFO_LDFLAGS="-L${LIB_DIR}"
2122                 SHLIB_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}"
2123         fi
2124 else
2125         # the next lines are needed for linking libtic over libncurses
2126         TINFO_NAME=${LIB_NAME}
2127         TINFO_SUFFIX=${DFT_LIB_SUFFIX}
2128         TINFO_ARG_SUFFIX=${LIB_NAME}${USE_ARG_SUFFIX}
2129         if test "x$with_tic_depends" = xyes ; then
2130                 TICS_LIST="$SHLIB_LIST -l${LIB_NAME}${USE_ARG_SUFFIX}"
2131         else
2132                 TICS_LIST="$SHLIB_LIST"
2133         fi
2134
2135         TINFO_LDFLAGS="-L${LIB_DIR}"
2136         TINFO_LIBS="-l${LIB_NAME}${USE_ARG_SUFFIX}"
2137 fi
2138
2139 if test "$DFT_LWR_MODEL" = shared ; then
2140         case $cf_cv_system_name in
2141         (cygwin*|msys*)
2142                 # "lib" files have ".dll.a" suffix, "cyg"or "msys-" files have ".dll"
2143                 TINFO_SUFFIX=.dll
2144                 ;;
2145         esac
2146 fi
2147
2148 AC_SUBST(TINFO_ARG_SUFFIX)
2149 AC_SUBST(TINFO_DEP_SUFFIX)
2150 AC_SUBST(TINFO_LIB_SUFFIX)
2151 AC_SUBST(TINFO_LDFLAGS)
2152 AC_SUBST(TINFO_LIBS)
2153
2154 if test "x$with_dlsym" = xyes ; then
2155         CF_REMOVE_LIB(TICS_LIST,$TICS_LIST,dl)
2156 fi
2157
2158 if test "$DFT_LWR_MODEL" = "libtool"; then
2159         OBJEXT=lo
2160 fi
2161
2162 # needed for Ada95
2163 TINFO_LDFLAGS2=`echo "$TINFO_LDFLAGS" | sed -e 's,-L\.\./,-L../../,'`
2164 AC_SUBST(TINFO_LDFLAGS2)
2165
2166 case $DFT_LWR_MODEL in
2167 (normal|debug|profile)
2168         CF_LDFLAGS_STATIC
2169         ;;
2170 esac
2171
2172 AC_MSG_CHECKING(where we will install curses.h)
2173 AC_SUBST(includesubdir)
2174 includesubdir=
2175 if test "$with_overwrite" = no && \
2176  ( test "x$includedir" = 'x${prefix}/include' || \
2177    test "x$includedir" = "x${prefix}/include" )
2178 then
2179         includesubdir="/ncurses${USE_LIB_SUFFIX}"
2180 fi
2181 AC_MSG_RESULT(${includedir}${includesubdir})
2182
2183 ### Resolve a conflict between normal and wide-curses by forcing applications
2184 ### that will need libutf8 to add it to their configure script.
2185 if test "$with_overwrite" != no ; then
2186 if test "$NCURSES_LIBUTF8" = 1 ; then
2187         NCURSES_LIBUTF8='defined(HAVE_LIBUTF8_H)'
2188         AC_MSG_WARN(Wide-character applications must define HAVE_LIBUTF8_H to include curses.h)
2189 fi
2190 fi
2191 WITH_OVERWRITE=$with_overwrite
2192
2193 AC_SUBST(WITH_OVERWRITE)
2194 AC_SUBST(TICS_LIST)
2195 AC_SUBST(TINFO_LIST)
2196 AC_SUBST(SHLIB_LIST)
2197
2198 # used to separate tack out of the tree
2199 NCURSES_TREE=
2200 AC_SUBST(NCURSES_TREE)
2201
2202 ### predefined stuff for the test programs
2203 AC_DEFINE(HAVE_SLK_COLOR,1,[Define to 1 if we have slk_color for test-programs])
2204
2205 ### Construct the list of subdirectories for which we'll customize makefiles
2206 ### with the appropriate compile-rules.
2207
2208 CF_SRC_MODULES($modules_to_build)
2209
2210 if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = "xyes"; then
2211    SUB_MAKEFILES="$SUB_MAKEFILES Ada95/src/library.gpr:Ada95/src/library.gpr.in"
2212    SUB_MAKEFILES="$SUB_MAKEFILES Ada95/gen/adacurses${USE_CFG_SUFFIX}-config:Ada95/gen/adacurses-config.in"
2213    SUB_MAKEFILES="$SUB_MAKEFILES man/adacurses${USE_CFG_SUFFIX}-config.1:man/MKada_config.in"
2214 fi
2215
2216 CF_DIRS_TO_MAKE
2217
2218 # symbols that differ when compiling Ada95 by itself.
2219 NCURSES_SHLIB2=$SHELL' $(top_srcdir)/misc/shlib'
2220 AC_SUBST(NCURSES_SHLIB2)
2221
2222 # values to use as strings
2223 AC_DEFINE_UNQUOTED(NCURSES_PATHSEP,'$PATH_SEPARATOR',[Define to override ':' as library path-separator])
2224
2225 AC_DEFINE_UNQUOTED(NCURSES_VERSION_STRING, "${NCURSES_MAJOR}.${NCURSES_MINOR}.${NCURSES_PATCH}",[Define to 1 if machine has ample memory for tic])
2226
2227 ### Now that we're done running tests, add the compiler-warnings, if any
2228 CF_ADD_CFLAGS($EXTRA_CFLAGS)
2229
2230 ### Define substitutions for header files to avoid name-pollution
2231 CF_SUBST_IF(["x$cf_cv_have_tcgetattr" = xyes], HAVE_TCGETATTR, 1, 0)
2232 CF_SUBST_IF(["x$ac_cv_header_stdint_h" = xyes], HAVE_STDINT_H, 1, 0)
2233 CF_SUBST_IF(["x$ac_cv_header_termio_h" = xyes], HAVE_TERMIO_H, 1, 0)
2234 CF_SUBST_IF(["x$ac_cv_header_termios_h" = xyes], HAVE_TERMIOS_H, 1, 0)
2235
2236 ################################################################################
2237 test "x$use_database" = xyes && \
2238 SUB_MAKEFILES="$SUB_MAKEFILES misc/run_tic.sh:misc/run_tic.in"
2239
2240 SUB_MAKEFILES="$SUB_MAKEFILES misc/ncurses-config:misc/ncurses-config.in"
2241 SUB_MAKEFILES="$SUB_MAKEFILES man/ncurses${USE_CFG_SUFFIX}-config.1:man/MKncu_config.in"
2242
2243 if test "x$enable_pc_files" = xyes && test -z "$MAKE_PC_FILES" ; then
2244 SUB_MAKEFILES="$SUB_MAKEFILES misc/gen-pkgconfig:misc/gen-pkgconfig.in"
2245 fi
2246 AC_SUBST(cross_compiling)
2247
2248 if test "x$cf_with_tests" != xno ; then
2249         MAKE_TESTS=
2250 else
2251         MAKE_TESTS="#"
2252 fi
2253 AC_SUBST(MAKE_TESTS)
2254
2255 ADAHTML_DIR=../../doc/html/ada
2256 AC_SUBST(ADAHTML_DIR)
2257
2258 # these could be configurable, but are not currently
2259 PANEL_NAME=panel
2260 MENU_NAME=menu
2261 FORM_NAME=form
2262 CXX_NAME=ncurses++
2263
2264 AC_SUBST(PANEL_NAME)
2265 AC_SUBST(MENU_NAME)
2266 AC_SUBST(FORM_NAME)
2267 AC_SUBST(CXX_NAME)
2268
2269 # workaround for OS/2 (20151017)
2270 case $cf_cv_system_name in
2271 (os2*)
2272         LIBTOOL_OPTS_CXX="-os2dllname ncurs++"
2273         ;;
2274 (*)
2275         LIBTOOL_OPTS_CXX=
2276         ;;
2277 esac
2278 AC_SUBST(LIBTOOL_OPTS_CXX)
2279
2280 # workaround for g++ versus Solaris (20131116)
2281 case $cf_cv_system_name in
2282 (solaris2*)
2283         case "x$CPPFLAGS" in
2284         (*-D_XOPEN_SOURCE_EXTENDED*)
2285                 CF_VERBOSE(moving _XOPEN_SOURCE_EXTENDED to work around g++ problem)
2286                 CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
2287                 CPPFLAGS=`echo "x$CPPFLAGS" | sed -e  's/^.//' -e 's/-D_XOPEN_SOURCE_EXTENDED//'`
2288                 ;;
2289         esac
2290         ;;
2291 esac
2292
2293 # Help to automatically enable the extended curses features when using either
2294 # the *-config or the ".pc" files by adding defines.
2295 AC_MSG_CHECKING(for defines to add to ncurses${USE_CFG_SUFFIX}-config script)
2296 PKG_CFLAGS=
2297 for cf_loop1 in $CPPFLAGS_after_XOPEN
2298 do
2299         cf_found=no
2300         for cf_loop2 in $CPPFLAGS_before_XOPEN
2301         do
2302                 if test "x$cf_loop1" = "x$cf_loop2"
2303                 then
2304                         cf_found=yes
2305                         break
2306                 fi
2307         done
2308         test "$cf_found" = no && PKG_CFLAGS="$PKG_CFLAGS $cf_loop1"
2309 done
2310 AC_MSG_RESULT($PKG_CFLAGS)
2311 AC_SUBST(PKG_CFLAGS)
2312
2313 # AC_CHECK_SIZEOF demands a literal parameter, no variables.  So we do this.
2314 case "x$NCURSES_OSPEED" in
2315 (*short*)
2316         cf_compatible=1
2317         ;;
2318 (*)
2319         cf_compatible=0
2320         ;;
2321 esac
2322 AC_DEFINE_UNQUOTED(NCURSES_OSPEED_COMPAT,$cf_compatible,[Define to 1 if termcap variable ospeed is short])
2323
2324 case "x$cf_cv_typeof_chtype" in
2325 (xshort|xint|xlong)
2326         cf_cv_typeof_chtype="unsigned $cf_cv_typeof_chtype"
2327         ;;
2328 esac
2329
2330 case "x$cf_cv_typeof_mmask_t" in
2331 (xshort|xint|xlong)
2332         cf_cv_typeof_mmask_t="unsigned $cf_cv_typeof_mmask_t"
2333         ;;
2334 esac
2335
2336 # substitute into misc/Makefile to suppress
2337 # (un)install.data from the
2338 # (un)install rules.
2339 if test "x$cf_with_db_install" = "xno"; then
2340         MISC_INSTALL_DATA=
2341         MISC_UNINSTALL_DATA=
2342 else
2343         MISC_INSTALL_DATA=install.data
2344         MISC_UNINSTALL_DATA=uninstall.data
2345 fi
2346 AC_SUBST(MISC_INSTALL_DATA)
2347 AC_SUBST(MISC_UNINSTALL_DATA)
2348
2349 if test "x$cf_with_db_install" = "xno" || test "x$TERMINFO_SRC" = "xno"; then
2350         MAKE_DATABASE="#"
2351 else
2352         MAKE_DATABASE="$MAKE_TERMINFO"
2353 fi
2354 AC_SUBST(MAKE_DATABASE)
2355
2356 dnl Override the package used for exported symbols
2357 if test -n "$PACKAGE"
2358 then
2359         PACKAGE="${PACKAGE}${DFT_ARG_SUFFIX}"
2360         export PACKAGE
2361         echo "package: $PACKAGE"
2362 fi
2363
2364 UNALTERED_SYMS=
2365 cf_filter_syms=no
2366
2367 if test -n "$RESULTING_SYMS"
2368 then
2369         cf_filter_syms=$cf_dft_filter_syms
2370         CF_VERBOSE(will map symbols to ABI=$cf_cv_abi_version)
2371 fi
2372
2373 if test "x$WILDCARD_SYMS" = xno
2374 then
2375         cf_filter_syms=yes
2376 fi
2377
2378 test "x$cf_with_trace" = xyes && NCURSES_INLINE=
2379
2380 UNALTERED_SYMS=`echo "$RESULTING_SYMS" | sed -e 's/\\$/\\\\$/g'`
2381 if test $cf_filter_syms = yes
2382 then
2383         RESULTING_SYMS=resulting.map
2384 fi
2385 AC_SUBST(UNALTERED_SYMS)
2386
2387 if test "x$cross_compiling" = xyes ; then
2388         ADAGEN_LDFLAGS='$(CROSS_LDFLAGS)'
2389         CHECK_BUILD="#"
2390 else
2391         ADAGEN_LDFLAGS='$(NATIVE_LDFLAGS)'
2392         CHECK_BUILD=
2393 fi
2394 AC_SUBST(ADAGEN_LDFLAGS)
2395 AC_SUBST(CHECK_BUILD)
2396 AC_SUBST(PRIVATE_LIBS)
2397
2398 # This is used for the *-config script and *.pc data files.
2399 CF_LD_SEARCHPATH
2400
2401 AC_DEFINE(HAVE_CURSES_DATA_BOOLNAMES,1,[definition needed for in-tree build of tack])
2402
2403 AC_OUTPUT( \
2404         include/MKterm.h.awk \
2405         include/curses.head:include/curses.h.in \
2406         include/ncurses_dll.h \
2407         include/termcap.h \
2408         include/unctrl.h \
2409         $SUB_MAKEFILES \
2410         Makefile,[
2411 if test "x$cf_with_tests" != xno ; then
2412         CF_PRG_RULES([$srcdir/test/mk-test.awk INSTALL=no ECHO_LINK="$ECHO_LD"], test)
2413 fi
2414 CF_LIB_RULES($SRC_SUBDIRS)
2415
2416 if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = "xyes"; then
2417 if test -z "$USE_OLD_MAKERULES" ; then
2418         $AWK -f $srcdir/Ada95/mk-1st.awk <$srcdir/Ada95/src/modules >>Ada95/src/Makefile
2419 fi
2420 fi
2421 ],[
2422 ### Special initialization commands, used to pass information from the
2423 ### configuration-run into config.status
2424
2425 AWK="$AWK"
2426 ALTERNATE_SYMS="$ALTERNATE_SYMS"
2427 DFT_ARG_SUFFIX="$DFT_ARG_SUFFIX"
2428 DFT_LWR_MODEL="$DFT_LWR_MODEL"
2429 ECHO_LD="$ECHO_LD"
2430 EXTRA_SUFFIX="$EXTRA_SUFFIX"
2431 LDCONFIG="$LDCONFIG"
2432 LIBTOOL_VERSION="$LIBTOOL_VERSION"
2433 LIB_NAME="$LIB_NAME"
2434 LIB_PREFIX="$LIB_PREFIX"
2435 LIB_SUBSETS="$LIB_SUBSETS"
2436 LIB_SUFFIX="$LIB_SUFFIX"
2437 LIB_TRACING="$LIB_TRACING"
2438 LN_S="$LN_S"
2439 MAKE_TERMINFO="$MAKE_TERMINFO"
2440 NCURSES_MAJOR="$NCURSES_MAJOR"
2441 NCURSES_MINOR="$NCURSES_MINOR"
2442 NCURSES_OSPEED="$NCURSES_OSPEED"
2443 NCURSES_PATCH="$NCURSES_PATCH"
2444 SRC_SUBDIRS="$SRC_SUBDIRS"
2445 TERMINFO="$TERMINFO"
2446 TICS_ARG_SUFFIX="$TICS_ARG_SUFFIX"
2447 TICS_LIB_SUFFIX="$TICS_LIB_SUFFIX"
2448 TICS_NAME="$TICS_NAME"
2449 TICS_SUFFIX="$TICS_SUFFIX"
2450 TIC_PATH="$TIC_PATH"
2451 TINFO_ARG_SUFFIX="$TINFO_ARG_SUFFIX"
2452 TINFO_LIB_SUFFIX="$TINFO_LIB_SUFFIX"
2453 TINFO_NAME="$TINFO_NAME"
2454 TINFO_SUFFIX="$TINFO_SUFFIX"
2455 UNALTERED_SYMS="$UNALTERED_SYMS"
2456 USE_ARG_SUFFIX="$USE_ARG_SUFFIX"
2457 USE_CFG_SUFFIX="$USE_CFG_SUFFIX"
2458 USE_LIB_SUFFIX="$USE_LIB_SUFFIX"
2459 USE_OLD_MAKERULES="$USE_OLD_MAKERULES"
2460 WILDCARD_SYMS="$WILDCARD_SYMS"
2461 WITH_CURSES_H="$with_curses_h"
2462 WITH_ECHO="${enable_echo:=yes}"
2463 WITH_OVERWRITE="$with_overwrite"
2464 cf_LIST_MODELS="$cf_list_models"
2465 cf_cv_abi_version="$cf_cv_abi_version"
2466 cf_cv_do_relink="$cf_cv_do_relink"
2467 cf_cv_do_reranlib="$cf_cv_do_reranlib"
2468 cf_cv_do_symlinks="$cf_cv_do_symlinks"
2469 cf_cv_enable_lp64="$cf_cv_enable_lp64"
2470 cf_cv_enable_opaque="$cf_cv_enable_opaque"
2471 cf_cv_prog_CC_c_o=$cf_cv_prog_CC_c_o
2472 cf_cv_prog_CXX_c_o=$cf_cv_prog_CXX_c_o
2473 cf_cv_prog_gnat_correct=$cf_cv_prog_gnat_correct
2474 cf_cv_rel_version="$cf_cv_rel_version"
2475 cf_cv_rm_so_locs="$cf_cv_rm_so_locs"
2476 cf_cv_shared_soname='$cf_cv_shared_soname'
2477 cf_cv_shlib_version="$cf_cv_shlib_version"
2478 cf_cv_shlib_version_infix="$cf_cv_shlib_version_infix"
2479 cf_cv_system_name="$cf_cv_system_name"
2480 cf_cv_term_driver="$with_term_driver"
2481 cf_with_ada="$cf_with_ada"
2482 cf_with_cxx_binding="$cf_with_cxx_binding"
2483 cf_with_db_install="$cf_with_db_install"
2484 cf_with_manpages="$cf_with_manpages"
2485 cf_with_tests="$cf_with_tests"
2486 host="$host"
2487 target="$target"
2488 with_shared_cxx="$with_shared_cxx"
2489
2490 ],cat)dnl
2491 ${MAKE:-make} preinstall