ncurses 5.1
[ncurses.git] / configure.in
1 dnl***************************************************************************
2 dnl Copyright (c) 1998,1999 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 <dickey@clark.net> 1996,1997
30 dnl
31 dnl $Id: configure.in,v 1.195 2000/07/05 22:24:29 tom Exp $
32 dnl Process this file with autoconf to produce a configure script.
33 AC_PREREQ(2.12.971230)
34 AC_REVISION($Revision: 1.195 $)
35 AC_INIT(ncurses/base/lib_initscr.c)
36 AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin)
37
38 CF_SUBST_NCURSES_VERSION
39 CF_CHECK_CACHE
40 AC_ARG_WITH(system-type,
41 [  --with-system-type=XXX  test: override derived host system-type],
42 [AC_MSG_WARN(overriding system type to $withval)
43  cf_cv_system_name=$withval])
44
45 # We need a configure script only when compiling as part of GNU C library.
46 # Here we have to generate one of the files we need while compiling.
47 #
48 # The only problem is that users of the package might think they have to
49 # run configure themself and find it irritating when nothing happens.
50 #
51 # So we try here to find out whether we are called from the glibc configure
52 # or by a user.
53 #
54 dnl Check if we are a drop-in addition to glibc.
55 AC_ARG_ENABLE(add-ons, dnl
56 [  --enable-add-ons=DIR... used to check if we are a glibc add-on.],
57                 [glibc_add_on=yes],
58                 [glibc_add_on=])
59
60 dnl We need to use [ and ] for other purposes for a while now.
61 changequote(,)dnl
62 if test x"$glibc_add_on" = "xyes" ; then
63   rm -f $srcdir/Banner
64   # We are in glibc.
65   rm -f $srcdir/Makefile
66   cp $srcdir/Makefile.glibc $srcdir/Makefile
67   echo "ncurses `grep \"^[      ]*ncurses-version[      ]*=.*$\" \
68                 $srcdir/Makefile | sed -e \
69                 's/^[   ]*ncurses-version[      ]*=[    ]*\([^  ^ ]*\)[         ]*$/\1/'`" > $srcdir/Banner
70   exit 0
71 fi
72 changequote([,])dnl
73
74 ###     Save the given $CFLAGS to allow user-override.
75 cf_user_CFLAGS="$CFLAGS"
76
77 ###     Default install-location
78 CF_CFG_DEFAULTS
79
80 ###     Checks for programs.
81 AC_PROG_CC
82 if test -n "$GCC" ; then
83 AC_MSG_CHECKING(version of gcc)
84 eval "$CC --version"
85 fi
86 if test $host != $build; then
87   AC_CHECK_PROGS(BUILD_CC, $CC gcc cc)
88 fi
89 AC_PROG_CPP
90 AC_PROG_GCC_TRADITIONAL
91 AC_ISC_POSIX
92 CF_ANSI_CC_REQD
93 CF_PROG_EXT
94
95 case "$cf_cv_system_name" in
96 freebsd*) #(vi
97   test -z "$LDCONFIG" && LDCONFIG="/sbin/ldconfig -R"
98   ;;
99 *) LDPATH=$PATH:/sbin:/usr/sbin
100   AC_PATH_PROG(LDCONFIG,ldconfig,,$LDPATH)
101   ;;
102 esac
103 AC_SUBST(LDCONFIG)
104
105 dnl DEFECT in autoconf 2.12:    an attempt to set policy, this breaks the
106 dnl                             configure script by not letting us test if C++
107 dnl                             is present, making this option necessary.
108 AC_MSG_CHECKING(if you want to ensure bool is consistent with C++)
109 AC_ARG_WITH(cxx,
110         [  --without-cxx           do not adjust ncurses bool to match C++],
111         [cf_with_cxx=$withval],
112         [cf_with_cxx=yes])
113 AC_MSG_RESULT($cf_with_cxx)
114 if test "X$cf_with_cxx" = Xno ; then
115         CXX=""
116         GXX=""
117 else
118         pushdef([AC_MSG_ERROR],
119                 [AC_MSG_RESULT([You don't have any C++ compiler, too bad]); dnl
120                 cf_with_cxx=no; CXX=""; GXX="";])dnl
121         AC_PROG_CXX
122         popdef([AC_MSG_ERROR])dnl
123 fi
124 changequote(,)dnl
125 if test -n "$GXX" ; then case "`${CXX-g++} --version`" in 1*|2.[0-6]*) GXX=""; CXX=""; ac_cv_prog_gxx=no; cf_cxx_library=no ; echo No: templates do not work;; esac; fi
126 changequote([,])dnl
127
128 AC_MSG_CHECKING(if you want to build C++ binding and demo)
129 AC_ARG_WITH(cxx-binding,
130         [  --without-cxx-binding   do not build C++ binding and demo],
131         [cf_with_cxx_binding=$withval],
132         [cf_with_cxx_binding=$cf_with_cxx])
133 AC_MSG_RESULT($cf_with_cxx_binding)
134
135 AC_MSG_CHECKING(if you want to build with Ada95)
136 AC_ARG_WITH(ada,
137         [  --without-ada           suppress check for Ada95, don't build demo],
138         [cf_with_ada=$withval],
139         [cf_with_ada=yes])
140 AC_MSG_RESULT($cf_with_ada)
141
142 AC_MSG_CHECKING(if you want to build programs such as tic)
143 AC_ARG_WITH(progs,
144         [  --without-progs         suppress build with programs (e.g., tic)],
145         [cf_with_progs=$withval],
146         [cf_with_progs=yes])
147 AC_MSG_RESULT($cf_with_progs)
148
149 modules_to_build="ncurses"
150 if test "X$cf_with_progs" != Xno ; then
151 modules_to_build="$modules_to_build progs tack"
152 fi
153 modules_to_build="$modules_to_build panel menu form"
154
155 AC_PROG_AWK
156 AC_PROG_MAKE_SET
157 CF_PROG_INSTALL
158 AC_SYS_LONG_FILE_NAMES
159 AC_PROG_LN_S
160 AC_PROG_RANLIB
161 AC_CHECK_PROGS(LINT, tdlint lint alint)
162 AC_CHECK_PROGS(MAN, man man_db)
163 AC_SUBST(LINT_OPTS)
164
165 dnl These are standard among *NIX systems, but not when cross-compiling
166 CF_SUBST(loader,LD,ld)
167 CF_SUBST(archiver,AR,ar)
168 CF_SUBST(archiver options,AR_OPTS,rv)
169
170 CF_MAKEFLAGS
171
172 dnl Special option for use by system-builders: the install-prefix is used to
173 dnl adjust the location into which the actual install is done, so that an
174 dnl archive can be built without modifying the host system's configuration.
175 AC_MSG_CHECKING(if you have specified an install-prefix)
176 AC_ARG_WITH(install-prefix,
177         [  --with-install-prefix   prefixes actual install-location],
178         [case "$withval" in #(vi
179         yes|no) #(vi
180                 ;;
181         *)      INSTALL_PREFIX="$withval"
182                 ;;
183         esac])
184 AC_MSG_RESULT($INSTALL_PREFIX)
185 AC_SUBST(INSTALL_PREFIX)
186
187 ###############################################################################
188 CF_MAN_PAGES
189
190 ###############################################################################
191 CF_HELP_MESSAGE(Options to Specify the Libraries Built/Used:)
192
193 ### Options to allow the user to specify the set of libraries which are used.
194 ### Use "--without-normal --with-shared" to allow the default model to be
195 ### shared, for example.
196 cf_list_models=""
197 AC_SUBST(cf_list_models)dnl     the complete list of models ("normal debug")
198
199 AC_MSG_CHECKING(if you want to build shared libraries)
200 AC_ARG_WITH(shared,
201         [  --with-shared           generate shared-libraries],
202         [with_shared=$withval],
203         [with_shared=no])
204 AC_MSG_RESULT($with_shared)
205 test "$with_shared" = "yes" && cf_list_models="$cf_list_models shared"
206
207 AC_MSG_CHECKING(if you want to build static libraries)
208 AC_ARG_WITH(normal,
209         [  --with-normal           generate normal-libraries (default)],
210         [with_normal=$withval],
211         [with_normal=yes])
212 AC_MSG_RESULT($with_normal)
213 test "$with_normal" = "yes" && cf_list_models="$cf_list_models normal"
214
215 AC_MSG_CHECKING(if you want to build debug libraries)
216 AC_ARG_WITH(debug,
217         [  --with-debug            generate debug-libraries (default)],
218         [with_debug=$withval],
219         [with_debug=yes])
220 AC_MSG_RESULT($with_debug)
221 test "$with_debug" = "yes" && cf_list_models="$cf_list_models debug"
222
223 AC_MSG_CHECKING(if you want to build profiling libraries)
224 AC_ARG_WITH(profile,
225         [  --with-profile          generate profile-libraries],
226         [with_profile=$withval],
227         [with_profile=no])
228 AC_MSG_RESULT($with_profile)
229 test "$with_profile" = "yes" && cf_list_models="$cf_list_models profile"
230
231 ###############################################################################
232
233 AC_MSG_CHECKING(for specified models)
234 test -z "$cf_list_models" && cf_list_models=normal
235 AC_MSG_RESULT($cf_list_models)
236
237 ### Use the first model as the default, and save its suffix for use in building
238 ### up test-applications.
239 AC_MSG_CHECKING(for default model)
240 DFT_LWR_MODEL=`echo $cf_list_models | $AWK '{print $1}'`
241 AC_MSG_RESULT($DFT_LWR_MODEL)
242
243 CF_UPPER(DFT_UPR_MODEL,$DFT_LWR_MODEL)dnl
244
245 AC_SUBST(DFT_LWR_MODEL)dnl      the default model ("normal")
246 AC_SUBST(DFT_UPR_MODEL)dnl      the default model ("NORMAL")
247
248 TINFO_NAME=tinfo
249 AC_SUBST(TINFO_NAME)
250
251 LIB_NAME=ncurses
252 AC_SUBST(LIB_NAME)
253
254 LIB_DIR=../lib
255 CF_LIB_PREFIX(cf_prefix)
256 LIB_PREFIX=$cf_prefix
257 AC_SUBST(LIB_PREFIX)
258
259 LIB_SUFFIX=
260 AC_SUBST(LIB_SUFFIX)
261
262 ###############################################################################
263
264 AC_MSG_CHECKING(if you want to build a separate terminfo library)
265 AC_ARG_WITH(termlib,
266         [  --with-termlib          generate separate terminfo library],
267         [with_termlib=$withval],
268         [with_termlib=no])
269 AC_MSG_RESULT($with_termlib)
270
271 ### Checks for special libraries, must be done up-front.
272 AC_MSG_CHECKING(if you want to link with dbmalloc for testing)
273 AC_ARG_WITH(dbmalloc,
274         [  --with-dbmalloc         test: use Conor Cahill's dbmalloc library],
275         [with_dbmalloc=$withval],
276         [with_dbmalloc=no])
277 AC_MSG_RESULT($with_dbmalloc)
278 if test $with_dbmalloc = yes ; then
279         AC_CHECK_LIB(dbmalloc,debug_malloc)
280 fi
281
282 AC_MSG_CHECKING(if you want to link with dmalloc for testing)
283 AC_ARG_WITH(dmalloc,
284         [  --with-dmalloc          test: use Gray Watson's dmalloc library],
285         [with_dmalloc=$withval],
286         [with_dmalloc=no])
287 AC_MSG_RESULT($with_dmalloc)
288 if test $with_dmalloc = yes ; then
289         AC_CHECK_LIB(dmalloc,dmalloc_debug)
290 fi
291
292 SHLIB_LIST=""
293 AC_MSG_CHECKING(if you want to link with the gpm mouse library)
294 AC_ARG_WITH(gpm,
295         [  --with-gpm              use Alessandro Rubini's GPM library],
296         [with_gpm=$withval],
297         [with_gpm=no])
298 AC_MSG_RESULT($with_gpm)
299 if test $with_gpm = yes ; then
300         AC_CHECK_LIB(gpm,Gpm_Open,[
301                 EXTRA_LIBS="-lgpm -lncurses $EXTRA_LIBS"
302                 SHLIB_LIST="-lgpm $SHLIB_LIST"
303                 AC_DEFINE(HAVE_LIBGPM)
304                 AC_CHECK_HEADERS(gpm.h)
305         ],AC_MSG_WARN(Cannot link with gpm library - read the FAQ))
306 fi
307
308 dnl Not all ports of gcc support the -g option
309
310 if test X"$CC_G_OPT" = X"" ; then
311         CC_G_OPT='-g'
312         test -n "$GCC" && test "${ac_cv_prog_cc_g}" != yes && CC_G_OPT=''
313 fi
314 AC_SUBST(CC_G_OPT)
315
316 if test X"$CXX_G_OPT" = X"" ; then
317         CXX_G_OPT='-g'
318         test -n "$GXX" && test "${ac_cv_prog_cxx_g}" != yes && CXX_G_OPT=''
319 fi
320 AC_SUBST(CXX_G_OPT)
321
322 AC_MSG_CHECKING(for default loader flags)
323 case $DFT_LWR_MODEL in
324 normal)  LD_MODEL=''   ;;
325 debug)   LD_MODEL=$CC_G_OPT ;;
326 profile) LD_MODEL='-pg';;
327 shared)  LD_MODEL=''   ;;
328 esac
329 AC_SUBST(LD_MODEL)dnl           the type of link (e.g., -g or -pg)
330 AC_MSG_RESULT($LD_MODEL)
331
332 AC_MSG_CHECKING(if rpath option should be used)
333 AC_ARG_ENABLE(rpath,
334 [  --enable-rpath          use rpath option when generating shared libraries],
335 [cf_cv_ld_rpath=$enableval],
336 [cf_cv_ld_rpath=no])
337 AC_MSG_RESULT($cf_cv_ld_rpath)
338
339 CF_SHARED_OPTS
340 if test "$CC_SHARED_OPTS" = "unknown"; then
341         for model in $cf_list_models; do
342                 if test "$model" = "shared"; then
343                         AC_ERROR(Shared libraries are not supported in this version)
344                 fi
345         done
346 fi
347
348 ###############################################################################
349 CF_HELP_MESSAGE(Fine-Tuning Your Configuration:)
350
351 ###     use option --disable-overwrite to leave out the link to -lcurses
352 AC_MSG_CHECKING(if you wish to install ncurses overwriting curses)
353 AC_ARG_ENABLE(overwrite,
354         [  --disable-overwrite     leave out the link to -lcurses],
355         [with_overwrite=$enableval],
356         [with_overwrite=yes])
357 AC_MSG_RESULT($with_overwrite)
358
359 AC_MSG_CHECKING(if external terminfo-database is used)
360 AC_ARG_ENABLE(database,
361         [  --disable-database      use only built-in data],
362         [with_database=$enableval],
363         [with_database=yes])
364 AC_MSG_RESULT($with_database)
365 test $with_database != no && AC_DEFINE(USE_DATABASE)
366
367 AC_MSG_CHECKING(for list of fallback descriptions)
368 AC_ARG_WITH(fallbacks,
369         [  --with-fallbacks=XXX    specify list of fallback terminal descriptions],
370         [with_fallback=$withval],
371         [with_fallback=])
372 AC_MSG_RESULT($with_fallback)
373 FALLBACK_LIST=`echo $with_fallback|sed -e 's/,/ /g'`
374 AC_SUBST(FALLBACK_LIST)
375
376 AC_MSG_CHECKING(for list of terminfo directories)
377 CF_WITH_PATHLIST(terminfo-dirs,
378         [  --with-terminfo-dirs=XXX specify list of terminfo directories],
379         TERMINFO_DIRS,
380         DATADIR/terminfo,
381         ${datadir}/terminfo)
382 AC_MSG_RESULT($TERMINFO_DIRS)
383 test -n "$TERMINFO_DIRS" && AC_DEFINE_UNQUOTED(TERMINFO_DIRS,"$TERMINFO_DIRS")
384
385 if test $with_database = no ; then
386         if test -z $with_fallback ; then
387                 AC_ERROR(You have disabled the database w/o specifying fallbacks)
388         fi
389 fi
390
391 ###     use option --disable-big-core to make tic run on small machines
392 ###     We need 4Mb, check if we can allocate 50% more than that.
393 AC_MSG_CHECKING(if big-core option selected)
394 AC_ARG_ENABLE(big-core,
395         [  --disable-big-core      assume machine has little memory],
396         [with_big_core=$enableval],
397         [AC_TRY_RUN([
398 #include <stdlib.h>
399 #include <string.h>
400 int main() { exit(malloc(6000000L) == 0); }],
401         [with_big_core=yes],
402         [with_big_core=no],
403         [with_big_core=no])])
404 AC_MSG_RESULT($with_big_core)
405 test "$with_big_core" = "yes" && AC_DEFINE(HAVE_BIG_CORE)
406
407 ###     use option --enable-termcap to compile in the termcap fallback support
408 AC_MSG_CHECKING(if you want termcap-fallback support)
409 AC_ARG_ENABLE(termcap,
410         [  --enable-termcap        compile in termcap fallback support],
411         [with_termcap=$enableval],
412         [with_termcap=no])
413 AC_MSG_RESULT($with_termcap)
414
415 if test "$with_termcap" != "yes" ; then
416         AC_DEFINE(PURE_TERMINFO)
417 else
418
419 ###     use option --enable-getcap to use a hacked getcap for reading termcaps
420 AC_MSG_CHECKING(if fast termcap-loader is needed)
421 AC_ARG_ENABLE(getcap,
422         [  --enable-getcap         fast termcap load, no xrefs to terminfo],
423         [with_getcap=$enableval],
424         [with_getcap=no])
425 AC_MSG_RESULT($with_getcap)
426 test "$with_getcap" = "yes" && AC_DEFINE(USE_GETCAP)
427
428 AC_MSG_CHECKING(if translated termcaps will be cached in ~/.terminfo)
429 AC_ARG_ENABLE(getcap-cache,
430         [  --enable-getcap-cache   cache translated termcaps in ~/.terminfo],
431         [with_getcap_cache=$enableval],
432         [with_getcap_cache=no])
433 AC_MSG_RESULT($with_getcap_cache)
434 test "$with_getcap_cache" = "yes" && AC_DEFINE(USE_GETCAP_CACHE)
435
436 fi
437
438 ###   Use option --enable-symlinks to make tic use symlinks, not hard links
439 ###   to reduce storage requirements for the terminfo database.
440 CF_LINK_FUNCS
441
442 with_links=no
443 with_symlinks=no
444
445 if test "$ac_cv_func_link" != yes ; then
446     AC_MSG_CHECKING(if tic should use symbolic links)
447     if test "$ac_cv_func_symlink" = yes ; then
448         with_symlinks=yes
449     else
450         with_symlinks=no
451     fi
452     AC_MSG_RESULT($with_symlinks)
453 elif test "$ac_cv_func_symlink" != yes ; then
454     AC_MSG_CHECKING(if tic should use hard links)
455     if test "$ac_cv_func_link" = yes ; then
456         with_links=yes
457     else
458         with_links=no
459     fi
460     AC_MSG_RESULT($with_links)
461 else
462     AC_MSG_CHECKING(if tic should use symbolic links)
463     AC_ARG_ENABLE(symlinks,
464         [  --enable-symlinks       make tic use symbolic links not hard links],
465         [with_symlinks=$enableval],
466         [with_symlinks=no])
467     AC_MSG_RESULT($with_symlinks)
468 fi
469
470 test "$with_links" = yes && AC_DEFINE(USE_LINKS)
471 test "$with_symlinks" = yes && AC_DEFINE(USE_SYMLINKS)
472
473 ###   use option --enable-broken-linker to force on use of broken-linker support
474 AC_MSG_CHECKING(if you want broken-linker support code)
475 AC_ARG_ENABLE(broken_linker,
476         [  --enable-broken_linker  compile with broken-linker support code],
477         [with_broken_linker=$enableval],
478         [with_broken_linker=$BROKEN_LINKER])
479 AC_MSG_RESULT($with_broken_linker)
480 test "$with_broken_linker" = yes && AC_DEFINE(BROKEN_LINKER)
481
482 ###   use option --enable-bsdpad to have tputs process BSD-style prefix padding
483 AC_MSG_CHECKING(if tputs should process BSD-style prefix padding)
484 AC_ARG_ENABLE(bsdpad,
485         [  --enable-bsdpad         recognize BSD-style prefix padding],
486         [with_bsdpad=$enableval],
487         [with_bsdpad=no])
488 AC_MSG_RESULT($with_bsdpad)
489 test "$with_bsdpad" = yes && AC_DEFINE(BSD_TPUTS)
490
491 ### Enable compiling-in rcs id's
492 AC_MSG_CHECKING(if RCS identifiers should be compiled-in)
493 AC_ARG_WITH(rcs-ids,
494         [  --with-rcs-ids          compile-in RCS identifiers],
495         [with_rcs_ids=$withval],
496         [with_rcs_ids=no])
497 AC_MSG_RESULT($with_rcs_ids)
498 test "$with_rcs_ids" = yes && AC_DEFINE(USE_RCS_IDS)
499
500 ###############################################################################
501 CF_HELP_MESSAGE(Extensions:)
502
503 ### Note that some functions (such as const) are normally disabled anyway.
504 AC_MSG_CHECKING(if you want to build with function extensions)
505 AC_ARG_ENABLE(ext-funcs,
506         [  --disable-ext-funcs     disable function-extensions],
507         [with_ext_funcs=$enableval],
508         [with_ext_funcs=yes])
509 AC_MSG_RESULT($with_ext_funcs)
510 if test "$with_ext_funcs" = yes ; then
511         AC_DEFINE(HAVE_HAS_KEY)
512         AC_DEFINE(HAVE_RESIZETERM)
513         AC_DEFINE(HAVE_USE_DEFAULT_COLORS)
514         AC_DEFINE(HAVE_WRESIZE)
515         AC_DEFINE(NCURSES_EXT_FUNCS)
516 fi
517
518 ###   use option --enable-const to turn on use of const beyond that in XSI.
519 AC_MSG_CHECKING(for extended use of const keyword)
520 AC_ARG_ENABLE(const,
521         [  --enable-const          compile with extra/non-standard const],
522         [with_ext_const=$enableval],
523         [with_ext_const=no])
524 AC_MSG_RESULT($with_ext_const)
525 NCURSES_CONST=""
526 if test "$with_ext_const" = yes ; then
527         AC_DEFINE(NCURSES_CONST,const)
528         NCURSES_CONST=const
529 fi
530 AC_SUBST(NCURSES_CONST)
531
532 ###   use option --enable-hashmap to turn on use of hashmap scrolling logic
533 AC_MSG_CHECKING(if you want hashmap scrolling-optimization code)
534 AC_ARG_ENABLE(hashmap,
535         [  --enable-hashmap        compile with hashmap scrolling-optimization code],
536         [with_hashmap=$enableval],
537         [with_hashmap=yes])
538 AC_MSG_RESULT($with_hashmap)
539 test "$with_hashmap" = yes && AC_DEFINE(USE_HASHMAP)
540
541 AC_MSG_CHECKING(if you want \$NCURSES_NO_PADDING code)
542 AC_ARG_ENABLE(no-padding,
543         [  --enable-no-padding     compile with \$NCURSES_NO_PADDING code],
544         [with_no_padding=$enableval],
545         [with_no_padding=$with_ext_funcs])
546 AC_MSG_RESULT($with_no_padding)
547 test "$with_no_padding" = yes && AC_DEFINE(NCURSES_NO_PADDING)
548
549 ###   use option --enable-sigwinch to turn on use of SIGWINCH logic
550 AC_MSG_CHECKING(if you want SIGWINCH handler)
551 AC_ARG_ENABLE(sigwinch,
552         [  --enable-sigwinch       compile with SIGWINCH handler],
553         [with_sigwinch=$enableval],
554         [with_sigwinch=$with_ext_funcs])
555 AC_MSG_RESULT($with_sigwinch)
556 test "$with_sigwinch" = yes && AC_DEFINE(USE_SIGWINCH)
557
558 ###   use option --enable-tcap-names to allow user to define new capabilities
559 AC_MSG_CHECKING(if you want user-definable terminal capabilities like termcap)
560 AC_ARG_ENABLE(tcap-names,
561         [  --enable-tcap-names     compile with user-definable terminal capabilities],
562         [with_tcap_names=$enableval],
563         [with_tcap_names=$with_ext_funcs])
564 AC_MSG_RESULT($with_tcap_names)
565 NCURSES_XNAMES=0
566 test "$with_tcap_names" = yes && NCURSES_XNAMES=1
567 AC_SUBST(NCURSES_XNAMES)
568
569 ###############################################################################
570 CF_HELP_MESSAGE(Experimental Code:)
571 AC_MSG_CHECKING(if you want all experimental code)
572 AC_ARG_WITH(develop,
573         [  --with-develop          enable all experimental options for testing],
574         [with_develop=$withval],
575         [with_develop=no])
576 AC_MSG_RESULT($with_develop)
577
578 ###   use option --enable-colorfgbg to turn on use of $COLORFGBG environment
579 AC_MSG_CHECKING(if you want experimental colorfgbg code)
580 AC_ARG_ENABLE(hard-tabs,
581         [  --enable-colorfgbg      compile with experimental \$COLORFGBG code],
582         [with_colorfgbg=$enableval],
583         [with_colorfgbg=$with_develop])
584 AC_MSG_RESULT($with_colorfgbg)
585 test "$with_colorfgbg" = yes && AC_DEFINE(USE_COLORFGBG)
586
587 ###   use option --enable-hard-tabs to turn on use of hard-tabs optimize
588 AC_MSG_CHECKING(if you want experimental hard-tabs code)
589 AC_ARG_ENABLE(hard-tabs,
590         [  --enable-hard-tabs      compile with experimental hard-tabs code],
591         [with_hardtabs=$enableval],
592         [with_hardtabs=$with_develop])
593 AC_MSG_RESULT($with_hardtabs)
594 test "$with_hardtabs" = yes && AC_DEFINE(USE_HARD_TABS)
595
596 AC_MSG_CHECKING(if you want experimental safe-sprintf code)
597 AC_ARG_ENABLE(safe-sprintf,
598         [  --enable-safe-sprintf   compile with experimental safe-sprintf code],
599         [with_safe_sprintf=$enableval],
600         [with_safe_sprintf=no])
601 AC_MSG_RESULT($with_safe_sprintf)
602 test "$with_safe_sprintf" = yes && AC_DEFINE(USE_SAFE_SPRINTF)
603
604 ###   use option --disable-scroll-hints to turn off use of scroll-hints scrolling logic
605 # when hashmap is used scroll hints are useless
606 if test "$with_hashmap" = no ; then
607 AC_MSG_CHECKING(if you want to experiment without scrolling-hints code)
608 AC_ARG_ENABLE(scroll-hints,
609         [  --disable-scroll-hints  compile without scroll-hints code],
610         [with_scroll_hints=$enableval],
611         [with_scroll_hints=yes])
612 AC_MSG_RESULT($with_scroll_hints)
613 test "$with_scroll_hints" = yes && AC_DEFINE(USE_SCROLL_HINTS)
614 fi
615
616 ###   use option --enable-widec to turn on use of wide-character support
617 AC_MSG_CHECKING(if you want experimental wide-character code)
618 AC_ARG_ENABLE(widec,
619         [  --enable-widec          compile with experimental wide-char code],
620         [with_widec=$enableval],
621         [with_widec=no])
622 AC_MSG_RESULT($with_widec)
623 if test "$with_widec" = yes ; then
624         LIB_SUFFIX="w${LIB_SUFFIX}"
625         AC_DEFINE(USE_WIDEC_SUPPORT)
626 fi
627
628 ###   use option --enable-xmc-glitch to turn on use of magic-cookie optimize
629 AC_MSG_CHECKING(if you want experimental xmc code)
630 AC_ARG_ENABLE(xmc-glitch,
631         [  --enable-xmc-glitch     compile with experimental xmc code],
632         [with_xmc_glitch=$enableval],
633         [with_xmc_glitch=$with_develop])
634 AC_MSG_RESULT($with_xmc_glitch)
635 test "$with_xmc_glitch" = yes && AC_DEFINE(USE_XMC_SUPPORT)
636
637 ###############################################################################
638 CF_HELP_MESSAGE(Testing/development Options:)
639
640 ###     use option --disable-echo to suppress full display compiling commands
641 AC_ARG_ENABLE(echo,
642         [  --enable-echo           build: display "compiling" commands (default)],
643         [with_echo=$enableval],
644         [with_echo=yes])
645 if test "$with_echo" = yes; then
646         ECHO_LINK=
647 else
648         ECHO_LINK='@ echo linking $@ ... ;'
649 fi
650 AC_SUBST(ECHO_LINK)
651
652 ###     use option --enable-warnings to turn on all gcc warnings
653 AC_ARG_ENABLE(warnings,
654         [  --enable-warnings       build: turn on GCC compiler warnings],
655         [with_warnings=$enableval])
656 if test -n "$with_warnings"; then
657         ADAFLAGS="$ADAFLAGS -gnatg"
658         CF_GCC_WARNINGS
659 fi
660 CF_GCC_ATTRIBUTES
661
662 ###     use option --enable-assertions to turn on generation of assertion code
663 AC_ARG_ENABLE(assertions,
664         [  --enable-assertions     test: turn on generation of assertion code],
665         [with_assertions=$enableval],
666         [with_assertions=no])
667 if test -n "$GCC"
668 then
669         if test $with_assertions = no
670         then
671                 AC_DEFINE(NDEBUG)
672                 CPPFLAGS="$CPPFLAGS -DNDEBUG"
673         else
674                 ADAFLAGS="$ADAFLAGS -gnata"
675         fi
676 fi
677
678 ###     use option --disable-leaks to suppress "permanent" leaks, for testing
679 AC_ARG_ENABLE(leaks,
680         [  --disable-leaks         test: suppress permanent memory-leaks],
681         [test $enableval = no && AC_DEFINE(NO_LEAKS)])
682 AC_DEFINE(HAVE_NC_ALLOC_H)
683
684 ###     use option --enable-expanded to generate certain macros as functions
685 AC_ARG_ENABLE(expanded,
686         [  --enable-expanded       test: generate functions for certain macros],
687         [test $enableval = yes && AC_DEFINE(NCURSES_EXPANDED)])
688
689 ###     use option --disable-macros to suppress macros in favor of functions
690 AC_ARG_ENABLE(macros,
691         [  --disable-macros        test: use functions rather than macros],
692         [test $enableval = no && AC_DEFINE(NCURSES_NOMACROS)])
693
694 ###     Checks for libraries.
695 AC_CHECK_FUNC(gettimeofday,
696         AC_DEFINE(HAVE_GETTIMEOFDAY),[
697
698 AC_CHECK_LIB(bsd, gettimeofday,
699         AC_DEFINE(HAVE_GETTIMEOFDAY)
700         LIBS="$LIBS -lbsd")])dnl CLIX: bzero, select, gettimeofday
701
702 CF_MATH_LIB(MATH_LIB,sin(x))
703 AC_SUBST(MATH_LIB)
704
705 ###     Checks for header files.
706 AC_STDC_HEADERS
707 AC_HEADER_DIRENT
708 CF_REGEX
709
710 dnl These are some other potentially nonportable headers.
711 AC_CHECK_HEADERS( \
712 fcntl.h \
713 getopt.h \
714 libc.h \
715 limits.h \
716 locale.h \
717 poll.h \
718 sys/bsdtypes.h \
719 sys/ioctl.h \
720 sys/param.h \
721 sys/poll.h \
722 sys/select.h \
723 sys/time.h \
724 sys/times.h \
725 termio.h \
726 termios.h \
727 ttyent.h \
728 unistd.h \
729 )
730
731 # check for ISC (this may also define _POSIX_SOURCE)
732 # Note: even non-Posix ISC needs <sys/bsdtypes.h> to declare fd_set
733 if test "$ISC" = yes ; then
734         AC_CHECK_LIB(cposix,main)
735         AC_CHECK_LIB(inet,bzero,LIBS="$LIBS -linet")dnl also 'select()'
736         AC_CHECK_HEADERS( sys/termio.h )
737 fi
738
739 CF_SYS_TIME_SELECT
740
741 ###     checks for compiler characteristics
742 AC_LANG_C
743 AC_C_CONST
744 AC_C_INLINE
745 test $ac_cv_c_inline != no && AC_DEFINE(CC_HAS_INLINE_FUNCS)
746
747 CF_TYPEOF_CHTYPE
748 CF_WIDEC_SHIFT
749
750 ###     Checks for external-data
751 CF_ERRNO
752 CF_LINK_DATAONLY
753 CF_SPEED_TYPE
754
755 ###     Checks for library functions.
756 AC_CHECK_FUNCS( \
757 getcwd \
758 getttynam \
759 memccpy \
760 mkstemp \
761 nanosleep \
762 poll \
763 remove \
764 select \
765 setbuf \
766 setbuffer \
767 setvbuf \
768 sigaction \
769 sigvec \
770 strdup \
771 strstr \
772 tcgetattr \
773 tcgetpgrp \
774 times \
775 vfscanf \
776 vsnprintf \
777 vsscanf \
778 )
779 if test "$with_getcap" = "yes" ; then
780         CF_CGETENT
781 fi
782
783 CF_ISASCII
784 CF_STRUCT_SIGACTION
785 CF_STRUCT_TERMIOS
786
787 dnl FIXME (may need this) AC_SYS_RESTARTABLE_SYSCALLS
788 if test "$cross_compiling" = yes ; then
789         AC_MSG_WARN(cross compiling: assume setvbuf params not reversed)
790 else
791         AC_FUNC_SETVBUF_REVERSED
792 fi
793 AC_TYPE_SIGNAL
794 CF_TYPE_SIGACTION
795 CF_SIZECHANGE
796 CF_FUNC_MEMMOVE
797 CF_FUNC_POLL
798
799 dnl We'll do our own -g libraries, unless the user's overridden via $CFLAGS
800 if test -z "$cf_user_CFLAGS" ; then
801         CF_STRIP_G_OPT(CFLAGS)
802         CF_STRIP_G_OPT(CXXFLAGS)
803 fi
804
805 dnl Check for C++ compiler characteristics (and ensure that it's there!)
806 CF_BOOL_DECL(cf_cv_cc_bool_type)
807 if test -n "$CXX" ; then
808         AC_LANG_CPLUSPLUS
809         CF_STDCPP_LIBRARY
810         case "`${CXX-g++} --version`" in
811         1*|2.[0-6]*)
812             cf_cxx_library=yes
813             ;;
814         2.7*)
815             CF_GPP_LIBRARY
816             ;;
817         *)
818             cf_cxx_library=no
819             ;;
820         esac
821         AC_CHECK_HEADERS(typeinfo)
822         CF_BOOL_DECL
823         CF_BOOL_SIZE
824         CF_ETIP_DEFINES
825         CF_CPP_PARAM_INIT
826         case $cf_cv_system_name in #(vi
827         sco3.2v5*)
828             CXXLDFLAGS="-u main"
829             ;;
830         esac
831         AC_SUBST(CXXLDFLAGS)
832 else
833         cf_cxx_library=no
834         cf_cv_builtin_bool=1
835
836         # Just because we are not configuring against C++ right now does not
837         # mean that a user will not want to use C++.  Some distributors disable
838         # the C++ portion of this configuration as a shortcut (or just to avoid
839         # compiling the demo in the c++ directory).  So we need a reasonable
840         # default for the 'bool' type.
841         #
842         # Caveat: since the storage of the bool type is not standardized, it
843         # may change.
844
845         AC_MSG_CHECKING(for fallback type of bool)
846         case "$host_cpu" in #(vi
847         i?86)   cf_cv_type_of_bool=char ;; #(vi
848         *)      cf_cv_type_of_bool=int  ;;
849         esac
850         AC_MSG_RESULT($cf_cv_type_of_bool)
851 fi
852 AC_SUBST(CXXLIBS)
853
854 CF_HELP_MESSAGE(Ada95 Binding Options:)
855
856 dnl Check for availability of GNU Ada Translator (GNAT).
857 dnl At the moment we support no other Ada95 compiler.
858 if test "$cf_with_ada" != "no" ; then
859 cf_ada_make=gnatmake
860 AC_CHECK_PROG(gnat_exists, $cf_ada_make, yes, no)
861 if test "$ac_cv_prog_gnat_exists" = no; then
862    cf_ada_make=
863 else
864    CF_GNAT_VERSION
865    AC_CHECK_PROG(m4_exists, m4, yes, no)
866    if test "$ac_cv_prog_m4_exists" = no; then
867       cf_cv_prog_gnat_correct=no
868       echo Ada95 binding required program m4 not found. Ada95 binding disabled.
869    fi
870    if test "$cf_cv_prog_gnat_correct" = yes; then
871       AC_MSG_CHECKING(if GNAT works)
872       CF_GNAT_TRY_RUN([procedure conftest;],
873 [with Text_IO;
874 with GNAT.OS_Lib;
875 procedure conftest is
876 begin
877    Text_IO.Put ("Hello World");
878    Text_IO.New_Line;
879    GNAT.OS_Lib.OS_Exit (0);
880 end conftest;],[cf_cv_prog_gnat_correct=yes],[cf_cv_prog_gnat_correct=no])
881       AC_MSG_RESULT($cf_cv_prog_gnat_correct)
882    fi
883 fi
884 if test "$cf_cv_prog_gnat_correct" = yes; then
885    ADAFLAGS="-O3 -gnatpn $ADAFLAGS"
886
887    AC_ARG_WITH(ada-compiler,
888         [  --with-ada-compiler=CMD Specify Ada95 compiler command (default gnatmake)],
889         [cf_ada_compiler=$withval],
890         [cf_ada_compiler=gnatmake])
891
892    cf_ada_package=terminal_interface
893
894    AC_SUBST(cf_ada_make)
895    AC_SUBST(cf_ada_compiler)
896    AC_SUBST(cf_ada_package)
897    AC_SUBST(ADAFLAGS)
898    AC_SUBST(cf_compile_generics)
899    AC_SUBST(cf_generic_objects)
900
901    CF_WITH_PATH(ada-include,
902        [  --with-ada-include=DIR  Ada includes are in DIR],
903        ADA_INCLUDE,
904        PREFIX/lib/ada/adainclude,
905        [$]prefix/lib/ada/adainclude)
906    AC_SUBST(ADA_INCLUDE)
907
908    CF_WITH_PATH(ada-objects,
909        [  --with-ada-objects=DIR  Ada objects are in DIR],
910        ADA_OBJECTS,
911        PREFIX/lib/ada/adalib,
912        [$]prefix/lib/ada/adalib)
913    AC_SUBST(ADA_OBJECTS)
914
915 # This has been fixed!
916 #   if test $with_shared = no
917 #   then
918 #      AC_MSG_WARN(Ada95 applications will not link properly with static libraries)
919 #   fi
920 fi
921 fi
922
923 ### It's not possible to appease gcc 2.6.3's conversion-warnings if we're
924 ### using a 'char' for bools.  gcc 2.7.0's conversion-warnings are broken too
925 ### badly to consider using for development purposes, but 2.5.8 is okay.
926 if test -n "$with_warnings"; then
927         if test -n "$GCC"; then
928                 case "`$CC --version`" in
929                 2.6.3)
930                         if test "$cf_cv_type_of_bool" != "char"; then
931                                 EXTRA_CFLAGS="$EXTRA_CFLAGS -Wconversion"
932                         fi
933                         ;;
934                 2.5*)
935                         EXTRA_CFLAGS="$EXTRA_CFLAGS -Wconversion"
936                         ;;
937                 esac
938         fi
939 fi
940
941 ### Construct the library-subsets, if any, from this set of keywords:
942 ### none, base, ext_funcs, termlib.
943 AC_MSG_CHECKING(for library subsets)
944 if test "$with_termlib" = yes ; then
945         LIB_SUBSETS="termlib "
946 else
947         LIB_SUBSETS="termlib+"
948 fi
949 LIB_SUBSETS="${LIB_SUBSETS}base"
950 test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs"
951 AC_MSG_RESULT($LIB_SUBSETS)
952
953 LIB_TRACING=DEBUG
954 case "$CFLAGS" in
955 *-DTRACE*)
956         LIB_TRACING=all
957         ;;
958 esac
959
960 ### Construct the list of include-directories to be generated
961 CF_INCLUDE_DIRS
962 CF_ADA_INCLUDE_DIRS
963
964 ### Build up pieces for makefile rules
965 AC_MSG_CHECKING(default library suffix)
966 CF_LIB_TYPE($DFT_LWR_MODEL,DFT_ARG_SUFFIX)dnl
967 AC_SUBST(DFT_ARG_SUFFIX)dnl the string to append to "-lncurses" ("")
968 AC_MSG_RESULT($DFT_ARG_SUFFIX)
969
970 AC_MSG_CHECKING(default library-dependency suffix)
971 CF_LIB_SUFFIX($DFT_LWR_MODEL,DFT_DEP_SUFFIX)dnl
972 AC_SUBST(DFT_DEP_SUFFIX)dnl the corresponding library-suffix (".a")
973 AC_MSG_RESULT($DFT_DEP_SUFFIX)
974
975 AC_MSG_CHECKING(default object directory)
976 CF_OBJ_SUBDIR($DFT_LWR_MODEL,DFT_OBJ_SUBDIR)dnl
977 AC_SUBST(DFT_OBJ_SUBDIR)dnl the default object-directory ("obj")
978 AC_MSG_RESULT($DFT_OBJ_SUBDIR)
979
980 TINFO_LIST="$SHLIB_LIST"
981 test $with_termlib = yes && SHLIB_LIST="$SHLIB_LIST -ltinfo${LIB_SUFFIX}"
982
983 AC_MSG_CHECKING(where we will install curses.h)
984 test "$with_overwrite" = no && \
985 test "x$includedir" = 'x${prefix}/include' && \
986         includedir='$(prefix)/include/ncurses'${LIB_SUFFIX}
987 AC_MSG_RESULT($includedir)
988
989 AC_SUBST(EXTRA_LIBS)
990 AC_SUBST(TINFO_LIST)
991 AC_SUBST(SHLIB_LIST)
992
993 ### Set up low-level terminfo dependencies for makefiles.  Note that we
994 ### could override this.
995 if test "$with_termlib" = yes ; then
996         TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${TINFO_NAME}${DFT_DEP_SUFFIX}"
997         TEST_ARGS="-l${TINFO_NAME}${DFT_ARG_SUFFIX}"
998 fi
999 PROG_DEPS="$TEST_DEPS"
1000 PROG_ARGS="$TEST_ARGS"
1001
1002 ### Construct the list of subdirectories for which we'll customize makefiles
1003 ### with the appropriate compile-rules.
1004
1005 CF_SRC_MODULES($modules_to_build)
1006 CF_DIRS_TO_MAKE
1007
1008 ### Now that we're done running tests, add the compiler-warnings, if any
1009 CFLAGS="$CFLAGS $EXTRA_CFLAGS"
1010
1011 ################################################################################
1012 AC_OUTPUT( \
1013         include/MKterm.h.awk \
1014         include/curses.h \
1015         include/termcap.h \
1016         include/unctrl.h \
1017         $SUB_MAKEFILES \
1018         Makefile,[
1019 CF_LIB_RULES
1020 ],[
1021 ### Special initialization commands, used to pass information from the
1022 ### configuration-run into config.status
1023
1024 AWK="$AWK"
1025 CF_LIST_MODELS="$cf_list_models"
1026 DFT_LWR_MODEL="$DFT_LWR_MODEL"
1027 LDCONFIG="$LDCONFIG"
1028 LIB_NAME="$LIB_NAME"
1029 LIB_SUFFIX="$LIB_SUFFIX"
1030 LIB_SUBSETS="$LIB_SUBSETS"
1031 LIB_TRACING="$LIB_TRACING"
1032 SRC_SUBDIRS="$SRC_SUBDIRS"
1033 TINFO_NAME="$TINFO_NAME"
1034 WITH_ECHO="$with_echo"
1035 WITH_OVERWRITE="$with_overwrite"
1036 cf_cv_abi_version="$cf_cv_abi_version"
1037 cf_cv_do_symlinks="$cf_cv_do_symlinks"
1038 cf_cv_rel_version="$cf_cv_rel_version"
1039 cf_cv_rm_so_locs="$cf_cv_rm_so_locs"
1040 cf_cv_system_name="$cf_cv_system_name"
1041 cf_with_cxx_binding="$cf_with_cxx_binding"
1042 cf_cv_shlib_version="$cf_cv_shlib_version"
1043 target="$target"
1044
1045 ],sort)dnl
1046 ${MAKE-make} preinstall