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