home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / octave-1.1.1p1-base.tgz / octave-1.1.1p1-base.tar / fsf / octave / configure.in < prev    next >
Text File  |  1995-02-14  |  22KB  |  791 lines

  1. dnl configure.in
  2. dnl
  3. dnl Process this file with autoconf to produce a configure script.
  4. dnl Requires GNU autoconf 1.8 or later.
  5. dnl
  6. dnl Copyright (C) 1992, 1993, 1994, 1995 John W. Eaton
  7. ### 
  8. ### This file is part of Octave.
  9. ### 
  10. ### Octave is free software; you can redistribute it and/or modify it
  11. ### under the terms of the GNU General Public License as published by the
  12. ### Free Software Foundation; either version 2, or (at your option) any
  13. ### later version.
  14. ### 
  15. ### Octave is distributed in the hope that it will be useful, but WITHOUT
  16. ### ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  17. ### FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  18. ### for more details.
  19. ### 
  20. ### You should have received a copy of the GNU General Public License
  21. ### along with Octave; see the file COPYING.  If not, write to the Free
  22. ### Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  23.  
  24. AC_REVISION($Revision: 1.92 $)
  25. AC_PREREQ(2.0)
  26. AC_INIT(src/octave.cc)
  27. AC_CONFIG_HEADER(config.h kpathsea/c-auto.h)
  28.  
  29. AC_DEFINE(OCTAVE_SOURCE, 1)
  30.  
  31. AC_CANONICAL_HOST
  32. if test -z "$host"; then
  33.   host=unknown
  34. fi
  35. target_host_type=$host
  36. canonical_host_type=$host
  37. if test "$host" = unknown; then
  38.   AC_MSG_WARN([configuring Octave for unknown system type
  39. ])
  40. fi
  41. AC_SUBST(target_host_type)
  42.  
  43. ### Allow the user to force us to use f2c.
  44.  
  45. AC_ARG_WITH(f2c,
  46.   [  --with-f2c              use f2c even if Fortran compiler is available],
  47.   use_f2c=true, use_f2c=false)
  48.  
  49. ### Allow the user to experiment with dynamic linking using GNU dld.
  50.  
  51. AC_ARG_ENABLE(dld,
  52.   [  --enable-dld            use DLD for dynamic linking (not all systems)],
  53.   use_dld=true, use_dld=false)
  54. AC_SUBST(use_dld)
  55.  
  56. ### Allow compilation of smaller kernel.  This only works if some form
  57. ### of dynamic linking is also supported and used.
  58.  
  59. AC_ARG_ENABLE(lite-kernel,
  60.   [  --enable-lite-kernel    compile smaller kernel (requires DLD)],
  61.   lite_kernel=true, lite_kernel=false)
  62. if $lite_kernel; then
  63.   AC_DEFINE(OCTAVE_LITE, 1)
  64. fi
  65. AC_SUBST(lite_kernel)
  66.  
  67. ### some defaults
  68.  
  69. AC_PREFIX_DEFAULT(/usr/local)
  70.  
  71. exec_prefix='$(prefix)'
  72. bindir='$(exec_prefix)/bin'
  73. datadir='$(prefix)/lib'
  74. libdir='$(exec_prefix)/lib'
  75. includedir='$(prefix)/include/octave'
  76. mandir='$(prefix)/man/man1'
  77. infodir='$(prefix)/info'
  78. fcnfiledir='$(datadir)/octave/$(version)/m'
  79. localfcnfiledir='$(datadir)/octave/site/m'
  80. localfcnfilepath='$(localfcnfiledir)//'
  81. archlibdir='$(libdir)/octave/$(version)/exec/$(target_host_type)'
  82. octfiledir='$(libdir)/octave/$(version)/oct/$(target_host_type)'
  83. localoctfiledir='$(datadir)/octave/site/oct/$(target_host_type)'
  84. localoctfilepath='$(localoctfiledir)//'
  85. fcnfilepath='.:$(localoctfilepath):$(localfcnfilepath):$(octfiledir)//:$(fcnfiledir)//'
  86. imagedir='$(datadir)/octave/$(version)/imagelib'
  87. imagepath='.:$(imagedir)//'
  88.  
  89. AC_MSG_RESULT([defining prefix to be $prefix])
  90. AC_MSG_RESULT([defining exec_prefix to be $exec_prefix])
  91. AC_MSG_RESULT([defining bindir to be $bindir])
  92. AC_MSG_RESULT([defining datadir to be $datadir])
  93. AC_MSG_RESULT([defining libdir to be $libdir])
  94. AC_MSG_RESULT([defining includedir to be $includedir])
  95. AC_MSG_RESULT([defining mandir to be $mandir])
  96. AC_MSG_RESULT([defining infodir to be $infodir])
  97. AC_MSG_RESULT([defining fcnfiledir to be $fcnfiledir])
  98. AC_MSG_RESULT([defining localfcnfiledir to be $localfcnfiledir])
  99. AC_MSG_RESULT([defining localfcnfilepath to be $localfcnfilepath])
  100. AC_MSG_RESULT([defining archlibdir to be $archlibdir])
  101. AC_MSG_RESULT([defining octfiledir to be $octfiledir])
  102. AC_MSG_RESULT([defining localoctfiledir to be $localoctfiledir])
  103. AC_MSG_RESULT([defining localoctfilepath to be $localoctfilepath])
  104. AC_MSG_RESULT([defining fcnfilepath to be $fcnfilepath])
  105. AC_MSG_RESULT([defining imagedir to be $imagedir])
  106. AC_MSG_RESULT([defining imagepath to be $imagepath])
  107. AC_SUBST(exec_prefix)
  108. AC_SUBST(bindir)
  109. AC_SUBST(datadir)
  110. AC_SUBST(libdir)
  111. AC_SUBST(includedir)
  112. AC_SUBST(mandir)
  113. AC_SUBST(infodir)
  114. AC_SUBST(fcnfiledir)
  115. AC_SUBST(localfcnfiledir)
  116. AC_SUBST(localfcnfilepath)
  117. AC_SUBST(archlibdir)
  118. AC_SUBST(octfiledir)
  119. AC_SUBST(localoctfiledir)
  120. AC_SUBST(localoctfilepath)
  121. AC_SUBST(fcnfilepath)
  122. AC_SUBST(imagedir)
  123. AC_SUBST(imagepath)
  124.  
  125. ### Path separator.
  126.  
  127. AC_DEFINE(SEPCHAR, [':'])
  128. AC_DEFINE(SEPCHAR_STR, [":"])
  129.  
  130. ### Do special stuff if using dld.
  131.  
  132. DLD_DIR=
  133. LIBDLD=
  134. LIBOCTDLD='liboctdld.a'
  135. LD_STATIC_FLAG=
  136. if $use_dld; then
  137.   DLD_DIR=dld
  138.   LIBDLD='../dld/libdld.a'
  139. # don't link them in only if doing dynamic linking and small kernel
  140. # requested.
  141.   if $lite_kernel; then
  142.     LIBOCTDLD=
  143.   fi
  144.   LD_STATIC_FLAG=-static
  145.   AC_DEFINE(WITH_DLD, 1)
  146. fi
  147.  
  148. ### Also use -static if compiling on Alpha OSF/1 1.3 systems.
  149.  
  150. case "$canonical_host_type" in
  151.   alpha-dec-osf1.3)
  152.     LD_STATIC_FLAG=-static
  153.   ;;
  154. esac
  155.  
  156. if test -n "$DLD_DIR"; then
  157.   AC_MSG_RESULT([defining DLD_DIR to be $DLD_DIR])
  158. fi
  159. if test -n "$LIBDLD"; then
  160.   AC_MSG_RESULT([defining LIBDLD to be $LIBDLD])
  161. fi
  162. if test -n "$LIBOCTDLD"; then
  163.   AC_MSG_RESULT([defining LIBOCTDLD to be $LIBOCTDLD])
  164. fi
  165. if test -n "$LD_STATIC_FLAG"; then
  166.   AC_MSG_RESULT([defining LD_STATIC_FLAG to be $LD_STATIC_FLAG])
  167. fi
  168. AC_SUBST(DLD_DIR)
  169. AC_SUBST(LIBDLD)
  170. AC_SUBST(LIBOCTDLD)
  171. AC_SUBST(LD_STATIC_FLAG)
  172.  
  173. ### See if the optional nonlinear programming code is present.
  174.  
  175. AC_MSG_CHECKING([for npsol])
  176. if test -f $srcdir/libcruft/npsol/npsol.f; then
  177.   AC_MSG_RESULT([yes])
  178. else
  179.   AC_MSG_RESULT([no])
  180.   AC_DEFINE(NPSOL_MISSING, 1)
  181. fi
  182.  
  183. AC_MSG_CHECKING([for qpsol])
  184. if test -f $srcdir/libcruft/qpsol/qpsol.f; then
  185.   AC_MSG_RESULT([yes])
  186. else
  187.   AC_MSG_RESULT([no])
  188.   AC_DEFINE(QPSOL_MISSING, 1)
  189. fi
  190.  
  191. AC_MSG_CHECKING([for fsqp])
  192. if test -f $srcdir/libcruft/fsqp/fsqpd.f; then
  193.   AC_MSG_RESULT([yes])
  194. else
  195.   AC_MSG_RESULT([no])
  196.   AC_DEFINE(FSQP_MISSING, 1)
  197. fi
  198.  
  199. ### See which C++ compiler to use (we expect to find g++).
  200.  
  201. AC_PROG_CXX
  202. AC_PROG_CXXCPP
  203.  
  204. ### Do special things for g++.
  205.  
  206. ADD_CXX_WALL=false
  207. NO_IMPLICIT_TEMPLATES=
  208. gxx_version=`$CXX -v 2>&1 | grep "^g.. version" | sed 's/^g.. version *//'`
  209. case "$gxx_version" in
  210. changequote(,)dnl
  211.   2.[6789].*|2.[123456789][0123456789].*)
  212. changequote([,])dnl
  213.     if test -z "$CXXFLAGS"; then
  214.       CXXFLAGS="-g -O"
  215.       AC_MSG_RESULT([defining CXXFLAGS to be $CXXFLAGS])
  216.       ADD_CXX_WALL=true
  217.     fi
  218.     NO_IMPLICIT_TEMPLATES="-fno-implicit-templates"
  219.     AC_MSG_RESULT([defining NO_IMPLICIT_TEMPLATES to be $NO_IMPLICIT_TEMPLATES])
  220.   ;;
  221. changequote(,)dnl
  222.   1.*|2.[012345].*)
  223. changequote([,])dnl
  224.     AC_MSG_WARN([g++ version $gxx_version will not work to compile Octave])
  225.   ;;
  226.   *)
  227.     AC_MSG_WARN([Octave has only been tested with g++, and I can't find it])
  228.   ;;
  229. esac
  230.  
  231. HOST_CXXFLAGS=
  232. case "$gxx_version" in
  233.   2.6.*)
  234.     case "$canonical_host_type" in
  235.       rs6000-ibm-aix*)
  236.         HOST_CXXFLAGS="-Wa,-u"
  237.         AC_MSG_RESULT([defining HOST_CXXFLAGS to be $HOST_CXXFLAGS])
  238.       ;;
  239.     esac
  240.   ;;
  241. esac
  242.  
  243. AC_SUBST(HOST_CXXFLAGS)
  244.  
  245. ### See what libraries are used by the C++ compiler.  Need this for
  246. ### dynamic linking.
  247.  
  248. CXXLIBS=`sh $srcdir/cxxlibs.sh`
  249. AC_MSG_RESULT([defining CXXLIBS to be $CXXLIBS])
  250.  
  251. AC_SUBST(CXXFLAGS)
  252. AC_SUBST(NO_IMPLICIT_TEMPLATES)
  253. AC_SUBST(CXXLIBS)
  254.  
  255. ### See which C compiler to use (we expect to find gcc).
  256.  
  257. AC_PROG_CC
  258. AC_PROG_CPP
  259. AC_PROG_GCC_TRADITIONAL
  260.  
  261. ### Do special things for gcc.
  262.  
  263. ADD_CC_WALL=false
  264. gcc_version=`$CC -v 2>&1 | grep "^gcc version" | sed 's/^gcc version *//'`
  265. case "$gcc_version" in
  266.   2.*)
  267.     if test -z "$CFLAGS"; then
  268.       CFLAGS="-g -O"
  269.       AC_MSG_RESULT([defining CFLAGS to be $CFLAGS])
  270.       ADD_CC_WALL=true
  271.     fi
  272.     if test -z "$LDFLAGS"; then
  273.       LDFLAGS="-g"
  274.       AC_MSG_RESULT([defining LDFLAGS to be $LDFLAGS])
  275.     fi
  276.   ;;
  277.   1.*)
  278.     AC_MSG_WARN([gcc version $gcc_version is likely to cause problems])
  279.   ;;
  280.   *)
  281.     AC_MSG_WARN([Octave has only been tested with gcc, and I can't find it])
  282.   ;;
  283. esac
  284.  
  285. AC_SUBST(CFLAGS)
  286. AC_SUBST(LDFLAGS)
  287.  
  288. ### On Linux systems we need to compile with -mieee-fp to get full
  289. ### support for IEEE floating point.
  290.  
  291. case "$canonical_host_type" in
  292.   i386-*-linux | i486-*-linux | i586-*-linux)
  293.     GCC_IEEE_FP_FLAG="-mieee-fp"
  294.     AC_MSG_RESULT([defining GCC_IEEE_FP_FLAG to be $GCC_IEEE_FP_FLAG])
  295.   ;;
  296. esac
  297.  
  298. AC_SUBST(GCC_IEEE_FP_FLAG)
  299.  
  300. ### Special checks for odd OS specific things.
  301.  
  302. AC_ISC_POSIX
  303. AC_MINIX
  304. AC_AIX
  305. AC_FUNC_STRFTIME
  306. AC_CHECK_LIB(sun, getpwnam)
  307.  
  308. ### How big are ints and how are they oriented?  These could probably
  309. ### be eliminated in favor of run-time checks.
  310.  
  311. AC_CHECK_SIZEOF(short)
  312. AC_CHECK_SIZEOF(int)
  313. AC_CHECK_SIZEOF(long)
  314. AC_C_BIGENDIAN
  315.  
  316. ### Try to determine the floating point format.  This could probably
  317. ### be eliminated in favor of run-time checks.
  318.  
  319. AC_MSG_CHECKING([floating point format])
  320. changequote(,)dnl
  321. XCFLAGS=`echo $CFLAGS | sed 's/-O[^ \t]*//'`
  322. changequote([,])dnl
  323. ${CC-cc} -DDP $XCFLAGS $LDFLAGS $srcdir/float-type.c -o conftest >/dev/null 2>&1
  324. FLOAT_FORMAT=`./conftest`
  325. case "$FLOAT_FORMAT" in
  326.   IEEE_BIG_ENDIAN)
  327.     AC_MSG_RESULT([IEEE big endian])
  328.     AC_DEFINE(IEEE_BIG_ENDIAN, 1)
  329.   ;;
  330.   IEEE_LITTLE_ENDIAN)
  331.     AC_MSG_RESULT([IEEE little endian])
  332.     AC_DEFINE(IEEE_LITTLE_ENDIAN, 1)
  333.   ;;
  334.   VAX_D_FLOAT)
  335.     AC_MSG_RESULT([VAX D floating])
  336.     AC_DEFINE(VAX_D_FLOAT, 1)
  337.   ;;
  338.   VAX_G_FLOAT)
  339.     AC_MSG_RESULT([VAX G floating])
  340.     AC_DEFINE(VAX_G_FLOAT, 1)
  341.   ;;
  342.   *)
  343.     AC_MSG_RESULT()
  344.     AC_MSG_WARN("unrecognized floating point format!")
  345.   ;;
  346. esac
  347.  
  348. ### Does the C compiler handle alloca() and const correctly?
  349.  
  350. AC_ALLOCA
  351.  
  352. ### This one is for kpathsea.
  353. ###
  354. ### It would be nicer to test for the requisite putenv features directly,
  355. ### but can't figure out how to do that.
  356.  
  357. if test "`(uname) 2>/dev/null`" = NetBSD \
  358.    || test "`(uname) 2>/dev/null`" = FreeBSD; then
  359.   AC_DEFINE(SMART_PUTENV)
  360. fi
  361.  
  362. AC_C_CONST
  363.  
  364. ### If we haven't been forced to use f2c, try to find a Fortran compiler
  365. ### under any one of several common Un*x Fortran compiler names. 
  366. ### Put fc last to avoid confusion with some vendor's /bin/sh fc
  367. ### builtin.
  368. ###
  369. ###    xlf : IBM / AIX
  370. ###   cf77 : Cray / Unicos
  371. ###    g77 : GNU Fortran (someday...)
  372. ###     fc : Convex
  373. ###
  374. ### I don't think the Cray compiler will ever work like f2c...
  375.  
  376. if $use_f2c; then
  377.   true
  378. else
  379.   AC_CHECK_PROGS(F77, xlf cf77 f77 g77 fc)
  380.  
  381.   # If it looks like we have a Fortran compiler, try to determine
  382.   # whether it might be compatible with f2c.
  383.  
  384.   if test -n "$F77"; then
  385.     AC_MSG_CHECKING([$F77/f2c compatibility])
  386.     export F77
  387.     export CC
  388.     tmpdef=`sh $srcdir/f2c-compat.sh $srcdir/flibs.sh`
  389.     status=$?
  390.     if test $status -eq 0; then
  391.       AC_MSG_RESULT([yes])
  392.       if test "$tmpdef" = '-DF77_APPEND_UNDERSCORE=1'; then
  393.         AC_DEFINE(F77_APPEND_UNDERSCORE, 1)
  394.       fi
  395.     else
  396.       AC_MSG_RESULT([no])
  397.       F77=
  398.     fi
  399.   fi
  400. fi
  401.  
  402. ### If we can't find a Fortran compiler, or if it looks like it isn't
  403. ### compatible with f2c, try to find f2c.
  404.  
  405. if test -z "$F77"; then
  406.   AC_CHECK_PROG(F2C, f2c, f2c, [])
  407. fi
  408.  
  409. if test -z "$F2CFLAGS"; then
  410.   F2CFLAGS=
  411. fi
  412.  
  413. if test -z "$FFLAGS"; then
  414.   FFLAGS="-O"
  415.   AC_MSG_RESULT([defining FFLAGS to be $FFLAGS])
  416. fi
  417.  
  418. if test -n "$F77"; then
  419.   export F77
  420.   FLIBS=`sh $srcdir/flibs.sh`
  421.   AC_MSG_RESULT([defining FLIBS to be $FLIBS])
  422.   DOT_C_FROM_DOT_F_CMD=
  423.   DOT_O_FROM_DOT_F_PAT=
  424. elif test -n "$F2C" || $use_f2c; then
  425.   AC_CHECK_LIB(f2c, main, FLIBS=-lf2c, [])
  426.   if test -z "$FLIBS" ; then
  427.     AC_CHECK_LIB(F77, main, FLIBS=-lF77, [])
  428.     if test -n "$FLIBS" ; then
  429.       AC_CHECK_LIB(I77, main, FLIBS="$FLIBS -lI77", [])
  430.     fi
  431.   fi
  432.   if test -z "$FLIBS" ; then
  433.     AC_MSG_WARN([I found f2c but not libf2c.a, or libF77.a and libI77.a])
  434.   fi
  435.   DOT_C_FROM_DOT_F_CMD='    cat $< | $(F2C) $(F2CFLAGS) > $(@F)'
  436.   AC_MSG_RESULT([defining DOT_C_FROM_DOT_F_CMD to be $DOT_C_FROM_DOT_F_CMD])
  437.   DOT_O_FROM_DOT_F_PAT='%.o : %.f'
  438.   AC_MSG_RESULT([defining DOT_O_FROM_DOT_F_PAT to be $DOT_O_FROM_DOT_F_PAT])
  439.   AC_DEFINE(F77_APPEND_UNDERSCORE, 1)
  440. else
  441.   AC_MSG_WARN([in order to build octave, you must have a compatible])
  442.   AC_MSG_WARN([Fortran compiler or f2c installed and in your path.])
  443.   AC_MSG_WARN([See the file INSTALL for more information.])
  444.   AC_MSG_WARN([Continuing anyway...])
  445. fi
  446.  
  447. AC_SUBST(F77)
  448. AC_SUBST(FFLAGS)
  449. AC_SUBST(FLIBS)
  450. AC_SUBST(F2C)
  451. AC_SUBST(F2CFLAGS)
  452. AC_SUBST(DOT_C_FROM_DOT_F_CMD)
  453. AC_SUBST(DOT_O_FROM_DOT_F_PAT)
  454.  
  455. ### Extract libraries and directories from FLIBS and CXXLIBS.
  456. ###
  457. ### Leave only libraries, with -lfoo converted to libfoo.a:
  458.  
  459. changequote(,)dnl
  460. FLIB_LIST=`echo " $FLIBS " | sed -e 's/ -Xlinker *[^ ]*/ /g' \
  461.     -e 's/ -L *[^ ]*/ /g' \
  462.     -e 's/ -l *\([^ ]*\)/ lib\1.a/g' -e 's/ -u *[^ ]*/ /g' \
  463.     -e 's/ [^ ]*\.o//g' \
  464.     -e 's/^ *//' -e 's/ *$//' -e 's/  */:/g'`
  465.  
  466. CXXLIB_LIST=`echo " $CXXLIBS " | sed -e 's/ -Xlinker *[^ ]*/ /g' \
  467.     -e 's/ -L *[^ ]*/ /g' \
  468.     -e 's/ -l *\([^ ]*\)/ lib\1.a/g' -e 's/ -u *[^ ]*/ /g' \
  469.     -e 's/ [^ ]*\.o//g' \
  470.     -e 's/^ *//' -e 's/ *$//' -e 's/  */:/g'`
  471.  
  472. ### Leave only directories where libraries might be found:
  473.  
  474. FLIB_PATH=`echo " $FLIBS " | sed \
  475.     -e 's/ /  /g' -e 's/ -Xlinker *[^ ]*/ /g' \
  476.     -e 's/ -L *\([^ ]*\)/ \1/g' -e 's, /[^ ]*\.a , ,g' \
  477.     -e 's/ -l *[^ ]*/ /g' -e 's/ -u *[^ ]*/ /g' \
  478.     -e 's/ [^ ]*\.o//g' \
  479.     -e 's/^ *//' -e 's/ *$//' -e 's/  */:/g'`
  480.  
  481. CXXLIB_PATH=`echo " $CXXLIBS " | sed -e 's/ -Xlinker *[^ ]*/ /g' \
  482.     -e 's/ -L *\([^ ]*\)/ \1/g' -e 's, /[^ ]*\.a , ,g' \
  483.     -e 's/ /  /g' -e 's/ -Xlinker *[^ ]*/ /g' \
  484.     -e 's/ -l *[^ ]*/ /g' -e 's/ -u *[^ ]*/ /g' \
  485.     -e 's/ [^ ]*\.o//g' \
  486.     -e 's/^ *//' -e 's/ *$//' -e 's/  */:/g'`
  487. changequote([,])dnl
  488.  
  489. AC_MSG_RESULT([defining FLIB_LIST to be $FLIB_LIST])
  490. AC_MSG_RESULT([defining FLIB_PATH to be $FLIB_PATH])
  491.  
  492. AC_MSG_RESULT([defining CXXLIB_LIST to be $CXXLIB_LIST])
  493. AC_MSG_RESULT([defining CXXLIB_PATH to be $CXXLIB_PATH])
  494.  
  495. AC_SUBST(FLIB_LIST)
  496. AC_SUBST(FLIB_PATH)
  497.  
  498. AC_SUBST(CXXLIB_LIST)
  499. AC_SUBST(CXXLIB_PATH)
  500.  
  501. ### Checks for header files.
  502.  
  503. AC_HEADER_STDC
  504. AC_CHECK_HEADERS(assert.h float.h limits.h memory.h pwd.h stdlib.h)
  505. AC_CHECK_HEADERS(string.h varargs.h unistd.h floatingpoint.h)
  506. AC_CHECK_HEADERS(sys/utsname.h sys/time.h sys/fcntl.h)
  507. AC_CHECK_HEADERS(sys/ttold.h sys/ptem.h sys/select.h sys/resource.h)
  508. AC_HEADER_DIRENT
  509. AC_TIME_WITH_SYS_TIME
  510.  
  511. ### Use sgtty on Ultrix so that using DEC Migrate to convert a Mips
  512. ### binary to an Alpha binary will work.  Also on Alpha/OSF to avoid
  513. ### a readline bug.
  514.  
  515. case "$canonical_host_type" in
  516.   mips-dec-ultrix* | alpha-dec-osf*)
  517.     AC_CHECK_HEADER(sgtty.h, [AC_DEFINE(HAVE_SGTTY_H, 1)], [])
  518.  
  519.     if test "$ac_cv_header_sgtty_h" = no; then
  520.       AC_CHECK_HEADERS(termios.h termio.h sgtty.h, [break], [])
  521.     fi
  522.   ;;
  523.   *)
  524.     AC_CHECK_HEADERS(termios.h termio.h sgtty.h, [break], [])
  525.   ;;
  526. esac
  527.  
  528. if test "$ac_cv_header_termios_h" = yes \
  529.     || test "$ac_cv_header_termio_h" = yes \
  530.     || test "$ac_cv_header_sgtty_h" = yes; then
  531.   true
  532. else
  533.   AC_MSG_ERROR([I couldn't find termios.h, termio.h, or sgtty.h!])
  534. fi
  535.  
  536. ### Checks for functions.
  537.  
  538. AC_CHECK_FUNCS(setvbuf getcwd gethostname bzero bcopy rindex vfprintf vsprintf)
  539. AC_CHECK_FUNCS(stricmp strnicmp strcasecmp strncasecmp strerror atexit)
  540. AC_CHECK_FUNCS(on_exit tempnam memmove putenv gettimeofday getrusage)
  541.  
  542. dnl Would like to get rid of this cruft, and just have
  543. dnl
  544. dnl   AC_CHECK_FUNCS(finite isnan isinf)
  545. dnl
  546. dnl instead, but that used to fail on some systems...
  547. dnl
  548. dnl Also just using AC_CHECK_FUNCS doesn't seem to work to find isinf
  549. dnl and isnan on Linux systems, so we use AC_CHECK_FUNC, and if that
  550. dnl fails, we try again by including math.h and invoking the function
  551. dnl with an argument. 
  552.  
  553. ### Check to see if we have IEEE math functions, and if so, which ones.
  554. ###
  555. ### For Linux: add -mieee-fp flag to CFLAGS when checking for IEEE FP
  556. ### functions, otherwise we may not find them.
  557. ###
  558. ### Also check for some additional trig functions that aren't ANSI but
  559. ### are often available.  If they are missing, we try to replace them
  560. ### with functions from the BSD/NET2 math library.
  561.  
  562. AC_CHECK_LIB(sunmath, main)
  563.  
  564. dnl This is bogus.  We shouldn't have to explicitly add libc too!
  565.  
  566. case "$canonical_host_type" in
  567.   *-*-linux*)
  568.     AC_CHECK_LIB(m, main, , , -lc)
  569.   ;;
  570.   *)
  571.     AC_CHECK_LIB(m, main)
  572.   ;;
  573. esac
  574.  
  575. XCFLAGS="$CFLAGS"
  576. CFLAGS="$CFLAGS $GCC_IEEE_FP_FLAG"
  577.  
  578. ### Inf and NaN don't work with gcc on the Alpha yet.  I am also told
  579. ### that they don't work on m68k HP sytems either.
  580.  
  581. case "$canonical_host_type" in
  582.   alpha-dec-osf* | m68k-hp-hpux*)
  583.   ;;
  584.   *)
  585.     AC_CHECK_FUNCS(finite isnan isinf infinity quiet_nan)
  586.   ;;
  587. esac
  588.  
  589. ### Check for nonstandard but common math functions that we need.
  590.  
  591. AC_CHECK_FUNCS(acosh asinh atanh erf erfc lgamma)
  592.  
  593. AC_MSG_CHECKING([for signgam declaration in math.h])
  594. AC_TRY_LINK([#include <math.h>],
  595.   [int foo = signgam + 1;],
  596.   AC_MSG_RESULT(yes)
  597.   AC_DEFINE(SIGNGAM_DECLARED, 1),
  598.   AC_MSG_RESULT(no))
  599.  
  600. CFLAGS="$XCFLAGS"
  601.  
  602. ### Checks for OS specific cruft.
  603.  
  604. AC_STRUCT_TM
  605. AC_FUNC_SETVBUF_REVERSED
  606. TERMLIBS=""
  607. for termlib in termcap terminfo curses termlib ; do
  608.   AC_CHECK_LIB(${termlib}, main, [TERMLIBS="${TERMLIBS} -l${termlib}"])
  609.   case "${TERMLIBS}" in
  610.     *-l${termlib}*)
  611.       AC_MSG_RESULT([defining TERMLIBS to be $TERMLIBS])
  612.       break
  613.     ;;
  614.   esac
  615. done
  616.  
  617. AC_MSG_CHECKING([for struct exception in math.h])
  618. AC_TRY_LINK([#include <math.h>],
  619.   [struct exception *x; x->type; x->name;],
  620.   AC_MSG_RESULT(yes)
  621.   AC_DEFINE(EXCEPTION_IN_MATH, 1),
  622.   AC_MSG_RESULT(no))
  623.  
  624. AC_SUBST(TERMLIBS)
  625.  
  626. ### Signal stuff.
  627.  
  628. AC_TYPE_SIGNAL
  629. AC_DECL_SYS_SIGLIST
  630. AC_MSG_CHECKING([for sys_siglist variable])
  631. AC_TRY_LINK([#include <stdio.h>],
  632.   [extern char *sys_siglist[]; printf ("%s\n", sys_siglist[1]);],
  633.   AC_MSG_RESULT(yes)
  634.   AC_DEFINE(HAVE_SYS_SIGLIST, 1),
  635.   AC_MSG_RESULT(no))
  636.  
  637. ### Define VOID_SIGHANDLER for readline.
  638.  
  639. case "$RETSIGTYPE" in
  640.   int)
  641.   ;;
  642.   *)
  643.     VOID_SIGHANDLER="-DVOID_SIGHANDLER=1"
  644.     AC_MSG_RESULT([defining VOID_SIGHANDLER to be 1])
  645.   ;;
  646. esac
  647. AC_SUBST(VOID_SIGHANDLER)
  648.  
  649. ### Checks for other programs used for building, testing, installing,
  650. ### and running Octave.
  651. ###
  652. ### For now, don't define LEXLIB to be -lfl -- we don't use anything in
  653. ### it, and it might not be installed.
  654. ###
  655. ### Also make sure that we generate an interactive scanner if we are
  656. ### using flex.
  657.  
  658. AC_PROG_LEX
  659. case "$LEX" in
  660.   flex*)
  661.     LFLAGS="-t -I"
  662.     AC_MSG_RESULT([defining LFLAGS to be $LFLAGS])
  663.     LEXLIB=
  664.   ;;
  665.   *)
  666.     LFLAGS="-t"
  667.     AC_MSG_RESULT([defining LFLAGS to be $LFLAGS])
  668.     AC_MSG_WARN([I didn't find flex, but that's only a problem])
  669.     AC_MSG_WARN([if you need to reconstruct lex.cc])
  670.   ;;
  671. esac
  672. AC_SUBST(LFLAGS)
  673.  
  674. AC_PROG_YACC
  675. case "$YACC" in
  676.   bison*)
  677.   ;;
  678.   *)
  679.     AC_MSG_WARN([I didn't find bison, but that's only a problem])
  680.     AC_MSG_WARN([if you need to reconstruct parse.cc])
  681.   ;;
  682. esac
  683.  
  684. AC_PROG_RANLIB
  685.  
  686. AC_CHECK_PROG(RUNTEST, runtest, runtest, [])
  687. AC_CHECK_PROG(EXPECT, expect, expect, [])
  688. if test -z "$EXPECT" ; then
  689.   RUNTEST=
  690. fi
  691. AC_SUBST(RUNTEST)
  692.  
  693. AC_PROG_INSTALL
  694.  
  695. AC_CHECK_PROG(GNUPLOT_BINARY, gnuplot, gnuplot, [])
  696. if test -z "$GNUPLOT_BINARY"; then
  697.   AC_MSG_WARN([I didn't find gnuplot.  It isn't necessary to have gnuplot])
  698.   AC_MSG_WARN([installed, but you won't be able to use any of Octave's])
  699.   AC_MSG_WARN([plotting commands without it.])
  700.   AC_MSG_WARN([])
  701.   AC_MSG_WARN([If gnuplot is installed but it isn't in your path, you can])
  702.   AC_MSG_WARN([tell Octave where to find it by typing the command])
  703.   AC_MSG_WARN([])
  704.   AC_MSG_WARN([gnuplot_binary = "/full/path/to/gnuplot/binary"])
  705.   AC_MSG_WARN([])
  706.   AC_MSG_WARN([at the Octave prompt.])
  707. fi
  708.  
  709. AC_CHECK_PROGS(DEFAULT_PAGER, less more page pg, [])
  710. if test -z "$DEFAULT_PAGER"; then
  711.   AC_MSG_WARN([I couldn't find `less', `more', `page', or `pg'])
  712. elif test "$DEFAULT_PAGER" = less; then
  713.   DEFAULT_PAGER="less -e"
  714.   AC_MSG_RESULT([defining DEFAULT_PAGER to be $DEFAULT_PAGER])
  715. fi
  716.  
  717. ### Even though we include config.h in most files, some need to be
  718. ### compiled with the -D options on the compiler command line.  Use
  719. ### UGLY_DEFS for that.
  720.  
  721. AC_OUTPUT_MAKE_DEFS
  722. UGLY_DEFS="$DEFS"
  723. AC_MSG_RESULT([defining UGLY_DEFS to be $UGLY_DEFS])
  724. AC_SUBST(UGLY_DEFS)
  725.  
  726. ### Maybe add -Wall to compiler flags now that we're done feature
  727. ### testing. 
  728. ###
  729. ### To get gcc and g++ to be really picky, try these adding these
  730. ### options to CFLAGS and CXXFLAGS along with -Wall:
  731. ###
  732. ###   -ansi
  733. ###   -pedantic
  734. ###   -Wwrite-strings
  735. ###   -Wid-clash-31
  736. ###   -Wpointer-arith
  737. ###   -Wcast-qual
  738. ###   -Wenum-clash
  739. ###   -Wcast-align
  740. ###   -Wtraditional
  741. ###   -Wstrict-prototypes
  742. ###   -Wmissing-prototypes
  743. ###   -Wnested-externs
  744. ###   -Woverloaded-virtual
  745. ###   -Winline
  746. ###   -felide-constructors
  747. ###   -fnonnull-objects
  748.  
  749. if $ADD_CXX_WALL; then
  750.   CXXFLAGS="$CXXFLAGS -Wall"
  751.   AC_MSG_RESULT([adding -Wall to CXXFLAGS])
  752. fi
  753. if $ADD_CC_WALL; then
  754.   CFLAGS="$CFLAGS -Wall"
  755.   AC_MSG_RESULT([adding -Wall to CFLAGS])
  756. fi
  757.  
  758. ### Do the substitutions in all the Makefiles.
  759.  
  760. define([tmpA], [Makefile octMakefile Makeconf])dnl
  761. define([tmpB], [libcruft/Makefile libcruft/Makerules])dnl
  762. define([tmpC], [liboctave/Makefile src/Makefile dld/Makefile])dnl
  763. define([tmpD], [info/Makefile readline/Makefile readline/doc/Makefile])dnl
  764. define([tmpE], [readline/examples/Makefile doc/Makefile])dnl
  765. define([tmpF], [test/Makefile kpathsea/Makefile])dnl
  766. define([srcdirs], [tmpA tmpB tmpC tmpD tmpE tmpF])dnl
  767.  
  768. define([tmpa], [libcruft/blas/Makefile libcruft/balgen/Makefile])dnl
  769. define([tmpb], [libcruft/dassl/Makefile libcruft/eispack/Makefile])dnl
  770. define([tmpc], [libcruft/fftpack/Makefile libcruft/fsqp/Makefile])dnl
  771. define([tmpd], [libcruft/lapack/Makefile libcruft/linpack/Makefile])dnl
  772. define([tmpe], [libcruft/minpack/Makefile libcruft/misc/Makefile])dnl
  773. define([tmpf], [libcruft/npsol/Makefile libcruft/odepack/Makefile])dnl
  774. define([tmpg], [libcruft/qpsol/Makefile libcruft/quadpack/Makefile])dnl
  775. define([tmph], [libcruft/ranlib/Makefile libcruft/slatec-fn/Makefile])dnl
  776. define([tmpi], [libcruft/villad/Makefile])dnl
  777.  
  778. define([cruftdirs], [tmpa tmpb tmpc tmpd tmpe tmpf tmpg tmph tmpi])dnl
  779. define([tmpSA], [scripts/Makefile scripts/control/Makefile])dnl
  780. define([tmpSB], [scripts/general/Makefile scripts/image/Makefile])
  781. define([tmpSC], [scripts/linear-algebra/Makefile])dnl
  782. define([tmpSD], [scripts/miscellaneous/Makefile scripts/plot/Makefile])dnl
  783. define([tmpSE], [scripts/polynomial/Makefile scripts/set/Makefile])dnl
  784. define([tmpSF], [scripts/signal/Makefile scripts/special-matrix/Makefile])dnl
  785. define([tmpSG], [scripts/startup/Makefile scripts/statistics/Makefile])dnl
  786. define([tmpSH], [scripts/elfun/Makefile scripts/specfun/Makefile])dnl
  787. define([tmpSI], [scripts/strings/Makefile])dnl
  788. define([mdirs], [tmpSA tmpSB tmpSC tmpSD tmpSE tmpSF tmpSG tmpSH tmpSI])dnl
  789.  
  790. AC_OUTPUT([srcdirs cruftdirs mdirs])
  791.