1 dnl*****************************************************************************
2 dnl Copyright 1996,1997 by Thomas E. Dickey <dickey@clark.net> *
3 dnl All Rights Reserved. *
5 dnl Permission to use, copy, modify, and distribute this software and its *
6 dnl documentation for any purpose and without fee is hereby granted, provided *
7 dnl that the above copyright notice appear in all copies and that both that *
8 dnl copyright notice and this permission notice appear in supporting *
9 dnl documentation, and that the name of the above listed copyright holder(s) *
10 dnl not be used in advertising or publicity pertaining to distribution of the *
11 dnl software without specific, written prior permission. THE ABOVE LISTED *
12 dnl COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *
13 dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO *
14 dnl EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY *
15 dnl SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER *
16 dnl RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF *
17 dnl CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN *
18 dnl CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
19 dnl*****************************************************************************
20 dnl $Id: configure.in,v 1.64 1997/05/10 15:26:07 tom Exp $
21 dnl Process this file with autoconf to produce a configure script.
23 AC_REVISION($Revision: 1.64 $)
24 AC_INIT(ncurses/lib_initscr.c)
29 # We need a configure script only when compiling as part of GNU C library.
30 # Here we have to generate one of the files we need while compiling.
32 # The only problem is that users of the package might think they have to
33 # run configure themself and find it irritating when nothing happens.
35 # So we try here to find out whether we are called from the glibc configure
38 dnl Check if we are a drop-in addition to glibc.
39 AC_ARG_ENABLE(add-ons, dnl
40 [ --enable-add-ons=DIR... used to check if we are a glibc add-on.],
44 dnl We need to use [ and ] for other purposes for a while now.
46 if test x"$glibc_add_on" = "xyes" ; then
47 if test -f $srcdir/../glibcbug.in; then
50 rm -f $srcdir/Makefile
51 cp $srcdir/Makefile.glibc $srcdir/Makefile
52 echo "ncurses `grep \"^[ ]*ncurses-version[ ]*=.*$\" \
53 $srcdir/Makefile | sed -e \
54 's/^[ ]*ncurses-version[ ]*=[ ]*\([^ ^ ]*\)[ ]*$/\1/'`" > $srcdir/Banner
60 ### Save the given $CFLAGS to allow user-override.
61 nc_user_CFLAGS="$CFLAGS"
63 ### Derive the system name, as a check for reusing the autoconf cache
64 system_name="`(uname -s -r || hostname || echo unknown) 2>/dev/null`"
65 if test -n "$system_name" ; then
66 AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
68 system_name="`(hostname) 2>/dev/null`"
70 AC_CACHE_VAL(nc_cv_system_name,[nc_cv_system_name="$system_name"])
71 test -z "$system_name" && system_name="$nc_cv_system_name"
72 test -n "$nc_cv_system_name" && AC_MSG_RESULT("Configuring for $nc_cv_system_name")
74 if test ".$system_name" != ".$nc_cv_system_name" ; then
75 AC_MSG_RESULT("Cached system name does not agree with actual")
76 AC_ERROR("Please remove config.cache and try again.")
79 ### Default install-location
82 ### Checks for programs.
84 if test -n "$GCC" ; then
85 AC_MSG_CHECKING(version of gcc)
89 AC_PROG_GCC_TRADITIONAL
92 dnl DEFECT in autoconf 2.12: an attempt to set policy, this breaks the
93 dnl configure script by not letting us test if C++
94 dnl is present, making this option necessary.
96 [ --without-cxx suppress check for C++])
97 if test "X$withval" != Xno ; then
101 if test -n "$GXX" ; then case "`${CXX-g++} --version`" in 1*|2.[0-6]*) GXX=""; CXX=""; ac_cv_prog_gxx=no; nc_cxx_library=no ; echo No: templates do not work;; esac; fi
108 AC_CHECK_PROGS(LINT, tdlint lint alint)
109 AC_CHECK_PROGS(MAN, man man_db)
112 dnl These are standard among *NIX systems, but not when cross-compiling
113 NC_SUBST(loader,LD,ld)
114 NC_SUBST(archiver,AR,ar)
115 NC_SUBST(archiver options,AR_OPTS,rv)
120 dnl Special option for use by system-builders: the install-prefix is used to
121 dnl adjust the location into which the actual install is done, so that an
122 dnl archive can be built without modifying the host system's configuration.
123 AC_ARG_WITH(install-prefix,
124 [ --with-install-prefix prefixes actual install-location],
125 [case "$withval" in #(vi
128 *) INSTALL_PREFIX="$withval"
131 AC_SUBST(INSTALL_PREFIX)
133 ### Options to allow the user to specify the set of libraries which are used.
134 ### Use "--without-normal --with-shared" to allow the default model to be
135 ### shared, for example.
138 [ --with-shared generate shared-libraries],
139 [test "$withval" = "yes" && nc_list_models="$nc_list_models shared"])
141 [ --with-normal generate normal-libraries (default)],
142 [test "$withval" = "yes" && nc_list_models="$nc_list_models normal"],
143 [nc_list_models="$nc_list_models normal"])
145 [ --with-debug generate debug-libraries (default)],
146 [test "$withval" = "yes" && nc_list_models="$nc_list_models debug"],
147 [nc_list_models="$nc_list_models debug"])
149 [ --with-profile generate profile-libraries],
150 [test "$withval" = "yes" && nc_list_models="$nc_list_models profile"])
152 ### Checks for special libraries, must be done up-front.
153 AC_ARG_WITH(dbmalloc,
154 [ --with-dbmalloc test: use Conor Cahill's dbmalloc library],
155 [AC_CHECK_LIB(dbmalloc,debug_malloc)])
157 [ --with-dmalloc test: use Gray Watson's dmalloc library],
158 [AC_CHECK_LIB(dmalloc,dmalloc_debug)])
160 [ --with-gpm use Alessandro Rubini's GPM library],
161 [AC_CHECK_LIB(gpm,Gpm_Open,[
162 EXTRA_LIBS="$EXTRA_LIBS -lgpm -lncurses"
163 AC_DEFINE(HAVE_LIBGPM)
164 AC_CHECK_HEADERS(gpm.h)
165 ],,-lcurses -ltermcap)])
169 AC_MSG_CHECKING(for specified models)
170 test -z "$nc_list_models" && nc_list_models=normal
171 AC_MSG_RESULT($nc_list_models)
173 ### Use the first model as the default, and save its suffix for use in building
174 ### up test-applications.
175 DFT_LWR_MODEL=`echo $nc_list_models | $AWK '{print $1}'`
176 NC_UPPERCASE($DFT_LWR_MODEL,DFT_UPR_MODEL)dnl
177 NC_LIB_SUFFIX($DFT_LWR_MODEL,DFT_DEP_SUFFIX)dnl
178 NC_LIB_TYPE($DFT_LWR_MODEL,DFT_ARG_SUFFIX)dnl
179 NC_OBJ_SUBDIR($DFT_LWR_MODEL,DFT_OBJ_SUBDIR)dnl
180 AC_SUBST(DFT_OBJ_SUBDIR)dnl the default object-directory ("obj")
181 AC_SUBST(DFT_LWR_MODEL)dnl the default model ("normal")
182 AC_SUBST(DFT_UPR_MODEL)dnl the default model ("NORMAL")
183 AC_SUBST(DFT_DEP_SUFFIX)dnl the corresponding library-suffix (".a")
184 AC_SUBST(DFT_ARG_SUFFIX)dnl the string to append to "-lncurses" ("")
185 AC_SUBST(nc_list_models)dnl the complete list of models ("normal debug")
191 LIB_PREFIX=$LIB_DIR/lib
194 dnl Not all ports of gcc support the -g option
195 dnl autoconf 2.12 uses different symbol for -g option than autoconf 2.10, etc.
197 if test X"$CC_G_OPT" = X"" ; then
199 test -n "$GCC" && test "${ac_cv_prog_cc_g}${ac_cv_prog_gcc_g}" != yes && CC_G_OPT=''
203 if test X"$CXX_G_OPT" = X"" ; then
205 test -n "$GXX" && test "${ac_cv_prog_cxx_g}${ac_cv_prog_gxx_g}" != yes && CXX_G_OPT=''
209 case $DFT_LWR_MODEL in
210 normal) LD_MODEL='' ;;
211 debug) LD_MODEL=$CC_G_OPT ;;
212 profile) LD_MODEL='-pg';;
213 shared) LD_MODEL='' ;;
215 AC_SUBST(LD_MODEL)dnl the type of link (e.g., -g or -pg)
218 if test "$CC_SHARED_OPTS" = "unknown"; then
219 for model in $nc_list_models; do
220 if test "$model" = "shared"; then
221 echo '** Shared libraries are not supported in this version'
227 ### use option --disable-overwrite to leave out the link to -lcurses
228 AC_MSG_CHECKING(include directory)
229 AC_ARG_ENABLE(overwrite,
230 [ --disable-overwrite leave out the link to -lcurses],
231 [with_overwrite=$enableval
232 test "$with_overwrite" = no && \
233 test "x$includedir" = 'x${prefix}/include' && \
234 includedir='$(prefix)/include/ncurses'
236 [with_overwrite=yes])
237 AC_MSG_RESULT($includedir)
239 ### use option --enable-big-core to make tic run faster on big machines
240 AC_MSG_CHECKING(if big-core option selected)
241 AC_ARG_ENABLE(big-core,
242 [ --enable-big-core assume machine has lots of memory],
243 [with_big_core=$enableval],
245 AC_MSG_RESULT($with_big_core)
246 test "$with_big_core" = "yes" && AC_DEFINE(HAVE_BIG_CORE)
248 ### use option --enable-termcap to compile in the termcap fallback support
249 AC_MSG_CHECKING(if termcap-fallback support is needed)
250 AC_ARG_ENABLE(termcap,
251 [ --enable-termcap compile in termcap fallback support],
252 [with_termcap=$enableval],
254 AC_MSG_RESULT($with_termcap)
256 if test "$with_termcap" != "yes" ; then
257 AC_DEFINE(PURE_TERMINFO)
260 ### use option --enable-getcap to use a hacked getcap for reading termcaps
261 AC_MSG_CHECKING(if fast termcap-loader is needed)
262 AC_ARG_ENABLE(getcap,
263 [ --enable-getcap fast termcap load, no xrefs to terminfo],
264 [with_getcap=$enableval],
266 AC_MSG_RESULT($with_getcap)
267 test "$with_getcap" = "yes" && AC_DEFINE(USE_GETCAP)
269 AC_MSG_CHECKING(if translated termcaps will be cached in ~/.terminfo)
270 AC_ARG_ENABLE(getcap-cache,
271 [ --enable-getcap-cache cache translated termcaps in ~/.terminfo],
272 [with_getcap_cache=$enableval],
273 [with_getcap_cache=no])
274 AC_MSG_RESULT($with_getcap_cache)
275 test "$with_getcap_cache" = "yes" && AC_DEFINE(USE_GETCAP_CACHE)
279 ### use option --enable-symlinks to make tic use symlinks, not hard links
280 AC_MSG_CHECKING(if tic should use symbolic links)
281 AC_ARG_ENABLE(symlinks,
282 [ --enable-symlinks make tic use symbolic links not hard links],
283 [with_symlinks=$enableval],
285 AC_MSG_RESULT($with_symlinks)
286 test "$with_symlinks" = yes && AC_DEFINE(USE_SYMLINKS)
288 ### use option --enable-bsdpad to have tputs process BSD-style prefix padding
289 AC_MSG_CHECKING(if tputs should process BSD-style prefix padding)
290 AC_ARG_ENABLE(bsdpad,
291 [ --enable-bsdpad recognize BSD-style prefix padding],
292 [with_bsdpad=$enableval],
294 AC_MSG_RESULT($with_bsdpad)
295 test "$with_bsdpad" = yes && AC_DEFINE(BSD_TPUTS)
297 ### use option --enable-const to turn on use of const beyond that in XSI.
298 AC_MSG_CHECKING(for extended use of const keyword)
300 [ --enable-const compile with extra/non-standard const],
301 [with_ext_const=$enableval],
303 AC_MSG_RESULT($with_ext_const)
304 test "$with_ext_const" = yes && AC_DEFINE(NCURSES_CONST,const)
306 ### Enable compiling-in rcs id's
307 AC_MSG_CHECKING(if RCS identifiers should be compiled-in)
309 [ --with-rcs-ids build: compile-in RCS identifiers],
310 [with_rcs_ids=$enableval],
312 AC_MSG_RESULT($with_rcs_ids)
313 test "$with_rcs_ids" = yes && AC_DEFINE(USE_RCS_IDS)
315 ### use option --disable-echo to suppress full display compiling commands
317 [ --enable-echo build: display \"compiling\" commands (default)],
318 [with_echo=$enableval],
320 if test "$with_echo" = yes; then
323 ECHO_LINK='@ echo linking $@ ... ;'
327 ### use option --enable-warnings to turn on all gcc warnings
328 AC_ARG_ENABLE(warnings,
329 [ --enable-warnings build: turn on GCC compiler warnings],
330 [with_warnings=$enableval])
331 if test -n "$with_warnings"; then
332 ADAFLAGS="$ADAFLAGS -gnatg"
337 ### use option --enable-assertions to turn on generation of assertion code
338 AC_ARG_ENABLE(assertions,
339 [ --enable-assertions test: turn on generation of assertion code],
340 [with_assertions=$enableval])
343 if test -z "$with_assertions"
345 CPPFLAGS="$CPPFLAGS -DNDEBUG"
347 ADAFLAGS="$ADAFLAGS -gnata"
351 ### use option --disable-leaks to suppress "permanent" leaks, for testing
353 [ --disable-leaks test: suppress permanent memory-leaks],
354 [test $enableval = no && AC_DEFINE(NO_LEAKS)])
355 AC_DEFINE(HAVE_NC_ALLOC_H)
357 ### use option --enable-expanded to generate certain macros as functions
358 AC_ARG_ENABLE(expanded,
359 [ --enable-expanded test: generate functions for certain macros],
360 [test $enableval = yes && AC_DEFINE(NCURSES_EXPANDED)])
362 ### use option --disable-macros to suppress macros in favor of functions
363 AC_ARG_ENABLE(macros,
364 [ --disable-macros test: use functions rather than macros],
365 [test $enableval = no && AC_DEFINE(NCURSES_NOMACROS)])
367 ### Checks for libraries.
368 AC_CHECK_FUNC(gettimeofday,
369 AC_DEFINE(HAVE_GETTIMEOFDAY),[
370 AC_CHECK_LIB(bsd, gettimeofday,
371 AC_DEFINE(HAVE_GETTIMEOFDAY)
372 LIBS="$LIBS -lbsd")])dnl CLIX: bzero, select, gettimeofday
374 ### Checks for header files.
379 dnl These are some other potentially nonportable headers.
401 # check for HPUX's ANSI compiler
402 if test $nc_cv_systype = HP_UX; then
403 if test -z "$GCC"; then
404 AC_MSG_CHECKING([for HP/UX ANSI compiler])
405 nc_save_CFLAGS="$CFLAGS"
407 AC_TRY_COMPILE([],[void (*f)(void)=0],[nc_hpux_cc=yes],[nc_hpux_cc=no])
408 AC_MSG_RESULT($nc_hpux_cc)
409 if test $nc_hpux_cc = yes; then
410 AC_DEFINE(_HPUX_SOURCE)
412 CFLAGS="$nc_save_CFLAGS"
416 # check for ISC (this may also define _POSIX_SOURCE)
417 # Note: even non-Posix ISC needs <sys/bsdtypes.h> to declare fd_set
418 if test "$ISC" = yes ; then
419 AC_CHECK_LIB(cposix,main)
420 AC_CHECK_LIB(inet,bzero,LIBS="$LIBS -linet")dnl also 'select()'
421 AC_CHECK_HEADERS( sys/termio.h )
424 # check for SCO. this is a hack, and should be split into individual
425 # features -- the sys/time.h and select.h conflict, and the need for
426 # ptem.h due to winsize struct.
427 AC_CHECKING([for SCO by checking on /usr/bin/scosh])
428 AC_PROGRAM_CHECK(COULD_BE_SCO, [scosh], maybe, maybenot)
429 if test "$COULD_BE_SCO" = "maybe"
431 AC_DEFINE(SYSTEM_LOOKS_LIKE_SCO)
434 ### checks for compiler characteristics
438 test $ac_cv_c_inline != no && AC_DEFINE(CC_HAS_INLINE_FUNCS)
440 ### Checks for external-data
446 ### Checks for library functions.
465 if test $ac_cv_func_sigaction = yes; then
466 AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE)
467 AC_TRY_COMPILE([#include <sys/types.h>
468 #include <signal.h>], [struct sigaction act;],
469 sigact_bad=no, sigact_bad=yes AC_DEFINE(SVR4_ACTION))
470 AC_MSG_RESULT($sigact_bad)
473 # some machines require _POSIX_SOURCE to completely define struct termios
474 if test $ac_cv_header_termios_h = yes ; then
478 *) termios_bad=maybe ;;
480 if test $termios_bad = maybe ; then
481 AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE)
482 AC_TRY_COMPILE([#include <termios.h>],
483 [struct termios foo; int x = foo.c_iflag],
486 #define _POSIX_SOURCE
487 #include <termios.h>],
488 [struct termios foo; int x = foo.c_iflag],
490 termios_bad=yes AC_DEFINE(SVR4_TERMIO))
492 AC_MSG_RESULT($termios_bad)
496 dnl FIXME (may need this) AC_SYS_RESTARTABLE_SYSCALLS
497 if test "$cross_compiling" = yes ; then
498 AC_MSG_WARN(cross compiling: assume setvbuf params not reversed)
500 AC_FUNC_SETVBUF_REVERSED
506 dnl FIXME checks we don't do (but neither does the old Configure script):
507 case "$nc_cv_systype" in
509 AC_DEFINE(GOOD_SELECT)
513 dnl We'll do our own -g libraries, unless the user's overridden via $CFLAGS
514 if test -z "$nc_user_CFLAGS" ; then
515 NC_STRIP_G_OPT(CFLAGS)
516 NC_STRIP_G_OPT(CXXFLAGS)
519 dnl Check for C++ compiler characteristics (and ensure that it's there!)
520 if test -n "$CXX" ; then
521 AC_CHECK_PROG(CXX_EXISTS, $CXX, yes, no)
523 ac_cv_prog_CXX_EXISTS=no
525 if test "$ac_cv_prog_CXX_EXISTS" = yes; then
528 AC_CHECK_HEADERS(builtin.h typeinfo)
533 AC_CACHE_VAL(nc_cv_builtin_bool,[nc_cv_builtin_bool=0])
534 AC_CACHE_VAL(nc_cv_sizeof_bool,[nc_cv_sizeof_bool=int])
538 dnl Check for availability of GNU Ada Translator (GNAT).
539 dnl At the moment we support no other Ada95 compiler.
541 AC_CHECK_PROG(gnat_exists, $nc_ada_make, yes, no)
542 if test "$ac_cv_prog_gnat_exists" = no; then
546 AC_CHECK_PROG(m4_exists, m4, yes, no)
547 if test "$ac_cv_prog_m4_exists" = no; then
548 ac_cv_prog_gnat_correct=no
549 echo Ada95 binding required program m4 not found. Ada95 binding disabled.
552 if test "$ac_cv_prog_gnat_correct" = yes; then
554 nc_ada_package=terminal_interface
555 AC_SUBST(nc_ada_make)
556 AC_SUBST(nc_ada_compiler)
557 AC_SUBST(nc_ada_package)
561 ### It's not possible to appease gcc 2.6.3's conversion-warnings if we're
562 ### using a 'char' for bools. gcc 2.7.0's conversion-warnings are broken too
563 ### badly to consider using for development purposes, but 2.5.8 is okay.
564 if test -n "$with_warnings"; then
565 if test -n "$GCC"; then
566 case "`$CC --version`" in
568 if test "$nc_cv_sizeof_bool" != "char"; then
569 nc_warn_CFLAGS="$nc_warn_CFLAGS -Wconversion"
573 nc_warn_CFLAGS="$nc_warn_CFLAGS -Wconversion"
579 ### Construct the list of include-directories to be generated
583 ### Construct the list of subdirectories for which we'll customize makefiles
584 ### with the appropriate compile-rules.
585 NC_SRC_MODULES(ncurses progs panel menu form)
588 ### Now that we're done running tests, add the compiler-warnings, if any
589 CFLAGS="$CFLAGS $nc_warn_CFLAGS"
591 ################################################################################
593 AC_OUTPUT(include/config_h \
594 include/MKterm.h.awk \
603 ### Special editing. We generate ncurses_cfg.h directly to allow all filenames
604 ### to be MSDOS-compatible, as well as to make the list of definitions be
605 ### dynamically determined by the configuration script -- a consideration when
606 ### doing type-clean development testing.
608 echo creating include/ncurses_cfg.h
609 rm -f include/ncurses_cfg.h
610 echo "/* generated by configure-script
614 #define NC_CONFIG_H" >include/ncurses_cfg.h
618 -e 's/\(#define [A-Za-z_][A-Za-z0-9_]*\)=/\1 /g' \
620 include/config_h | sort >>include/ncurses_cfg.h
622 /* The C compiler may not treat these properly, but C++ has to */
627 #if defined(lint) || defined(TRACE)
629 #define inline /* nothing */
633 #endif /* NC_CONFIG_H */" >> include/ncurses_cfg.h
634 echo removing include/config_h
637 ### Special initialization commands, used to pass information from the
638 ### configuration-run into config.status
640 SYS_NAME="`(uname -a || hostname) 2>/dev/null | sed 1q`"
641 if test -z "\$SYS_NAME"; then SYS_NAME=unknown;fi
644 DFT_LWR_MODEL="$DFT_LWR_MODEL"
645 NC_LIST_MODELS="$nc_list_models"
646 WITH_ECHO="$with_echo"
647 WITH_OVERWRITE="$with_overwrite"
648 SRC_SUBDIRS="$SRC_SUBDIRS"
649 nc_cxx_library="$nc_cxx_library"
650 nc_cv_systype="$nc_cv_systype"
651 nc_cv_rel_version="$nc_cv_rel_version"
652 nc_cv_abi_version="$nc_cv_abi_version"
653 nc_cv_do_symlinks="$nc_cv_do_symlinks"
654 nc_cv_rm_so_locs="$nc_cv_rm_so_locs"