home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / vile-src.zip / vile-8.1 / configure.in < prev    next >
Text File  |  1998-08-30  |  12KB  |  524 lines

  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_REVISION($Revision: 1.93 $)
  3. AC_PREREQ(2.12.971222)
  4. rm -f config.cache
  5.  
  6. ### Use "configure -with-screen" to override the default configuration, which is
  7. ### termcap-based on unix systems.
  8.  
  9. dnl $Header: /usr/build/vile/vile/RCS/configure.in,v 1.93 1998/08/30 22:47:25 tom Exp $
  10.  
  11. dnl
  12. AC_INIT(mktbls.c)
  13. AC_CONFIG_HEADER(config.h:config_h.in)
  14.  
  15. CF_CHECK_CACHE
  16.  
  17. ###    checks for alternative programs
  18. AC_PROG_CC
  19. AC_PROG_CPP
  20. AC_GCC_TRADITIONAL
  21. AC_PROG_INSTALL
  22. AC_PROGRAM_PATH(TD_CONFIG,td_config)
  23.  
  24. CF_DISABLE_ECHO
  25. CF_PROG_EXT
  26.  
  27. CF_ARG_DISABLE(extensions,
  28.     [  --disable-extensions    test: build only core functions],
  29.     [AC_DEFINE(SMALLER)
  30.      AC_DEFINE(FEWNAMES)],
  31.     [EXTRAOBJS="$EXTRAOBJS btree.o crypt.o"])
  32. CF_ARG_DISABLE(shell,
  33.     [  --disable-shell         test: disable shell/external commands],
  34.     [AC_DEFINE(OPT_SHELL,0)],
  35.     [EXTRAOBJS="$EXTRAOBJS npopen.o spawn.o"])
  36.  
  37. ###    use option --with-cflags to set default CFLAGS
  38. AC_MSG_CHECKING(for CFLAGS options)
  39. AC_ARG_WITH(CFLAGS,
  40.     [  --with-CFLAGS=value     set default for \$CFLAGS],
  41.     [cflags=$withval])
  42. if test -z "$cflags"; then
  43.     AC_ARG_WITH(cflags,
  44.         [  --with-cflags=value     (same as --with-CFLAGS)],
  45.         [cflags=$withval])
  46. fi
  47.  
  48. # if the user specified nothing else, set -O.  user can override
  49. # with --with-cflags=" "
  50. if test -n "$cflags"; then
  51.     CFLAGS="$cflags"
  52. elif test -z "$CFLAGS" ; then
  53.     CFLAGS="-O"
  54. fi
  55. AC_MSG_RESULT($cflags)
  56.  
  57. AC_MSG_CHECKING(for startup path)
  58. AC_ARG_WITH(startup-path,
  59. [  --with-startup-path=PATH specify locations to search for vile.hlp, etc.],
  60. [VILE_STARTUP_PATH=$withval],
  61. [test -z "$VILE_STARTUP_PATH" &&\
  62.     VILE_STARTUP_PATH='$(datadir):/usr/local/lib/:/usr/local/:/usr/lib/'])
  63. AC_MSG_RESULT($VILE_STARTUP_PATH)
  64. AC_SUBST(VILE_STARTUP_PATH)
  65.  
  66. AC_MSG_CHECKING(if you want to use perl as an extension language)
  67. AC_ARG_WITH(perl,
  68.     [  --with-perl             enable use of Perl as an extension language],
  69.     [with_perl=$withval],
  70.     [with_perl=no])
  71. AC_MSG_RESULT($with_perl)
  72. if test "$with_perl" = yes ; then
  73.     CF_PROG_PERL(5.004)
  74.     if test "$PERL" = no; then
  75.         AC_ERROR([perl not found])
  76.     fi
  77.     perl_lib_path=`$PERL -MConfig -e 'print $Config{privlib}'`
  78.     AC_DEFINE(OPT_PERL)
  79.     EXTRAOBJS="$EXTRAOBJS perl.o"
  80.     LINK_PREFIX=`$PERL -MConfig -e 'print $Config{shrpenv}'`
  81.     ac_link="$LINK_PREFIX $ac_link"
  82.     CFLAGS="$CFLAGS `$PERL -MExtUtils::Embed -e ccopts`"
  83.     LIBS="$LIBS `$PERL -MExtUtils::Embed -e ldopts`"
  84.     EXTRA_INSTALL_DIRS="$EXTRA_INSTALL_DIRS \$(INSTALL_PERL_DIRS)"
  85.     EXTRA_INSTALL_FILES="$EXTRA_INSTALL_FILES \$(INSTALL_PERL_FILES)"
  86. fi
  87. AC_SUBST(perl_lib_path)
  88. AC_SUBST(PERL)
  89. AC_SUBST(EXTRA_INSTALL_DIRS)
  90. AC_SUBST(EXTRA_INSTALL_FILES)
  91.  
  92. # X11 checks will sometimes add to CFLAGS.  We want the state of CFLAGS
  93. # prior to these checks
  94. saved_CFLAGS="$CFLAGS"
  95.  
  96. ###    checks for UNIX variants that set C preprocessor variables
  97. AC_AIX
  98. AC_ISC_POSIX
  99. AC_MINIX
  100. dnl: why this? AC_DYNIX_SEQ
  101. AC_CHECK_FUNC(getpwnam,,AC_CHECK_LIB(sun,getpwnam))
  102.  
  103. # check for SCO.
  104. # FIXME:  this is a hack, and should be split into individual features -- the
  105. # sys/time.h and select.h conflict.
  106. AC_CHECKING([for SCO by checking on /usr/bin/scosh])
  107. AC_PROGRAM_CHECK(COULD_BE_SCO, [scosh], maybe, maybenot)
  108. if test "$COULD_BE_SCO" = "maybe"
  109. then
  110.     AC_DEFINE(SYSTEM_LOOKS_LIKE_SCO)
  111. fi
  112.  
  113. # check for a lint program.
  114. AC_CHECK_PROGS(LINT, lint alint lclint, [])
  115. if test -n "$LINT"
  116. then
  117.     AC_DEFINE(SYSTEM_HAS_LINT_PROG)
  118. fi
  119.  
  120. ###    checks for header files
  121. AC_STDC_HEADERS
  122. AC_HEADER_DIRENT
  123. AC_CHECK_HEADERS(unistd.h stdlib.h stdarg.h stddef.h string.h memory.h fcntl.h \
  124.                 poll.h pwd.h termios.h termio.h sgtty.h \
  125.         ioctl.h select.h setjmp.h signal.h utime.h varargs.h)
  126.  
  127. ###    checks for <sys/xxx> header files (separate, to avoid bug in autoconf)
  128. AC_CHECK_HEADERS(sys/filio.h sys/ioctl.h sys/itimer.h \
  129.         sys/param.h \
  130.         sys/resource.h sys/wait.h sys/time.h sys/select.h)
  131.  
  132. ###    checks for typedefs
  133. AC_TYPE_SIGNAL
  134. AC_DEFINE(SIGT,RETSIGTYPE)
  135. if test $ac_cv_type_signal = void; then
  136.     AC_DEFINE(SIGRET,[/*do nothing*/])
  137. else
  138.     AC_DEFINE(SIGRET,[return 0])
  139. fi
  140.  
  141. AC_TYPE_SIZE_T
  142. AC_TYPE_OFF_T
  143. AC_TYPE_UID_T
  144. AC_TYPE_PID_T
  145. AC_CHECK_TYPE(time_t, long)
  146.  
  147. ###    checks for library functions
  148. if test "$cross_compiling" = no; then
  149.     AC_FUNC_SETVBUF_REVERSED
  150. fi
  151.  
  152. ###    checks for structures
  153. AC_STAT_MACROS_BROKEN
  154. AC_ST_BLKSIZE
  155. AC_ST_BLOCKS
  156. AC_ST_RDEV
  157. AC_TIME_WITH_SYS_TIME
  158. AC_STRUCT_TM
  159. CF_SIZECHANGE
  160. CF_FP_ISREADY
  161.  
  162. ###    checks for compiler characteristics
  163. AC_CONST
  164. CF_ANSI_CC_REQD
  165. CF_CC_INIT_UNIONS
  166. CF_CC_OFFSETOF_CASES
  167.  
  168. ###    checks for system services and user specified options
  169. AC_LONG_FILE_NAMES
  170. CF_RESTARTABLE_PIPEREAD        # is a read() of a pipe restartable?
  171.  
  172. AC_SUBST(CFLAGS)
  173. AC_SUBST(LIBS)
  174. AC_SUBST(X_CFLAGS)
  175. AC_SUBST(X_LIBS)
  176. AC_SUBST(X_EXTRA_LIBS)
  177. AC_SUBST(SCREEN)
  178. AC_SUBST(TARGET)
  179. AC_SUBST(LINK_PREFIX)
  180. dnl
  181. dnl The killpg test and the tests for the presence of certain functions on
  182. dnl a particular operating system are done prior to the checks for existence
  183. dnl of screen libraries due to a problem with -lXt on certain SunOS systems.
  184. dnl The nature of this problem is described in the FAQ on X.  Look for the
  185. dnl following subject: ``What are these problems with "_XtInherit not found"
  186. dnl on the Sun? ...''  The long and the short of it is that AC_HAVE_FUNCS will
  187. dnl not work properly (without being rewritten) if placed after adding -lXt to
  188. dnl LIBS on SunOS (and perhaps some others as well).
  189. dnl
  190. AC_FUNC_SETPGRP
  191. AC_FUNC_GETPGRP
  192. CF_KILLPG
  193. CF_ERRNO
  194. CF_SYS_ERRLIST
  195. AC_DEFINE(SYS_UNIX)
  196. AC_DEFINE(scrn_chosen)
  197. # Try to eventually eliminate the following
  198. AC_DEFINE(os_chosen)
  199.  
  200. AC_MSG_CHECKING(for screen type)
  201. AC_ARG_WITH(screen,
  202. [  --with-screen=value     specify terminal driver.  The default is tcap, for
  203.                           the termcap/terminfo driver.  Other values include
  204.                           ncurses (a special case of terminfo), X11, OpenLook,
  205.                           Motif, Athena, Xaw, Xaw3d, neXtaw and ansi.],
  206. [screen=$withval])
  207.  
  208. if test -z "$screen"; then
  209.     AC_ARG_WITH(scr,
  210.         [  --with-scr=value        (same as --with-screen)],
  211.         [screen=$withval])
  212. fi
  213. test -z "$screen" && test "$with_x" = yes && screen=x11
  214.  
  215. if test -z "$screen"; then
  216.     screen=termcap;
  217. fi
  218. AC_MSG_RESULT($screen)
  219.  
  220. : See if this is any type of xvile configuration:
  221. case "$screen" in
  222. changequote(,)dnl
  223.     [Oo]pen[Ll]ook | [Mm]otif* | [xX] | [Aa]thena | [xX][atTmMoO]* | [xX]11 | neXtaw )
  224. changequote([,])dnl
  225.         CF_X_TOOLKIT
  226.         CF_IMAKE_CFLAGS
  227.         X_CFLAGS="$X_CFLAGS $IMAKE_CFLAGS"
  228.         LDFLAGS="$LDFLAGS $X_LIBS"
  229.         CFLAGS="$CFLAGS $X_CFLAGS"
  230.         SCREEN=x11
  231.         TARGET=xvile
  232.         AC_DEFINE(DISP_X11)
  233.         AC_DEFINE(XTOOLKIT)
  234.         AC_CHECK_HEADERS(X11/IntrinsicI.h)
  235.     ;;
  236. esac
  237.  
  238. : Find the libraries that apply to the selected screen-type:
  239. case "$screen" in
  240. changequote(,)dnl
  241.     [Oo]pen* | [Xx]ol )
  242. changequote([,])dnl
  243.         AC_DEFINE(OL_WIDGETS)
  244.         CF_X_OPENLOOK
  245.     ;;
  246. changequote(,)dnl
  247.     [mM]otif* | [Xx]m )
  248. changequote([,])dnl
  249.         AC_DEFINE(MOTIF_WIDGETS)
  250.         CF_X_MOTIF
  251.          EXTRAOBJS="$EXTRAOBJS menu.o"
  252.     ;;
  253. changequote(,)dnl
  254.     [Aa]thena* | [Xx]aw* | neXtaw )
  255. changequote([,])dnl
  256.         AC_DEFINE(ATHENA_WIDGETS)
  257.         case $screen in #(vi
  258.         *aw*)
  259.             cf_x_athena=`echo $screen | sed -e s/x/X/`
  260.             ;;
  261.         esac
  262.         CF_X_ATHENA
  263.          EXTRAOBJS="$EXTRAOBJS menu.o"
  264.     ;;
  265. changequote(,)dnl
  266.     x | X | [Xx][Tt]* | [Xx]11 )
  267. changequote([,])dnl
  268.         AC_DEFINE(NO_WIDGETS)
  269.     ;;
  270.     ansi)
  271.         SCREEN=ansi
  272.         TARGET=vile
  273.         AC_DEFINE(DISP_ANSI)
  274.     ;;
  275.     * )
  276.         SCREEN=tcap
  277.         TARGET=vile
  278.         AC_DEFINE(DISP_TERMCAP)
  279.         CF_TERMCAP_LIBS($screen)
  280.     ;;
  281. esac
  282.  
  283. : Check for termcap vs terminfo:
  284. cf_tc_funcs=""
  285. cf_tc_externs=""
  286. if test ".$cf_cv_lib_termcap" = .terminfo ; then
  287.     AC_DEFINE(USE_TERMINFO)
  288.     cf_tc_funcs="tigetint tigetnum tparam tparm"
  289.     cf_tc_externs="$cf_tc_funcs tgoto tigetstr tputs tigetflag"
  290. elif test ".$cf_cv_lib_termcap" = .termcap ; then
  291.     # BSD 'tputs()' may need 'PC' to be set.
  292.     AC_TRY_LINK([],[extern char PC; PC = 0],
  293.         [AC_DEFINE(HAVE_EXTERN_TCAP_PC)])
  294.     cf_tc_funcs="tgetint tgetnum tparam tparm"
  295.     cf_tc_externs="$cf_tc_funcs tgoto tgetstr tputs tgetent tgetflag"
  296. fi
  297.  
  298. LIBS="$LIBS $X_EXTRA_LIBS"
  299.  
  300. AC_HAVE_FUNCS( \
  301. access \
  302. alarm \
  303. getcwd \
  304. gethostname \
  305. getpass \
  306. getwd \
  307. killpg \
  308. link \
  309. mkdir \
  310. poll \
  311. putenv \
  312. select \
  313. setitimer \
  314. setsid \
  315. setvbuf \
  316. sigaction \
  317. sigprocmask \
  318. strchr \
  319. strrchr \
  320. symlink \
  321. tcgetattr \
  322. ttyname \
  323. utime \
  324. utimes \
  325. $cf_tc_funcs \
  326. )
  327.  
  328. CF_ANSI_QSORT
  329.  
  330. ###    Miscellaneous options
  331. if test -n "$cf_x_athena" ; then
  332.     AC_MSG_CHECKING(if you want to use Xaw scrollbars rather than our own)
  333.     AC_ARG_WITH(Xaw-scrollbars,
  334.     [  --with-Xaw-scrollbars   use Xaw scrollbars rather than our own],
  335.     [cf_Xaw_scrollbars=$withval],
  336.     [cf_Xaw_scrollbars=no])
  337.     AC_MSG_RESULT($cf_Xaw_scrollbars)
  338.  
  339.     if test "$cf_Xaw_scrollbars" = no ; then
  340.     AC_DEFINE(OPT_KEV_SCROLLBARS)
  341.     AC_DEFINE(OPT_KEV_DRAGGING)
  342.     else
  343.     AC_DEFINE(OPT_XAW_SCROLLBARS)
  344.     AC_MSG_CHECKING(if you want to use the drag/scrolling extension with Xaw)
  345.     AC_ARG_WITH(drag-extension,
  346.         [  --with-drag-extension   use drag/scrolling extension with Xaw],
  347.         [cf_drag_extension=$withval],
  348.         [cf_drag_extension=no])
  349.     AC_MSG_RESULT($cf_drag_extension)
  350.     if test "$cf_drag_extension" != "no" ; then
  351.         AC_DEFINE(OPT_KEV_DRAGGING)
  352.     fi
  353.     fi
  354. fi
  355.  
  356. AC_MSG_CHECKING(if you want to change the number of exec-macros)
  357. AC_ARG_WITH(exec-macros,
  358.     [  --with-exec-macros=N    specify count of numbered macros],
  359.     [cf_exec_macros=$withval],
  360.     [cf_exec_macros=no])
  361. AC_MSG_RESULT($cf_exec_macros)
  362. test "$cf_exec_macros" != no && AC_DEFINE(OPT_EXEC_MACROS,$cf_exec_macros)
  363.  
  364. # I don't know of a reliable test for working locale, but we can at least check
  365. # that it is available before offering it as an option.
  366. AC_CHECK_FUNC(setlocale,[
  367. AC_CHECK_HEADER(locale.h,[
  368. AC_MSG_CHECKING(if you want to use i18n locale support)
  369. AC_ARG_WITH(locale,
  370.     [  --with-locale           use i18n support for character-types],
  371.     [cf_locale=$withval],
  372.     [cf_locale=no])
  373. AC_MSG_RESULT($cf_locale)
  374. test "$cf_locale" != no && AC_DEFINE(OPT_LOCALE)
  375. ])])
  376.  
  377. ###    Debugging/development options
  378. AC_ARG_WITH(dbmalloc,
  379.     [  --with-dbmalloc         test: use Conor Cahill's dbmalloc library],
  380.     [AC_DEFINE(USE_DBMALLOC)
  381.      LIBS="$LIBS -ldbmalloc"])
  382.  
  383. AC_ARG_WITH(dmalloc,
  384.     [  --with-dmalloc          test: use Gray Watson's dmalloc library],
  385.     [AC_DEFINE(USE_DMALLOC)
  386.      LIBS="$LIBS -ldmalloc"])
  387.  
  388. AC_ARG_WITH(no-leaks,
  389.     [  --with-no-leaks         test: free permanent memory, analyze leaks],
  390.     [AC_DEFINE(NO_LEAKS)])
  391.  
  392. AC_ARG_WITH(trace,
  393.     [  --with-trace            test: turn on debug-tracing],
  394.     [AC_DEFINE(OPT_TRACE)
  395.      EXTRAOBJS="$EXTRAOBJS trace.o"])
  396.  
  397. CFLAGS="$saved_CFLAGS"
  398. AC_ARG_WITH(warnings,
  399.     [  --with-warnings         test: turn on GCC compiler warnings],
  400.     [with_warnings=$withval])
  401. if test -n "$with_warnings"
  402. then
  403.     CF_GCC_ATTRIBUTES
  404.     CF_GCC_WARNINGS
  405. fi
  406.  
  407. ###    Do these last, since they rely on a properly constructed config.h
  408.  
  409. ###    Mandatory checks for missing prototypes:
  410. CHECK_DECL_FLAG="-I. -I$srcdir -Dscrn_chosen"
  411. VILE_CHECK_HDRS='
  412. #define CHECK_PROTOTYPES 1
  413. #include <estruct.h>
  414. '
  415. CHECK_DECL_HDRS="$VILE_CHECK_HDRS"
  416.  
  417. CF_MISSING_EXTERN( \
  418. environ \
  419. getenv \
  420. getpass \
  421. getwd \
  422. malloc \
  423. realloc \
  424. rindex \
  425. strerror \
  426. strtol \
  427. )
  428.  
  429. if test -n "$cf_tc_externs"
  430. then
  431. CHECK_DECL_HDRS="$VILE_CHECK_HDRS
  432. #include <tcap.h>
  433. "
  434.  
  435. if test ".$cf_cv_lib_termcap" != ".none" ; then
  436.     CF_TYPE_OUTCHAR
  437. fi
  438. CF_MISSING_EXTERN( \
  439. $cf_tc_externs \
  440. )
  441. fi
  442.  
  443. ###    Optional checks for missing functions (enabled with --with-warnings)
  444. if test -n "$with_warnings"
  445. then
  446. CHECK_DECL_HDRS="$VILE_CHECK_HDRS"
  447. CF_MISSING_EXTERN( \
  448. _filbuf \
  449. _flsbuf \
  450. access \
  451. alarm \
  452. atoi \
  453. bzero \
  454. chdir \
  455. close \
  456. dup \
  457. execlp \
  458. fclose \
  459. fflush \
  460. fgetc \
  461. fileno \
  462. fork \
  463. fprintf \
  464. fputc \
  465. fputs \
  466. fread \
  467. free \
  468. fseek \
  469. fwrite \
  470. gethostname \
  471. getpgrp \
  472. getpid \
  473. getuid \
  474. isatty \
  475. kill \
  476. killpg \
  477. link \
  478. longjmp \
  479. lstat \
  480. memset \
  481. mkdir \
  482. mktemp \
  483. open \
  484. perror \
  485. pipe \
  486. printf \
  487. puts \
  488. qsort \
  489. read \
  490. readlink \
  491. select \
  492. setbuf \
  493. setbuffer \
  494. setitimer \
  495. setjmp \
  496. setpgrp \
  497. setsid \
  498. setvbuf \
  499. sleep \
  500. sscanf \
  501. system \
  502. time \
  503. unlink \
  504. utime \
  505. utimes \
  506. wait \
  507. write \
  508. )
  509.  
  510. CHECK_DECL_HDRS="$VILE_CHECK_HDRS
  511. #if HAVE_SYS_IOCTL_H
  512. #include    <sys/ioctl.h>
  513. #endif
  514. "
  515. CF_MISSING_EXTERN( \
  516. ioctl \
  517. )
  518. fi
  519.  
  520. AC_SUBST(EXTRAOBJS)
  521.  
  522. ###    output makefile and config.h
  523. AC_OUTPUT(makefile,,,sort)
  524.