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