1dnl @(#)configure.in 8.134 (Berkeley) 10/15/96 2 3dnl Process this file with autoconf to produce a configure script. 4AC_INIT(../common/main.c) 5AC_CONFIG_HEADER(config.h) 6 7dnl Configure setup. 8AC_PROG_INSTALL() 9AC_CANONICAL_HOST 10AC_ARG_PROGRAM() 11 12dnl If the user wants a debugging environment, set OPTFLAG now. (Some 13dnl compilers won't mix optimizing and debug flags.) 14AC_MSG_CHECKING(if --enable-debug option specified) 15AC_ARG_ENABLE(debug, 16 [ --enable-debug Build a debugging version.], 17 [vi_cv_debug="yes"], [vi_cv_debug="no"]) 18if test "$vi_cv_debug" = yes; then 19 AC_DEFINE(DEBUG) 20 OPTFLAG=${OPTFLAG-"-g"} 21 no_op_OPTFLAG=${no_op_OPTFLAG-"-g"} 22fi 23AC_MSG_RESULT($vi_cv_debug) 24 25dnl This is where we handle stuff that autoconf can't handle. 26dnl XXX 27dnl Don't override anything if it's already set from the environment. 28 29dnl Compiler, preprocessor and load flags. 30dnl AUX: -ZP disables _BSD_SOURCE et al, but enables POSIX at link time. 31dnl LynxOS: We check for gcc 2.x or better, the gcc 1 that was shipped with 32dnl LynxOS historically wasn't good enough. 33AC_SUBST(CPPFLAGS) 34case "$host_os" in 35aix3.2.5) OPTFLAG=${OPTFLAG-"-O"};; 36aix4.1*) CFLAGS=${CFLAGS-"-qstrict"} 37 OPTFLAG=${OPTFLAG-"-O3"};; 38aux*) CPPFLAGS=${CPPFLAGS-"-ZP -D_BSD_SOURCE -D_SYSV_SOURCE -D_AUX_SOURCE"} 39 LDFLAGS=${LDFLAGS-"-ZP"} 40 OPTFLAG=${OPTFLAG-"-O"};; 41bsd4.4) OPTFLAG=${OPTFLAG-"-O2"};; 42bsdi*) CC=${CC-"shlicc"} 43 OPTFLAG=${OPTFLAG-"-O2"};; 44irix6*) OPTFLAG=${OPTFLAG-"-O2"};; 45irix*) OPTFLAG=${OPTFLAG-"-O2"};; 46lynxos*) AC_PROG_CC() 47 AC_MSG_CHECKING([for GNU C (gcc) version 2.x]) 48 ac_cv_gcc_vers=`${CC-cc} -v 2>&1 | \ 49 grep "gcc version " | sed 's/.*version //'` 50 ac_cv_gcc_major=`echo "$ac_cv_gcc_vers" | sed 's/\..*//'` 51 if test "$ac_cv_gcc_major" = "2" ; then 52 AC_MSG_RESULT(yes) 53 else 54 AC_MSG_RESULT(no) 55 echo "Fatal error: Nvi requires gcc 2.x to build on LynxOS." 56 echo "See build/README.LynxOS for more information." 57 exit 1 58 fi;; 59nextstep3) CPPFLAGS=${CPPFLAGS-"-w -pipe -posix"} 60 LDFLAGS=${LDFLAGS-"-posix"} 61 OPTFLAG=${OPTFLAG-"-O9"};; 62osf*) CFLAGS=${CFLAGS-"-Olimit 1000"};; 63solaris*) no_op_OPTFLAG=${no_op_OPTFLAG-""};; 64sunos*) no_op_OPTFLAG=${no_op_OPTFLAG-""};; 65esac 66 67dnl The default compiler is cc. 68AC_SUBST(CC) 69CC=${CC-cc} 70 71dnl The default OPTFLAG is -O 72AC_SUBST(OPTFLAG) 73OPTFLAG=${OPTFLAG-"-O"} 74 75dnl The SunOS/Solaris compiler can't optimize vi/v_txt.c; the symptom is 76dnl that the command 35i==<esc> turns into an infinite loop. 77AC_SUBST(no_op_OPTFLAG) 78no_op_OPTFLAG=${no_op_OPTFLAG-"$OPTFLAG"} 79 80dnl Libraries. 81case "$host_os" in 82bsdi2.1) LIBS=${LIBS-"-lipc"};; 83dgux*) LIBS=${LIBS-"-ldgc"};; 84irix6*) LIBS=${LIBS-"-lbsd"};; 85irix*) LIBS=${LIBS-"-lc_s -lbsd"};; 86isc*) LIBS=${LIBS-"-lcposix -linet"};; 87netbsd1*) LIBS=${LIBS-"-lcrypt"};; 88ptx*) LIBS=${LIBS-"-lseq -linet -lsocket"};; 89sco3.2*) LIBS=${LIBS-"-lsocket"};; 90sinix*) LIBS=${LIBS-"-lelf -lc"};; 91solaris*) LIBS=${LIBS-"-lsocket -lnsl -ldl"} 92 RLIBS=yes;; 93wgs*) LIBS=${LIBS-"-lnsl"};; 94esac 95 96dnl A/UX has a broken getopt(3), strpbrk(3). 97case "$host_os" in 98aux*) LIBOBJS="getopt.o strpbrk.o $LIBOBJS";; 99esac 100 101dnl Ultrix has a broken POSIX.1 VDISABLE value. 102case "$host_os" in 103ultrix*) AC_DEFINE(HAVE_BROKEN_VDISABLE);; 104esac 105 106dnl The user may have additional CPP information. 107CPPFLAGS="$ADDCPPFLAGS $CPPFLAGS" 108 109dnl The user may have additional load line information. 110LDFLAGS="$ADDLDFLAGS $LDFLAGS" 111 112dnl The user may have additional library information. 113LIBS="$ADDLIBS $LIBS" 114 115dnl Check to see if it's going to work. 116AM_SANITY_CHECK_CC 117 118dnl Checks for programs. 119PATH="$PATH:/usr/bin:/usr/sbin:/sbin:/etc:/usr/etc:/usr/lib:/usr/ucblib:" 120 121dnl Check for the shell path. 122AC_PATH_PROG(vi_cv_path_shell, sh, no) 123if test "$vi_cv_path_shell" = no; then 124 echo "Fatal error: the shell utility not found." 125 exit 1 126fi 127 128dnl Check for the sendmail path. 129AC_PATH_PROG(vi_cv_path_sendmail, sendmail, no) 130if test "$vi_cv_path_sendmail" = no; then 131 echo "WARNING: The sendmail utility was not found!" 132 echo "WARNING: Users will not be told of saved files." 133fi 134 135dnl Check for the perl5/perl path. 136AC_SUBST(vi_cv_path_perl) 137AC_PATH_PROGS(vi_cv_path_perl, perl5 perl, no) 138 139dnl Check for the "preserve" path. 140dnl Historically, nvi has used /var/tmp/vi.recover. The Linux filesystem 141dnl standard (FSSTND) uses /var/preserve; we add the vi.recover directory 142dnl beneath it so that we don't have name collisions with other editors. 143dnl Other systems have /var/preserve as well, so we test first for an already 144dnl existing name, and then use the first one that's writeable. 145AC_SUBST(vi_cv_path_preserve) 146AC_MSG_CHECKING(for preserve directory) 147AC_CACHE_VAL(vi_cv_path_preserve, [dnl 148 dirlist="/var/preserve /var/tmp /usr/tmp" 149 vi_cv_path_preserve=no 150 for i in $dirlist; do 151 if test -d $i/vi.recover; then 152 vi_cv_path_preserve=$i/vi.recover 153 break; 154 fi 155 done 156 if test "$vi_cv_path_preserve" = no; then 157 for i in $dirlist; do 158 if test -d $i -a -w $i; then 159 vi_cv_path_preserve=$i/vi.recover 160 break; 161 fi 162 done 163 164 fi]) 165if test "$vi_cv_path_preserve" = no; then 166 echo "Fatal error: no writeable preserve directory found." 167 exit 1 168fi 169AC_MSG_RESULT($vi_cv_path_preserve) 170 171dnl Check for programs used for installation 172AC_PATH_PROG(vi_cv_path_chmod, chmod, missing_chmod) 173AC_PATH_PROG(vi_cv_path_cp, cp, missing_cp) 174AC_PATH_PROG(vi_cv_path_ln, ln, missing_ln) 175AC_PATH_PROG(vi_cv_path_mkdir, mkdir, missing_mkdir) 176AC_PATH_PROG(vi_cv_path_rm, rm, missing_rm) 177AC_PATH_PROG(vi_cv_path_strip, strip, missing_strip) 178 179dnl Checks for libraries. 180dnl Find the X libraries and includes. 181AC_PATH_X 182if test "$no_x" = yes; then 183 AC_MSG_ERROR(X is required for Vigor, but could not be located.) 184fi 185AC_SUBST(XINCS) 186if test "X$x_libraries" != "X"; then 187 if test "X$RLIBS" = "Xyes"; then 188 XLIBS="-R$x_libraries -L$x_libraries $XLIBS" 189 else 190 XLIBS="-L$x_libraries $XLIBS" 191 fi 192fi 193XLIBS="$XLIBS -lX11" 194if test "X$x_includes" != "X"; then 195 XINCS="-I$x_includes" 196fi 197 198dnl If the user wants a Perl interpreter in nvi, load it. 199AC_SUBST(shrpenv) 200AC_SUBST(vi_cv_perllib) 201AC_MSG_CHECKING(if --enable-perlinterp option specified) 202AC_ARG_ENABLE(perlinterp, 203 [ --enable-perlinterp Include a Perl interpreter in vi.], 204 [vi_cv_perlinterp="yes"], [vi_cv_perlinterp="no"]) 205AC_MSG_RESULT($vi_cv_perlinterp) 206if test "$vi_cv_perlinterp" = "yes"; then 207 if test "$vi_cv_path_perl" = no; then 208 echo "Fatal error: no perl5 utility found." 209 exit 1 210 fi 211 $vi_cv_path_perl -e 'require 5.002' || { 212 echo "Fatal error: perl5 must be version 5.002 or later." 213 exit 1 214 } 215 $vi_cv_path_perl -e 'close(STDERR);require 5.003_01' && 216 AC_DEFINE(HAVE_PERL_5_003_01) 217 218 eval `$vi_cv_path_perl -V:shrpenv` 219 if test "X$shrpenv" = "XUNKNOWN"; then # pre 5.003_04 220 shrpenv="" 221 fi 222 vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlib}'` 223 perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \ 224 -e 'ccflags;perl_inc'` 225 if test "X$perlcppflags" != "X"; then 226 CPPFLAGS="$perlcppflags $CPPFLAGS" 227 fi 228 perllibs=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \ 229 -e 'ldopts'` 230 if test "X$perllibs" != "X"; then 231 LIBS="$perllibs $LIBS" 232 fi 233 perlldflags=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \ 234 -e 'ccdlflags'` 235 if test "X$perlldflags" != "X"; then 236 LDFLAGS="$perlldflags $LDFLAGS" 237 fi 238 LIBOBJS="perl.o perlsfio.o $LIBOBJS" 239 AC_DEFINE(HAVE_PERL_INTERP) 240fi 241 242dnl Make sure we can find a Tcl/Tk interpreter. 243LIBOBJS="tcl.o $LIBOBJS" 244dnl GNU/Linux Tcl requires -ldl 245AC_CHECK_LIB(dl,dlopen) 246LIBS="$LIBS -lm" 247AC_SEARCH_LIBS(Tcl_Init,tcl tcl82 tcl8.2 tcl80 tcl8.0,,dnl 248 AC_MSG_ERROR([Tcl is required for Vigor but could not be located.])) 249AC_SEARCH_LIBS(Tk_Init,tk tk82 tk8.2 tk80 tk8.0,,dnl 250 AC_MSG_ERROR([Tk is required for Vigor but could not be located.]),$XLIBS) 251LIBS="$LIBS $XLIBS -lm" 252AC_DEFINE(HAVE_TCL_INTERP) 253 254dnl Both Tcl/Tk and Perl interpreters need the vi api code. 255LIBOBJS="api.o $LIBOBJS" 256 257dnl Check for the termcap/termlib library. Compile in nvi's curses routines 258dnl only if the user specifies to. These two checks must occur in the 259dnl current order, and -lcurses must be loaded before -ltermcap/-ltermlib. 260AC_CHECK_LIB(termlib, tgetent, 261 [vi_cv_termlib=-ltermlib], [vi_cv_termlib=no]) 262if test "$vi_cv_termlib" = no; then 263 AC_CHECK_LIB(termcap, tgetent, 264 [vi_cv_termlib=-ltermcap], [vi_cv_termlib=no]) 265fi 266if test "$vi_cv_termlib" != no; then 267 LIBS="$vi_cv_termlib $LIBS" 268fi 269AC_SUBST(cobjs) 270AC_MSG_CHECKING(if --enable-curses option specified) 271AC_ARG_ENABLE(curses, 272 [ --enable-curses Use the nvi-provided curses routines.], 273 [vi_cv_curses="bundled curses"], [vi_cv_curses="other curses"]) 274AC_MSG_RESULT($vi_cv_curses) 275case "$vi_cv_curses" in 276"bundled curses") 277 CPPFLAGS="-I\$(srcdir)/curses $CPPFLAGS" 278 cobjs="\$(COBJS)";; 279"other curses") 280 LIBS="-lcurses $LIBS";; 281esac 282 283dnl Checks for header files. 284AC_MSG_CHECKING(for sys/mman.h) 285AC_CACHE_VAL(vi_cv_include_sys_mman, [dnl 286AC_TRY_CPP([#include <sys/mman.h>], 287 [vi_cv_include_sys_mman=yes], [vi_cv_include_sys_mman=no])]) 288if test "$vi_cv_include_sys_mman" = yes; then 289 AC_DEFINE(HAVE_SYS_MMAN_H) 290fi 291AC_MSG_RESULT($vi_cv_include_sys_mman) 292 293AC_MSG_CHECKING(for sys/select.h) 294AC_CACHE_VAL(vi_cv_include_sys_select, [dnl 295AC_TRY_CPP([#include <sys/select.h>], 296 [vi_cv_include_sys_select=yes], [vi_cv_include_sys_select=no])]) 297if test "$vi_cv_include_sys_select" = yes; then 298 AC_DEFINE(HAVE_SYS_SELECT_H) 299fi 300AC_MSG_RESULT($vi_cv_include_sys_select) 301 302dnl Checks for typedefs, structures, and compiler characteristics. 303AC_CHECK_TYPE(ssize_t, int) 304AC_C_BIGENDIAN 305AC_C_CONST 306AC_STRUCT_ST_BLKSIZE 307AC_TYPE_MODE_T 308AC_TYPE_OFF_T 309AC_TYPE_PID_T 310AC_TYPE_SIZE_T 311AC_STRUCT_TM 312 313dnl Checks for library functions. 314 AC_CHECK_FUNCS(bsearch gethostname getopt memchr memcpy memmove memset) 315AC_REPLACE_FUNCS(bsearch gethostname getopt memchr memcpy memmove memset) 316 AC_CHECK_FUNCS(mkstemp mmap snprintf strdup strerror strpbrk strtol) 317AC_REPLACE_FUNCS(mkstemp mmap snprintf strdup strerror strpbrk strtol) 318 AC_CHECK_FUNCS(strtoul vsnprintf) 319AC_REPLACE_FUNCS(strtoul vsnprintf) 320 321AC_CHECK_FUNCS(select) 322AC_CHECK_FUNCS(setenv, [need_env=no], [need_env=yes]) 323AC_CHECK_FUNCS(strsep, [need_strsep=no], [need_strsep=yes]) 324AC_CHECK_FUNCS(unsetenv,, [need_env=yes]) 325 326AC_FUNC_MMAP 327AC_FUNC_VFORK 328 329dnl If we needed setenv or unsetenv, add in the clib/env.c replacement file. 330if test "$need_env" = yes; then 331 LIBOBJS="env.o $LIBOBJS" 332fi 333 334dnl If we need strsep, add it and define it so we get a prototype. 335if test "$need_strsep" = yes; then 336 LIBOBJS="strsep.o $LIBOBJS" 337fi 338 339dnl Check for fcntl/flock 340dnl Use flock preferentially, since it has cleaner semantics and won't 341dnl hang up the editor. 342dnl XXX 343dnl Ultrix has a broken fcntl, but a working flock. 344dnl IRIX and DGUX have a broken flock, but working fcntl. 345AC_MSG_CHECKING(for fcntl/flock) 346AC_CACHE_VAL(vi_cv_lock, [dnl 347 vi_cv_lock=none 348 case "$host_os" in 349 dgux*);; 350 irix*);; 351 *) 352 AC_TRY_LINK([#include <fcntl.h>], [flock(0, 0);], 353 [vi_cv_lock=flock]);; 354 esac 355 if test "$vi_cv_lock" = none; then 356 AC_TRY_LINK([#include <fcntl.h>], [fcntl(0, F_SETLK, 0);], 357 [vi_cv_lock=fcntl]) 358 fi]) 359 360if test "$vi_cv_lock" = flock; then 361 AC_DEFINE(HAVE_LOCK_FLOCK) 362fi 363if test "$vi_cv_lock" = fcntl; then 364 AC_DEFINE(HAVE_LOCK_FCNTL) 365fi 366AC_MSG_RESULT($vi_cv_lock) 367 368dnl Check for ftruncate/chsize 369AC_MSG_CHECKING(for ftruncate/chsize) 370AC_CACHE_VAL(vi_cv_ftruncate, [dnl 371AC_TRY_LINK([#include <unistd.h>], [ftruncate(0, 0);], 372 [vi_cv_ftruncate=ftruncate], 373AC_TRY_LINK([#include <unistd.h>], [chsize(0, 0);], 374 [vi_cv_ftruncate=chsize], [vi_cv_ftruncate=no]))]) 375if test "$vi_cv_ftruncate" = ftruncate; then 376 AC_DEFINE(HAVE_FTRUNCATE_FTRUNCATE) 377fi 378if test "$vi_cv_ftruncate" = chsize; then 379 AC_DEFINE(HAVE_FTRUNCATE_CHSIZE) 380fi 381if test "$vi_cv_ftruncate" = no; then 382 echo 383 echo "Fatal error: no file truncation system call." 384 exit 1 385fi 386AC_MSG_RESULT($vi_cv_ftruncate) 387 388dnl Check for the tigetstr/tigetnum functions. 389AC_MSG_CHECKING(for tigetstr/tigetnum) 390AC_CACHE_VAL(vi_cv_have_curses_tigetstr, [dnl 391AC_TRY_LINK([#include <curses.h>], [tigetstr(0);], 392 [vi_cv_have_curses_tigetstr=yes], 393 [vi_cv_have_curses_tigetstr=no])]) 394if test "$vi_cv_have_curses_tigetstr" = yes; then 395 AC_DEFINE(HAVE_CURSES_TIGETSTR) 396fi 397AC_MSG_RESULT($vi_cv_have_curses_tigetstr) 398 399dnl Check for potentially missing curses functions in system or user-specified 400dnl libraries. We also have to guess at whether the specified library is a 401dnl BSD or System V style curses. Use the newterm function, all System V 402dnl curses implementations have it, none, as far as I know, of the BSD ones do. 403if test "$vi_cv_curses" = "bundled curses"; then 404 AC_DEFINE(HAVE_BSD_CURSES) 405 AC_DEFINE(HAVE_CURSES_ADDNSTR) 406 AC_DEFINE(HAVE_CURSES_IDLOK) 407else 408 dnl Check for the addnstr function. 409 AC_MSG_CHECKING(for addnstr) 410 AC_CACHE_VAL(vi_cv_have_curses_addnstr, [dnl 411 AC_TRY_LINK([#include <curses.h>], [addnstr(0, 0);], 412 [vi_cv_have_curses_addnstr=yes], 413 [vi_cv_have_curses_addnstr=no])]) 414 if test "$vi_cv_have_curses_addnstr" = yes; then 415 AC_DEFINE(HAVE_CURSES_ADDNSTR) 416 fi 417 AC_MSG_RESULT($vi_cv_have_curses_addnstr) 418 419 dnl Check for the beep function. 420 AC_MSG_CHECKING(for beep) 421 AC_CACHE_VAL(vi_cv_have_curses_beep, [dnl 422 AC_TRY_LINK([#include <curses.h>], [beep();], 423 [vi_cv_have_curses_beep=yes], 424 [vi_cv_have_curses_beep=no])]) 425 if test "$vi_cv_have_curses_beep" = yes; then 426 AC_DEFINE(HAVE_CURSES_BEEP) 427 fi 428 AC_MSG_RESULT($vi_cv_have_curses_beep) 429 430 dnl Check for the flash function. 431 AC_MSG_CHECKING(for flash) 432 AC_CACHE_VAL(vi_cv_have_curses_flash, [dnl 433 AC_TRY_LINK([#include <curses.h>], [flash();], 434 [vi_cv_have_curses_flash=yes], 435 [vi_cv_have_curses_flash=no])]) 436 if test "$vi_cv_have_curses_flash" = yes; then 437 AC_DEFINE(HAVE_CURSES_FLASH) 438 fi 439 AC_MSG_RESULT($vi_cv_have_curses_flash) 440 441 dnl Check for the idlok function. 442 AC_MSG_CHECKING(for idlok) 443 AC_CACHE_VAL(vi_cv_have_curses_idlok, [dnl 444 AC_TRY_LINK([#include <curses.h>], [idlok(0, 0);], 445 [vi_cv_have_curses_idlok=yes], 446 [vi_cv_have_curses_idlok=no])]) 447 if test "$vi_cv_have_curses_idlok" = yes; then 448 AC_DEFINE(HAVE_CURSES_IDLOK) 449 fi 450 AC_MSG_RESULT($vi_cv_have_curses_idlok) 451 452 dnl Check for the keypad function. 453 AC_MSG_CHECKING(for keypad) 454 AC_CACHE_VAL(vi_cv_have_curses_keypad, [dnl 455 AC_TRY_LINK([#include <curses.h>], [keypad(0, 0);], 456 [vi_cv_have_curses_keypad=yes], 457 [vi_cv_have_curses_keypad=no])]) 458 if test "$vi_cv_have_curses_keypad" = yes; then 459 AC_DEFINE(HAVE_CURSES_KEYPAD) 460 fi 461 AC_MSG_RESULT($vi_cv_have_curses_keypad) 462 463 dnl Check for the newterm function. 464 AC_MSG_CHECKING(for newterm) 465 AC_CACHE_VAL(vi_cv_have_curses_newterm, [dnl 466 AC_TRY_LINK([#include <curses.h>], [newterm(0, 0, 0);], 467 [vi_cv_have_curses_newterm=yes], 468 [vi_cv_have_curses_newterm=no])]) 469 if test "$vi_cv_have_curses_newterm" = yes; then 470 AC_DEFINE(HAVE_CURSES_NEWTERM) 471 fi 472 AC_MSG_RESULT($vi_cv_have_curses_newterm) 473 474 if test "$vi_cv_have_curses_newterm" = no; then 475 AC_DEFINE(HAVE_BSD_CURSES) 476 fi 477fi 478 479dnl Check for the setupterm function. We make this check regardless of 480dnl using the system library, because it may be part of the underlying 481dnl termcap/termlib support, and we want to use the local one. 482AC_MSG_CHECKING(for setupterm) 483AC_CACHE_VAL(vi_cv_have_curses_setupterm, [dnl 484AC_TRY_LINK([#include <curses.h>], [setupterm(0, 0, 0);], 485 [vi_cv_have_curses_setupterm=yes], 486 [vi_cv_have_curses_setupterm=no])]) 487if test "$vi_cv_have_curses_setupterm" = yes; then 488 AC_DEFINE(HAVE_CURSES_SETUPTERM) 489fi 490AC_MSG_RESULT($vi_cv_have_curses_setupterm) 491 492dnl Some moron decided to drop off an argument from the gettimeofday call, 493dnl without changing the name. 494AC_MSG_CHECKING(for broken gettimeofday system call) 495AC_CACHE_VAL(vi_cv_gettimeofday, [dnl 496AC_TRY_LINK([#include <sys/types.h> 497#include <sys/time.h>], [gettimeofday(0, 0);], 498 [vi_cv_gettimeofday=okay], [vi_cv_gettimeofday=broken])]) 499if test "$vi_cv_gettimeofday" = broken; then 500 AC_DEFINE(HAVE_BROKEN_GETTIMEOFDAY) 501fi 502AC_MSG_RESULT($vi_cv_gettimeofday) 503 504dnl Check for which version of openpty to use, System V or Berkeley. 505AC_MSG_CHECKING(for System V pty calls) 506AC_CACHE_VAL(vi_cv_sys5_pty, [dnl 507AC_TRY_LINK(, [grantpt(0);], 508 [vi_cv_sys5_pty=yes], [vi_cv_sys5_pty=no])]) 509if test "$vi_cv_sys5_pty" = yes; then 510 AC_DEFINE(HAVE_SYS5_PTY) 511fi 512AC_MSG_RESULT($vi_cv_sys5_pty) 513 514dnl Check for the revoke system call. 515AC_MSG_CHECKING(for revoke system call) 516AC_CACHE_VAL(vi_cv_revoke, [dnl 517AC_TRY_LINK(, [revoke("a");], 518 [vi_cv_revoke=yes], [vi_cv_revoke=no])]) 519if test "$vi_cv_revoke" = yes; then 520 AC_DEFINE(HAVE_REVOKE) 521fi 522AC_MSG_RESULT($vi_cv_revoke) 523 524dnl Some versions of sprintf return a pointer to the first argument instead 525dnl of a character count. We assume that the return value of snprintf and 526dnl vsprintf etc. will be the same as sprintf, and check the easy one. 527AC_MSG_CHECKING(for int type sprintf return value) 528AC_CACHE_VAL(vi_cv_sprintf_count, [dnl 529AC_TRY_RUN([main(){char buf[20]; exit(sprintf(buf, "XXX") != 3);}], 530 [vi_cv_sprintf_count=yes], [vi_cv_sprintf_count=no])]) 531if test "$vi_cv_sprintf_count" = no; then 532 AC_DEFINE(SPRINTF_RET_CHARPNT) 533fi 534AC_MSG_RESULT($vi_cv_sprintf_count) 535 536dnl We compile in nvi's DB routines only if the user specifies to. 537AC_MSG_CHECKING(if --enable-db option specified) 538AC_ARG_ENABLE(db, 539 [ --enable-db Use the nvi-provided DB routines.], 540 [vi_cv_db_lib="bundled DB"], [vi_cv_db_lib="other DB"]) 541AC_MSG_RESULT($vi_cv_db_lib) 542case "$vi_cv_db_lib" in 543"bundled DB") 544 CPPFLAGS="-I\$(srcdir)/db/include $CPPFLAGS" 545 LIBOBJS="\$(DBOBJS) $LIBOBJS";; 546"other DB") 547 ;; 548esac 549 550dnl We compile in nvi's RE routines only if the user specifies to. 551AC_MSG_CHECKING(if --enable-re option specified) 552AC_ARG_ENABLE(re, 553 [ --enable-re Use the nvi-provided RE routines.], 554 [vi_cv_re_lib="bundled RE"], [vi_cv_re_lib="other RE"]) 555AC_MSG_RESULT($vi_cv_re_lib) 556case "$vi_cv_re_lib" in 557"bundled RE") 558 CPPFLAGS="-I\$(srcdir)/regex $CPPFLAGS" 559 LIBOBJS="\$(REOBJS) $LIBOBJS";; 560"other RE") 561 ;; 562esac 563 564dnl Check for the standard shorthand types. 565AC_SUBST(u_char_decl) 566AC_MSG_CHECKING(for u_char) 567AC_CACHE_VAL(vi_cv_uchar, [dnl 568AC_TRY_COMPILE([#include <sys/types.h>], u_char foo;, 569 [vi_cv_uchar=yes], [vi_cv_uchar=no])]) 570AC_MSG_RESULT($vi_cv_uchar) 571if test "$vi_cv_uchar" = no; then 572 u_char_decl="typedef unsigned char u_char;" 573fi 574 575AC_SUBST(u_short_decl) 576AC_MSG_CHECKING(for u_short) 577AC_CACHE_VAL(vi_cv_ushort, [dnl 578AC_TRY_COMPILE([#include <sys/types.h>], u_short foo;, 579 [vi_cv_ushort=yes], [vi_cv_ushort=no])]) 580AC_MSG_RESULT($vi_cv_ushort) 581if test "$vi_cv_ushort" = no; then 582 u_short_decl="typedef unsigned short u_short;" 583fi 584 585AC_SUBST(u_int_decl) 586AC_MSG_CHECKING(for u_int) 587AC_CACHE_VAL(vi_cv_uint, [dnl 588AC_TRY_COMPILE([#include <sys/types.h>], u_int foo;, 589 [vi_cv_uint=yes], [vi_cv_uint=no])]) 590AC_MSG_RESULT($vi_cv_uint) 591if test "$vi_cv_uint" = no; then 592 u_int_decl="typedef unsigned int u_int;" 593fi 594 595AC_SUBST(u_long_decl) 596AC_MSG_CHECKING(for u_long) 597AC_CACHE_VAL(vi_cv_ulong, [dnl 598AC_TRY_COMPILE([#include <sys/types.h>], u_long foo;, 599 [vi_cv_ulong=yes], [vi_cv_ulong=no])]) 600AC_MSG_RESULT($vi_cv_ulong) 601if test "$vi_cv_ulong" = no; then 602 u_long_decl="typedef unsigned long u_long;" 603fi 604 605dnl DB/Vi use specific integer sizes. 606AC_SUBST(u_int8_decl) 607AC_MSG_CHECKING(for u_int8_t) 608AC_CACHE_VAL(vi_cv_uint8, [dnl 609AC_TRY_COMPILE([#include <sys/types.h>], u_int8_t foo;, 610 [vi_cv_uint8=yes], 611AC_TRY_COMPILE([#include <sys/types.h>], uint8_t foo;, 612 [vi_cv_uint8=uint8_t], 613AC_TRY_RUN([main(){exit(sizeof(unsigned char) != 1);}], 614 [vi_cv_uint8="unsigned char"], [vi_cv_uint8=no])))]) 615AC_MSG_RESULT($vi_cv_uint8) 616if test "$vi_cv_uint8" = no; then 617 echo 618 echo "Fatal error: no unsigned, 8-bit integral type." 619 exit 1 620fi 621if test "$vi_cv_uint8" != yes; then 622 u_int8_decl="typedef $vi_cv_uint8 u_int8_t;" 623fi 624 625AC_SUBST(u_int16_decl) 626AC_MSG_CHECKING(for u_int16_t) 627AC_CACHE_VAL(vi_cv_uint16, [dnl 628AC_TRY_COMPILE([#include <sys/types.h>], u_int16_t foo;, 629 [vi_cv_uint16=yes], 630AC_TRY_COMPILE([#include <sys/types.h>], uint16_t foo;, 631 [vi_cv_uint16=uint16_t], 632AC_TRY_RUN([main(){exit(sizeof(unsigned short) != 2);}], 633 [vi_cv_uint16="unsigned short"], 634AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 2);}], 635 [vi_cv_uint16="unsigned int"], [vi_cv_uint16=no]))))]) 636AC_MSG_RESULT($vi_cv_uint16) 637if test "$vi_cv_uint16" = no; then 638 echo 639 echo "Fatal error: no unsigned, 16-bit integral type." 640 exit 1 641fi 642if test "$vi_cv_uint16" != yes; then 643 u_int16_decl="typedef $vi_cv_uint16 u_int16_t;" 644fi 645 646AC_SUBST(int16_decl) 647AC_MSG_CHECKING(for int16_t) 648AC_CACHE_VAL(vi_cv_int16, [dnl 649AC_TRY_COMPILE([#include <sys/types.h>], int16_t foo;, 650 [vi_cv_int16=yes], 651AC_TRY_RUN([main(){exit(sizeof(short) != 2);}], 652 [vi_cv_int16="short"], 653AC_TRY_RUN([main(){exit(sizeof(int) != 2);}], 654 [vi_cv_int16="int"], [vi_cv_int16=no])))]) 655AC_MSG_RESULT($vi_cv_int16) 656if test "$vi_cv_int16" = no; then 657 echo 658 echo "Fatal error: no signed, 16-bit integral type." 659 exit 1 660fi 661if test "$vi_cv_int16" != yes; then 662 int16_decl="typedef $vi_cv_int16 int16_t;" 663fi 664 665AC_SUBST(u_int32_decl) 666AC_MSG_CHECKING(for u_int32_t) 667AC_CACHE_VAL(vi_cv_uint32, [dnl 668AC_TRY_COMPILE([#include <sys/types.h>], u_int32_t foo;, 669 [vi_cv_uint32=yes], 670AC_TRY_COMPILE([#include <sys/types.h>], uint32_t foo;, 671 [vi_cv_uint32=uint32_t], 672AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 4);}], 673 [vi_cv_uint32="unsigned int"], 674AC_TRY_RUN([main(){exit(sizeof(unsigned long) != 4);}], 675 [vi_cv_uint32="unsigned long"], [vi_cv_uint32=no]))))]) 676AC_MSG_RESULT($vi_cv_uint32) 677if test "$vi_cv_uint32" = no; then 678 echo 679 echo "Fatal error: no unsigned, 32-bit integral type." 680 exit 1 681fi 682if test "$vi_cv_uint32" != yes; then 683 u_int32_decl="typedef $vi_cv_uint32 u_int32_t;" 684fi 685 686AC_SUBST(int32_decl) 687AC_MSG_CHECKING(for int32_t) 688AC_CACHE_VAL(vi_cv_int32, [dnl 689AC_TRY_COMPILE([#include <sys/types.h>], int32_t foo;, 690 [vi_cv_int32=yes], 691AC_TRY_RUN([main(){exit(sizeof(int) != 4);}], 692 [vi_cv_int32="int"], 693AC_TRY_RUN([main(){exit(sizeof(long) != 4);}], 694 [vi_cv_int32="long"], [vi_cv_int32=no])))]) 695AC_MSG_RESULT($vi_cv_int32) 696if test "$vi_cv_int32" = no; then 697 echo 698 echo "Fatal error: no signed, 32-bit integral type." 699 exit 1 700fi 701if test "$vi_cv_int32" != yes; then 702 int32_decl="typedef $vi_cv_int32 int32_t;" 703fi 704 705AC_OUTPUT(Makefile port.h:port.h.in 706 pathnames.h:pathnames.h.in recover:recover.in,echo timestamp > stamp-h) 707