dnl Process this file with autoconf to produce a configure script. AC_REVISION($Revision: 1.73 $) AC_PREREQ(2.12) ### Use "configure -with-screen" to override the default configuration, which is ### termcap-based on unix systems. dnl $Header: /usr/build/vile/vile/RCS/configure.in,v 1.73 1997/12/07 12:25:11 tom Exp $ dnl AC_INIT(mktbls.c) CF_CHECK_CACHE ### checks for alternative programs AC_PROG_CC AC_PROG_CPP AC_GCC_TRADITIONAL AC_PROG_INSTALL AC_PROGRAM_PATH(TD_CONFIG,td_config) CF_DISABLE_ECHO CF_ARG_DISABLE(extensions, [ --disable-extensions test: build only core functions], [AC_DEFINE(SMALLER) AC_DEFINE(FEWNAMES)], [EXTRAOBJS="$EXTRAOBJS btree.o crypt.o"]) CF_ARG_DISABLE(shell, [ --disable-shell test: disable shell/external commands], [AC_DEFINE(OPT_SHELL,0)], [EXTRAOBJS="$EXTRAOBJS npopen.o spawn.o"]) ### use option --with-cflags to set default CFLAGS AC_MSG_CHECKING(for CFLAGS options) AC_ARG_WITH(CFLAGS, [ --with-CFLAGS=value set default for \$CFLAGS], [cflags=$withval]) if test -z "$cflags"; then AC_ARG_WITH(cflags, [ --with-cflags=value (same as --with-CFLAGS)], [cflags=$withval]) fi # if the user specified nothing else, set -O. user can override # with --with-cflags=" " if test -n "$cflags"; then CFLAGS="$cflags" elif test -z "$CFLAGS" ; then CFLAGS="-O" fi AC_MSG_RESULT($cflags) AC_PATH_PROGS(perl_bin_path, perl5 perl, no) AC_ARG_WITH(perl, [ --with-perl enable use of Perl as an extension language], [ if test "$perl_bin_path" = no; then echo "Fatal configure error: perl not found." exit 1 fi $perl_bin_path -e 'require 5.003' || { echo "Fatal configure error: perl version must be 5.003 or greater." exit 1 } perl_lib_path=`$perl_bin_path -MConfig -e 'print $Config{privlib}'` AC_DEFINE(OPT_PERL) EXTRAOBJS="$EXTRAOBJS perl.o" LINK_PREFIX=`$perl_bin_path -MConfig -e 'print $Config{shrpenv}'` CFLAGS="$CFLAGS `$perl_bin_path -MExtUtils::Embed -e ccopts`" LIBS="$LIBS `$perl_bin_path -MExtUtils::Embed -e ldopts`"]) AC_SUBST(perl_lib_path) AC_SUBST(perl_bin_path) # X11 checks will sometimes add to CFLAGS. We want the state of CFLAGS # prior to these checks saved_CFLAGS="$CFLAGS" ### checks for UNIX variants that set C preprocessor variables AC_AIX AC_ISC_POSIX AC_MINIX dnl: why this? AC_DYNIX_SEQ AC_CHECK_FUNC(getpwnam,,AC_CHECK_LIB(sun,getpwnam)) # check for SCO. this is a hack, and should be split into individual # features -- the sys/time.h and select.h conflict, and the need for # ptem.h due to winsize struct. AC_CHECKING([for SCO by checking on /usr/bin/scosh]) AC_PROGRAM_CHECK(COULD_BE_SCO, [scosh], maybe, maybenot) if test "$COULD_BE_SCO" = "maybe" then AC_DEFINE(SYSTEM_LOOKS_LIKE_SCO) fi # check for a lint program. AC_CHECK_PROGS(LINT, lint alint lclint, []) if test -n "$LINT" then AC_DEFINE(SYSTEM_HAS_LINT_PROG) fi ### checks for header files AC_STDC_HEADERS AC_HEADER_DIRENT AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h stddef.h string.h memory.h fcntl.h \ poll.h termios.h termio.h sgtty.h \ ioctl.h select.h setjmp.h signal.h utime.h varargs.h) ### checks for header files (separate, to avoid bug in autoconf) AC_CHECK_HEADERS(sys/filio.h sys/ioctl.h sys/itimer.h \ sys/param.h \ sys/resource.h sys/wait.h sys/time.h sys/select.h) ### checks for typedefs AC_TYPE_SIGNAL AC_DEFINE(SIGT,RETSIGTYPE) if test $ac_cv_type_signal = void; then AC_DEFINE(SIGRET,[/*do nothing*/]) else AC_DEFINE(SIGRET,[return 0]) fi AC_TYPE_SIZE_T AC_TYPE_OFF_T AC_TYPE_UID_T AC_TYPE_PID_T AC_CHECK_TYPE(time_t, long) ### checks for library functions if test "$cross_compiling" = no; then AC_FUNC_SETVBUF_REVERSED fi ### checks for structures AC_STAT_MACROS_BROKEN AC_ST_BLKSIZE AC_ST_BLOCKS AC_ST_RDEV AC_TIME_WITH_SYS_TIME AC_STRUCT_TM ### checks for compiler characteristics AC_CONST CF_ANSI_CC_REQD # I haven't found a "losing" compiler to check the following on. I gather # that some losing compiler's can be found on pyramid's, aix, and Apple's AUX2. # (Lint on several platforms will complain, even when the compiler won't). AC_MSG_CHECKING([if switch cases work with structure offsets]) AC_CACHE_VAL(cf_cv_case_offsetof,[ AC_TRY_COMPILE([], [struct foo {int a,b;}; extern getpid(); switch(getpid()){case ((int) &(((struct foo *)0)->b)) : printf("foo"); } ], [cf_cv_case_offsetof=yes], [cf_cv_case_offsetof=no]) ]) AC_MSG_RESULT($cf_cv_case_offsetof) test $cf_cv_case_offsetof = no && AC_DEFINE(HAVE_LOSING_SWITCH_WITH_STRUCTURE_OFFSET) ### checks for system services and user specified options AC_LONG_FILE_NAMES CF_RESTARTABLE_PIPEREAD # is a read() of a pipe restartable? AC_SUBST(CFLAGS) AC_SUBST(LIBS) AC_SUBST(X_CFLAGS) AC_SUBST(X_LIBS) AC_SUBST(X_EXTRA_LIBS) AC_SUBST(SCREEN) AC_SUBST(TARGET) AC_SUBST(LINK_PREFIX) dnl dnl The killpg test and the tests for the presence of certain functions on dnl a particular operating system are done prior to the checks for existence dnl of screen libraries due to a problem with -lXt on certain SunOS systems. dnl The nature of this problem is described in the FAQ on X. Look for the dnl following subject: ``What are these problems with "_XtInherit not found" dnl on the Sun? ...'' The long and the short of it is that AC_HAVE_FUNCS will dnl not work properly (without being rewritten) if placed after adding -lXt to dnl LIBS on SunOS (and perhaps some others as well). dnl AC_FUNC_SETPGRP AC_FUNC_GETPGRP CF_KILLPG CF_ERRNO CF_SYS_ERRLIST AC_DEFINE(SYS_UNIX) AC_DEFINE(scrn_chosen) # Try to eventually eliminate the following AC_DEFINE(os_chosen) AC_MSG_CHECKING(for screen type) AC_ARG_WITH(screen, [ --with-screen=value specify terminal driver. The default is tcap, for the termcap/terminfo driver. Other values include ncurses (a special case of terminfo), X11, OpenLook, Motif, Athena, Xaw, Xaw3d, neXtaw and ansi.], [screen=$withval]) if test -z "$screen"; then AC_ARG_WITH(scr, [ --with-scr=value (same as --with-screen)], [screen=$withval]) fi termlib=none if test -z "$screen"; then screen=termcap; fi AC_MSG_RESULT($screen) : See if this is any type of xvile configuration: case "$screen" in changequote(,)dnl [Oo]pen[Ll]ook | [Mm]otif | [xX] | [Aa]thena | [xX][atTmMoO]* | [xX]11 | neXtaw ) changequote([,])dnl CF_X_TOOLKIT CF_IMAKE_CFLAGS X_CFLAGS="$X_CFLAGS $IMAKE_CFLAGS" LDFLAGS="$LDFLAGS $X_LIBS" CFLAGS="$CFLAGS $X_CFLAGS" SCREEN=x11 TARGET=xvile AC_DEFINE(DISP_X11) AC_DEFINE(XTOOLKIT) AC_CHECK_HEADERS(X11/IntrinsicI.h) ;; esac : Find the libraries that apply to the selected screen-type: case "$screen" in changequote(,)dnl [Oo]pen* | Xol ) changequote([,])dnl AC_DEFINE(OL_WIDGETS) if test -n "$OPENWINHOME"; then X_LIBS="$X_LIBS -L${OPENWINHOME}/lib" X_CFLAGS="$X_CFLAGS -I${OPENWINHOME}/include" fi LDFLAGS="$LDFLAGS $X_LIBS" AC_CHECK_LIB(Xmu,XmuClientWindow) AC_CHECK_LIB(Xol, OlToolkitInitialize, [LIBS="-lXol -lm $LIBS"], AC_ERROR( [Unable to successfully link OpenLook library (-lXol) with test program])) ;; motif* | Motif* | Xm ) AC_DEFINE(MOTIF_WIDGETS) AC_CHECK_HEADERS(X11/IntrinsicI.h Xm/XmP.h) AC_CHECK_LIB(gen,regcmp) AC_CHECK_LIB(Xmu,XmuClientWindow) AC_CHECK_LIB(Xext,XextCreateExtension, [LIBS="-lXext $LIBS"]) AC_CHECK_LIB(Xpm, XpmCreatePixmapFromXpmImage, [LIBS="-lXpm $LIBS"],, [$LIBS $X_EXTRA_LIBS]) AC_CHECK_LIB(XIM,XmbTextListToTextProperty)dnl needed for Unixware's Xm AC_CHECK_LIB(Xm, XmProcessTraversal, [LIBS="-lXm $LIBS"], AC_ERROR( [Unable to successfully link Motif library (-lXm) with test program]), [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS]) EXTRAOBJS="$EXTRAOBJS menu.o" ;; changequote(,)dnl [Aa]thena* | Xaw* | neXtaw ) changequote([,])dnl AC_DEFINE(ATHENA_WIDGETS) case $screen in #(vi *aw*) cf_x_athena=$screen ;; esac CF_X_ATHENA EXTRAOBJS="$EXTRAOBJS menu.o" ;; changequote(,)dnl x | X | [Xx][Tt]* | [Xx]11 ) changequote([,])dnl AC_DEFINE(NO_WIDGETS) ;; ansi) SCREEN=ansi TARGET=vile AC_DEFINE(DISP_ANSI) ;; * ) SCREEN=tcap TARGET=vile AC_DEFINE(DISP_TERMCAP) if test "$screen" = ncurses; then CF_NCURSES_LIBS termlib=terminfo fi # HP-UX 9.x terminfo has setupterm, but no tigetstr. if test "$termlib" = none; then AC_CHECK_LIB(termlib, tigetstr, [LIBS="$LIBS -ltermlib" termlib=terminfo]) fi if test "$termlib" = none; then AC_CHECK_LIB(termlib, tgoto, [LIBS="$LIBS -ltermlib" termlib=termcap]) fi if test "$termlib" = none; then # allow curses library for broken AIX system. AC_CHECK_LIB(curses, initscr, [LIBS="$LIBS -lcurses" termlib=termcap]) AC_CHECK_LIB(termcap, tgoto, [LIBS="$LIBS -ltermcap" termlib=termcap]) fi if test "$termlib" = none; then AC_CHECK_LIB(termcap, tgoto, [LIBS="$LIBS -ltermcap" termlib=termcap]) fi if test "$termlib" = none; then AC_WARN([Can't find -ltermlib, -lcurses, or -ltermcap]) fi ;; esac : Check for termcap vs terminfo: cf_tc_funcs="" cf_tc_externs="" if test "$termlib" = terminfo ; then AC_DEFINE(USE_TERMINFO) CF_CURSES_TERM_H cf_tc_funcs="tigetint tigetnum tparam tparm" cf_tc_externs="$cf_tc_funcs tgoto tigetstr tputs" elif test "$termlib" = termcap ; then # BSD 'tputs()' may need 'PC' to be set. AC_TRY_LINK([],[extern char PC; PC = 0], [AC_DEFINE(HAVE_EXTERN_TCAP_PC)]) AC_CHECK_HEADERS(termcap.h) cf_tc_funcs="tgetint tgetnum tparam tparm" cf_tc_externs="$cf_tc_funcs tgoto tgetstr tputs" fi if test "$termlib" != "none" ; then CF_TYPE_OUTCHAR fi LIBS="$LIBS $X_EXTRA_LIBS" AC_HAVE_FUNCS( \ access \ alarm \ getcwd \ gethostname \ getwd \ killpg \ link \ mkdir \ poll \ putenv \ select \ setitimer \ setsid \ setvbuf \ sigaction \ sigprocmask \ strchr \ strrchr \ symlink \ tcgetattr \ ttyname \ utime \ utimes \ $cf_tc_funcs \ ) CF_ANSI_QSORT ### Miscellaneous options if test -n "$cf_x_athena" ; then AC_MSG_CHECKING(if you want to use Xaw scrollbars rather than our own) AC_ARG_WITH(Xaw-scrollbars, [ --with-Xaw-scrollbars use Xaw scrollbars rather than our own], [cf_Xaw_scrollbars=$withval], [cf_Xaw_scrollbars=no]) AC_MSG_RESULT($cf_Xaw_scrollbars) if test "$cf_Xaw_scrollbars" = no ; then AC_DEFINE(OPT_KEV_SCROLLBARS) AC_DEFINE(OPT_KEV_DRAGGING) else AC_DEFINE(OPT_XAW_SCROLLBARS) AC_MSG_CHECKING(if you want to use the drag/scrolling extension with Xaw) AC_ARG_WITH(drag-extension, [ --with-drag-extension use drag/scrolling extension with Xaw], [cf_drag_extension=$withval], [cf_drag_extension=no]) AC_MSG_RESULT($cf_drag_extension) if test "$cf_drag_extension" != "no" ; then AC_DEFINE(OPT_KEV_DRAGGING) fi fi fi AC_MSG_CHECKING(if you want to change the number of exec-macros) AC_ARG_WITH(exec-macros, [ --with-exec-macros=N specify count of numbered macros], [cf_exec_macros=$withval], [cf_exec_macros=no]) AC_MSG_RESULT($cf_exec_macros) test "$cf_exec_macros" != no && AC_DEFINE(OPT_EXEC_MACROS,$cf_exec_macros) ### Debugging/development options AC_ARG_WITH(dbmalloc, [ --with-dbmalloc use Conor Cahill's dbmalloc library], [AC_DEFINE(USE_DBMALLOC) LIBS="$LIBS -ldbmalloc"]) AC_ARG_WITH(dmalloc, [ --with-dmalloc use Gray Watson's dmalloc library], [AC_DEFINE(USE_DMALLOC) LIBS="$LIBS -ldmalloc"]) AC_ARG_WITH(no-leaks, [ --with-no-leaks free permanent memory, analyze leaks], [AC_DEFINE(NO_LEAKS)]) AC_ARG_WITH(trace, [ --with-trace turn on debug-tracing], [AC_DEFINE(OPT_TRACE) EXTRAOBJS="$EXTRAOBJS trace.o"]) CFLAGS="$saved_CFLAGS" AC_ARG_WITH(warnings, [ --with-warnings turn on GCC compiler warnings], [with_warnings=$withval]) if test -n "$with_warnings" then CF_GCC_ATTRIBUTES CF_GCC_WARNINGS fi ### Do these last, since they rely on a properly constructed config.h ### Mandatory checks for missing prototypes: CHECK_DECL_FLAG="-I. -I$srcdir -Dscrn_chosen" VILE_CHECK_HDRS=' #define CHECK_PROTOTYPES 1 #include ' CHECK_DECL_HDRS="$VILE_CHECK_HDRS" CF_MISSING_EXTERN( \ environ \ getenv \ getwd \ malloc \ realloc \ rindex \ strtol \ ) if test -n "$cf_tc_externs" then CHECK_DECL_HDRS="$VILE_CHECK_HDRS #include " CF_MISSING_EXTERN( \ $cf_tc_externs \ ) fi ### Optional checks for missing functions (enabled with --with-warnings) if test -n "$with_warnings" then CHECK_DECL_HDRS="$VILE_CHECK_HDRS" CF_MISSING_EXTERN( \ _filbuf \ _flsbuf \ access \ alarm \ atoi \ bzero \ chdir \ close \ dup \ execlp \ fclose \ fflush \ fgetc \ fileno \ fork \ fprintf \ fputc \ fputs \ fread \ free \ fseek \ fwrite \ gethostname \ getpgrp \ getpid \ getuid \ isatty \ kill \ killpg \ link \ longjmp \ lstat \ memset \ mkdir \ mktemp \ open \ perror \ pipe \ printf \ puts \ qsort \ read \ readlink \ select \ setbuf \ setbuffer \ setitimer \ setjmp \ setpgrp \ setsid \ setvbuf \ sleep \ sscanf \ system \ time \ unlink \ utime \ utimes \ wait \ write \ ) CHECK_DECL_HDRS="$VILE_CHECK_HDRS #if HAVE_SYS_IOCTL_H #include #endif " CF_MISSING_EXTERN( \ ioctl \ ) fi AC_SUBST(EXTRAOBJS) ### output makefile and config.h AC_OUTPUT(makefile config_h, [CF_SED_CONFIG_H(config_h,config.h)], [ac_cv_path_TD_CONFIG="$ac_cv_path_TD_CONFIG"])