1dnl $Id: configure.ac,v 1.2 2013/11/25 23:03:18 christos Exp $ 2dnl Process this file with autoconf to produce a configure script. 3 4AC_INIT([vi], [1.81.6]) 5AC_CONFIG_SRCDIR([../common/main.c]) 6AC_CONFIG_AUX_DIR(.) 7AM_INIT_AUTOMAKE 8AM_CONFIG_HEADER(config.h) 9AC_CONFIG_MACRO_DIR([m4]) 10 11dnl Configure setup. 12AC_PROG_INSTALL() 13AC_CANONICAL_HOST 14dnl part of AM_INIT_AUTOMAKE ? 15dnl AC_ARG_PROGRAM() 16 17AC_PROG_LIBTOOL 18 19dnl If the user wants a debugging environment, set OPTFLAG now, some 20dnl compilers won't mix optimizing and debug flags.) 21AC_MSG_CHECKING(if --enable-debug option specified) 22AC_ARG_ENABLE(debug, 23 [ --enable-debug Build a debugging version.], 24 [vi_cv_debug=$enableval], [vi_cv_debug="no"]) 25AC_MSG_RESULT($vi_cv_debug) 26if test "$vi_cv_debug" = yes; then 27 AC_DEFINE(DEBUG, 1, [Define if you want a debugging version.]) 28 OPTFLAG=${OPTFLAG-"-g"} 29 no_op_OPTFLAG=${no_op_OPTFLAG-"-g"} 30fi 31 32dnl This is where we handle stuff that autoconf can't handle. 33dnl XXX 34dnl Don't override anything if it's already set from the environment. 35 36dnl Compiler, preprocessor and load flags. 37dnl AUX: -ZP disables _BSD_SOURCE et al, but enables POSIX at link time. 38dnl LynxOS: We check for gcc 2.x or better, the gcc 1 that was shipped with 39dnl LynxOS historically wasn't good enough. 40AC_SUBST(CPPFLAGS) 41case "$host_os" in 42aix3.2.5) OPTFLAG=${OPTFLAG-"-O"};; 43aix4.1*) CFLAGS=${CFLAGS-"-qstrict"} 44 OPTFLAG=${OPTFLAG-"-O3"};; 45aux*) CPPFLAGS=${CPPFLAGS-"-ZP -D_BSD_SOURCE -D_SYSV_SOURCE -D_AUX_SOURCE"} 46 LDFLAGS=${LDFLAGS-"-ZP"} 47 OPTFLAG=${OPTFLAG-"-O"};; 48bsd4.4) OPTFLAG=${OPTFLAG-"-O2"};; 49bsdi*) CC=${CC-"shlicc"} 50 OPTFLAG=${OPTFLAG-"-O2"};; 51irix6*) OPTFLAG=${OPTFLAG-"-O2"};; 52irix*) OPTFLAG=${OPTFLAG-"-O2"};; 53lynxos*) AC_PROG_CC() 54 AC_MSG_CHECKING([for GNU C (gcc) version 2.x]) 55 ac_cv_gcc_vers=`${CC-cc} -v 2>&1 | \ 56 grep "gcc version " | sed 's/.*version //'` 57 ac_cv_gcc_major=`echo "$ac_cv_gcc_vers" | sed 's/\..*//'` 58 if test "$ac_cv_gcc_major" = "2" ; then 59 AC_MSG_RESULT(yes) 60 else 61 AC_MSG_RESULT(no) 62 AC_MSG_WARN([Nvi requires gcc 2.x to build on LynxOS.]) 63 AC_MSG_ERROR([See build/README.LynxOS for more information.]) 64 fi;; 65nextstep3) CPPFLAGS=${CPPFLAGS-"-w -pipe -posix"} 66 LDFLAGS=${LDFLAGS-"-posix"} 67 OPTFLAG=${OPTFLAG-"-O2"};; 68osf*) CFLAGS=${CFLAGS-"-Olimit 1000"};; 69solaris*) no_op_OPTFLAG=${no_op_OPTFLAG-""};; 70sunos*) no_op_OPTFLAG=${no_op_OPTFLAG-""};; 71esac 72 73dnl The default OPTFLAG is -O 74AC_SUBST(OPTFLAG) 75OPTFLAG=${OPTFLAG-"-O"} 76 77dnl The default compiler is cc (NOT gcc), the default CFLAGS is empty, 78dnl NOT whatever AC_PROG_CC sets. 79AC_SUBST(CC) 80CC=${CC-cc} 81CFLAGS=${CFLAGS-""} 82AC_PROG_CC 83AM_PROG_CC_C_O 84 85if test "$GCC" = yes; then 86 AC_DEFINE(HAVE_GCC, 1, [Define if you have gcc.]) 87fi 88 89dnl The SunOS/Solaris compiler can't optimize vi/v_txt.c; the symptom is 90dnl that the command 35i==<esc> turns into an infinite loop. 91AC_SUBST(no_op_OPTFLAG) 92no_op_OPTFLAG=${no_op_OPTFLAG-"$OPTFLAG"} 93 94dnl Libraries. 95case "$host_os" in 96bsdi2.1) LIBS=${LIBS-"-lipc"};; 97dgux*) LIBS=${LIBS-"-ldgc"};; 98irix6*) LIBS=${LIBS-"-lbsd"};; 99irix*) LIBS=${LIBS-"-lc_s -lbsd"};; 100isc*) LIBS=${LIBS-"-lcposix -linet"};; 101netbsd1*) LIBS=${LIBS-"-lcrypt"};; 102ptx*) LIBS=${LIBS-"-lseq -linet -lsocket"};; 103sco3.2*) LIBS=${LIBS-"-lsocket"};; 104sinix*) LIBS=${LIBS-"-lelf -lc"};; 105solaris*) LIBS=${LIBS-"-lsocket -lnsl -ldl"};; 106wgs*) LIBS=${LIBS-"-lnsl"};; 107esac 108 109dnl A/UX has a broken getopt(3), strpbrk(3). 110case "$host_os" in 111aux*) LIBOBJS="getopt.o strpbrk.o $LIBOBJS";; 112esac 113 114dnl Ultrix has a broken POSIX.1 VDISABLE value. 115case "$host_os" in 116ultrix*) AC_DEFINE(HAVE_BROKEN_VDISABLE, 1, 117 [Define if you have a Ultrix-style (broken) vdisable.]);; 118esac 119 120AC_MSG_CHECKING(whether recording of pathnames of libraries is enabled) 121AC_ARG_ENABLE(runpath, 122 [ --disable-runpath Don't record path of libraries in binary.], 123 [vi_cv_runpath="$enableval"], [vi_cv_runpath="yes"]) 124AC_MSG_RESULT($vi_cv_runpath) 125 126if test "X$vi_cv_runpath" = "Xyes"; then 127 LRscript='s/^\(.*\)/-R\1 -L\1 /' 128else 129 LRscript='s/^\(.*\)/-L\1 /' 130fi 131 132dnl If the user wants a tracing version, add the TRACE compile flag. 133AC_MSG_CHECKING(if --enable-trace option specified) 134AC_ARG_ENABLE(trace, 135 [ --enable-trace Build a tracing version.], 136 [vi_cv_trace="yes"], [vi_cv_trace="no"]) 137if test "$vi_cv_trace" = yes; then 138 CPPFLAGS="-DTRACE $CPPFLAGS" 139fi 140AC_MSG_RESULT($vi_cv_trace) 141 142dnl The user may have additional CPP information. 143CPPFLAGS="$ADDCPPFLAGS $CPPFLAGS" 144 145dnl The user may have additional load line information. 146LDFLAGS="$ADDLDFLAGS $LDFLAGS" 147 148dnl The user may have additional library information. 149LIBS="$ADDLIBS $LIBS" 150 151dnl Checks for programs. 152PATH="$PATH:/usr/bin:/usr/sbin:/sbin:/etc:/usr/etc:/usr/lib:/usr/ucblib" 153 154dnl Check for the shell path. 155AC_PATH_PROG(vi_cv_path_shell, sh, no) 156if test "$vi_cv_path_shell" = no; then 157 AC_MSG_ERROR([No shell utility found.]) 158fi 159 160dnl Check for the sendmail path. 161AC_PATH_PROG(vi_cv_path_sendmail, sendmail, no) 162if test "$vi_cv_path_sendmail" = no; then 163 AC_MSG_WARN([No sendmail utility found;]) 164 AC_MSG_WARN([ users will not be told of saved files.]) 165fi 166 167dnl Check for the perl5/perl path. 168AC_SUBST(vi_cv_path_perl) 169AC_PATH_PROGS(vi_cv_path_perl, perl5 perl, no) 170 171dnl Check for the "preserve" path. 172dnl Historically, nvi has used /var/tmp/vi.recover. The Linux filesystem 173dnl standard (FSSTND) uses /var/preserve; we add the vi.recover directory 174dnl beneath it so that we don't have name collisions with other editors. 175dnl Other systems have /var/preserve as well, so we test first for an already 176dnl existing name, and then use the first one that's writeable. 177AC_SUBST(vi_cv_path_preserve) 178AC_MSG_CHECKING(for preserve directory) 179AC_CACHE_VAL(vi_cv_path_preserve, [dnl 180 dirlist="/var/preserve /var/tmp /usr/tmp" 181 vi_cv_path_preserve=no 182 for i in $dirlist; do 183 if test -d $i/vi.recover; then 184 vi_cv_path_preserve=$i/vi.recover 185 break; 186 fi 187 done 188 if test "$vi_cv_path_preserve" = no; then 189 for i in $dirlist; do 190 if test -d $i -a -w $i; then 191 vi_cv_path_preserve=$i/vi.recover 192 break; 193 fi 194 done 195 196 fi]) 197if test "$vi_cv_path_preserve" = no; then 198 AC_MSG_ERROR([No writeable preserve directory found.]) 199fi 200AC_MSG_RESULT($vi_cv_path_preserve) 201AC_PATH_PROG(vi_cv_path_fuser, fuser, no) 202AC_PATH_PROG(vi_cv_path_lsof, lsof, no) 203AC_SUBST(INUSE) 204INUSE="" 205if test "$vi_cv_path_lsof" != no; then 206 INUSE='test `lsof -t $i`' 207fi 208if test "$vi_cv_path_fuser" != no; then 209 INUSE='fuser -s $i' 210fi 211 212dnl Check for programs used for installation 213AC_PROG_AWK 214AC_PATH_PROG(vi_cv_path_ar, ar, missing_ar) 215AC_PATH_PROG(vi_cv_path_chmod, chmod, missing_chmod) 216AC_PATH_PROG(vi_cv_path_cp, cp, missing_cp) 217AC_PATH_PROG(vi_cv_path_ln, ln, missing_ln) 218AC_PATH_PROG(vi_cv_path_mkdir, mkdir, missing_mkdir) 219AC_PATH_PROG(vi_cv_path_rm, rm, missing_rm) 220AC_PATH_PROG(vi_cv_path_ranlib, ranlib, missing_ranlib) 221AC_PATH_PROG(vi_cv_path_strip, strip, missing_strip) 222 223dnl Checks for libraries. 224dnl Find the X libraries and includes. 225AC_PATH_X 226AC_SUBST(XINCS) 227if test "$no_x" != yes; then 228 if test "X$x_libraries" != "X"; then 229 XLIBS="`echo $x_libraries | sed "$LRscript"` $XLIBS" 230 fi 231 XLIBS="$XLIBS -lX11" 232 if test "X$x_includes" != "X"; then 233 XINCS="-I$x_includes" 234 fi 235fi 236 237AC_DEFUN([VI_CV_REPLACE_FUNCS], 238[AC_FOREACH([AC_Func], [$1], [])dnl 239AC_CHECK_FUNCS([$1], , [_AC_LIBOBJ($ac_func)]) 240]) 241 242dnl Check if the user wants widechar support. 243AC_MSG_CHECKING(if --enable-widechar option specified) 244AC_ARG_ENABLE(widechar, 245 [ --enable-widechar Build a wide char aware vi.], 246 [vi_cv_widechar=$enableval], [vi_cv_widechar="no"]) 247if test "$vi_cv_widechar" = "yes"; then 248 AC_DEFINE(USE_WIDECHAR, 1, [Define when using wide characters.]) 249fi 250AC_MSG_RESULT($vi_cv_widechar) 251 252dnl Check whether we can use iconv 253AC_CHECK_HEADER(langinfo.h, [ 254 AC_CHECK_HEADER(iconv.h, [ 255 AC_DEFINE(USE_ICONV, 1, [Define when iconv can be used.]) 256 VI_CV_REPLACE_FUNCS(iswblank) 257 ]) 258]) 259 260dnl If the user wants a Gtk IPC front-end for nvi, build it. 261AC_SUBST(vi_programs) 262AC_SUBST(vi_ipc) 263AC_SUBST(GTKLIBS) 264AC_SUBST(GTKINCS) 265AC_MSG_CHECKING(if --enable-gtk option specified) 266AC_ARG_ENABLE(gtk, 267 [ --enable-gtk Build a Gtk front-end for vi.], 268 [vi_cv_gtk=$enableval], [vi_cv_gtk="no"]) 269AC_MSG_RESULT($vi_cv_gtk) 270if test "$vi_cv_gtk" = "yes"; then 271 # 272 # Find pkg-config 273 # 274 AC_PATH_PROG(PKG_CONFIG, pkg-config, no) 275 if test x$PKG_CONFIG = xno ; then 276 if test "$vi_cv_widechar" = "yes"; then 277 AC_MSG_ERROR( 278[*** pkg-config not found. See http://pkgconfig.sourceforge.net]) 279 fi 280 281 else 282 if ! $PKG_CONFIG --atleast-pkgconfig-version 0.5 ; then 283 if test "$vi_cv_widechar" = "yes"; then 284 AC_MSG_ERROR( 285[*** pkg-config too old; version 0.5 or better required.]) 286 fi 287 PKG_CONFIG=no 288 fi 289 290 fi 291 if test x$PKG_CONFIG = xno ; then 292 PKG_CONFIG=/bin/false 293 fi 294 295 vi_programs="$vi_programs vi-gtk" 296 vi_ipc=vi-ipc 297 AC_MSG_CHECKING(for gtk+) 298 if $PKG_CONFIG gtk+-2.0 ; then 299 GTKINCS=`$PKG_CONFIG --cflags gtk+-2.0` 300 GTKLIBS=`$PKG_CONFIG --libs gtk+-2.0` 301 302 AC_MSG_RESULT(ok) 303 AC_DEFINE(HAVE_PANGO, 1, [Define is appropriate pango is available.]) 304 else 305 if test "$vi_cv_widechar" = "yes"; then 306 AC_MSG_ERROR([ 307*** gtk+-2.0 is required. The latest version of gtk 308*** is always available from ftp://ftp.gtk.org/. 309 ]) 310 else 311 AM_PATH_GTK(1.2.0) 312 GTKINCS="$GTK_CFLAGS" 313 GTKLIBS="$GTK_LIBS $LIBS" 314 fi 315 fi 316 317 SAVELIBS="$LIBS" 318 LIBS="-lutil $GTKLIBS" 319 AC_CHECK_LIB(nvizvt, zvt_get_ptys, 320 [vi_cv_zvt="yes"], [vi_cv_zvt="no"]) 321 if test "$vi_cv_zvt" = "yes"; then 322 GTKLIBS="-lnvizvt $LIBS" 323 AC_DEFINE(HAVE_ZVT, 1, [Define is appropriate zvt is available.]) 324 fi 325 LIBS="$SAVELIBS" 326# AC_PATH_PROG(vi_cv_gnome_config, gnome-config, no) 327# if test "$vi_cv_gnome_config" != "no"; then 328# ZVTLIBS=`$vi_cv_gnome_config zvt --libs` 329# GTKLIBS="$ZVTLIBS $GTKLIBS" 330# fi 331fi 332 333dnl If the user wants a Motif IPC front-end for nvi, build it. 334AC_SUBST(MOTIFLIBS) 335AC_MSG_CHECKING(if --enable-motif option specified) 336AC_ARG_ENABLE(motif, 337 [ --enable-motif Build a Motif front-end for vi.], 338 [vi_cv_motif=$enableval], [vi_cv_motif="no"]) 339AC_MSG_RESULT($vi_cv_motif) 340if test "$vi_cv_motif" = "yes"; then 341 vi_programs="$vi_programs vi-motif" 342 vi_ipc=vi-ipc 343 344 dnl XXX 345 dnl BSDI's Motif libraries aren't shared. 346 347 case "$host_os" in 348 bsdi*) CC=cc;; 349 esac 350 351 dnl XXX 352 dnl The Xinside Motif distribution requires -lSM, -lICE and -lXext. 353 dnl -lXext is generally available, the others aren't. 354 dnl 355 dnl XXX 356 dnl Color icons require -lXpm, which may or may not be available, 357 dnl depending on the version of X11. 358 359 MOTIFLIBS="-lXm -lXt" 360 AC_CHECK_LIB(SM, main, 361 [vi_cv_smlib="yes"], [vi_cv_smlib="no"], "$XLIBS") 362 if test "$vi_cv_smlib" = "yes"; then 363 MOTIFLIBS="$MOTIFLIBS -lSM" 364 fi 365 AC_CHECK_LIB(ICE, main, 366 [vi_cv_icelib="yes"], [vi_cv_icelib="no"], "$XLIBS") 367 if test "$vi_cv_icelib" = "yes"; then 368 MOTIFLIBS="$MOTIFLIBS -lICE" 369 fi 370 AC_CHECK_LIB(Xext, main, 371 [vi_cv_xextlib="yes"], [vi_cv_xextlib="no"], "$XLIBS") 372 if test "$vi_cv_xextlib" = "yes"; then 373 MOTIFLIBS="$MOTIFLIBS -lXext" 374 fi 375 AC_CHECK_LIB(Xpm, main, 376 [vi_cv_xpmlib="yes"], [vi_cv_xpmlib="no"], "$XLIBS") 377 if test "$vi_cv_xpmlib" = "yes"; then 378 MOTIFLIBS="$MOTIFLIBS -lXpm" 379 fi 380 MOTIFLIBS="$MOTIFLIBS $XLIBS -lm $LIBS" 381fi 382 383AC_SUBST(IPCOBJS) 384dnl Check for threads 385AC_MSG_CHECKING(if --enable-threads option specified) 386AC_ARG_ENABLE(threads, 387 [ --enable-threads Turn on thread support.], 388 [vi_cv_threads=$enableval], [vi_cv_threads="no"]) 389AC_MSG_RESULT($vi_cv_threads) 390if test "$vi_cv_threads" = "yes"; then 391 LIBS="$LIBS -lpthread" 392 AC_CACHE_VAL(vi_cv_have_pthreads, [dnl 393 AC_TRY_LINK([#include <pthread.h>], 394 [pthread_self()], 395 [vi_cv_have_pthreads=yes], 396 [vi_cv_have_pthreads=no])]) 397 if test "$vi_cv_have_pthreads" = "no"; then 398 AC_MSG_ERROR(No threading library found) 399 fi 400 IPCOBJS="pthread.o $IPCOBJS" 401 AC_DEFINE(HAVE_PTHREAD, 1, [Define if using pthread.]) 402else 403 IPCOBJS="nothread.o $IPCOBJS" 404fi 405 406dnl If the user wants a Perl interpreter in nvi, load it. 407AC_SUBST(shrpenv) 408AC_SUBST(perlldflags) 409AC_SUBST(perllibs) 410AC_SUBST(vi_cv_perllib) 411AC_MSG_CHECKING(if --enable-perlinterp option specified) 412AC_ARG_ENABLE(perlinterp, 413 [ --enable-perlinterp Include a Perl interpreter in vi.], 414 [vi_cv_perlinterp=$enableval], [vi_cv_perlinterp="no"]) 415AC_MSG_RESULT($vi_cv_perlinterp) 416if test "$vi_cv_perlinterp" = "yes"; then 417 if test "$vi_cv_path_perl" = no; then 418 AC_MSG_ERROR([No perl5 utility found.]) 419 fi 420 $vi_cv_path_perl -e 'require 5.004' || { 421 AC_MSG_ERROR([perl5 must be version 5.004 or later.]) 422 } 423 if test "$vi_cv_threads" = "yes"; then 424 useithreads=`$vi_cv_path_perl -MConfig -e 'print $Config{useithreads}'` 425 if test "X$useithreads" != "Xdefine"; then 426 AC_MSG_ERROR([vi threading only compatible with perl's ithreads.]) 427 fi 428 fi 429 430 eval `$vi_cv_path_perl -V:shrpenv` 431 vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlib}'` 432 perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \ 433 -e 'ccflags;perl_inc'` 434 if test "X$perlcppflags" != "X"; then 435 CPPFLAGS="$perlcppflags $CPPFLAGS" 436 fi 437 perllibs=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \ 438 -e 'ldopts'` 439 perlldflags=`cd $srcdir;$vi_cv_path_perl -MExtUtils::Embed \ 440 -e 'ccdlflags'` 441 LIBOBJS="perl.o perlxsi.o perlsfio.o $LIBOBJS" 442 AC_DEFINE(HAVE_PERL_INTERP, 1, 443 [Define if you want to compile in the Perl interpreter.]) 444 AC_CACHE_CHECK([whether we need to use perl's setenv], 445 vi_cv_perl_setenv, [ 446 AC_TRY_RUN([ 447#include <EXTERN.h> 448#include <perl.h> 449#include <XSUB.h> 450int main(){ 451#if defined(USE_ENVIRON_ARRAY) && !defined(PERL_USE_SAFE_PUTENV) 452exit(0); 453#else 454exit(1); 455#endif 456} 457 ], [vi_cv_perl_setenv=yes], [vi_cv_perl_setenv=no])]) 458 if test "$vi_cv_perl_setenv" = yes; then 459 AC_DEFINE(USE_PERL_SETENV, 1, 460 [Define when perl's setenv should be used.]) 461 fi 462fi 463 464dnl If the user wants a Tk/Tcl interpreter in nvi, load it. Make sure that 465dnl we can find a Tk/Tcl library. 466AC_MSG_CHECKING(if --enable-tclinterp option specified) 467AC_ARG_ENABLE(tclinterp, 468 [ --enable-tclinterp Include a Tk/Tcl interpreter in vi.], 469 [vi_cv_tclinterp=$enableval], [vi_cv_tclinterp="no"]) 470AC_MSG_RESULT($vi_cv_tclinterp) 471if test "$vi_cv_tclinterp" = "yes"; then 472 AC_MSG_CHECKING([for tclConfig.sh]) 473 AC_CACHE_VAL(vi_cv_tclconfig, [ 474 vi_cv_tclconfig=`$srcdir/findconfig`]) 475 AC_MSG_RESULT($vi_cv_tclconfig) 476 if test "x$vi_cv_tclconfig" = x; then 477 AC_MSG_ERROR([No Tcl library found;]) 478 fi 479 . $vi_cv_tclconfig 480 LIBOBJS="tcl.o $LIBOBJS" 481 LIBS="$TCL_LIB_SPEC $TCL_LIBS $LIBS" 482 AC_DEFINE(HAVE_TCL_INTERP, 1, 483 [Define if you want to compile in the Tcl interpreter.]) 484fi 485 486dnl check for curses 487AC_SUBST(CURSLIBS) 488AC_SUBST(CURSCPPFLAGS) 489AC_SUBST(CURSLDFLAGS) 490AC_SUBST(HAVE_NCURSESW) 491 492dnl AC_ARG_WITH(slang, 493dnl [ --with-slang[=DIR] Use S-Lang instead of curses. ], 494dnl [ 495dnl if test "$withval" != yes; then 496dnl LDFLAGS="-L${withval}/lib $LDFLAGS" 497dnl CPPFLAGS="-I${withval}/include $CPPFLAGS" 498dnl fi 499dnl AC_DEFINE(USE_SLANG_CURSES) 500dnl AC_CHECK_LIB(slang, SLtt_get_terminfo, 501dnl [CURSLIBS="$CURSLIBS -lslang -lm"], 502dnl [AC_MSG_ERROR(unable to compile. check config.log)], -lm) 503dnl 504dnl vi_cv_curses=slcurses 505dnl ], 506dnl [ 507 SAVELIBS="$LIBS" 508 SAVELDFLAGS="$LDFLAGS" 509 SAVECPPFLAGS="$CPPFLAGS" 510 AC_ARG_WITH(curses, 511 [ --with-curses=DIR Path to curses installation. ]) 512 if test "x$with_curses" != "x"; then 513 CURSLDFLAGS="`echo $with_curses/lib | sed "$LRscript"` $CURSLDFLAGS" 514 CURSCPPFLAGS="-I$with_curses/include $CURSCPPFLAGS" 515 fi; 516 LDFLAGS="$CURSLDFLAGS $LDFLAGS" 517 CPPFLAGS="$CURSCPPFLAGS $CPPFLAGS" 518 519 if test "$vi_cv_widechar" = "yes"; then 520 for vi_cv_curses in ncurses ncursesw curses; do 521 AC_CHECK_LIB($vi_cv_curses, waddnwstr,[break]) 522 vi_cv_curses=unknown 523 done 524 else 525 for vi_cv_curses in ncurses ncursesw curses; do 526 AC_CHECK_LIB($vi_cv_curses, initscr, [break]) 527 vi_cv_curses=unknown 528 done 529 fi 530 531 if test "$vi_cv_curses" != "unknown"; then 532 CURSHEADER=curses.h 533 if test "$vi_cv_curses" = "ncurses"; then 534 AC_CHECK_HEADERS(ncurses.h, [CURSHEADER=ncurses.h]) 535 fi 536 if test "$vi_cv_curses" = "ncursesw"; then 537 AC_CHECK_HEADERS(ncursesw/ncurses.h, 538 [CURSHEADER=ncursesw/ncurses.h]) 539 fi 540 vi_programs="vi $vi_programs" 541 CURSLIBS="-l$vi_cv_curses" 542 else 543 AC_MSG_WARN([*** No suitable curses library found.]) 544 if test "$vi_programs"X = X; then 545 AC_MSG_ERROR([No executable to build.]) 546 fi 547 fi 548 549dnl Check for the termcap/termlib library. These two checks must occur in the 550dnl current order, and -lcurses must be loaded before -ltermcap/-ltermlib. 551dnl On Solaris curses==termlib, but different versions of curses 552dnl can be used. Avoid loading termlib is curses has tgetent. 553AC_CHECK_LIB($vi_cv_curses, tgetent, 554 [vi_cv_curses_tgetent=yes], [vi_cv_curses_tgetent=no]) 555if test "$vi_cv_curses_tgetent" = no; then 556 AC_CHECK_LIB(termlib, tgetent, 557 [vi_cv_termlib=-ltermlib], [vi_cv_termlib=no]) 558 if test "$vi_cv_termlib" = no; then 559 AC_CHECK_LIB(termcap, tgetent, 560 [vi_cv_termlib=-ltermcap], [vi_cv_termlib=no]) 561 fi 562fi 563if test "$vi_cv_termlib" != no; then 564 CURSLIBS="$CURSLIBS $vi_cv_termlib" 565fi 566 567 LIBS="$SAVELIBS" 568 LDFLAGS="$SAVELDFLAGS" 569 CPPFLAGS="$SAVECPPFLAGS" 570dnl ]) 571 572dnl Checks for header files. 573AC_MSG_CHECKING(for sys/mman.h) 574AC_CACHE_VAL(vi_cv_include_sys_mman, [dnl 575AC_TRY_CPP([#include <sys/mman.h>], 576 [vi_cv_include_sys_mman=yes], [vi_cv_include_sys_mman=no])]) 577if test "$vi_cv_include_sys_mman" = yes; then 578 AC_DEFINE(HAVE_SYS_MMAN_H, 1, [Define if you have <sys/mman.h>]) 579fi 580AC_MSG_RESULT($vi_cv_include_sys_mman) 581 582AC_MSG_CHECKING(for sys/select.h) 583AC_CACHE_VAL(vi_cv_include_sys_select, [dnl 584AC_TRY_CPP([#include <sys/select.h>], 585 [vi_cv_include_sys_select=yes], [vi_cv_include_sys_select=no])]) 586if test "$vi_cv_include_sys_select" = yes; then 587 AC_DEFINE(HAVE_SYS_SELECT_H, 1, [Define if you have <sys/select.h]) 588fi 589AC_MSG_RESULT($vi_cv_include_sys_select) 590 591dnl Checks for typedefs, structures, and compiler characteristics. 592AC_CHECK_TYPE(ssize_t, int) 593AC_C_BIGENDIAN 594AC_C_CONST 595AC_STRUCT_ST_BLKSIZE 596AC_TYPE_MODE_T 597AC_TYPE_OFF_T 598AC_TYPE_PID_T 599AC_TYPE_SIZE_T 600AC_STRUCT_TM 601 602dnl AC_CHECK_HEADER(sys/cdefs.h, [], [AC_CONFIG_FILES([sys/cdefs.h:../db.1.85/PORT/include/cdefs.h])]) 603 604dnl Checks for library functions. 605VI_CV_REPLACE_FUNCS(bsearch gethostname memchr memset) 606VI_CV_REPLACE_FUNCS(mkstemp mmap strdup strpbrk) 607VI_CV_REPLACE_FUNCS(snprintf vsnprintf) 608 609AC_CHECK_FUNCS(select memcpy) 610AC_CHECK_FUNCS(setenv, [need_env=no], [need_env=yes]) 611AC_CHECK_FUNCS(strsep, [need_strsep=no], [need_strsep=yes]) 612AC_CHECK_FUNCS(unsetenv,, [need_env=yes]) 613 614AC_FUNC_MMAP 615AC_FUNC_VFORK 616 617dnl If we needed setenv or unsetenv, add in the clib/env.c replacement file. 618if test "$need_env" = yes; then 619 LIBOBJS="env.o $LIBOBJS" 620fi 621 622dnl If we need strsep, add it and define it so we get a prototype. 623if test "$need_strsep" = yes; then 624 LIBOBJS="strsep.o $LIBOBJS" 625fi 626 627dnl Check for fcntl/flock 628dnl Use flock preferentially, since it has cleaner semantics and won't 629dnl hang up the editor. 630dnl XXX 631dnl Ultrix has a broken fcntl, but a working flock. 632dnl IRIX and DGUX have a broken flock, but working fcntl. 633AC_MSG_CHECKING(for fcntl/flock) 634AC_CACHE_VAL(vi_cv_lock, [dnl 635 vi_cv_lock=none 636 case "$host_os" in 637 dgux*);; 638 irix*);; 639 *) 640 AC_TRY_LINK([#include <fcntl.h>], [flock(0, 0);], 641 [vi_cv_lock=flock]);; 642 esac 643 if test "$vi_cv_lock" = none; then 644 AC_TRY_LINK([#include <fcntl.h>], [fcntl(0, F_SETLK, 0);], 645 [vi_cv_lock=fcntl]) 646 fi]) 647 648if test "$vi_cv_lock" = flock; then 649 AC_DEFINE(HAVE_LOCK_FLOCK, 1, 650 [Define if you have flock(2) style locking.]) 651fi 652if test "$vi_cv_lock" = fcntl; then 653 AC_DEFINE(HAVE_LOCK_FCNTL, 1, 654 [Define if you have fcntl(2) style locking.]) 655fi 656AC_MSG_RESULT($vi_cv_lock) 657 658dnl Check for ftruncate/chsize 659AC_MSG_CHECKING(for ftruncate/chsize) 660AC_CACHE_VAL(vi_cv_ftruncate, [dnl 661AC_TRY_LINK([#include <unistd.h>], [ftruncate(0, 0);], 662 [vi_cv_ftruncate=ftruncate], 663AC_TRY_LINK([#include <unistd.h>], [chsize(0, 0);], 664 [vi_cv_ftruncate=chsize], [vi_cv_ftruncate=no]))]) 665if test "$vi_cv_ftruncate" = ftruncate; then 666 AC_DEFINE(HAVE_FTRUNCATE_FTRUNCATE, 1, 667 [Define if you have the ftruncate(2) system call.]) 668fi 669if test "$vi_cv_ftruncate" = chsize; then 670 AC_DEFINE(HAVE_FTRUNCATE_CHSIZE, 1, 671 [Define if you have the chsize(2) system call.]) 672fi 673if test "$vi_cv_ftruncate" = no; then 674 AC_MSG_ERROR([No file truncation system call.]) 675fi 676AC_MSG_RESULT($vi_cv_ftruncate) 677 678CSAVELIBS="$LIBS" 679CSAVELDFLAGS="$LDFLAGS" 680CSAVECPPFLAGS="$CPPFLAGS" 681LIBS="$CURSLIBS $LIBS" 682LDFLAGS="$CURSLDFLAGS $LDFLAGS" 683CPPFLAGS="$CURSCPPFLAGS $CPPFLAGS" 684dnl Check for the tigetstr/tigetnum functions. 685AC_MSG_CHECKING(for tigetstr/tigetnum) 686AC_CACHE_VAL(vi_cv_have_curses_tigetstr, [dnl 687AC_TRY_LINK([#include <$CURSHEADER>], [tigetstr(0);], 688 [vi_cv_have_curses_tigetstr=yes], 689 [vi_cv_have_curses_tigetstr=no])]) 690if test "$vi_cv_have_curses_tigetstr" = yes; then 691 AC_DEFINE(HAVE_CURSES_TIGETSTR, 1, 692 [Define if you have the curses(3) tigetstr/tigetnum functions.]) 693fi 694AC_MSG_RESULT($vi_cv_have_curses_tigetstr) 695 696dnl Check for potentially missing curses functions in system or user-specified 697dnl libraries. We also have to guess at whether the specified library is a 698dnl BSD or System V style curses. Use the newterm function, all System V 699dnl curses implementations have it, none, as far as I know, of the BSD ones do. 700if test "$vi_cv_curses" = "bundled curses"; then 701 AC_DEFINE(HAVE_BSD_CURSES, 1, 702 [Define if you have a BSD version of curses.]) 703 AC_DEFINE(HAVE_CURSES_WADDNSTR, 1, 704 [Define if you have the curses(3) waddnstr function.]) 705 AC_DEFINE(HAVE_CURSES_IDLOK, 1, 706 [Define if you have the curses(3) idlok function.]) 707else 708 dnl Check for the waddnstr function. 709 AC_MSG_CHECKING(for waddnstr) 710 AC_CACHE_VAL(vi_cv_have_curses_waddnstr, [dnl 711 AC_TRY_LINK([#include <$CURSHEADER>], [waddnstr(stdscr, 0, 0);], 712 [vi_cv_have_curses_waddnstr=yes], 713 [vi_cv_have_curses_waddnstr=no])]) 714 if test "$vi_cv_have_curses_waddnstr" = yes; then 715 AC_DEFINE(HAVE_CURSES_WADDNSTR, 1, 716 [Define if you have the curses(3) waddnstr function.]) 717 fi 718 AC_MSG_RESULT($vi_cv_have_curses_waddnstr) 719 720 dnl Check for the beep function. 721 AC_MSG_CHECKING(for beep) 722 AC_CACHE_VAL(vi_cv_have_curses_beep, [dnl 723 AC_TRY_LINK([#include <$CURSHEADER>], [beep();], 724 [vi_cv_have_curses_beep=yes], 725 [vi_cv_have_curses_beep=no])]) 726 if test "$vi_cv_have_curses_beep" = yes; then 727 AC_DEFINE(HAVE_CURSES_BEEP, 1, 728 [Define if you have the curses(3) beep function.]) 729 fi 730 AC_MSG_RESULT($vi_cv_have_curses_beep) 731 732 dnl Check for the flash function. 733 AC_MSG_CHECKING(for flash) 734 AC_CACHE_VAL(vi_cv_have_curses_flash, [dnl 735 AC_TRY_LINK([#include <$CURSHEADER>], [flash();], 736 [vi_cv_have_curses_flash=yes], 737 [vi_cv_have_curses_flash=no])]) 738 if test "$vi_cv_have_curses_flash" = yes; then 739 AC_DEFINE(HAVE_CURSES_FLASH, 1, 740 [Define if you have the curses(3) flash function.]) 741 fi 742 AC_MSG_RESULT($vi_cv_have_curses_flash) 743 744 dnl Check for the idlok function. 745 AC_MSG_CHECKING(for idlok) 746 AC_CACHE_VAL(vi_cv_have_curses_idlok, [dnl 747 AC_TRY_LINK([#include <$CURSHEADER>], [idlok(0, 0);], 748 [vi_cv_have_curses_idlok=yes], 749 [vi_cv_have_curses_idlok=no])]) 750 if test "$vi_cv_have_curses_idlok" = yes; then 751 AC_DEFINE(HAVE_CURSES_IDLOK, 1, 752 [Define if you have the curses(3) idlok function.]) 753 fi 754 AC_MSG_RESULT($vi_cv_have_curses_idlok) 755 756 dnl Check for the keypad function. 757 AC_MSG_CHECKING(for keypad) 758 AC_CACHE_VAL(vi_cv_have_curses_keypad, [dnl 759 AC_TRY_LINK([#include <$CURSHEADER>], [keypad(0, 0);], 760 [vi_cv_have_curses_keypad=yes], 761 [vi_cv_have_curses_keypad=no])]) 762 if test "$vi_cv_have_curses_keypad" = yes; then 763 AC_DEFINE(HAVE_CURSES_KEYPAD, 1, 764 [Define if you have the curses(3) keypad function.]) 765 fi 766 AC_MSG_RESULT($vi_cv_have_curses_keypad) 767 768 dnl Check for the newterm function. 769 AC_MSG_CHECKING(for newterm) 770 AC_CACHE_VAL(vi_cv_have_curses_newterm, [dnl 771 AC_TRY_LINK([#include <$CURSHEADER>], [newterm(0, 0, 0);], 772 [vi_cv_have_curses_newterm=yes], 773 [vi_cv_have_curses_newterm=no])]) 774 if test "$vi_cv_have_curses_newterm" = yes; then 775 AC_DEFINE(HAVE_CURSES_NEWTERM, 1, 776 [Define if you have the curses(3) newterm function.]) 777 fi 778 AC_MSG_RESULT($vi_cv_have_curses_newterm) 779 780 if test "$vi_cv_have_curses_newterm" = no; then 781 AC_DEFINE(HAVE_BSD_CURSES, 1, 782 [Define if you have a BSD version of curses.]) 783 fi 784fi 785 786dnl Check for the setupterm function. We make this check regardless of 787dnl using the system library, because it may be part of the underlying 788dnl termcap/termlib support, and we want to use the local one. 789AC_MSG_CHECKING(for setupterm) 790AC_CACHE_VAL(vi_cv_have_curses_setupterm, [dnl 791AC_TRY_LINK([#include <$CURSHEADER>], [setupterm(0, 0, 0);], 792 [vi_cv_have_curses_setupterm=yes], 793 [vi_cv_have_curses_setupterm=no])]) 794if test "$vi_cv_have_curses_setupterm" = yes; then 795 AC_DEFINE(HAVE_CURSES_SETUPTERM, 1, 796 [Define if you have the curses(3) setupterm function.]) 797fi 798AC_MSG_RESULT($vi_cv_have_curses_setupterm) 799LIBS="$CSAVELIBS" 800LDFLAGS="$CSAVELDFLAGS" 801CPPFLAGS="$CSAVECPPFLAGS" 802 803dnl Some moron decided to drop off an argument from the gettimeofday call, 804dnl without changing the name. 805AC_MSG_CHECKING(for broken gettimeofday system call) 806AC_CACHE_VAL(vi_cv_gettimeofday, [dnl 807AC_TRY_LINK([#include <sys/types.h> 808#include <sys/time.h>], [gettimeofday(0, 0);], 809 [vi_cv_gettimeofday=okay], [vi_cv_gettimeofday=broken])]) 810if test "$vi_cv_gettimeofday" = broken; then 811 AC_DEFINE(HAVE_BROKEN_GETTIMEOFDAY, 1, 812 [Define if you have a System V-style (broken) gettimeofday.]) 813fi 814AC_MSG_RESULT($vi_cv_gettimeofday) 815 816dnl Check for which version of openpty to use, System V or Berkeley. 817AC_CACHE_VAL(vi_cv_sys5_pty, [dnl 818AC_CHECK_HEADER(sys/stropts.h, 819 [vi_cv_sys5_pty=yes], [vi_cv_sys5_pty=no])]) 820if test "$vi_cv_sys5_pty" = yes; then 821 AC_DEFINE(HAVE_SYS5_PTY, 1, 822 [Define if you have the System V style pty calls.]) 823fi 824AC_MSG_CHECKING(for System V pty calls) 825AC_MSG_RESULT($vi_cv_sys5_pty) 826 827dnl Check for the revoke system call. 828AC_MSG_CHECKING(for revoke system call) 829AC_CACHE_VAL(vi_cv_revoke, [dnl 830AC_TRY_LINK(, [revoke("a");], 831 [vi_cv_revoke=yes], [vi_cv_revoke=no])]) 832if test "$vi_cv_revoke" = yes; then 833 AC_DEFINE(HAVE_REVOKE, 1, 834 [Define if you have the Berkeley style revoke(2) system call.]) 835fi 836AC_MSG_RESULT($vi_cv_revoke) 837 838dnl Some versions of sprintf return a pointer to the first argument instead 839dnl of a character count. We assume that the return value of snprintf and 840dnl vsprintf etc. will be the same as sprintf, and check the easy one. 841AC_MSG_CHECKING(for int type sprintf return value) 842AC_CACHE_VAL(vi_cv_sprintf_count, [dnl 843AC_TRY_RUN([main(){char buf[20]; exit(sprintf(buf, "XXX") != 3);}], 844 [vi_cv_sprintf_count=yes], [vi_cv_sprintf_count=no])]) 845if test "$vi_cv_sprintf_count" = no; then 846 AC_DEFINE(SPRINTF_RET_CHARPNT, 1, 847 [Define if your sprintf returns a pointer, not a length.]) 848fi 849AC_MSG_RESULT($vi_cv_sprintf_count) 850 851 852dnl Check for the standard shorthand types. 853AC_SUBST(u_char_decl) 854AC_CACHE_CHECK([for u_char], vi_cv_uchar, [dnl 855AC_TRY_COMPILE([#include <sys/types.h>], u_char foo;, 856 [vi_cv_uchar=yes], [vi_cv_uchar=no])]) 857if test "$vi_cv_uchar" = no; then 858 u_char_decl="typedef unsigned char u_char;" 859fi 860 861AC_SUBST(u_short_decl) 862AC_CACHE_CHECK([for u_short], vi_cv_ushort, [dnl 863AC_TRY_COMPILE([#include <sys/types.h>], u_short foo;, 864 [vi_cv_ushort=yes], [vi_cv_ushort=no])]) 865if test "$vi_cv_ushort" = no; then 866 u_short_decl="typedef unsigned short u_short;" 867fi 868 869AC_SUBST(u_int_decl) 870AC_CACHE_CHECK([for u_int], vi_cv_uint, [dnl 871AC_TRY_COMPILE([#include <sys/types.h>], u_int foo;, 872 [vi_cv_uint=yes], [vi_cv_uint=no])]) 873if test "$vi_cv_uint" = no; then 874 u_int_decl="typedef unsigned int u_int;" 875fi 876 877AC_SUBST(u_long_decl) 878AC_CACHE_CHECK([for u_long], vi_cv_ulong, [dnl 879AC_TRY_COMPILE([#include <sys/types.h>], u_long foo;, 880 [vi_cv_ulong=yes], [vi_cv_ulong=no])]) 881if test "$vi_cv_ulong" = no; then 882 u_long_decl="typedef unsigned long u_long;" 883fi 884 885dnl DB/Vi use specific integer sizes. 886AC_SUBST(u_int8_decl) 887AC_CACHE_CHECK([for u_int8_t], vi_cv_uint8, [dnl 888AC_TRY_COMPILE([#include <sys/types.h>], u_int8_t foo;, 889 [vi_cv_uint8=yes], 890 AC_TRY_RUN([main(){exit(sizeof(unsigned char) != 1);}], 891 [vi_cv_uint8="unsigned char"], [vi_cv_uint8=no]))]) 892if test "$vi_cv_uint8" = no; then 893 AC_MSG_ERROR(No unsigned 8-bit integral type.) 894fi 895if test "$vi_cv_uint8" != yes; then 896 u_int8_decl="typedef $vi_cv_uint8 u_int8_t;" 897fi 898 899AC_SUBST(u_int16_decl) 900AC_CACHE_CHECK([for u_int16_t], vi_cv_uint16, [dnl 901AC_TRY_COMPILE([#include <sys/types.h>], u_int16_t foo;, 902 [vi_cv_uint16=yes], 903AC_TRY_RUN([main(){exit(sizeof(unsigned short) != 2);}], 904 [vi_cv_uint16="unsigned short"], 905AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 2);}], 906 [vi_cv_uint16="unsigned int"], [vi_cv_uint16=no])))]) 907if test "$vi_cv_uint16" = no; then 908 AC_MSG_ERROR([No unsigned 16-bit integral type.]) 909fi 910if test "$vi_cv_uint16" != yes; then 911 u_int16_decl="typedef $vi_cv_uint16 u_int16_t;" 912fi 913 914AC_SUBST(int16_decl) 915AC_CACHE_CHECK([for int16_t], vi_cv_int16, [dnl 916AC_TRY_COMPILE([#include <sys/types.h>], int16_t foo;, 917 [vi_cv_int16=yes], 918AC_TRY_RUN([main(){exit(sizeof(short) != 2);}], 919 [vi_cv_int16="short"], 920AC_TRY_RUN([main(){exit(sizeof(int) != 2);}], 921 [vi_cv_int16="int"], [vi_cv_int16=no])))]) 922if test "$vi_cv_int16" = no; then 923 AC_MSG_ERROR([No signed 16-bit integral type.]) 924fi 925if test "$vi_cv_int16" != yes; then 926 int16_decl="typedef $vi_cv_int16 int16_t;" 927fi 928 929AC_SUBST(u_int32_decl) 930AC_CACHE_CHECK([for u_int32_t], vi_cv_uint32, [dnl 931AC_TRY_COMPILE([#include <sys/types.h>], u_int32_t foo;, 932 [vi_cv_uint32=yes], 933AC_TRY_RUN([main(){exit(sizeof(unsigned int) != 4);}], 934 [vi_cv_uint32="unsigned int"], 935AC_TRY_RUN([main(){exit(sizeof(unsigned long) != 4);}], 936 [vi_cv_uint32="unsigned long"], [vi_cv_uint32=no])))]) 937if test "$vi_cv_uint32" = no; then 938 AC_MSG_ERROR([No unsigned 32-bit integral type.]) 939fi 940if test "$vi_cv_uint32" != yes; then 941 u_int32_decl="typedef $vi_cv_uint32 u_int32_t;" 942fi 943 944AC_SUBST(int32_decl) 945AC_CACHE_CHECK([for int32_t], vi_cv_int32, [dnl 946AC_TRY_COMPILE([#include <sys/types.h>], int32_t foo;, 947 [vi_cv_int32=yes], 948AC_TRY_RUN([main(){exit(sizeof(int) != 4);}], 949 [vi_cv_int32="int"], 950AC_TRY_RUN([main(){exit(sizeof(long) != 4);}], 951 [vi_cv_int32="long"], [vi_cv_int32=no])))]) 952if test "$vi_cv_int32" = no; then 953 AC_MSG_ERROR([No signed 32-bit integral type.]) 954fi 955if test "$vi_cv_int32" != yes; then 956 int32_decl="typedef $vi_cv_int32 int32_t;" 957fi 958 959AC_CACHE_CHECK([return type of fprintf], vi_cv_type_fprintf, 960[AC_TRY_COMPILE([#include <stdio.h> 961int fprintf (); 962],[int i;], vi_cv_type_fprintf=int, vi_cv_type_fprintf=void)]) 963 964AC_SUBST(NEED_FPRINTF_PROTO) 965AC_CACHE_CHECK([fprintf prototype needed], vi_cv_proto_fprintf, 966[AC_TRY_COMPILE([ #include <stdio.h> 967typedef int (*funcPtr)(); 968],[funcPtr ptr = (funcPtr) fprintf;], 969vi_cv_proto_fprintf=no, 970[vi_cv_proto_fprintf=yes])]) 971if test "$vi_cv_proto_fprintf" = yes; then 972 AC_DEFINE(NEED_FPRINTF_PROTO, 1, 973 [Define when fprintf prototype not in an obvious place.]) 974fi 975 976AC_ARG_WITH(db_type, 977 [ --with-db=bundled|system Which db to use. ]) 978 979dnl Check for DB 3 980AC_ARG_WITH(db_prefix, 981 [ --with-db-prefix=PFX Path to db installation. ]) 982 983AC_SUBST(DB_LDFLAGS) 984AC_SUBST(DB_CPPFLAGS) 985if test "x$with_db_prefix" != "x"; then 986 DB_LDFLAGS="-L$with_db_prefix/lib $LDFLAGS" 987 DB_CPPFLAGS="-I$with_db_prefix/include $CPPFLAGS" 988 with_db_type="system" 989fi 990 991AC_MSG_CHECKING(which db to use) 992case "$with_db_type" in 993"system") 994 ;; 995*) 996 with_db_type="bundled" 997 ;; 998esac 999AC_MSG_RESULT($with_db_type) 1000AM_CONDITIONAL(BUNDLED_DB, test $with_db_type = bundled) 1001 1002case "$with_db_type" in 1003bundled) 1004 AC_DEFINE(USE_BUNDLED_DB, 1, [Define when using bundled db.]) 1005 LIBOBJS="log1.o $LIBOBJS" 1006 ;; 1007system) 1008 SAVELDFLAGS="$LDFLAGS" 1009 SAVELIBS="$LIBS" 1010 1011 if test "x$with_db_prefix" != "x"; then 1012 LDFLAGS="-L$with_db_prefix/lib $LDFLAGS" 1013 CPPFLAGS="-I$with_db_prefix/include $CPPFLAGS" 1014 with_db_type="system" 1015 fi 1016 1017 LIBS="$LIBS -ldb" 1018 AC_TRY_LINK([#include <db.h>], 1019 [db_create(NULL,NULL,0)], 1020 [vi_cv_dbfatal="no"], [vi_cv_dbfatal="yes"]) 1021 if test "$vi_cv_dbfatal" = "yes"; then 1022 AC_MSG_ERROR([Need DB 3.]) 1023 fi 1024 1025 LIBS="$SAVELIBS" 1026 LDFLAGS="$SAVELDFLAGS" 1027 1028 AC_SUBST(dl_src) 1029 AC_MSG_CHECKING(if --enable-dynamic-loading option specified) 1030 AC_ARG_ENABLE(dynamic-loading, 1031 [ --enable-dynamic-loading Load DB 3 dynamically.], 1032 [vi_cv_dl=$enableval], [vi_cv_dl="no"]) 1033 AC_MSG_RESULT($vi_cv_dl) 1034 if test "$vi_cv_dl" = yes; then 1035 AC_CHECK_LIB(dl, dlopen, 1036 [vi_cv_dlfatal="no"], [vi_cv_dlfatal="yes"]) 1037 if test "$vi_cv_dlfatal" = "yes"; then 1038 AC_MSG_ERROR([Need dl to support dynamic loading.]) 1039 fi 1040 OLDPATH="$PATH" 1041 1042 PATH="$with_db_prefix/lib:/usr/lib:/lib" 1043 AC_PATH_PROG(vi_cv_path_db3, libdb-3.so, no) 1044 if test "$vi_cv_path_db3" = no; then 1045 AC_MSG_ERROR([Path of libdb-3.so not found.]) 1046 fi 1047 PATH="$OLDPATH" 1048 1049 AC_DEFINE(USE_DYNAMIC_LOADING, 1, 1050 [Define when dynamically loading DB 3.]) 1051 LIBOBJS="dldb.o $LIBOBJS" 1052 dl_src=../common/dldb.c 1053 LIBS="-ldl $LIBS" 1054 else 1055 LIBS="-ldb $LIBS" 1056 if test "X$with_db_prefix" != "X"; then 1057 LDFLAGS="`echo $with_db_prefix/lib | sed "$LRscript"` $LDFLAGS" 1058 fi 1059 fi 1060 1061 AC_ARG_WITH(db_build, 1062 [ --with-db-build=prefix Path to db build. ]) 1063 if test "x$with_db_build" != "x"; then 1064 vi_cv_dbsrc=`$AWK '/^srcdir/ {gsub("srcdir[[ \t]]*=","");print $1}' \ 1065 $with_db_build/Makefile` 1066 case $with_db_build in 1067 *[[\\/]]);; 1068 *) 1069 with_db_build="$with_db_build/";; 1070 esac 1071 case $vi_cv_dbsrc in 1072 [[\\/]]*);; 1073 *) 1074 vi_cv_dbsrc="$with_db_build$vi_cv_dbsrc";; 1075 esac 1076 fi; 1077 1078 vi_cv_db4="no" 1079 AC_ARG_ENABLE(log4, 1080 [ --enable-db4-logging Enable experimental/broken db4 logging.], 1081 [ 1082 AC_MSG_CHECKING(for DB 4) 1083 AC_EGREP_CPP([^4], 1084 [#include <db.h> 1085 DB_VERSION_MAJOR], 1086 [vi_cv_db4="yes"], [vi_cv_db4="no"]) 1087 AC_MSG_RESULT($vi_cv_db4) 1088 ]) 1089 if test "$vi_cv_db4" = "yes"; then 1090 DB_CPPFLAGS="-I$vi_cv_dbsrc/include $DB_CPPFLAGS" 1091 DB_CPPFLAGS="-I$vi_cv_dbsrc/include_auto $DB_CPPFLAGS" 1092 DB_CPPFLAGS="-I$with_db_build $DB_CPPFLAGS" 1093 AC_DEFINE(USE_DB4_LOGGING, 1, [Define when using db4 logging.]) 1094 LIBOBJS="log4.o vi_auto.o vi_rec.o $LIBOBJS" 1095 else 1096 LIBOBJS="log.o $LIBOBJS" 1097 fi 1098 ;; 1099esac 1100 1101dnl We compile in nvi's RE routines unless the user specifies otherwise. 1102AC_MSG_CHECKING(if --disable-re option specified) 1103AC_ARG_ENABLE(re, 1104 [ --disable-re DON'T use the nvi-provided RE routines.], 1105 [if test "$enable_re" = "yes"; then 1106 vi_cv_re_lib="bundled RE" 1107 else 1108 vi_cv_re_lib="other RE" 1109 fi],[vi_cv_re_lib="bundled RE"]) 1110AC_MSG_RESULT($vi_cv_re_lib) 1111case "$vi_cv_re_lib" in 1112"bundled RE") 1113 CPPFLAGS="-I\$(visrcdir)/regex $CPPFLAGS" 1114 LIBOBJS="regcomp.o regerror.o regexec.o regfree.o $LIBOBJS";; 1115"other RE") 1116 ;; 1117esac 1118 1119AC_OUTPUT(Makefile port.h:port.h.in compat.h:port.h.in 1120 pathnames.h:pathnames.h.in recover:recover.in) 1121