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