comparison configure.ac @ 15125:067699edef86

configure.ac: Re-organize to follow Autoconf layout guidelines * configure.ac: Re-organize to follow Autoconf layout guidelines
author Rik <rik@octave.org>
date Tue, 07 Aug 2012 13:34:22 -0700
parents 4e0ab3b28418
children 25200c04bc25
comparison
equal deleted inserted replaced
15124:0464e3ceb85b 15125:067699edef86
25 ### AC_PROG_CC or AC_PROG_CXX. 25 ### AC_PROG_CC or AC_PROG_CXX.
26 26
27 EXTERN_CFLAGS="$CFLAGS" 27 EXTERN_CFLAGS="$CFLAGS"
28 EXTERN_CXXFLAGS="$CXXFLAGS" 28 EXTERN_CXXFLAGS="$CXXFLAGS"
29 29
30 AC_PREREQ([2.62])
30 AC_INIT([GNU Octave], [3.7.0+], [http://octave.org/bugs.html], [octave]) 31 AC_INIT([GNU Octave], [3.7.0+], [http://octave.org/bugs.html], [octave])
31 32
32 dnl PACKAGE_VERSION is set by the AC_INIT VERSION arg 33 dnl PACKAGE_VERSION is set by the AC_INIT VERSION arg
33 OCTAVE_VERSION="$PACKAGE_VERSION" 34 OCTAVE_VERSION="$PACKAGE_VERSION"
34 OCTAVE_API_VERSION_NUMBER="48" 35 OCTAVE_API_VERSION_NUMBER="48"
39 AC_SUBST(OCTAVE_API_VERSION_NUMBER) 40 AC_SUBST(OCTAVE_API_VERSION_NUMBER)
40 AC_SUBST(OCTAVE_API_VERSION) 41 AC_SUBST(OCTAVE_API_VERSION)
41 AC_SUBST(OCTAVE_RELEASE_DATE) 42 AC_SUBST(OCTAVE_RELEASE_DATE)
42 AC_SUBST(OCTAVE_COPYRIGHT) 43 AC_SUBST(OCTAVE_COPYRIGHT)
43 44
44 AC_REVISION($Revision: 1.603 $) 45 dnl FIXME: We should auto-insert the Mercurial changeset ID into the
45 AC_PREREQ([2.62]) 46 dnl AC_REVISION field whenever configure.ac is modified.
47 dnl AC_REVISION($Revision: 1.603 $)
46 AC_CONFIG_SRCDIR([src/octave.cc]) 48 AC_CONFIG_SRCDIR([src/octave.cc])
47 AC_CONFIG_HEADERS([config.h]) 49 AC_CONFIG_HEADERS([config.h])
48 AC_CONFIG_AUX_DIR([build-aux]) 50 AC_CONFIG_AUX_DIR([build-aux])
49 AC_CONFIG_MACRO_DIR([m4]) 51 AC_CONFIG_MACRO_DIR([m4])
50 52
52 54
53 OCTAVE_HOST_TYPE 55 OCTAVE_HOST_TYPE
54 56
55 AC_DEFINE(OCTAVE_SOURCE, 1, [Define to 1 if this is Octave.]) 57 AC_DEFINE(OCTAVE_SOURCE, 1, [Define to 1 if this is Octave.])
56 58
57 dnl FIXME: Can this MSVC test be moved down to the section on finding a
58 dnl a C compiler which already has an MSVC exception test?
59 dnl FIXME: We should probably only generate this file if it is missing.
60 ### Produce unistd.h for MSVC target, this simplifies changes in
61 ### Octave source tree and avoid problems with lex-generated code.
62 case "$canonical_host_type" in
63 *-*-msdosmsvc)
64 AC_MSG_NOTICE([Generating replacement for <unistd.h> for MSVC])
65 cat << \EOF > unistd.h
66 /* File generated by configure script. */
67 #include <direct.h>
68 #include <io.h>
69 #include <process.h>
70 EOF
71 CPPFLAGS="-I. $CPPFLAGS"
72 ;;
73 esac
74
75 AC_USE_SYSTEM_EXTENSIONS 59 AC_USE_SYSTEM_EXTENSIONS
76 60
77 ### Path separator. 61 ### Path separator.
78 62
79 sepchar=: 63 sepchar=:
257 if test -n "$gxx_version"; then 241 if test -n "$gxx_version"; then
258 CXX_VERSION="$gxx_version" 242 CXX_VERSION="$gxx_version"
259 fi 243 fi
260 AC_SUBST(CXX_VERSION) 244 AC_SUBST(CXX_VERSION)
261 245
262 OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL
263 OCTAVE_CXX_ISO_COMPLIANT_LIBRARY
264 OCTAVE_CXX_BROKEN_REINTERPRET_CAST
265
266 ### Determine which C compiler to use (we expect to find gcc). 246 ### Determine which C compiler to use (we expect to find gcc).
267 247
268 AC_PROG_CC 248 AC_PROG_CC
269 AC_PROG_CPP 249 AC_PROG_CPP
270 AC_PROG_GCC_TRADITIONAL 250 AC_PROG_GCC_TRADITIONAL
339 AC_SUBST(DEPEND_EXTRA_SED_PATTERN) 319 AC_SUBST(DEPEND_EXTRA_SED_PATTERN)
340 320
341 ### Check for pthread library 321 ### Check for pthread library
342 322
343 AX_PTHREAD 323 AX_PTHREAD
344 ## Include pthread libs and flags here in case other tests need them. 324 ## Include pthread libs and flags early in case other tests need them.
345 ## They seem to be required for the OpenGL tests on Debian systems. 325 ## They seem to be required for the OpenGL tests on Debian systems.
346 LIBS="$PTHREAD_LIBS $LIBS" 326 LIBS="$PTHREAD_LIBS $LIBS"
347 CFLAGS="$CFLAGS $PTHREAD_CFLAGS" 327 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
348 CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" 328 CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
349 329
453 OCTAVE_CHECK_OPENMP(-openmp) 433 OCTAVE_CHECK_OPENMP(-openmp)
454 ;; 434 ;;
455 ## Add other compilers supporting OpenMP here 435 ## Add other compilers supporting OpenMP here
456 esac 436 esac
457 fi 437 fi
458
459 dnl FIXME: This is OS-specific tests. Can this be moved further down in
460 dnl configure.ac to reside with other similar tests?
461 ### Use -static if compiling on Alpha OSF/1 1.3 systems.
462
463 case "$canonical_host_type" in
464 alpha*-dec-osf1.3)
465 LD_STATIC_FLAG=-static
466 ;;
467 esac
468 if test -n "$LD_STATIC_FLAG"; then
469 AC_MSG_NOTICE([defining LD_STATIC_FLAG to be $LD_STATIC_FLAG])
470 fi
471 AC_SUBST(LD_STATIC_FLAG)
472 438
473 ### Defaults for cross compiling. BUILD_CC and BUILD_CXX are 439 ### Defaults for cross compiling. BUILD_CC and BUILD_CXX are
474 ### the compilers that we use for building tools on the build system. 440 ### the compilers that we use for building tools on the build system.
475 ### For now, we assume that the only cross compiling we can do is 441 ### For now, we assume that the only cross compiling we can do is
476 ### with gcc on a Unixy system, but the dedicated hacker can override these. 442 ### with gcc on a Unixy system, but the dedicated hacker can override these.
637 AC_MSG_RESULT([setting F77_FLOAT_STORE_FLAG to -ffloat-store]) 603 AC_MSG_RESULT([setting F77_FLOAT_STORE_FLAG to -ffloat-store])
638 F77_FLOAT_STORE_FLAG=-ffloat-store 604 F77_FLOAT_STORE_FLAG=-ffloat-store
639 AC_SUBST(F77_FLOAT_STORE_FLAG) 605 AC_SUBST(F77_FLOAT_STORE_FLAG)
640 ]) 606 ])
641 607
642 ### Check that C compiler and libraries support IEEE754 data format.
643 OCTAVE_IEEE754_DATA_FORMAT
644
645 ### Check C++ library for various capabilities.
646 OCTAVE_CXX_BITWISE_OP_TEMPLATES
647 OCTAVE_CXX_COMPLEX_SETTERS
648 OCTAVE_CXX_COMPLEX_REFERENCE_ACCESSORS
649
650 ### Check for the Qhull library 608 ### Check for the Qhull library
651 609
652 OCTAVE_CHECK_LIBRARY(qhull, QHull, 610 OCTAVE_CHECK_LIBRARY(qhull, QHull,
653 [Qhull library not found -- this will result in loss of functionality of some geometry functions.], 611 [Qhull library not found -- this will result in loss of functionality of some geometry functions.],
654 [libqhull/libqhull.h qhull/libqhull.h libqhull.h qhull/qhull.h qhull.h], [qh_qhull], [], [], 612 [libqhull/libqhull.h qhull/libqhull.h libqhull.h qhull/qhull.h qhull.h], [qh_qhull], [], [],
1085 1043
1086 AC_SUBST(GRAPHICS_CFLAGS) 1044 AC_SUBST(GRAPHICS_CFLAGS)
1087 AC_SUBST(GRAPHICS_LIBS) 1045 AC_SUBST(GRAPHICS_LIBS)
1088 1046
1089 ### Start determination of shared vs. static libraries 1047 ### Start determination of shared vs. static libraries
1048
1049 ## Use -static if compiling on Alpha OSF/1 1.3 systems.
1050 case "$canonical_host_type" in
1051 alpha*-dec-osf1.3)
1052 LD_STATIC_FLAG=-static
1053 ;;
1054 esac
1055 if test -n "$LD_STATIC_FLAG"; then
1056 AC_MSG_NOTICE([defining LD_STATIC_FLAG to be $LD_STATIC_FLAG])
1057 fi
1058 AC_SUBST(LD_STATIC_FLAG)
1090 1059
1091 OCTAVE_PROG_AR 1060 OCTAVE_PROG_AR
1092 1061
1093 ifdef([LT_INIT], [], [ 1062 ifdef([LT_INIT], [], [
1094 errprint([error: you must have libtool 2.2.2 or a more recent version 1063 errprint([error: you must have libtool 2.2.2 or a more recent version
1637 AC_SUBST(OCTINTERP_DLL_DEFS) 1606 AC_SUBST(OCTINTERP_DLL_DEFS)
1638 AC_SUBST(OCTGRAPHICS_DLL_DEFS) 1607 AC_SUBST(OCTGRAPHICS_DLL_DEFS)
1639 AC_SUBST(library_path_var) 1608 AC_SUBST(library_path_var)
1640 AC_SUBST(ldpreloadsep) 1609 AC_SUBST(ldpreloadsep)
1641 1610
1642 ### special checks for odd OS specific things. 1611 ### More configure argument checking related to linking
1643
1644 AC_CHECK_FUNCS(getpwnam, [], [AC_CHECK_LIB(sun, getpwnam)])
1645
1646 case "$canonical_host_type" in
1647 *-*-mingw*)
1648 if test "$have_msvc" = "yes"; then
1649 AC_CHECK_LIB(dirent, opendir)
1650 LIBS="$LIBS -ladvapi32 -lgdi32 -lws2_32 -luser32 -lkernel32"
1651 else
1652 LIBS="$LIBS -lgdi32 -lws2_32 -luser32 -lkernel32"
1653 fi
1654 LIBS="$LIBS -lgdi32 -lws2_32 -luser32 -lkernel32"
1655 ;;
1656 *-*-msdosmsvc*)
1657 AC_CHECK_LIB(dirent, opendir)
1658 LIBS="$LIBS -ladvapi32 -lgdi32 -lws2_32 -luser32 -lkernel32"
1659 ;;
1660 esac
1661 1612
1662 AC_ARG_ENABLE([no-undefined], 1613 AC_ARG_ENABLE([no-undefined],
1663 [AS_HELP_STRING([--enable-no-undefined], 1614 [AS_HELP_STRING([--enable-no-undefined],
1664 [pass -no-undefined to libtool when linking Octave and its shared libraries (on by default)])], 1615 [pass -no-undefined to libtool when linking Octave and its shared libraries (on by default)])],
1665 [case "${enableval}" in 1616 [case "${enableval}" in
1677 no) link_all_deps=false ;; 1628 no) link_all_deps=false ;;
1678 *) AC_MSG_ERROR([bad value ${enableval} for --enable-link-all-depenencies]) ;; 1629 *) AC_MSG_ERROR([bad value ${enableval} for --enable-link-all-depenencies]) ;;
1679 esac], [link_all_deps=false]) 1630 esac], [link_all_deps=false])
1680 AM_CONDITIONAL([AMCOND_LINK_ALL_DEPS], [test x$link_all_deps = xtrue]) 1631 AM_CONDITIONAL([AMCOND_LINK_ALL_DEPS], [test x$link_all_deps = xtrue])
1681 1632
1682 ### Type stuff. 1633 ## Dynamic linking is now enabled only if we are building shared
1683 1634 ## libs and some API for dynamic linking has been detected.
1684 AC_TYPE_MODE_T
1685 AC_TYPE_OFF_T
1686 AC_TYPE_PID_T
1687 AC_TYPE_SIZE_T
1688 AC_TYPE_UID_T
1689 AC_CHECK_TYPES([dev_t, ino_t])
1690 AC_CHECK_TYPES([long long int, unsigned long long int])
1691
1692 ### How big are ints and how are they oriented? These could probably
1693 ### be eliminated in favor of run-time checks.
1694
1695 AC_CHECK_SIZEOF(short)
1696 AC_CHECK_SIZEOF(int)
1697 AC_CHECK_SIZEOF(long)
1698 AC_CHECK_SIZEOF(long long)
1699
1700 ### Does the C compiler handle alloca() and const correctly?
1701
1702 AC_FUNC_ALLOCA
1703
1704 ### See if we should use placement delete.
1705
1706 OCTAVE_PLACEMENT_DELETE
1707
1708 ### See if we can auto allocate variable sized arrays.
1709
1710 OCTAVE_DYNAMIC_AUTO_ARRAYS
1711
1712 ### See if we can use fast integer arithmetics
1713
1714 OCTAVE_FAST_INT_OPS
1715
1716 ### Check for long double type (for 64-bit integers)
1717
1718 AC_CHECK_SIZEOF(long double)
1719
1720 ### Checks for header files.
1721
1722 AC_HEADER_DIRENT
1723 AC_HEADER_SYS_WAIT
1724
1725 ### C headers
1726
1727 AC_CHECK_HEADERS(curses.h direct.h dlfcn.h floatingpoint.h grp.h \
1728 ieeefp.h inttypes.h locale.h memory.h ncurses.h poll.h pthread.h \
1729 pwd.h sunmath.h sys/ioctl.h sys/param.h sys/poll.h sys/resource.h \
1730 sys/select.h sys/utsname.h termcap.h)
1731
1732 ### C++ headers
1733
1734 AC_LANG_PUSH(C++)
1735 AC_CHECK_HEADERS(sstream)
1736 AC_CHECK_HEADERS([unordered_map], [], [
1737 AC_CHECK_HEADERS([tr1/unordered_map])])
1738 AC_MSG_CHECKING([whether unordered_map requires tr1 namespace])
1739 unordered_map_requires_tr1_namespace=no
1740 if test "$ac_cv_header_unordered_map" = "yes"; then
1741 ## Have <unordered_map>, but still have to check whether
1742 ## tr1 namespace is required (like MSVC, for instance).
1743 AC_COMPILE_IFELSE([
1744 AC_LANG_PROGRAM([
1745 #include <unordered_map>
1746 ], [
1747 std::unordered_map<int,int> m;
1748 ])], [], [unordered_map_requires_tr1_namespace=yes])
1749 elif test "$ac_cv_header_tr1_unordered_map" = "yes"; then
1750 unordered_map_requires_tr1_namespace=yes
1751 fi
1752 if test "$unordered_map_requires_tr1_namespace" = "yes"; then
1753 AC_DEFINE(USE_UNORDERED_MAP_WITH_TR1, 1, [Define to 1 if unordered_map requires the use of tr1 namespace.])
1754 fi
1755 AC_MSG_RESULT([$unordered_map_requires_tr1_namespace])
1756 AC_LANG_POP(C++)
1757
1758 have_termios_h=no
1759 AC_CHECK_HEADERS(termios.h, have_termios_h=yes)
1760 AC_CHECK_HEADERS(termio.h, have_termio_h=yes, have_termio_h=no)
1761 AC_CHECK_HEADERS(sgtty.h, have_sgtty_h=yes, have_sgtty_h=no)
1762 AC_CHECK_HEADERS(fnmatch.h, have_fnmatch_h=yes, have_fnmatch_h=no)
1763 AC_CHECK_HEADERS(conio.h, have_conio_h=yes, have_conio_h=no)
1764
1765 if test "$have_termios_h" = yes \
1766 || test "$have_termio_h" = yes \
1767 || test "$have_sgtty_h" = yes; then
1768 true
1769 else
1770 AC_MSG_WARN([I couldn't find termios.h, termio.h, or sgtty.h!])
1771 fi
1772
1773 ### For MSVC compilers, avoid #define of min/max from windows.h header
1774 if test "$have_msvc" = "yes"; then
1775 AC_DEFINE(NOMINMAX, 1, [Define to 1 if you want to avoid min/max macro definition in Windows headers.])
1776 fi
1777
1778 ### Checks for functions and variables.
1779
1780 AC_CHECK_FUNCS(basename canonicalize_file_name \
1781 chmod dup2 endgrent endpwent execvp expm1 expm1f fork \
1782 getegid geteuid getgid getgrent getgrgid getgrnam getpgrp getpid \
1783 getppid getpwent getpwuid getuid getwd _kbhit kill \
1784 lgamma lgammaf lgamma_r lgammaf_r localtime_r log1p log1pf \
1785 mkstemp pipe putenv \
1786 realpath resolvepath rindex roundl select setgrent setlocale \
1787 setpwent setvbuf siglongjmp \
1788 strsignal tempnam tgammaf umask \
1789 uname utime waitpid \
1790 _chmod x_utime _utime32)
1791
1792 AC_LANG_PUSH(C++)
1793 AC_CHECK_DECLS([exp2, round, tgamma], [], [], [[#include <cmath>]])
1794 AC_CHECK_FUNCS([exp2 round tgamma])
1795 AH_VERBATIM([Z_FUNCS_AND_DECLS], [
1796 #if defined (__cplusplus)
1797 extern "C" {
1798 #endif
1799 #if HAVE_EXP2 && ! HAVE_DECL_EXP2
1800 double exp2 (double );
1801 #endif
1802 #if HAVE_ROUND && ! HAVE_DECL_ROUND
1803 double round (double);
1804 #endif
1805 #if HAVE_TGAMMA && ! HAVE_DECL_TGAMMA
1806 double tgamma (double);
1807 #endif
1808 #if defined (__cplusplus)
1809 }
1810 #endif
1811 ])
1812 AC_LANG_POP(C++)
1813
1814 case "$canonical_host_type" in
1815 *-*-mingw*)
1816 ## MinGW does not provide a mkstemp function. However, it provides
1817 ## the mkstemps function in libiberty.
1818 AC_MSG_CHECKING([for mkstemps in libiberty])
1819 save_LIBS="$LIBS"
1820 LIBS="-liberty $LIBS"
1821 AC_LINK_IFELSE([
1822 AC_LANG_PROGRAM([[int mkstemps (char *pattern, int suffix_len);]],
1823 [[mkstemps ("XXXXXX", 0);]]
1824 )],
1825 [AC_MSG_RESULT(yes)
1826 HAVE_MKSTEMPS=yes
1827 AC_DEFINE(HAVE_MKSTEMPS, 1, [Define to 1 if mkstemps is available in libiberty.])
1828 ],
1829 [AC_MSG_RESULT(no)
1830 HAVE_MKSTEMPS=no
1831 LIBS="$save_LIBS"
1832 ])
1833 ;;
1834 esac
1835
1836 OCTAVE_SMART_PUTENV
1837
1838 case "$canonical_host_type" in
1839 *-*-msdosmsvc | *-*-mingw*)
1840 AC_MSG_CHECKING([for required _WIN32_WINNT])
1841 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1842 #include <windows.h>
1843 #if _WIN32_WINNT < 0x0403
1844 #error "Wrong version"
1845 #endif]], [])],
1846 AC_MSG_RESULT([none]), [
1847 AC_DEFINE(_WIN32_WINNT, 0x0403, [Define to 0x0403 to access InitializeCriticalSectionAndSpinCount.])
1848 AC_MSG_RESULT([0x0403])])
1849 AC_MSG_CHECKING([whether _USE_MATH_DEFINES needs to be defined])
1850 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]],
1851 [[int x = M_LN2;]])],
1852 AC_MSG_RESULT([no]), [
1853 AC_DEFINE(_USE_MATH_DEFINES, 1, [Define to 1 if your system needs to define math constants like M_LN2.])
1854 AC_MSG_RESULT([yes])])
1855 ;;
1856 esac
1857
1858 ## Check for CGDisplayBitsPerPixel function on Mac OSX systems with Carbon
1859 OCTAVE_CARBON_CGDISPLAYBITSPERPIXEL
1860
1861 ### Dynamic linking is now enabled only if we are building shared
1862 ### libs and some API for dynamic linking is detected.
1863 1635
1864 ## FIXME: A lot of the following duplicates the functionality of 1636 ## FIXME: A lot of the following duplicates the functionality of
1865 ## code generated by the dlopen option for LT_INIT. 1637 ## code generated by the dlopen option for LT_INIT.
1866 1638
1867 LD_CXX='$(CXX)' 1639 LD_CXX='$(CXX)'
1931 AC_SUBST(ENABLE_DYNAMIC_LINKING) 1703 AC_SUBST(ENABLE_DYNAMIC_LINKING)
1932 AC_SUBST(LIBOCTINTERP) 1704 AC_SUBST(LIBOCTINTERP)
1933 AC_SUBST(LIBOCTAVE) 1705 AC_SUBST(LIBOCTAVE)
1934 AC_SUBST(LIBCRUFT) 1706 AC_SUBST(LIBCRUFT)
1935 1707
1936 dnl Maybe <cmath> defines the IEEE functions we need. 1708 ### Check for existence of various libraries
1709
1710 ## OS-specific test for dirent, opendir.
1711 case "$canonical_host_type" in
1712 *-*-mingw*)
1713 if test "$have_msvc" = "yes"; then
1714 AC_CHECK_LIB(dirent, opendir)
1715 LIBS="$LIBS -ladvapi32 -lgdi32 -lws2_32 -luser32 -lkernel32"
1716 else
1717 LIBS="$LIBS -lgdi32 -lws2_32 -luser32 -lkernel32"
1718 fi
1719 LIBS="$LIBS -lgdi32 -lws2_32 -luser32 -lkernel32"
1720 ;;
1721 *-*-msdosmsvc*)
1722 AC_CHECK_LIB(dirent, opendir)
1723 LIBS="$LIBS -ladvapi32 -lgdi32 -lws2_32 -luser32 -lkernel32"
1724 ;;
1725 esac
1726
1727 ## Find a termlib to use.
1728 octave_found_termlib=no
1729 for termlib in ncurses curses termcap terminfo termlib; do
1730 AC_CHECK_LIB(${termlib}, tputs, [
1731 TERM_LIBS="-l${termlib}"
1732 octave_found_termlib=yes
1733 break])
1734 done
1735
1736 if test "$octave_found_termlib" = no; then
1737 warn_termlibs="I couldn't find -ltermcap, -lterminfo, -lncurses, -lcurses, o\
1738 r -ltermlib!"
1739 AC_MSG_WARN([$warn_termlibs])
1740 fi
1741 AC_SUBST(TERM_LIBS)
1742
1743 ### Checks for header files.
1744
1745 AC_HEADER_DIRENT
1746 AC_HEADER_SYS_WAIT
1747
1748 dnl FIXME: We should probably only generate this file if it is missing.
1749 ### Produce unistd.h for MSVC target, this simplifies changes in
1750 ### Octave source tree and avoid problems with lex-generated code.
1751 case "$canonical_host_type" in
1752 *-*-msdosmsvc)
1753 AC_MSG_NOTICE([Generating replacement for <unistd.h> for MSVC])
1754 cat << \EOF > unistd.h
1755 /* File generated by configure script. */
1756 #include <direct.h>
1757 #include <io.h>
1758 #include <process.h>
1759 EOF
1760 CPPFLAGS="-I. $CPPFLAGS"
1761 ;;
1762 esac
1763
1764 ## C headers
1765
1766 AC_CHECK_HEADERS(curses.h direct.h dlfcn.h floatingpoint.h grp.h \
1767 ieeefp.h inttypes.h locale.h memory.h ncurses.h poll.h pthread.h \
1768 pwd.h sunmath.h sys/ioctl.h sys/param.h sys/poll.h sys/resource.h \
1769 sys/select.h sys/utsname.h termcap.h)
1770
1771 ## C++ headers
1772
1773 AC_LANG_PUSH(C++)
1774 AC_CHECK_HEADERS(sstream)
1775 AC_CHECK_HEADERS([unordered_map], [], [
1776 AC_CHECK_HEADERS([tr1/unordered_map])])
1777 AC_MSG_CHECKING([whether unordered_map requires tr1 namespace])
1778 unordered_map_requires_tr1_namespace=no
1779 if test "$ac_cv_header_unordered_map" = "yes"; then
1780 ## Have <unordered_map>, but still have to check whether
1781 ## tr1 namespace is required (like MSVC, for instance).
1782 AC_COMPILE_IFELSE([
1783 AC_LANG_PROGRAM([
1784 #include <unordered_map>
1785 ], [
1786 std::unordered_map<int,int> m;
1787 ])], [], [unordered_map_requires_tr1_namespace=yes])
1788 elif test "$ac_cv_header_tr1_unordered_map" = "yes"; then
1789 unordered_map_requires_tr1_namespace=yes
1790 fi
1791 if test "$unordered_map_requires_tr1_namespace" = "yes"; then
1792 AC_DEFINE(USE_UNORDERED_MAP_WITH_TR1, 1, [Define to 1 if unordered_map requires the use of tr1 namespace.])
1793 fi
1794 AC_MSG_RESULT([$unordered_map_requires_tr1_namespace])
1795 AC_LANG_POP(C++)
1796
1797 ## Find a termio header to include.
1798
1799 have_termios_h=no
1800 AC_CHECK_HEADERS(termios.h, have_termios_h=yes)
1801 AC_CHECK_HEADERS(termio.h, have_termio_h=yes, have_termio_h=no)
1802 AC_CHECK_HEADERS(sgtty.h, have_sgtty_h=yes, have_sgtty_h=no)
1803 AC_CHECK_HEADERS(fnmatch.h, have_fnmatch_h=yes, have_fnmatch_h=no)
1804 AC_CHECK_HEADERS(conio.h, have_conio_h=yes, have_conio_h=no)
1805
1806 if test "$have_termios_h" = yes \
1807 || test "$have_termio_h" = yes \
1808 || test "$have_sgtty_h" = yes; then
1809 true
1810 else
1811 AC_MSG_WARN([I couldn't find termios.h, termio.h, or sgtty.h!])
1812 fi
1813
1814 ## For MSVC compilers, avoid #define of min/max from windows.h header
1815 if test "$have_msvc" = "yes"; then
1816 AC_DEFINE(NOMINMAX, 1, [Define to 1 if you want to avoid min/max macro definition in Windows headers.])
1817 fi
1818
1819 ### Determine types and size of types.
1820
1821 AC_TYPE_MODE_T
1822 AC_TYPE_OFF_T
1823 AC_TYPE_PID_T
1824 AC_TYPE_SIZE_T
1825 AC_TYPE_UID_T
1826 AC_CHECK_TYPES([dev_t, ino_t])
1827 AC_CHECK_TYPES([long long int, unsigned long long int])
1828
1829 ## How big are ints and how are they oriented?
1830 ## These could probably be eliminated in favor of run-time checks.
1831
1832 AC_CHECK_SIZEOF(short)
1833 AC_CHECK_SIZEOF(int)
1834 AC_CHECK_SIZEOF(long)
1835 AC_CHECK_SIZEOF(long long)
1836 ## Check for long double type (for 64-bit integers)
1837 AC_CHECK_SIZEOF(long double)
1838
1839 ### Check structures and existence of necessary members
1840
1841 AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct stat.st_rdev, struct group.gr_passwd])
1842 #AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct stat.st_rdev])
1843 #AC_CHECK_MEMBERS(struct group.gr_passwd)
1844 #AC_CHECK_MEMBERS(struct group.gr_passwd)
1845
1846 AC_STRUCT_TIMEZONE
1847
1848 ### Check compiler characteristics.
1849
1850 ## Does compiler have support for new friend template declarations?
1851 OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL
1852
1853 ## Does reinterpret_cast fail for function pointers?
1854 OCTAVE_CXX_BROKEN_REINTERPRET_CAST
1855
1856 ## Check if C++ compiler allows placement delete.
1857 OCTAVE_PLACEMENT_DELETE
1858
1859 ## Check if C++ compiler can auto allocate variable sized arrays.
1860 OCTAVE_DYNAMIC_AUTO_ARRAYS
1861
1862 ## Check that C compiler and libraries support IEEE754 data format.
1863 OCTAVE_IEEE754_DATA_FORMAT
1864
1865 ## Is C++ runtime library ISO compliant?
1866 OCTAVE_CXX_ISO_COMPLIANT_LIBRARY
1867
1868 ## Are bit_and, bit_or, and bit_xor defined as templated operators?
1869 OCTAVE_CXX_BITWISE_OP_TEMPLATES
1870
1871 ## Can complex class set components independently?
1872 OCTAVE_CXX_COMPLEX_SETTERS
1873
1874 ## Are there functions to access real/imag parts of numbers via references?
1875 OCTAVE_CXX_COMPLEX_REFERENCE_ACCESSORS
1876
1877 ## Check if fast integer arithmetics based on bit tricks is available.
1878 OCTAVE_FAST_INT_OPS
1879
1880 ## Does the C compiler handle alloca() and const correctly?
1881 AC_FUNC_ALLOCA
1882
1883 ### Checks for functions and variables.
1884
1885 AC_CHECK_FUNCS(basename canonicalize_file_name \
1886 chmod dup2 endgrent endpwent execvp expm1 expm1f fork \
1887 getegid geteuid getgid getgrent getgrgid getgrnam getpgrp getpid \
1888 getppid getpwent getpwuid getuid getwd _kbhit kill \
1889 lgamma lgammaf lgamma_r lgammaf_r localtime_r log1p log1pf \
1890 mkstemp pipe putenv \
1891 realpath resolvepath rindex roundl select setgrent setlocale \
1892 setpwent setvbuf siglongjmp \
1893 strsignal tempnam tgammaf umask \
1894 uname utime waitpid \
1895 _chmod x_utime _utime32)
1896
1897 ## exp2, round, tgamma function checks
1898 AC_LANG_PUSH(C++)
1899 AC_CHECK_DECLS([exp2, round, tgamma], [], [], [[#include <cmath>]])
1900 AC_CHECK_FUNCS([exp2 round tgamma])
1901 AH_VERBATIM([Z_FUNCS_AND_DECLS], [
1902 #if defined (__cplusplus)
1903 extern "C" {
1904 #endif
1905 #if HAVE_EXP2 && ! HAVE_DECL_EXP2
1906 double exp2 (double);
1907 #endif
1908 #if HAVE_ROUND && ! HAVE_DECL_ROUND
1909 double round (double);
1910 #endif
1911 #if HAVE_TGAMMA && ! HAVE_DECL_TGAMMA
1912 double tgamma (double);
1913 #endif
1914 #if defined (__cplusplus)
1915 }
1916 #endif
1917 ])
1918 AC_LANG_POP(C++)
1919
1920 ## Look in <cmath> for the IEEE functions isnan, isinf, isfinite that we need.
1937 1921
1938 OCTAVE_CMATH_FUNC(isnan) 1922 OCTAVE_CMATH_FUNC(isnan)
1939 OCTAVE_CMATH_FUNC(isinf) 1923 OCTAVE_CMATH_FUNC(isinf)
1940 OCTAVE_CMATH_FUNC(isfinite) 1924 OCTAVE_CMATH_FUNC(isfinite)
1941 1925
1960 AC_CHECK_FUNCS(_finite _isnan) 1944 AC_CHECK_FUNCS(_finite _isnan)
1961 AC_CHECK_DECLS(signbit, , , [#include <math.h>]) 1945 AC_CHECK_DECLS(signbit, , , [#include <math.h>])
1962 ;; 1946 ;;
1963 esac 1947 esac
1964 1948
1965 ### Check for nonstandard but common math functions that we need. 1949 ## Check for nonstandard, but common math functions, that we need.
1966 1950
1967 AC_CHECK_FUNCS(acosh acoshf asinh asinhf atanh atanhf erf erff erfc erfcf exp2f log2 log2f) 1951 AC_CHECK_FUNCS(acosh acoshf asinh asinhf atanh atanhf erf erff erfc erfcf exp2f log2 log2f)
1968 AC_CHECK_FUNCS(hypotf _hypotf cbrt cbrtf) 1952 AC_CHECK_FUNCS(hypotf _hypotf cbrt cbrtf)
1969 1953
1970 ### Checks for OS specific cruft. 1954 ## MinGW exception for mkstemp
1971 1955 case "$canonical_host_type" in
1972 AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct stat.st_rdev]) 1956 *-*-mingw*)
1973 1957 ## MinGW does not provide a mkstemp function. However, it provides
1974 AC_STRUCT_TIMEZONE 1958 ## the mkstemps function in libiberty.
1959 AC_MSG_CHECKING([for mkstemps in libiberty])
1960 save_LIBS="$LIBS"
1961 LIBS="-liberty $LIBS"
1962 AC_LINK_IFELSE([
1963 AC_LANG_PROGRAM([[int mkstemps (char *pattern, int suffix_len);]],
1964 [[mkstemps ("XXXXXX", 0);]]
1965 )],
1966 [AC_MSG_RESULT(yes)
1967 HAVE_MKSTEMPS=yes
1968 AC_DEFINE(HAVE_MKSTEMPS, 1, [Define to 1 if mkstemps is available in libiberty.])
1969 ],
1970 [AC_MSG_RESULT(no)
1971 HAVE_MKSTEMPS=no
1972 LIBS="$save_LIBS"
1973 ])
1974 ;;
1975 esac
1976
1977 ## Windows-specific tests for extra #defines
1978 case "$canonical_host_type" in
1979 *-*-msdosmsvc | *-*-mingw*)
1980 AC_MSG_CHECKING([for required _WIN32_WINNT])
1981 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1982 #include <windows.h>
1983 #if _WIN32_WINNT < 0x0403
1984 #error "Wrong version"
1985 #endif]], [])],
1986 AC_MSG_RESULT([none]), [
1987 AC_DEFINE(_WIN32_WINNT, 0x0403, [Define to 0x0403 to access InitializeCriticalSectionAndSpinCount.])
1988 AC_MSG_RESULT([0x0403])])
1989 AC_MSG_CHECKING([whether _USE_MATH_DEFINES needs to be defined])
1990 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]],
1991 [[int x = M_LN2;]])],
1992 AC_MSG_RESULT([no]), [
1993 AC_DEFINE(_USE_MATH_DEFINES, 1, [Define to 1 if your system needs to define math constants like M_LN2.])
1994 AC_MSG_RESULT([yes])])
1995 ;;
1996 esac
1997
1998 ## Cygwin kluge for getrusage.
1999 AC_CHECK_FUNCS(getrusage)
2000 case "$canonical_host_type" in
2001 *-*-cygwin*)
2002 AC_DEFINE(RUSAGE_TIMES_ONLY, 1, [Define to 1 if your struct rusage only has time information.])
2003 ;;
2004 esac
2005
2006 ## Check for CGDisplayBitsPerPixel function on Mac OSX systems with Carbon
2007 OCTAVE_CARBON_CGDISPLAYBITSPERPIXEL
2008
2009 OCTAVE_SMART_PUTENV
2010
2011 AC_CHECK_FUNCS(getpwnam, [], [AC_CHECK_LIB(sun, getpwnam)])
2012
1975 AC_FUNC_CLOSEDIR_VOID 2013 AC_FUNC_CLOSEDIR_VOID
1976 2014
1977 AC_CHECK_MEMBERS(struct group.gr_passwd) 2015 ## Return type of matherr()
1978
1979 octave_found_termlib=no
1980 for termlib in ncurses curses termcap terminfo termlib; do
1981 AC_CHECK_LIB(${termlib}, tputs, [
1982 TERM_LIBS="-l${termlib}"
1983 octave_found_termlib=yes
1984 break])
1985 done
1986
1987 if test "$octave_found_termlib" = no; then
1988 warn_termlibs="I couldn't find -ltermcap, -lterminfo, -lncurses, -lcurses, o\
1989 r -ltermlib!"
1990 AC_MSG_WARN([$warn_termlibs])
1991 fi
1992 AC_SUBST(TERM_LIBS)
1993
1994 ### Return type of matherr()
1995 AC_MSG_CHECKING([for struct exception in math.h]) 2016 AC_MSG_CHECKING([for struct exception in math.h])
1996 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], 2017 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]],
1997 [[struct exception *x; x->type; x->name;]])], 2018 [[struct exception *x; x->type; x->name;]])],
1998 [AC_MSG_RESULT(yes) 2019 [AC_MSG_RESULT(yes)
1999 AC_DEFINE(EXCEPTION_IN_MATH, 1, 2020 AC_DEFINE(EXCEPTION_IN_MATH, 1,
2000 [Define to 1 if your math.h declares struct exception for matherr().])], 2021 [Define to 1 if your math.h declares struct exception for matherr().])],
2001 [AC_MSG_RESULT(no)]) 2022 [AC_MSG_RESULT(no)])
2002 2023
2003 ### Signal stuff. 2024 ## Signal stuff.
2004 2025
2005 AC_CHECK_DECLS([sys_siglist], [], [], 2026 AC_CHECK_DECLS([sys_siglist], [], [],
2006 [#include <signal.h> 2027 [#include <signal.h>
2007 /* NetBSD declares sys_siglist in unistd.h. */ 2028 /* NetBSD declares sys_siglist in unistd.h. */
2008 #if HAVE_UNISTD_H 2029 #if HAVE_UNISTD_H
2009 # include <unistd.h> 2030 # include <unistd.h>
2010 #endif 2031 #endif
2011 ]) 2032 ])
2012
2013 ### A system dependent kludge or two.
2014
2015 AC_CHECK_FUNCS(getrusage)
2016 case "$canonical_host_type" in
2017 *-*-cygwin*)
2018 AC_DEFINE(RUSAGE_TIMES_ONLY, 1, [Define to 1 if your struct rusage only has time information.])
2019 ;;
2020 esac
2021 2033
2022 ### Checks for other programs used in building, testing, installing, and 2034 ### Checks for other programs used in building, testing, installing, and
2023 ### running Octave. 2035 ### running Octave.
2024 2036
2025 AC_PROG_AWK 2037 AC_PROG_AWK