Rev 46553 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
### configure.ac -*- Autoconf -*-###### Process this file with autoconf to produce a configure script.###### Copyright (C) 1998-2008 R Core Team###### This file is part of R.###### R is free software; you can redistribute it and/or modify it under### the terms of the GNU General Public License as published by the Free### Software Foundation; either version 2 of the License, or (at your### option) any later version.###### R is distributed in the hope that it will be useful, but WITHOUT ANY### WARRANTY; without even the implied warranty of MERCHANTABILITY or### FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public### License for more details.###### You should have received a copy of the GNU General Public License### along with R; if not, a copy is available at### http://www.r-project.org/Licenses/AC_PREREQ(2.60)## We want to get the version number from file 'VERSION' (rather than## specifying the version info in 'configure.ac'. Hence, we need a bit## of M4 magic. Note that M4 esyscmd has a trailing newline because the## shell command output has one, hence the patsubst() trick.m4_define([R_VERSION],m4_bpatsubst(m4_esyscmd([cat VERSION]),[\([0-9.]*\)\(\w\|\W\)*],[\1]))AC_INIT([R],[R_VERSION],[r-bugs@R-project.org],[R])AC_CONFIG_SRCDIR([src/include/Defn.h])AC_CONFIG_AUX_DIR([tools])### * Information on the package.dnl ## Automake initialization.dnl Not needed, and possibly resulting in non-portable configure scriptsdnl with hard-wired Automake API numbers (aclocal-1.x) ...dnl AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)dnl Nevertheless, we need to provide PACKAGE and VERSION ...PACKAGE=[${PACKAGE_NAME}]AC_DEFINE_UNQUOTED(PACKAGE, "${PACKAGE}", [Name of package])AC_SUBST(PACKAGE)VERSION=[${PACKAGE_VERSION}]AC_DEFINE_UNQUOTED(VERSION, "${VERSION}", [Version number of package])AC_SUBST(VERSION)MAJ_MIN_VERSION=`echo ${VERSION} | sed 's/\.[[0-9]]$//'`AC_SUBST(MAJ_MIN_VERSION)## Autoheader initialization.AH_TOP([#ifndef R_CONFIG_H#define R_CONFIG_H])AH_BOTTOM([#endif /* not R_CONFIG_H */])## The gettext macros call AC_GNU_SOURCE early, so all the## C compiling makes use of that. If it is ever removed, we## would need it or something similar here.### ** Platform.AC_CANONICAL_HOSTAC_DEFINE_UNQUOTED(R_PLATFORM, "${host}",[Define this to be the canonical name (cpu-vendor-os) of your system.])AC_DEFINE_UNQUOTED(R_CPU, "${host_cpu}",[Define this to be the name of the CPU of your system.])AC_DEFINE_UNQUOTED(R_VENDOR, "${host_vendor}",[Define this to be the name of the vendor of your system.])AC_DEFINE_UNQUOTED(R_OS, "${host_os}",[Define this to be the name of the OS of your system.])R_PLATFORM="${host}"AC_SUBST(R_PLATFORM)R_OS="${host_os}"AC_SUBST(R_OS)case "${host_os}" inmingw*|windows*|winnt)AC_DEFINE(Win32, 1,[Define according to your operating system type.])R_OSTYPE="windows";;*)AC_DEFINE(Unix, 1,[Define according to your operating system type.])R_OSTYPE="unix";;esacAC_SUBST(R_OSTYPE)### ** Defaults.cfile="${srcdir}/config.site"if test -r "${cfile}"; thenecho "loading site script '${cfile}'". "${cfile}"ficfile="${HOME}/.Rconfig"if test -r "${cfile}"; thenecho "loading user script '${cfile}'". "${cfile}"## <FIXME>## Remove support for ~/.Rconf eventually.elsecfile="${HOME}/.Rconf"if test -r "${cfile}"; thenecho "loading user script '${cfile}'". "${cfile}"fi## </FIXME>ficfile="./config.site"if test -r "${cfile}"; thenecho "loading build specific script '${cfile}'". "${cfile}"fi## We need to establish suitable defaults for a 64-bit OSlibnn=libcase "${host_os}" inlinux*)case "${host_cpu}" inx86_64|mips64|ppc64|powerpc64|sparc64|s390x)libnn=lib64;;esac;;solaris*)## libnn=lib/sparcv9 ## on 64-bit only, but that's compiler-specific;;esac: ${LIBnn=$libnn}## We provide these defaults so that headers and libraries in## '/usr/local' are found (by the native tools, mostly).if test -f "/sw/etc/fink.conf"; then: ${CPPFLAGS="-I/sw/include -I/usr/local/include"}: ${LDFLAGS="-L/sw/lib -L/usr/local/lib"}else: ${CPPFLAGS="-I/usr/local/include"}: ${LDFLAGS="-L/usr/local/${LIBnn}"}fiAC_SUBST(LIBnn)## take care not to override the command-line settingif test "${libdir}" = '${exec_prefix}/lib'; thenlibdir='${exec_prefix}/${LIBnn}'fi## R installation directoriesm4_divert_once([HELP_BEGIN], [R installation directories:--libdir=DIR R files to R_HOME=DIR/R @<:@EPREFIX/$LIBnn@:>@rdocdir=DIR R doc files to DIR @<:@R_HOME/doc@:>@rincludedir=DIR R include files to DIR @<:@R_HOME/include@:>@rsharedir=DIR R share files to DIR @<:@R_HOME/share@:>@])dnlif test -z "${rdocdir}"; thenrdocdir='${rhome}/doc'fiAC_SUBST([rdocdir])if test -z "${rincludedir}"; thenrincludedir='${rhome}/include'fiAC_SUBST([rincludedir])if test -z "${rsharedir}"; thenrsharedir='${rhome}/share'fiAC_SUBST([rsharedir])### ** Handle arguments to configure.config_opts="${ac_configure_args}"AC_SUBST(config_opts)### ** Optional features.## Allow the user to specify support for R profiling.AC_ARG_ENABLE([R-profiling],[AS_HELP_STRING([--enable-R-profiling],[attempt to compile support for Rprof() @<:@yes@:>@])],[if test "${enableval}" = no; thenwant_R_profiling=noelif test "${enableval}" = yes; thenwant_R_profiling=yeselsewant_R_profiling=yesfi],[want_R_profiling=yes])## Allow the user to specify support for memory profiling.AC_ARG_ENABLE([memory-profiling],[AS_HELP_STRING([--enable-memory-profiling],[attempt to compile support for Rmemprof(), tracemem() @<:@no@:>@])],[if test "${enableval}" = no; thenwant_memory_profiling=noelif test "${enableval}" = yes; thenwant_memory_profiling=yeselsewant_memory_profiling=nofi],[want_memory_profiling=no])## Allow the user to specify building an R framework (Darwin).AC_ARG_ENABLE([R-framework],[AS_HELP_STRING([--enable-R-framework@<:@=DIR@:>@],[MacOS X only: build R framework (if possible), and specifyits installation prefix @<:@yes, /Library/Frameworks@:>@])],[want_R_framework="${enableval}"],[want_R_framework=yes])## Can only build frameworks on Darwin.if test "${want_R_framework}" != no; thencase "${host_os}" indarwin*)if test "${want_R_framework}" = yes; then## If we build a framework and 'prefix' was not given, we need## to set it to '/Library/Frameworks' rather than '/usr/local'.## Note that Autoconf sets things up so that by default, prefix## and exec_prefix are set to 'NONE'. Let's hope for no change.if test "x${prefix}" = xNONE; thenprefix="/Library/Frameworks"fielseprefix="${want_R_framework}"want_R_framework=yesfi## FW_VERSION is the sub-directory name used in R.framework/Version## By default it's the a.b form of the full a.b.c version to simplify## binary updates.: ${FW_VERSION=`echo "${PACKAGE_VERSION}" | sed -e "s/[[\.]][[0-9]]$//"`};;*)want_R_framework=no;;esacfiAM_CONDITIONAL(WANT_R_FRAMEWORK, [test "x${want_R_framework}" = xyes])## Allow the user to specify building R shared libraries.## <NOTE>## Building a framework implies building R shared libraries, hence the## strange default.## We might want to warn about the case where '--disable-R-shlib' was## given explicitly ...## </NOTE>AC_ARG_ENABLE([R-shlib],[AS_HELP_STRING([--enable-R-shlib],[build the shared/dynamic library 'libR' @<:@no@:>@])],[want_R_shlib="${enableval}"],[want_R_shlib="${want_R_framework}"])AM_CONDITIONAL(WANT_R_SHLIB, [test "x${want_R_shlib}" = xyes])AC_ARG_ENABLE([R-static-lib],[AS_HELP_STRING([--enable-R-static-lib],[build the static library 'libR.a' @<:@no@:>@])],[want_R_static="${enableval}"],[want_R_static="no"])if test "x${want_R_static}" = xyes; thenif test "x${want_R_shlib}" = xyes; thenAC_MSG_WARN([--enable-R-static-lib conflicts with --enable-R-shlib and will be ignored])want_R_static=nofifiAM_CONDITIONAL(WANT_R_STATIC, [test "x${want_R_static}" = xyes])## Build separate shared library containing R's BLAS if desiredAC_ARG_ENABLE([BLAS-shlib],[AS_HELP_STRING([--enable-BLAS-shlib],[build BLAS into a shared library @<:@perhaps@:>@])],[use_blas_shlib="${enableval}"],[use_blas_shlib="unset"])if test "${want_R_shlib}" = yes; thenLIBR="-L\$(R_HOME)/lib\$(R_ARCH) -lR"elseLIBR=fi## Enable maintainer-specific portions of Makefiles.AC_ARG_ENABLE([maintainer-mode],[AS_HELP_STRING([--enable-maintainer-mode],[enable make rules and dependencies not useful (andmaybe confusing) to the casual installer @<:@no@:>@])],[use_maintainer_mode="${enableval}"],[use_maintainer_mode=no])AM_CONDITIONAL(MAINTAINER_MODE, [test "x${use_maintainer_mode}" = xyes])## Enable testing the write barrier.AC_ARG_ENABLE([strict-barrier],[AS_HELP_STRING([--enable-strict-barrier],[provoke compile error on write barrier violation@<:@no@:>@])],[use_strict_barrier="${enableval}"],[use_strict_barrier=no])if test x"${use_strict_barrier}" = xyes; thenAC_DEFINE(TESTING_WRITE_BARRIER, 1,[Define to enable provoking compile errors on write barrierviolation.])fiAC_ARG_ENABLE([mbcs],[AS_HELP_STRING([--enable-mbcs],[enable support for UTF-8 and other MBCS locales @<:@yes@:>@])],[want_mbcs_support="${enableval}"],[want_mbcs_support=yes])### ** Optional packages.## BLAS.AC_ARG_WITH([blas],[AS_HELP_STRING([--with-blas],[use system BLAS library (if available), or specify it @<:@no@:>@])],[R_ARG_USE(blas)],[use_blas=unset])# default is "no" except on MacOS X## LAPACK.AC_ARG_WITH([lapack],[AS_HELP_STRING([--with-lapack],[use system LAPACK library (if available), or specify it @<:@no@:>@])],[R_ARG_USE(lapack)],[use_lapack=unset])# default is "no" except on MacOS X## Readline.AC_ARG_WITH([readline],[AS_HELP_STRING([--with-readline],[use readline library @<:@yes@:>@])],[R_ARG_USE(readline)],[use_readline=yes])## Aqua.AC_ARG_WITH([aqua],[AS_HELP_STRING([--with-aqua],[MacOS X only: use Aqua (if available) @<:@yes@:>@])],[if test "${withval}" = no; thenwant_aqua=noelsewant_aqua=yesfi],[want_aqua=yes])## Tcl/Tk.AC_ARG_WITH([tcltk],[AS_HELP_STRING([--with-tcltk],[use Tcl/Tk (if available), or specify its library dir @<:@yes@:>@])],[if test "${withval}" = no; thenwant_tcltk=noelif test "${withval}" = yes; thenwant_tcltk=yeselsewant_tcltk=yesLDFLAGS="${LDFLAGS} -L${withval}"tcltk_prefix="${withval}"fi],[want_tcltk=yes])AC_ARG_WITH([tcl-config],[AS_HELP_STRING([--with-tcl-config=TCL_CONFIG],[specify location of tclConfig.sh @<:@@:>@])],[TCL_CONFIG="${withval}"],[TCL_CONFIG=""])AC_ARG_WITH([tk-config],[AS_HELP_STRING([--with-tk-config=TK_CONFIG],[specify location of tkConfig.sh @<:@@:>@])],[TK_CONFIG="${withval}"],[TK_CONFIG=""])## Cairo etcAC_ARG_WITH([cairo],[AS_HELP_STRING([--with-cairo],[use cairo (and pango) if available @<:@yes@:>@])],[if test "${withval}" = no; thenwant_cairo=noelsewant_cairo=yesfi], [want_cairo=yes])## other librariesAC_ARG_WITH([libpng],[AS_HELP_STRING([--with-libpng],[use libpng library (if available) @<:@yes@:>@])],[R_ARG_USE(libpng)],[use_libpng=yes])AC_ARG_WITH([jpeglib],[AS_HELP_STRING([--with-jpeglib],[use jpeglib library (if available) @<:@yes@:>@])],[R_ARG_USE(jpeglib)],[use_jpeglib=yes])AC_ARG_WITH([system-zlib],[AS_HELP_STRING([--with-system-zlib],[use system zlib library (if available) @<:@no@:>@])],[R_ARG_USE_SYSTEM(zlib)],[use_system_zlib=no])AC_ARG_WITH([system-bzlib],[AS_HELP_STRING([--with-system-bzlib],[use system bzlib library (if available) @<:@no@:>@])],[R_ARG_USE_SYSTEM(bzlib)],[use_system_bzlib=no])AC_ARG_WITH([system-pcre],[AS_HELP_STRING([--with-system-pcre],[use system PCRE library (if available) @<:@no@:>@])],[R_ARG_USE_SYSTEM(pcre)],[use_system_pcre=no])## Valgrind instrumentationAC_ARG_WITH([valgrind-instrumentation],[AS_HELP_STRING([--with-valgrind-instrumentation],[Level of additional instrumentation for Valgrind (0/1/2) @<:@0@:>@])],[valgrind_level=${withval}],[valgrind_level=0])## <FIXME>## Completely disable using libtool for building shlibs until libtool## fully supports Fortran and C++.## AC_ARG_WITH([libtool],## [AS_HELP_STRING([--with-libtool],[use libtool for building shared libraries @<:@yes@:>@])],## [use_libtool="${withval}"],## [use_libtool=yes])## AM_CONDITIONAL(USE_LIBTOOL, [test "x${use_libtool}" = xyes])## </FIXME>## Recommended R packages.AC_ARG_WITH([recommended-packages],[AS_HELP_STRING([--with-recommended-packages],[use/install recommended R packages @<:@yes@:>@])],[R_ARG_USE(recommended_packages)],[use_recommended_packages=yes])## Iconv.AC_ARG_WITH([iconv],[AS_HELP_STRING([--with-iconv],[use iconv library @<:@yes@:>@])],[R_ARG_USE(iconv)],[use_iconv=yes])## ICUAC_ARG_WITH([ICU],[AS_HELP_STRING([--with-ICU],[use ICU library @<:@no@:>@])],[R_ARG_USE(ICU)],[use_ICU=no])### ** Precious variables.AC_ARG_VAR([R_PRINTCMD],[command used to spool PostScript files to the printer])AC_ARG_VAR([R_PAPERSIZE],[paper size for the local (PostScript) printer])AC_ARG_VAR([R_BATCHSAVE],[set default behavior of R when ending a session])AC_ARG_VAR([MAIN_CFLAGS],[additional CFLAGS used when compiling the main binary])AC_ARG_VAR([SHLIB_CFLAGS],[additional CFLAGS used when building shared libraries])AC_ARG_VAR([MAIN_FFLAGS],[additional FFLAGS used when compiling the main binary])AC_ARG_VAR([SHLIB_FFLAGS],[additional FFLAGS used when building shared libraries])AC_ARG_VAR([MAIN_LD],[command used to link the main binary])AC_ARG_VAR([MAIN_LDFLAGS],[flags which are necessary for loading a main program whichwill load shared library modules (DLLs) at runtime])AC_ARG_VAR([CPICFLAGS],[special flags for compiling C code to be turned into ashared library.])AC_ARG_VAR([FPICFLAGS],[special flags for compiling Fortran code to be turned into ashared library.])AC_ARG_VAR([FCPICFLAGS],[special flags for compiling Fortran 95 code to be turned into ashared library.])AC_ARG_VAR([SHLIB_LD],[command for linking shared libraries which contain objectfiles from a C or Fortran compiler only])AC_ARG_VAR([SHLIB_LDFLAGS],[special flags used by SHLIB_LD])AC_ARG_VAR([DYLIB_LD],[command for linking dynamic libraries which contain objectfiles from a C or Fortran compiler only])AC_ARG_VAR([DYLIB_LDFLAGS],[special flags used for make a dynamic library])AC_ARG_VAR([CXXPICFLAGS],[special flags for compiling C++ code to be turned into ashared library])AC_ARG_VAR([SHLIB_CXXLD],[command for linking shared libraries which contain objectfiles from a C++ compiler])AC_ARG_VAR([SHLIB_CXXLDFLAGS],[special flags used by SHLIB_CXXLD])AC_ARG_VAR([SHLIB_FCD],[command for linking shared libraries which contain objectfiles from the Fortran 95 compiler])AC_ARG_VAR([SHLIB_FCLDFLAGS],[special flags used by SHLIB_FCLD])AC_ARG_VAR([TCLTK_LIBS],[flags needed for linking against the Tcl and Tk libraries])AC_ARG_VAR([TCLTK_CPPFLAGS],[flags needed for finding the tcl.h and tk.h headers])AC_ARG_VAR([MAKE], [Make command])AC_ARG_VAR([R_BROWSER], [default browser])AC_ARG_VAR([BLAS_LIBS],[flags needed for linking against external BLAS libraries])AC_ARG_VAR([LAPACK_LIBS],[flags needed for linking against external LAPACK libraries])AC_ARG_VAR([LIBnn], ['lib' or 'lib64' for dynamic libraries])AC_ARG_VAR([SAFE_FFLAGS],[Safe Fortran 77 compiler flags for e.g. dlamc.f])AC_ARG_VAR([r_arch],[Use architecture-dependent subdirs with this name])AC_ARG_VAR([DEFS], [C defines for use when compiling R])AC_ARG_VAR([JAVA_HOME],[Path to the root of the Java environment])if test -z "${r_arch}"; thenR_ARCH=R_XTRA_CPPFLAGS2="-I\$(R_INCLUDE_DIR)"elseR_ARCH="/${r_arch}"R_XTRA_CPPFLAGS2="-I\$(R_INCLUDE_DIR) -I\$(R_INCLUDE_DIR)/${r_arch}"fiAC_DEFINE_UNQUOTED(R_ARCH, "${r_arch}",[Define this to use architecture-dependent subdirectories of this name.])AC_SUBST([R_ARCH])AC_SUBST([R_XTRA_CPPFLAGS2])### ** Check whether we build in srcdir.AC_PATH_PROG(GETWD, pwd, pwd)AC_MSG_CHECKING([whether builddir is srcdir])if test "`cd ${srcdir} && ${GETWD}`" = "`${GETWD}`"; thenBUILDDIR_IS_SRCDIR=yeselseBUILDDIR_IS_SRCDIR=nofiAC_SUBST(BUILDDIR_IS_SRCDIR)AC_MSG_RESULT([${BUILDDIR_IS_SRCDIR}])### * Checks for programs.R_MISSING_PROG(ACLOCAL, aclocal)R_MISSING_PROG(AUTOCONF, autoconf)R_MISSING_PROG(AUTOMAKE, automake)R_MISSING_PROG(AUTOHEADER, autoheader)AC_PROG_AWKAC_PROG_EGREPAC_PROG_LN_S## AC_PROG_RANLIBAC_PROG_YACCR_PROG_ARR_PROG_INSTALL## we would like a POSIX sed, and need one on SolarisAC_PATH_PROGS(SED, sed, /bin/sed, [/usr/xpg4/bin:$PATH])## Make: ${MAKE=make}AC_SUBST(MAKE)## PagerR_PROG_PAGER## PerlR_PROG_PERL## Tar: ${TAR=tar}AC_SUBST(TAR)## TeXMF stuffR_PROG_TEXMF## Unzip && zip && gzipAC_PATH_PROGS(R_UNZIPCMD, [${UNZIP} unzip], "")AC_PATH_PROGS(R_ZIPCMD, [${ZIP} zip], "")AC_PATH_PROGS(R_GZIPCMD, [${GZIP} gzip], true)## BrowserR_PROG_BROWSER## PDF viewerR_PROG_PDFVIEWER## Cairo needs pkg-configAC_PATH_PROG(PKGCONF,pkg-config,[],[$PATH:/usr/local/bin:/ext/bin:/ext:/sw/bin:/opt/bin])AC_PROG_CCAC_PROG_GCC_TRADITIONALAC_PROG_CPPR_PROG_CPP_CPPFLAGSR_PROG_F77AC_PROG_CXXAC_PROG_CXXCPPR_GCC4_VISIBILITYAC_GNU_SOURCE ## needed to libintlAC_PROG_OBJC## unfortunately autoconf sets OBJC to gcc even if there is no working compilerif test "${OBJC}" = gcc; thenAC_LANG_PUSH([Objective C])AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[id foo;])],,[OBJC=''])AC_LANG_POP([Objective C])fiR_PROG_OBJCXX## This has to be R_DEFS as autoconf overrrides DEFSR_DEFS=${DEFS}AC_SUBST(R_DEFS)## Libtool.## (Run this after R_PROG_F77, as AC_PROG_LIBTOOL checks for a## Fortran 77 compiler and sets F77 accordingly.)AC_DISABLE_STATICLT_INITAC_SUBST(LIBTOOL_DEPS)## cross-compilingR_CROSS_COMPILINGAC_SUBST(BUILD_CC)AC_SUBST(BUILD_R)AM_CONDITIONAL(CROSS_COMPILING, [test "${cross_compiling}" = yes])### * Checks for libraries.## Set up LD_LIBRARY_PATH or equivalent.## <FIXME>## What is this doing *HERE*?## Should be needed for tests using AC_RUN_IFELSE()?## Make sure that non-standard directories specified via '-L' are really## searched in the tests.## Note: earlier versions used LIBS rather than LDFLAGS.case "${host_os}" indarwin*)## Darwin provides a full path in the ID of each library such## that the linker can add library's path to the binary at link time.## This allows the dyld to find libraries even without xx_LIBRARY_PATH.## No paths should be added to R_LD_LIBRARY_PATH (which in turn## changes DYLD_LIBRARY_PATH), because they override the system## look-up sequence. Such automatic override has proven to break things## like system frameworks (e.g. ImageIO or OpenGL framework).;;*)for arg in ${LDFLAGS}; docase "${arg}" in-L*)lib=`echo ${arg} | sed "s/^-L//"`R_SH_VAR_ADD(R_LD_LIBRARY_PATH, [${lib}], [${PATH_SEPARATOR}]);;esacdone;;esac## </FIXME>## Record name of environment variable which tells the dynamic linker## where to find shlibs (typically, 'LD_LIBRARY_PATH').AC_SUBST(shlibpath_var)## Export LD_LIBRARY_PATH or equivalent.if eval "test -z \"\${${shlibpath_var}}\""; theneval "${shlibpath_var}=\"${R_LD_LIBRARY_PATH}\""elseeval "${shlibpath_var}=\"${R_LD_LIBRARY_PATH}${PATH_SEPARATOR}\${${shlibpath_var}}\""fieval "export ${shlibpath_var}"## record how to strip shared/dynamic libraries.AC_SUBST(striplib)## record how to strip static libraries.stripstaticlib=${old_striplib}AC_SUBST(stripstaticlib)## <NOTE>## This actually comes from libtool.m4.AC_CHECK_LIBMAC_SUBST(LIBM)## </NOTE>## AC_CHECK_LIBM computes LIBM but does not add to LIBS, hence we do## the following as well.AC_CHECK_LIB(m, sin)case "${host_os}" indarwin*)## MacOS <= 10.2 doesn't have dlcompat, >= 10.3 include it in libSystem## since R 2.3 we don't provide a work-around for missing dl anymoreAC_SEARCH_LIBS(dlopen, dl,,[AC_MSG_ERROR([Please install dlcompat or update to a more recent OS X.])])## SI says we want '-lcc_dynamic' on Darwin, although currently## http://developer.apple.com/documentation/MacOSX/ has nothing## official. Bill Northcott <w.northcott@unsw.edu.au> points out## that it is only needed to GCC 3.x (and earlier) ...if test "${GCC}" = yes; thencase "${CC_VERSION}" in2.*|3.*)AC_CHECK_LIB(cc_dynamic, main) ;;esacfi;;*)AC_CHECK_LIB(dl, dlopen);;esac## Readline.if test "${use_readline}" = yes; thenAC_CHECK_HEADERS(readline/history.h readline/readline.h)r_save_LIBS="${LIBS}"LIBS=## don't use the cached value as we need to rebuild LIBSunset ac_cv_lib_readline_rl_callback_read_charAC_CHECK_LIB(readline, rl_callback_read_char)use_readline="${ac_cv_lib_readline_rl_callback_read_char}"if test "${use_readline}" = no; then## only need ncurses if libreadline is not statically linked against itunset ac_cv_lib_readline_rl_callback_read_charAC_CHECK_LIB(ncurses, main, [],AC_CHECK_LIB(termcap, main, [],AC_CHECK_LIB(termlib, main)))AC_CHECK_LIB(readline, rl_callback_read_char)use_readline="${ac_cv_lib_readline_rl_callback_read_char}"fi## the NetBSD version as used in MacOS X does not have thisAC_CHECK_FUNCS(history_truncate_file)READLINE_LIBS="${LIBS}"LIBS="${r_save_LIBS}"if test "${use_readline}" = no; thenAC_MSG_ERROR([--with-readline=yes (default) and headers/libs are not available])elseR_CHECK_FUNCS([rl_completion_matches],[#include <stdio.h>#include <readline/readline.h>])fifiAC_SUBST(READLINE_LIBS)### * Checks for header files.AC_HEADER_STDCAC_HEADER_TIMEAC_HEADER_DIRENTAC_HEADER_SYS_WAIT## <NOTE>## Some of these are also checked for when Autoconf computes the default## includes.AC_CHECK_HEADERS(arpa/inet.h dl.h dlfcn.h elf.h fcntl.h floatingpoint.h \fpu_control.h glob.h grp.h limits.h locale.h \netdb.h netinet/in.h pwd.h stdbool.h strings.h \sys/param.h sys/select.h sys/socket.h sys/stat.h sys/resource.h \sys/time.h sys/times.h sys/utsname.h time.h unistd.h)## </NOTE>## <NOTE>## These are C99 headers but some C code (written to work also## without assuming C99) may need the corresponding conditionals.AC_CHECK_HEADERS(errno.h inttypes.h stdarg.h stdint.h string.h)## </NOTE>## <NOTE>## src/main/regex.c uses HAVE_LIBINTL_H.## But then we want full gettext support and AM_GNU_GETTEXT.## AC_CHECK_HEADERS(libintl.h)## </NOTE>R_HEADER_SETJMPR_HEADER_GLIBC2### * Checks for types.AC_TYPE_SIGNALAC_TYPE_PID_TAC_TYPE_SIZE_TR_SIZE_MAXAC_CHECK_TYPE(blkcnt_t, long)AH_TEMPLATE([blkcnt_t],[Define to 'long' if <sys/types.h> does not define.Apparently necessary to fix a GCC bug on AIX?])R_TYPE_SOCKLENAC_CHECK_TYPES([stack_t], , , [#include <signal.h>])## These are optional C99 types, which we typedef in Defn.h if absent.## There seems some confusion as to where they should be defined:## the standard says stdint.h but drafts and Solaris 8 have inttypes.h.## It seems all systems having stdint.h include it in inttypes.h, and## POSIX requires that. But we will make sure.AC_CHECK_TYPES([intptr_t, uintptr_t], , , [#ifdef HAVE_INTTYPES_H#include <inttypes.h>#endif#ifdef HAVE_STDINT_H#include <stdint.h>#endif])### * Checks for compiler characteristics.### ** Generic tests for the C, Fortran 77 and C++ compilers.### *** C compiler.AC_C_BIGENDIANAC_C_CONSTR_C_INLINEAC_CHECK_SIZEOF(int)## on some platforms this gives a trailing lf, socase "${ac_cv_sizeof_int}" in4*)AC_DEFINE(INT_32_BITS, 1, [Define if you have 32 bit ints.]);;esacAC_CHECK_SIZEOF(long)AC_CHECK_SIZEOF(long long)AC_CHECK_SIZEOF(double)AC_CHECK_SIZEOF(long double)AC_CHECK_SIZEOF(size_t)dnl AC_CHECK_SIZEOF(time_t, [dnl #include <stdio.h>dnl #include <time.h>dnl ])R_PROG_CC_MAKEFRAGR_PROG_CC_LO_MAKEFRAG### *** Fortran 77 compiler.R_PROG_F77_FLIBSR_PROG_F77_APPEND_UNDERSCORER_PROG_F77_CAN_RUNR_PROG_F77_CC_COMPATR_PROG_F77_CC_COMPAT_COMPLEXAM_CONDITIONAL(COMPILE_FORTRAN_DOUBLE_COMPLEX,[test "x${HAVE_FORTRAN_DOUBLE_COMPLEX}" != x])### *** C++ compiler.R_PROG_CXX_MAKEFRAG### *** ObjC compilerR_PROG_OBJC_MAKEFRAGR_PROG_OBJC_RUNTIMER_OBJC_FOUNDATION### ** Platform-specific overrides for the C, Fortran 77 and C++ compilers.case "${host_cpu}" ini*86|x86_64)R_PROG_CC_FLAG_D__NO_MATH_INLINES## We used to add -mieee-fp here, but it seems it is really a## linker flag for old Linuxen adding -lieee to a non-shared link.;;alpha*)## <NOTE>## * IEEE math## We really need to use @option{-ieee_with_inexact} (called## @option{-mieee-with-inexact} for GCC) for the C compiler:## @option{-ieee} (or @option{-mieee}) are not enough.## According to <Albrecht.Gebhardt@uni-klu.ac.at> and Luke Tierney## <luke@stat.uiowa.edu>, @option{-fpe3} is what we want for the## native Fortran 77 compiler: seems that not all versions map## @option{-ieee} to @option{-fpe3}.## What about the C++ compilers?if test "${GCC}" = yes; thenR_PROG_CC_FLAG([-mieee-with-inexact],R_SH_VAR_ADD(R_XTRA_CFLAGS, [-mieee-with-inexact]))elseR_PROG_CC_FLAG([-ieee_with_inexact],R_SH_VAR_ADD(R_XTRA_CFLAGS, [-ieee_with_inexact]))fiif test "${G77}" = yes; thenR_PROG_F77_FLAG([-mieee],R_SH_VAR_ADD(R_XTRA_FFLAGS, [-mieee]))elseR_PROG_F77_FLAG([-fpe3],R_SH_VAR_ADD(R_XTRA_FFLAGS, [-fpe3]))fiif test "${GXX}" = yes; thenR_PROG_CXX_FLAG([-mieee],R_SH_VAR_ADD(R_XTRA_CXXFLAGS, [-mieee]))elseR_PROG_CXX_FLAG([-ieee],R_SH_VAR_ADD(R_XTRA_CXXFLAGS, [-ieee]))fi## </NOTE>;;esacAH_TEMPLATE([HAVE_NO_SYMBOL_UNDERSCORE],[Define if module-loading does not need an underscore tobe prepended to external names.])case "${host_os}" inaix*)AC_DEFINE(HAVE_NO_SYMBOL_UNDERSCORE)if test "${GCC}" = yes; thenif test "x${OBJECT_MODE}" = "x64"; thenR_PROG_CC_FLAG([-mminimal-toc],R_SH_VAR_ADD(R_XTRA_CFLAGS, [-mminimal-toc]))elseR_PROG_CC_FLAG([-mno-fp-in-toc],R_SH_VAR_ADD(R_XTRA_CFLAGS, [-mno-fp-in-toc]))fifi;;cygwin*|mingw*|windows*|winnt)AC_DEFINE(HAVE_NO_SYMBOL_UNDERSCORE);;darwin*)## This is needed for Apple's dlsym included in >= 10.3## and so we've changed dlfcn-darwin.c for 2.1.0AC_DEFINE(HAVE_NO_SYMBOL_UNDERSCORE)## Need '-no-cpp-precomp' say J de Leeuw <deleeuw@stat.ucla.edu> and## http://fink.sourceforge.net/doc/porting/basics.php.if test "${GCC}" = yes; then## only old Apple builds of gcc support (and need?) -no-cpp-precompAPPLEBLD=`${CC} --version|sed -n -e 's:.*Apple.*build \([[0-9]]\{1,\}\).*:\1:p' 2>/dev/null`if test -n "${APPLEBLD}" -a "${APPLEBLD}" -lt 5300 2>/dev/null; thenR_SH_VAR_ADD(R_XTRA_CPPFLAGS, [-no-cpp-precomp])fifi;;hpux*)AC_DEFINE(HAVE_NO_SYMBOL_UNDERSCORE)AC_DEFINE(USE_BUILTIN_RINT, 1,[Define if your rint() is broken on your system.Apparently needed on HPUX.])case "${CC}" incc|c89)## Luke Tierney says we also need '-Wp,-H16000' which tells the## pre-processor to increase the size of an internal table. It## seems that src/modules/vfonts/g_her_glyph.c contains a line## that is too long for the pre-processor without this flag.R_SH_VAR_ADD(R_XTRA_CPPFLAGS, [-Wp,-H16000]);;esacAC_CHECK_LIB(dld, shl_load, [R_XTRA_LIBS="-ldld ${R_XTRA_LIBS}"]);;irix*)R_C_OPTIEEE## <NOTE>## We really should test explictly whether the Fortran and C++## compilers *need* '-OPT:IEEE_NaN_inf=ON'. Currently, all we do is## check whether the non-GNU tools *accept* the flag.if test "${G77}" != yes; thenR_PROG_F77_FLAG([-OPT:IEEE_NaN_inf=ON],R_SH_VAR_ADD(R_XTRA_FFLAGS, [-OPT:IEEE_NaN_inf=ON]))fiif test "${GXX}" != yes; thenR_PROG_CXX_FLAG([-OPT:IEEE_NaN_inf=ON],R_SH_VAR_ADD(R_XTRA_CXXFLAGS, [-OPT:IEEE_NaN_inf=ON]))fi## </NOTE>;;linux*)case "${CC}" in## Intel compiler*icc*)## icc declares __GNUC__, so it picks up CFLAGS intended for gcc.if test "$ac_test_CFLAGS" != set; thenif test $ac_cv_prog_cc_g = yes; thencase "${host_cpu}" inx86_64)CFLAGS="-g -O2 -std=c99";;*)## on ix86 optimization failsCFLAGS="-g -std=c99";;esacelsecase "${host_cpu}" inx86_64)CFLAGS="-O2 -std=c99";;*)CFLAGS="-std=c99";;esacfifi## -mp is the preferred form of -mieee-fpR_PROG_CC_FLAG([-mp],R_SH_VAR_ADD(R_XTRA_CFLAGS, [-mp]));;esaccase "${F77}" in## Intel compilers*ifc|*ifort)if test "$ac_test_FFLAGS" != set; thenif test $ac_cv_prog_f77_g = yes; thencase "${host_cpu}" inx86_64)FFLAGS="-g -O2";;*)FFLAGS="-g";;esacelsecase "${host_cpu}" inx86_64)FFLAGS="-O2";;*)## on ix86 optimization of dlamc.f failsFFLAGS=;;esacfifiR_PROG_CC_FLAG([-mp],R_SH_VAR_ADD(R_XTRA_FFLAGS, [-mp]));;esaccase "${CXX}" in## Intel compilers*icpc|*icc)if test "$ac_test_CXXFLAGS" != set; thenif test $ac_cv_prog_cxx_g = yes; thencase "${host_cpu}" inx86_64)CXXFLAGS="-g -O2";;*)CXXFLAGS="-g";;esacelsecase "${host_cpu}" inx86_64)CXXFLAGS="-O2";;*)CXXFLAGS=;;esacfifiR_PROG_CC_FLAG([-mp],R_SH_VAR_ADD(R_XTRA_CXXFLAGS, [-mp]));;esac;;openbsd*)if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; thenAC_DEFINE(HAVE_NO_SYMBOL_UNDERSCORE)fi;;osf*)AC_DEFINE(HAVE_NO_SYMBOL_UNDERSCORE);;esacif test "${SAFE_FFLAGS+set}" != set; thenif test "x${ac_cv_f77_compiler_gnu}" = xyes; thenSAFE_FFLAGS="${FFLAGS} -ffloat-store"elseSAFE_FFLAGS=${FFLAGS}fifiAC_SUBST(CFLAGS)AC_SUBST(MAIN_CFLAGS)AC_SUBST(SHLIB_CFLAGS)AC_SUBST(CXXFLAGS)AC_SUBST(SHLIB_CXXFLAGS)AC_SUBST(FFLAGS)AC_SUBST(SAFE_FFLAGS)AC_SUBST(MAIN_FFLAGS)AC_SUBST(SHLIB_FFLAGS)AC_SUBST(R_XTRA_CFLAGS)AC_SUBST(R_XTRA_CPPFLAGS)AC_SUBST(R_XTRA_CXXFLAGS)AC_SUBST(R_XTRA_FFLAGS)AC_SUBST(R_XTRA_LIBS)AC_SUBST(OBJC_LIBS)AC_SUBST(OBJCFLAGS)AC_SUBST(OBJCXXFLAGS)### ** DLL stuff.## We need to determine the following:#### MAIN_LD, MAINLD_FLAGS## command and flags for loading the main binary so that it will load## shared libraries (DLLs) at runtime, also for profiling.## CPICFLAGS, CXXPICFLAGS, FPICFLAGS, FCPICFLAGS## flags for compiling C, C++, and Fortran library code.## SHLIB_LD, SHLIB_LDFLAGS## command and flags for creating DLLs (which contain object files## from a C or Fortran compiler).## DYLIB_LD, DYLIB_LDFLAGS## ditto for dynamic libraries (where different.)## SHLIB_CXXLD, SHLIB_CXXLDFLAGS## command and flags for creating DLLs which contain object files from## a C++ compiler. According to Autoconf, the C++ compiler/linker## must be used for linking in this case (since special C++-ish things## need to happen at link time like calling global constructors,## instantiating templates, enabling exception support, etc.).#### The procedure is as follows.#### * We use applicable values from imake in case its CC is ours.## * Irrespective of that, we think we know what to do with GNU tools## (GNU C, Fortran, and C++ compilers).## * Then, use platform specific overrides.## * As a final safeguard, values from the environment (as specified in## one of the configuration files or at the configure command line)## override anything we figure out in the case of compiler flags; for## linker flags (*LDFLAGS), environment settings override our results## if the corresponding *LD variable was set, and add otherwise.#### NOTE: We do not provide defaults for the *LDFLAGS, taking a defensive## approach. In case we cannot figure out {MAIN,SHLIB}_LDFLAGS and the## user did not provide defaults, an error results. A warning is given## if nothing was obtained for SHLIB_CXXLDFLAGS.#### Note also that some systems (formerly AIX) do not allow for unresolved## symbols at link time. For such systems, we link against -lm (in case## it exists) when building a shlib module via SHLIB_LIBADD.main_ld="${CC}"shlib_ld="${CC}"shlib_cxxld="${CXX}"SHLIB_EXT=".so"SHLIB_LIBADD=use_exportfiles=no## Step 1. Ask imake.## <NOTE>## Earlier versions had fpicflags=${cpicflags}. As this really amounts## to hoping rather than knowing, we no longer do this.## </NOTE>r_xtra_path="${PATH}"for dir in /usr/bin/X11 /usr/X11R6/bin /usr/openwin/bin; dor_xtra_path="${r_xtra_path}${PATH_SEPARATOR}${dir}"doneAC_PATH_PROG(XMKMF, xmkmf, [], [${r_xtra_path}])if test -n "${XMKMF}"; thenecho > Imakefile${XMKMF} > /dev/null 2>&1 || echo > Makefilecc=`${srcdir}/tools/GETMAKEVAL CC`cc=`echo ${cc} | sed "s/ .*//"`## Paul Gilbert reported on R-devel 2006-04-13 a system with cc=""if test -n "${cc}" ; thenr_cc_cmd=`echo ${CC} | sed "s/ .*//"`if test "`which ${cc}`" = "`which ${r_cc_cmd}`"; thenshlib_ldflags=`${srcdir}/tools/GETMAKEVAL SHLIBLDFLAGS`cpicflags=`${srcdir}/tools/GETMAKEVAL PICFLAGS`fificxx=`${srcdir}/tools/GETMAKEVAL CXX`cxx=`echo ${cxx} | sed "s/ .*//"`if test -n "${cxx}" ; thenr_cxx_cmd=`echo ${CXX} | sed "s/ .*//"`if test "`which ${cxx}`" = "`which ${r_cxx_cmd}`"; thencxxpicflags=`${srcdir}/tools/GETMAKEVAL CXXPICFLAGS`fifirm -f Imakefile Makefilefi## Step 2. GNU compilers.if test "${GCC}" = yes; thencase "${host_cpu}" in## Sparc has only an 8k global object table, 1024 entries on 64-bit.## PowerPC has 32k, not enough on ppc64 for the ca6200 entries in libR.so## The only other platform where this is said to matter is m68k, which## has 32k and so can use -fpic.## However, although the gcc docs do not mention it, it seems s390/s390x## also supports and needs -fPICsparc*|ppc64|powerpc64|s390*)cpicflags="-fPIC";;*)cpicflags="-fpic";;esacshlib_ldflags="-shared"fiif test "${G77}" = yes; thencase "${host_cpu}" insparc*|ppc64|powerpc64|s390*)fpicflags="-fPIC";;*)fpicflags="-fpic";;esacfiif test "${GXX}" = yes; thencase "${host_cpu}" insparc*|ppc64|powerpc64|s390*)cxxpicflags="-fPIC";;*)cxxpicflags="-fpic";;esacshlib_cxxldflags="-shared"fi## Step 3. Individual platform overrides.dylib_undefined_allowed=yesis_cygwin=nocase "${host_os}" inaix[123]*|aix4.[01]*)## These need a form of linking we no longer supportAC_MSG_ERROR([AIX prior to 4.2 is not supported]);;aix*)## now use run-time linkingif test "${want_R_shlib}" != yes; thenuse_exportfiles=yesfi## All AIX code is PIC.cpicflags=cxxpicflags=fpicflags=## not clear if this is correct for native compilerswl="-Wl,"## libtool suggests that ia64 needs -Bexport and not -brtl## but we have no confirmation.dylib_undefined_allowed=no##ADD: A symbol of memcpy,memset is exported in libR by expall.##ADD: However, for example, symbol in libc of memcpy is __memmove,__memmove64.##ADD: This black magic puts lc before lR and pockets this.if test "x${OBJECT_MODE}" = "x64"; thenmain_ldflags="${wl}-brtl ${wl}-bexpall ${wl}-bpT:0x100000000 ${wl}-bpD:0x110000000 -lc"elsemain_ldflags="${wl}-brtl ${wl}-bexpall -lc"fishlib_ldflags="${wl}-brtl ${wl}-G ${wl}-bexpall ${wl}-bnoentry -lc"if test "${want_R_shlib}" != yes; then## symbol of an archive(RLIBS and EXTRA_LIBS) is thrown away## unless export it in a main link when unused.R_SH_VAR_ADD(main_ldflags, [-Wl,-bE:\$(top_builddir)/etc/R.exp])## Import symbol is IMPid = '.'## no import symbol is IMPid = '..' (run-time link style)## R_SH_VAR_ADD(LIBR, [-Wl,-bI:\$(R_HOME)/etc/R.exp])fi# main_ldflags="${wl}-bdynamic ${wl}-bE:\$(top_builddir)/etc/R.exp ${wl}-bM:SRE"# shlib_ldflags="${wl}-bM:SRE ${wl}-H512 ${wl}-T512 ${wl}-bnoentry ${wl}-bexpall ${wl}-bI:\$(R_HOME)/etc/R.exp"SHLIB_LIBADD="\$(LIBM)"shlib_cxxldflags="${shlib_ldflags}";;cygwin*)## All Windows code is PICcpicflags=cxxpicflags=fpicflags=fcpicflags=SHLIB_EXT=".dll"dylib_undefined_allowed=nois_cygwin=yesmain_ldflags="${wl}--large-address-aware ${wl}--stack=0xA00000";;darwin*)darwin_pic="-fPIC"dylib_undefined_allowed=nodarwin_dylib_ldflags="-dynamiclib"## Used to need this for GUI and quartz device, but neither are in## R or libR.dylib any longer (2.1.0).## main_ldflags="-framework Carbon"## Want '-mdynamic-no-pic' for GCC 3, says Jan de Leeuw.if test "${GCC}" = yes; thencase "${CC_VERSION}" in3.*)R_SH_VAR_ADD(main_ldflags, [-mdynamic-no-pic]) ;;esacfi## some linkers are broken and need to be set to a specific## Mac OS X version to work bettercase "${host_os}" indarwin8*)# this is the 'old' way and it doesn't work with recent gcc as the driver# prepends its own version### darwin_min_flag='Wl,-macosx_version_min -Wl,10.4'# this is the 'new' way, but it's not clear which driver version# started to support it (Xcode 2.5 is known to work and 2.4 should)# A work-around for older Xcode is to set MACOSX_DEPLOYMENT_TARGET# environment variable. It has its own problems, but we may as well# honor it, assuming that it fixes things.if test -z "${MACOSX_DEPLOYMENT_TARGET}"; thendarwin_min_flag='-mmacosx-version-min=10.4'fi;;*)darwin_min_flag='';;esaccase "${host_os}" in## According to Jan de Leeuw, OS X 10.1 is darwin 5, OS X 10.2 is## darwin 6, and the real difference is between darwin < and >= 5.## It would be nice to use R.bin (or libR.dylib) as bundle_loader## together with '-undefined suppress' for darwin 5 or better, but## the paths to these change when installing.## The Darwin 1.[012] special casing is from libtool and could be## eliminated ('-flat_namespace' is the default if available).## FIXME: Rblas is entirely untested and possibly doesn't work## for any darwin before darwin7!darwin1.[[012]]*)shlib_ldflags="-bundle -undefined suppress"darwin_pic="${darwin_pic} -fno-common";;## although OS X 10.3 (Panther = Darwin 7) has some useful features,## dlopen doesn't work with dylibs and RTLD_LOCAL, so we can't use them.darwin[[567]]*)shlib_ldflags="-flat_namespace -bundle -undefined suppress"darwin_pic="${darwin_pic} -fno-common";;## * recent ld has -single_module so it doesn't need -fno-common## we have to use dylib instead of a bundle## * dylib+single_module+flat_namespace=pretty much what other platforms call .so## but there can be no multiple symbols (due to flat namespace)## * since 10.3 we can also use -undefined dynamic_lookup which allows us to## use two-level namespace and still have undefined symbols*)## FIXME: strictly speaking it should be "yes" but libRblas still## needs -lgfortran because the sharing is a one-way street## dylib_undefined_allowed=yes## we have to test this in case an outdated linker or non-Apple compiler is usedAC_MSG_CHECKING([whether linker supports dynamic lookup])shlib_ldflags="-dynamiclib -Wl,-headerpad_max_install_names ${darwin_min_flag} -undefined dynamic_lookup -single_module -multiply_defined suppress"AC_CACHE_VAL([r_cv_has_dynlookup],[[cat > conftest.c <<EOFvoid dummy() { }EOF]echo "${CC} ${CFLAGS} conftest.c ${shlib_ldflags} -o libconftest${DYLIB_EXT} ${LIBS}" >&AS_MESSAGE_LOG_FDif ${CC} ${CFLAGS} conftest.c ${shlib_ldflags} -o libconftest${DYLIB_EXT} ${LIBS} 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; thenr_cv_has_dynlookup=yesAC_MSG_RESULT([yes])elser_cv_has_dynlookup=noAC_MSG_RESULT([no])AC_MSG_WARN([*** Please consider updating your Xcode tools. ***])firm -f libconftest${DYLIB_EXT} conftest.c])if test -n "${FORCE_FLAT_NAMESPACE}"; thenAC_MSG_WARN([Use of flat namespace is requested by user.])r_cv_has_dynlookup=forced-nofiif test "${r_cv_has_dynlookup}" != "yes"; thenshlib_ldflags="-dynamiclib -flat_namespace -undefined suppress -single_module -multiply_defined suppress"dylib_undefined_allowed=yesfi## we use the same method for shlib and dylib nowdarwin_dylib_ldflags="${shlib_ldflags}"## side note: we could use flat namespace instead, but there is an exception:## * libRblas must be 2-level, dyn lookup because of xerbla which is undefined;;esaccpicflags="${darwin_pic}"cxxpicflags="${darwin_pic}"fpicflags="${darwin_pic}"shlib_cxxldflags="${shlib_ldflags}"if test "${ac_cv_lib_cc_dynamic_main}" = yes; then## Could also try grepping LIBS for '-lcc_dynamic' ...SHLIB_LIBADD="-lcc_dynamic"fi;;freebsd*)## Only sure for FreeBSD 3 and above.main_ldflags="-export-dynamic"shlib_ldflags="-shared";;gnu*) # GNU Hurdmain_ldflags="-export-dynamic";;hpux*)SHLIB_EXT=".sl"case "${CC}" incc|c89)cpicflags="+Z";;esaccase "${F77}" inf77|fort77|f90)fpicflags="+Z";;esacmain_ldflags="-Wl,-E"if test "${GCC}" = yes; thenshlib_ldflags="-shared -fPIC -Wl,-Bsymbolic"else## <NOTE>## Native cc insists on tacking on crt0.o when it calls ld, and## crt0.o is not built with PIC. As there seems to be no obvious## way to tell cc not to do this, we use ld for linking shlibs.shlib_ld=ldshlib_ldflags="-b -Bsymbolic"## </NOTE>fiif test "${GXX}" = yes; thenshlib_cxxldflags="-shared -fPIC"fi;;irix*)cpicflags=cxxpicflags=fpicflags=shlib_ldflags="-shared"shlib_cxxldflags="-shared";;linux*aout) # GNU Linux/aoutsed '/HAVE_ELF_H/d' confdefs.h > tmp.h ; mv tmp.h confdefs.h;;linux*) # GNU Linux/ELFcase "${CC}" in## Intel compiler: note that -c99 may have been appended*icc*)cpicflags="-fpic";;## Portland Group*pgcc*)cpicflags="-fpic";;esaccase "${F77}" in## Intel compilers*ifc|*ifort)fpicflags="-fpic";;## Portland Group*pgf77|*pgf90|*pgf95)fpicflags="-fpic";;esaccase "${CXX}" in## Intel compilers*icpc|*icc)cxxpicflags="-fpic";;## Portland Group*pgCC)cxxpicflags="-fpic";;esac## Luke Tierney says that just '-export-dynamic' does not work for## Intel compilers (icc).main_ldflags="-Wl,--export-dynamic";;mingw*)SHLIB_EXT=".dll"cpicflags=cxxpicflags=fpicflags=fcpicflags=;;netbsd*)if ${CPP} - -dM < /dev/null | grep __ELF__ >/dev/null ; thenmain_ldflags="-export-dynamic"shlib_ldflags="-shared"elseshlib_ldflags="-Bshareable"fi;;openbsd*)## looks like ${wl} is not defined here. Perhaps in libtool code?if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; thenmain_ldflags="${wl}-export-dynamic"shlib_ldflags="-shared -fPIC"fi;;osf*)cpicflags=cxxpicflags=fpicflags=shlib_ldflags="-shared";;solaris*)## SPARC has only an 8k global object table, 1024 entries on 64-bit,## so need PIC not pic. They are the same on other Solaris platforms.shlib_ldflags="-G"shlib_cxxldflags="-G"if test "${GCC}" = yes; thenld=`${CC} -print-prog-name=ld`ldoutput=`${ld} -v 2>&1 | grep GNU`if test -n "${ldoutput}"; thenmain_ldflags="-Wl,-export-dynamic"shlib_ldflags="-shared"fielsecpicflags="-KPIC"if test "`basename ${CXX}`" = "CC" ; then## Forte version 7 needs -lCstd: Forte 6 does not.ver=`${CXX} -V 2>&1 | sed 2d | grep 'Forte Developer 7 C++'`if test -n "${ver}" ; thenshlib_cxxldflags="-G -lCstd"fififiif test "${G77}" != yes; thenfpicflags="-PIC"fiif test "${GXX}" = yes; thenld=`${CXX} -print-prog-name=ld`ldoutput=`${ld} -v 2>&1 | grep GNU`if test -n "${ldoutput}"; thenshlib_cxxldflags="-shared"fielsecxxpicflags="-KPIC"fi;;esac## <FIXME>## Completely disable using libtool for building shlibs until libtool## fully supports at least Fortran and C++.## ## Step 4. In case we use libtool ...## if test "${use_libtool}" = yes; then## case "${host_os}" in## *)## ;;## esac## fi## </FIXME>## Step 5. Overrides from the environment and error checking.if test -z "${MAIN_LD}"; thenMAIN_LD="${main_ld}"R_SH_VAR_ADD(MAIN_LDFLAGS, [${main_ldflags}])fi: ${CPICFLAGS="${cpicflags}"}if test -z "${CPICFLAGS}"; thencase "${host_os}" inaix*|cygwin*|irix*|mingw*|osf*);;*)AC_MSG_WARN([I could not determine CPICFLAGS.])AC_MSG_ERROR([See the file doc/html/R-admin.html for more information.]);;esacfi: ${FPICFLAGS="${fpicflags}"}if test -z "${FPICFLAGS}"; thencase "${host_os}" inaix*|cygwin*|irix*|mingw*|osf*);;*)AC_MSG_WARN([I could not determine FPICFLAGS.])AC_MSG_ERROR([See the file doc/html/R-admin.html for more information.]);;esacfi: ${CXXPICFLAGS="${cxxpicflags}"}if test -z "${CXXPICFLAGS}"; thencase "${host_os}" inaix*|cygwin*|irix*|mingw*|osf*);;*)warn_cxxpicflags="I could not determine CXXPICFLAGS."AC_MSG_WARN([${warn_cxxpicflags}]);;esacfiif test -z "${SHLIB_LD}"; thenSHLIB_LD="${shlib_ld}"R_SH_VAR_ADD(SHLIB_LDFLAGS, [${shlib_ldflags}])fiif test -z "${SHLIB_LDFLAGS}"; thenAC_MSG_WARN([I could not determine SHLIB_LDFLAGS.])AC_MSG_ERROR([See the file doc/html/R-admin.html for more information.])fiif test -z "${SHLIB_CXXLD}"; thenSHLIB_CXXLD="${shlib_cxxld}"R_SH_VAR_ADD(SHLIB_CXXLDFLAGS, [${shlib_cxxldflags}])fiif test -z "${SHLIB_CXXLDFLAGS}"; thenwarn_shlib_cxxldflags="I could not determine SHLIB_CXXLDFLAGS"AC_MSG_WARN([${warn_shlib_cxxldflags}])fi## Step 6. We may need flags different from SHLIB_LDFLAGS and SHLIB_EXT## for building R as a shared library to link against (the SHLIB_* vars## just determined are really for loadable modules). On ELF there is no## difference, but e.g. on Mach-O for Darwin there is.#### Also need flags to build the Rlapack shared library on some platforms.DYLIB_EXT="${SHLIB_EXT}"dylib_ldflags="${SHLIB_LDFLAGS}"LIBR_LDFLAGS=""RLAPACK_LDFLAGS=""RBLAS_LDFLAGS=""case "${host_os}" inaix*)## Not needed for -brtl linking# RLAPACK_LDFLAGS="${wl}-bE:\$(top_builddir)/etc/Rlapack.exp"# LAPACK_LDFLAGS="${wl}-bI:\$(R_HOME)/etc/Rlapack.exp";;darwin*)DYLIB_EXT=".dylib"dylib_ldflags="${darwin_dylib_ldflags}"MAJR_VERSION=`echo "${PACKAGE_VERSION}" | sed -e "s/[[\.]][[1-9]]$/.0/"`LIBR_LDFLAGS="-install_name libR.dylib -compatibility_version ${MAJR_VERSION} -current_version ${PACKAGE_VERSION} -headerpad_max_install_names"RLAPACK_LDFLAGS="-install_name libRlapack.dylib -compatibility_version ${MAJR_VERSION} -current_version ${PACKAGE_VERSION} -headerpad_max_install_names"## don't use version in libRblas so we can replace it with any BLAS implementationRBLAS_LDFLAGS="-install_name libRblas.dylib -headerpad_max_install_names";;hpux*)## Needs to avoid embedding a relative path ../../../bin.## See the above code for shlib_ldflags for reasons why we currently## cannot always use '-Wl,+s'.if test "${GCC}" = yes; thenLAPACK_LDFLAGS="-Wl,+s"elseLAPACK_LDFLAGS="+s"fi;;openbsd*)PACKAGE_VERSION_MAJOR=`echo "${PACKAGE_VERSION}" | \sed -e "s/\.//" -e "s/\..*$//"`PACKAGE_VERSION_MINOR=`echo "${PACKAGE_VERSION}" | \sed -e "s/.*\.\([[^.]][[^.]]*$\)/\1/"`DYLIB_EXT=".so.${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}";;esacif test -z "${DYLIB_LD}"; thenDYLIB_LD="${SHLIB_LD}"R_SH_VAR_ADD(DYLIB_LDFLAGS, [${dylib_ldflags}])elseif test -z "${DYLIB_LDFLAGS}"; thenDYLIB_LDFLAGS="${dylib_ldflags}"fifiAM_CONDITIONAL(DYLIB_UNDEFINED_ALLOWED, [test "x${dylib_undefined_allowed}" = xyes])AM_CONDITIONAL(BUILD_CYGWIN, [test "x${is_cygwin}" = xyes])AC_SUBST(MAIN_LD)AC_SUBST(MAIN_LDFLAGS)AC_SUBST(CPICFLAGS)AC_SUBST(CXXPICFLAGS)AC_SUBST(DYLIB_LD)AC_SUBST(DYLIB_LDFLAGS)AC_SUBST(FCPICFLAGS)AC_SUBST(FPICFLAGS)AC_SUBST(SHLIB_CXXLD)AC_SUBST(SHLIB_CXXLDFLAGS)AC_SUBST(SHLIB_LD)AC_SUBST(SHLIB_LDFLAGS)AC_SUBST(SHLIB_LIBADD)AC_SUBST(SHLIB_EXT)AC_DEFINE_UNQUOTED(SHLIB_EXT, "${SHLIB_EXT}",[Define this to be the extension used for shared libraries on yoursystem.])AM_CONDITIONAL(USE_EXPORTFILES, [test "x${use_exportfiles}" = xyes])AC_SUBST(DYLIB_EXT)AC_SUBST(LIBR_LDFLAGS)AC_SUBST(RBLAS_LDFLAGS)AC_SUBST(RLAPACK_LDFLAGS)AC_SUBST(LAPACK_LDFLAGS)AC_SUBST(FW_VERSION)### Now we have found all the flags, we need to use them to test appropriately.### We don't currently have any C++ tests, but future-proof.### In principle we should do this before testing for C-Fortran compatibility.CPPFLAGS_KEEP=${CPPFLAGS}CFLAGS_KEEP=${CFLAGS}FFLAGS_KEEP=${FFLAGS}CXXFLAGS_KEEP=${CXXFLAGS}CPPFLAGS="${CPPFLAGS} ${R_XTRA_CPPFLAGS}"if test "${want_R_shlib}" = yes; thenCFLAGS="${CFLAGS} ${CPICFLAGS} ${R_XTRA_CFLAGS}"FFLAGS="${FFLAGS} ${FPICFLAGS} ${R_XTRA_FFLAGS}"CXXFLAGS="${CXXFLAGS} ${CXXPICFLAGS} ${R_XTRA_CXXFLAGS}"elseCFLAGS="${CFLAGS} ${R_XTRA_CFLAGS}"FFLAGS="${FFLAGS} ${R_XTRA_FFLAGS}"CXXFLAGS="${CXXFLAGS} ${R_XTRA_CXXFLAGS}"fi### * Checks for library functions.AC_CHECK_TYPES([off_t])AC_FUNC_ALLOCAAC_CHECK_DECLS([alloca], , ,[#ifdef HAVE_ALLOCA_H# include <alloca.h>#endif])## C99 functions: we don't as yet require a C99 compiler/runtime## (and not everyone has one).R_CHECK_FUNCS([expm1 hypot log1p log2 log10 rint], [#include <math.h>])## fseeko/ftello may be macros, matherr is redefined## is.blank should be a macro according to C99AC_CHECK_FUNCS(fseeko ftello isblank matherr)R_CHECK_FUNCS([fcntl], [#include <fcntl.h>])R_CHECK_FUNCS([getgrgid], [#include <grp.h>])R_CHECK_FUNCS([getpwuid], [#include <pwd.h>])R_CHECK_FUNCS([sigaction sigaltstack sigemptyset], [#include <signal.h>])## va_copy is C99R_CHECK_FUNCS([va_copy __va_copy], [#include <stdarg.h>])R_CHECK_FUNCS([fdopen popen], [#include <stdio.h>])## system is C89: [un]setenv are POSIX and BSDR_CHECK_FUNCS([setenv system unsetenv], [#include <stdlib.h>])## strcoll is C89R_CHECK_FUNCS([strcoll], [#include <string.h>])R_CHECK_FUNCS([getrlimit getrusage], [#include <sys/resource.h>])R_CHECK_FUNCS([chmod mkfifo stat umask], [#include <sys/stat.h>])R_CHECK_FUNCS([gettimeofday], [#include <sys/time.h>])R_CHECK_FUNCS([times], [#include <sys/times.h>])R_CHECK_FUNCS([time], [#include <time.h>])R_CHECK_FUNCS([access chdir execv ftruncate getcwd getuid symlink sysconf],[#ifdef HAVE_UNISTD_H# include <unistd.h>#endif])## We need setenv or putenv. It seems that everyone does have## putenv, as earlier versions of R would have failed without it.## It is not always declared, so we do not require a declaration.AC_CHECK_FUNCS(putenv)AC_CHECK_DECLS([putenv], , , [#include <stdlib.h>])## this is a GNU extension so usually hiddenAC_CHECK_FUNCS(vasprintf)AC_CHECK_DECLS([vasprintf], , , [#include <stdio.h>])## mempcpy is a GNU extension used by regex.c. That defines## _GNU_SOURCE, so should be declared on glibc systems.## gettext will also check for this.AC_CHECK_FUNCS(mempcpy)## realpath is a BSD extension.## Some early GNU libc systems had it in unistd.h.AC_CHECK_FUNCS(realpath)AC_CHECK_DECLS([realpath], , , [#include <stdlib.h>#ifdef HAVE_UNISTD_H#include <unistd.h>#endif])R_CHECK_FUNCS([glob], [#ifdef HAVE_GLOB_H# include <glob.h>#endif])## we can't use dir() or unlink(recursive=TRUE) without theseif test "${ac_cv_have_decl_stat}" = "no"; thenAC_MSG_ERROR([Building R requires the 'stat' system call])fiif test "${ac_cv_search_opendir}" = "no"; thenAC_MSG_ERROR([Building R requires the 'opendir' system call])fi## <NOTE>## No need checking for bcopy bzero memcpy even though ifnames## might report corresponding HAVE_FOO conditionals.## </NOTE>if test $ac_cv_type_off_t=yes -a $ac_cv_func_fseeko=yes -a $ac_cv_func_ftello=yes; thenAC_DEFINE(HAVE_OFF_T, 1,[Define if you have off_t, fseeko and ftello.])fi## IEEE 754. We rely on this in e.g. the working log test.R_IEEE_754## check if putenv can substitute for unsetenvR_PUTENV_AS_UNSETENV## check whether nl_langinfo(CODESET) is in langinfo.h## defines HAVE_LANGINFO_CODESET if it's thereAM_LANGINFO_CODESET## Used to build src/include/Rmath.h.## <NOTE>## we don't use AC_CONFIG_HEADERS on Rmath.h.in because## a) that would comment out #undef statements in Rmath.h.in and## b) Rmath.h should be a self-contained file for standalone Rmath use.## </NOTE>if test "${ac_cv_have_decl_expm1}" = yes; thenRMATH_HAVE_EXPM1="# define HAVE_EXPM1 1"elseRMATH_HAVE_EXPM1="# undef HAVE_EXPM1"fiAC_SUBST(RMATH_HAVE_EXPM1)if test "${ac_cv_have_decl_log1p}" = yes; thenRMATH_HAVE_LOG1P="# define HAVE_LOG1P 1"elseRMATH_HAVE_LOG1P="# undef HAVE_LOG1P"fiAC_SUBST(RMATH_HAVE_LOG1P)## Do we need substitutes?AC_REPLACE_FUNCS(acosh asinh atanh mkdtemp snprintf strdup strncasecmp vsnprintf)## Enable declarations in Defn.h?AC_CHECK_DECLS([acosh, asinh, atanh], , , [#include <math.h>])AC_CHECK_DECLS([mkdtemp, snprintf, strdup, strncasecmp, vsnprintf])AC_SEARCH_LIBS(connect, [socket])AC_SEARCH_LIBS(gethostbyname, [nsl socket])AC_SEARCH_LIBS(xdr_string, [nsl])R_FUNC___SETFPUCWR_FUNC_CALLOCif test "${ac_cv_have_decl_isfinite}" = "yes"; thenR_FUNC_ISFINITEfi## check accuracy of log1pR_FUNC_LOG1PR_FUNC_FTELLR_FUNC_SIGACTIONR_MKTIME_ERRNOR_C99_COMPLEX## check for vecLib framework (potentially to be used for BLAS)## in theory vecLib is platform-independent, in practice only## Apple's Mac OS X is known to provide itR_CHECK_FRAMEWORK(cblas_cdotu_sub, vecLib)## BLAS.## <NOTE>## This has to come *after* checking for Fortran 77 compiler/converter## characteristics (notably name mangling and FLIBS).## </NOTE>if test "${use_blas}" = yes; then## may acx_blas_ok to yesR_BLAS_LIBSfiif test "${acx_blas_ok}" != "yes"; thencase "${host_os}" indarwin[[1-7]]*|aix*);;*)if test "${use_blas_shlib}" = "unset"; thenuse_blas_shlib="yes"fi;;esacfiAM_CONDITIONAL(BLAS_SHLIB, [test "x${use_blas_shlib}" = xyes])case "${host_os}" indarwin*)## In order to allow the R build to be relocatable, we strip paths## from all shlibs and rely on DYLD_LIBRARY_PATH. Unfortunately## Darwin linker ignores it at build-time and doesn't use -L to## resolve dylib dependencies, so libRblas will not be found unless## we tell ld where it lives. I don't know of any more elegant solution :/if test "x${use_blas_shlib}" = xyes; thenLIBR="${LIBR} -dylib_file libRblas.dylib:\$(R_HOME)/lib\$(R_ARCH)/libRblas.dylib"fi;;esacAC_SUBST(LIBR)## This version is used to build a shared BLAS libBLAS_LIBS0=${BLAS_LIBS}## external BLAS + shared BLAS lib = we need to pass symbols through## this may require some magicif test "${acx_blas_ok}" = yes -a "${use_blas_shlib}" = yes; thencase "${host_os}" indarwin*)## test whether we can see symbols through the proxy BLAS library## this test could be modified to not be Darwin-specific,## however the fix is darwin-specificif test "${r_cv_prog_f77_append_underscore}" = yes; thendgemm=dgemm_xerbla=xerbla_elsedgemm=dgemmxerbla=xerblafiAC_MSG_CHECKING([whether external BLAS is visible through libRblas])AC_CACHE_VAL([r_cv_blas0_passthrough],[[cat > conftestl.c <<EOFvoid ${dgemm}();void dummy() { ${dgemm}(); }EOF]echo "${CC} ${CFLAGS} conftestl.c ${SHLIB_LDFLAGS} -o libconftest${DYLIB_EXT} ${LIBS} ${BLAS_LIBS}" >&AS_MESSAGE_LOG_FD${CC} ${CFLAGS} conftestl.c ${SHLIB_LDFLAGS} -o libconftest${DYLIB_EXT} ${LIBS} ${BLAS_LIBS} 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD[cat > conftest.c <<EOFvoid ${dgemm}();void ${xerbla}(char *srname, int *info){};int main(int argc, char **argv) { if (argc<0) ${dgemm}(); return 0; }EOF]if ${CC} ${CFLAGS} -c conftest.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; thenif ${CC} ${LDFLAGS} -o conftest${ac_exeext} \conftest.${ac_objext} -L. -lconftest \1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD;then## redirect error messages to config.logoutput=`./conftest${ac_exeext} 2>&AS_MESSAGE_LOG_FD`if test ${?} = 0; thenr_cv_blas0_passthrough=yesfififi])if test -n "${r_cv_blas0_passthrough}"; thenr_cv_blas0_passthrough=yesAC_MSG_RESULT([yes])elseAC_MSG_RESULT([no])AC_MSG_CHECKING([can it be fixed by using -sub_umbrella])ac_test_BLAS_LIBS=`echo "${BLAS_LIBS}"|sed -e s/-framework/-sub_umbrella/`rm -f libconftest.dylibecho "${CC} ${CFLAGS} conftestl.c ${SHLIB_LDFLAGS} -o libconftest${DYLIB_EXT} ${LIBS} ${BLAS_LIBS} ${ac_test_BLAS_LIBS}" >&AS_MESSAGE_LOG_FD${CC} ${CFLAGS} conftestl.c ${SHLIB_LDFLAGS} -o libconftest${DYLIB_EXT} ${LIBS} ${BLAS_LIBS} ${ac_test_BLAS_LIBS} 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FDif ${CC} ${CFLAGS} -c conftest.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; thenif ${CC} ${LDFLAGS} -o conftest${ac_exeext} \conftest.${ac_objext} -L. -lconftest \1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD;then## redirect error messages to config.logoutput=`./conftest${ac_exeext} 2>&AS_MESSAGE_LOG_FD`if test ${?} = 0; thenr_cv_blas0_passthrough=yesfififiif test -n "${r_cv_blas0_passthrough}"; thenr_cv_blas0_passthrough=yesAC_MSG_RESULT([yes])BLAS_LIBS0="${BLAS_LIBS} ${ac_test_BLAS_LIBS}"elseAC_MSG_RESULT([no])AC_MSG_ERROR([Cannot build Rblas shared library such that it makes external BLAS visible.An alternative is to use internal BLAS instead and replacelibRblas.dylib with the external BLAS library after R is built.])fifirm -f conftest.c conftest.o conftestl.c libconftest.dylib;;esacfiAC_SUBST(BLAS_LIBS0)if test "${use_blas_shlib}" = yes; then## set BLAS_LIBS to point at local versionBLAS_LIBS="-L\$(R_HOME)/lib\$(R_ARCH) -lRblas"fiAM_CONDITIONAL(USE_VECLIB_G95FIX, [test "x${use_veclib_g95fix}" = xyes])AM_CONDITIONAL(USE_EXTERNAL_BLAS, [test "${acx_blas_ok}" = "yes"])## LAPACK.## The default has already been set on MacOS X: otherwise it is "no"## and so this test fails.if test "${use_lapack}" = "yes"; thenR_LAPACK_LIBSfiif test "${acx_lapack_ok}" != "yes"; thenLAPACK_LIBS="-L\$(R_HOME)/lib\$(R_ARCH) -lRlapack"fiAC_SUBST(LAPACK_LIBS)AM_CONDITIONAL(USE_EXTERNAL_LAPACK, [test "${acx_lapack_ok}" = "yes"])### * Checks for system services.AC_SUBST(R_MODULES)## iconv headers and function.if test "${use_iconv}" = yes; thenR_ICONVif test "$r_cv_iconv_latin1" != yes; thenAC_MSG_ERROR([--with-iconv=yes (default) and a suitable iconv is not available])fielseAC_MSG_WARN([--with-iconv=no is deprecated and will be withdrawn shortly])fi## support for MBCScase "${host_os}" inmingw*)r_cv_iconv_latin1=yes;;esacR_MBCS## support for ICUif test "$use_ICU" = yes ; thenR_ICUif test "$use_ICU" = no ; thencase "${host_os}" in## darwin has ICU 3.2 in 10.4, 3.6 in 10.5darwin*)AC_CHECK_LIB(icucore, ucol_open, [],[AC_MSG_ERROR([library 'icucore' is required for ICU])])AC_DEFINE(USE_ICU_APPLE, 1, [Define to use Apple's ICU.])AC_DEFINE(USE_ICU, 1, [Define to use ICU for collation.])use_ICU=yes;;esacfifiAC_SUBST(USE_ICU)AC_SUBST(USE_ICU_APPLE)## X11.R_X11if test "${use_X11}" = yes; thenR_MODULES=X11elseR_MODULES=fi## check if X11 typedefs KeySymR_TYPE_KEYSYM## check if Xmu is supportedR_X11_Xmuif test "x${want_cairo}" = "xyes"; thenR_PANGO_CAIROfi## check for CoreFoundation framework (chances are much higher## that we can build AQUA if this one is present)R_CHECK_FRAMEWORK(CFStringGetSystemEncoding, CoreFoundation)## AquaR_AQUAAM_CONDITIONAL(BUILD_AQUA, [test "x${use_aqua}" = xyes])AC_SUBST(use_aqua)## Tcl/Tk.R_TCLTK## BSD networking.R_BSD_NETWORKING## Bitmap headers and libraries.R_BITMAPS## XDR headers and library routines.R_XDR## zlib headers and libraries.R_ZLIB## bzlib headers and libraries.R_BZLIB## PCRE headers and libraries.R_PCRE## libtiffAC_CHECK_HEADERS(tiffio.h)AC_CHECK_LIB(tiff, TIFFOpen, [have_tiff=yes], [have_tiff=no], [])if test "x${ac_cv_header_tiffio_h}" = xyes ; thenif test "x${have_tiff}" = xyes; thenAC_DEFINE(HAVE_TIFF, 1, [Define this if libtiff is available.])TIFF_LIBS=-ltiffelsehave_tiff=nofifiAC_SUBST(TIFF_LIBS)## POSIX times.R_SYS_POSIX_LEAPSECONDS## R profiling.if test "${want_R_profiling}" = yes; thenAC_CHECK_FUNCS(setitimer,[AC_DEFINE(R_PROFILING, 1,[Define this to enable R-level profiling.])],[want_R_profiling="no"])fiAC_SUBST(R_PROFILING)## R profiling.if test "${want_memory_profiling}" = yes; thenAC_DEFINE(R_MEMORY_PROFILING, 1, [Define this to enable memory profiling.])fi## Large-file-supportAC_SYS_LARGEFILEAC_FUNC_FSEEKO## Valgrind instrumentationif test ${valgrind_level} -eq 0; thenAC_DEFINE(NVALGRIND, 1, [Define to disable Valgrind instrumentation])fiAC_DEFINE_UNQUOTED(VALGRIND_LEVEL, ${valgrind_level}, [Define as 1 or 2 to specify levels of Valgrind instrumentation])## KERN_USRSTACK support (BSD, Darwin, ...)R_KERN_USRSTACK## check for visible __libc_stack_end on Linuxcase "${host_os}" inlinux*)AC_CACHE_CHECK([for visible __lib_stack_end],[r_cv_libc_stack_end],[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include "confdefs.h"#include <stdlib.h>extern void * __libc_stack_end;int main () {exit(0);}]])], [r_cv_libc_stack_end=yes], [r_cv_libc_stack_end=no],[r_cv_libc_stack_end=no])])if test "${r_cv_libc_stack_end}" = yes; thenAC_DEFINE(HAVE_LIBC_STACK_END, 1, [Define if __libc_stack_end is visible.])fiesac### * Miscellaneous.## Printing.## We look to see whether we have 'lpr' or 'lp'. Some platforms## provide both (SunOS and HPUX), and in those cases we choose lpr.if test -z "${R_PRINTCMD}"; thenAC_CHECK_PROGS(R_PRINTCMD, [lpr lp])fiAC_DEFINE_UNQUOTED(R_PRINTCMD, "${R_PRINTCMD}",[Define this to be printing command on your system.])## Default paper size.AC_PATH_PROG(PAPERCONF, paperconf, false): ${PAPERSIZE=a4}papersize=`${PAPERCONF}`test -z "${papersize}" && papersize="${PAPERSIZE}": ${R_PAPERSIZE="${papersize}"}AC_SUBST(R_PAPERSIZE)## Saving.AC_SUBST(R_BATCHSAVE)## Java supportR_JAVA## F90/F95 supportAC_PROG_FC()AC_LANG_PUSH(Fortran)AC_FC_SRCEXT(f90, [dummy=1], [dummy=0])AC_FC_SRCEXT(f95, [dummy=1], [dummy=0])AC_LANG_POP(): ${SHLIB_FCLD="${FC}"}: ${SHLIB_FCLDFLAGS="${SHLIB_LDFLAGS}"}AC_SUBST(SHLIB_FCLD)AC_SUBST(SHLIB_FCLDFLAGS)## Look for FCPICFLAGS## Debian in their wisdom have f95 as a link to gfortran, so## use this to pick out gfortran (even though it is unreliable).if test "${ac_cv_fc_compiler_gnu}" = yes; thencase "${host_cpu}" insparc*|ppc64|powerpc64|s390*)fcpicflags="-fPIC";;*)fcpicflags="-fpic";;esacficase "${host_os}" indarwin*)fcpicflags="-fno-common";;hpux*)case "${FC}" inf90)fcpicflags="+Z";;esac;;linux*)case "${FC}" in## Intel compilers: probably get identified as GNU, but make sure.*ifc|*ifort)fcpicflags="-fpic";;## Portland Group*pgf95|*pgf90)fcpicflags="-fpic";;esac;;solaris*)if test "${ac_cv_fc_compiler_gnu}" = yes; thenfcpicflags="-fPIC"elsefcpicflags="-PIC"fi;;esac: ${FCPICFLAGS="${fcpicflags}"}if test -z "${FCPICFLAGS}"; thencase "${host_os}" inaix*|cygwin*|irix*|mingw*|osf*);;*)AC_MSG_WARN([I could not determine FCPICFLAGS.]);;esacfi## Make sure -L terms come first in LIBS.LIBS1=""LIBS2=""for arg in ${LIBS}; docase "${arg}" in-L*)R_SH_VAR_ADD(LIBS1, [${arg}]);;*)R_SH_VAR_ADD(LIBS2, [${arg}]);;esacdoneLIBS="${LIBS1} ${LIBS2}"## R_LD_LIBRARY_PATH.## <FIXME>## This should not be necessary when using libtool for linking.## In any case, is this really good enough?## On Linux, do not add the ld.so system directories '/lib' and## '/usr/lib', so that the entries from '/etc/ld.so.conf' are not## shadowed (otherwise, e.g. optimized ATLAS libs would not be used).## On OS X (Darwin) /usr/X11R6/lib shadows OpenGL framework and is not## needed in DYLD_LIBRARY_PATH.case "${host_os}" inlinux*)r_ld_library_defaults="/usr/lib64:/lib64:/usr/lib:/lib";;solaris*)r_ld_library_defaults="/usr/lib:/lib";;darwin*)r_ld_library_defaults="/usr/X11R6/lib";;*)r_ld_library_defaults=;;esacfor arg in ${LDFLAGS} ${FLIBS} ${BLAS_LIBS} ${LAPACK_LIBS} ${X_LIBS} \${TCLTK_LIBS}; docase "${arg}" in-L*)lib=`echo ${arg} | sed "s/^-L//"`r_want_lib=true## don't add anything for Darwincase "${host_os}" in darwin*) r_want_lib=false ;; esac## Do not add non-existent directories.test -d "${lib}" || r_want_lib=falseif test x"${r_want_lib}" = xtrue; then## Canonicalize (/usr/lib/gcc-lib/i486-linux/3.3.4/../../..).lib=`cd "${lib}" && ${GETWD}`## Do not add something twice, or default paths.r_save_IFS="${IFS}"; IFS="${PATH_SEPARATOR}"for dir in ${R_LD_LIBRARY_PATH}${IFS}${r_ld_library_defaults}; doif test x"${dir}" = x"${lib}"; thenr_want_lib=falsebreakfidoneIFS="${r_save_IFS}"if test x"${r_want_lib}" = xtrue; thenR_SH_VAR_ADD(R_LD_LIBRARY_PATH, [${lib}], [${PATH_SEPARATOR}])fifi;;esacdone## Handle JAVA_LD_LIBRARY_PATH specially so that users can conveniently set just## R_JAVA_LD_LIBRARY_PATH in their environment.if test -n "${JAVA_LD_LIBRARY_PATH}"; thenargs=`echo ${JAVA_LD_LIBRARY_PATH} | sed -e s:\$\(JAVA_HOME\):${JAVA_HOME}:g`r_save_IFS="${IFS}"; IFS="${PATH_SEPARATOR}"for lib in ${args}; dor_want_lib=true## Do not add non-existent directories.test -d "${lib}" || r_want_lib=falseif test x"${r_want_lib}" = xtrue; then## do NOT Canonicalize (/usr/lib/j2sdk1.5-sun/jre/../lib/i386).## because we may lose the reference to ${JAVA_HOME} if it is a symlink (it often is)##lib=`cd "${lib}" && ${GETWD}`## Do not add something twice, or something already in## R_LD_LIBRARY_PATH or the defaults.for dir in ${R_JAVA_LD_LIBRARY_PATH}${IFS}${R_LD_LIBRARY_PATH}${IFS}${r_ld_library_defaults}; doif test x"${dir}" = x"${lib}"; thenr_want_lib=falsebreakfidoneif test x"${r_want_lib}" = xtrue; thenlib=`echo ${lib}|sed -e s:${JAVA_HOME}:\$\{JAVA_HOME\}:g`R_SH_VAR_ADD(R_JAVA_LD_LIBRARY_PATH, [${lib}], [${PATH_SEPARATOR}])fifidoneIFS="${r_save_IFS}"fi## </FIXME>AC_SUBST(R_LD_LIBRARY_PATH)AC_SUBST(R_JAVA_LD_LIBRARY_PATH)## Recommended packages.if test "${use_recommended_packages}" = yes; thenR_RECOMMENDED_PACKAGESfiAM_CONDITIONAL(USE_RECOMMENDED_PACKAGES,[test "x${use_recommended_packages}" = xyes])# i18n support. To update to a new version of gettext, run (untested):# gettextize -f -c --intlAM_NLSif test "${USE_NLS}" = "yes"; thenAM_GNU_GETTEXT_VERSION(0.14.5)AM_GNU_GETTEXT(, [need-ngettext], [../extra/intl])if test -n "$INTL_MACOSX_LIBS"; thenXTRA_INTL_CPPFLAGS=-I/System/Library/Frameworks/CoreFoundation.framework/HeadersfielseUSE_INCLUDED_LIBINTL=no## for ICONV_CONSTAM_ICONVfiAC_SUBST(XTRA_INTL_CPPFLAGS)AM_CONDITIONAL(USE_NLS, [test "x${USE_NLS}" = xyes])AM_CONDITIONAL(BUILD_LIBINTL, [test "x${USE_INCLUDED_LIBINTL}" = xyes])### * bug fixes# PR#9375 claims that sh on OSF1 is not POSIX-compliant and that is# not a bug in the OS: we add a workaround for such benighted OSescase "${host_os}" inosf*)OSF_SH_BUG='"${1+@}"';;*)OSF_SH_BUG='"${@}"';;esacAC_SUBST(OSF_SH_BUG)### * Win32 overridescase "${host_os}" inmingw*)AC_DEFINE(HAVE_ICONV, 1)AC_DEFINE(HAVE_ICONVLIST, 1)AC_DEFINE(HAVE_ICONV_H, 1)AC_DEFINE(HAVE_INTERNET, 1)AC_DEFINE(HAVE_JPEG, 1)AC_DEFINE(HAVE_PNG, 1)AC_DEFINE(HAVE_POSIX_SETJMP, 1)AC_DEFINE(HAVE_SOCKETS, 1)AC_DEFINE(HAVE_TCLTK, 1)AC_DEFINE(HAVE_TIMES, 1)AC_DEFINE(ICONV_LATIN1, 1)want_R_profiling=yesAC_DEFINE(R_PROFILING, 1)AC_DEFINE(SUPPORT_LIBXML, 1);;esac### * Output.AC_CONFIG_HEADERS([src/include/config.h])AC_CONFIG_FILES([MakeconfMakefiledoc/Makefiledoc/html/Makefiledoc/html/search/Makefiledoc/manual/Makefileetc/Makefileetc/Makeconfetc/Renvironetc/ldpathsm4/Makefilepo/Makefile.inshare/Makefilesrc/Makefilesrc/appl/Makefilesrc/extra/Makefilesrc/extra/blas/Makefilesrc/extra/bzip2/Makefilesrc/extra/intl/Makefilesrc/extra/pcre/Makefilesrc/extra/xdr/Makefilesrc/extra/zlib/Makefilesrc/include/Makefilesrc/include/Rmath.h0src/include/R_ext/Makefilesrc/library/Recommended/Makefilesrc/library/Makefilesrc/library/base/DESCRIPTIONsrc/library/base/Makefilesrc/library/datasets/DESCRIPTIONsrc/library/datasets/Makefilesrc/library/graphics/DESCRIPTIONsrc/library/graphics/Makefilesrc/library/grDevices/DESCRIPTIONsrc/library/grDevices/Makefilesrc/library/grDevices/src/Makefilesrc/library/grid/DESCRIPTIONsrc/library/grid/Makefilesrc/library/grid/src/Makefilesrc/library/methods/DESCRIPTIONsrc/library/methods/Makefilesrc/library/methods/src/Makefilesrc/library/profile/Makefilesrc/library/stats/DESCRIPTIONsrc/library/stats/Makefilesrc/library/stats/src/Makefilesrc/library/stats4/DESCRIPTIONsrc/library/stats4/Makefilesrc/library/splines/DESCRIPTIONsrc/library/splines/Makefilesrc/library/splines/src/Makefilesrc/library/tcltk/DESCRIPTIONsrc/library/tcltk/Makefilesrc/library/tcltk/src/Makefilesrc/library/tools/DESCRIPTIONsrc/library/tools/Makefilesrc/library/tools/src/Makefilesrc/library/utils/DESCRIPTIONsrc/library/utils/Makefilesrc/main/Makefilesrc/modules/Makefilesrc/modules/X11/Makefilesrc/modules/internet/Makefilesrc/modules/lapack/Makefilesrc/modules/vfonts/Makefilesrc/nmath/Makefilesrc/nmath/standalone/Makefilesrc/scripts/Makefilesrc/scripts/COMPILEsrc/scripts/INSTALLsrc/scripts/REMOVEsrc/scripts/R.shsrc/scripts/Rdconvsrc/scripts/Rprofsrc/scripts/SHLIBsrc/scripts/Sd2Rdsrc/scripts/buildsrc/scripts/checksrc/unix/Makefiletests/Makefiletests/Embedding/Makefiletests/Examples/Makefiletests/Native/Makefiletools/Makefile])AC_CONFIG_COMMANDS([stamp-h],[test -f src/include/stamp-h || echo timestamp > src/include/stamp-h])### now reset flagsCPPFLAGS=${CPPFLAGS_KEEP}CFLAGS=${CFLAGS_KEEP}FFLAGS=${FFLAGS_KEEP}CXXFLAGS=${CXXFLAGS_KEEP}AC_OUTPUT## Summarize configure results.## <NOTE>## Doing this via AC_CONFIG_COMMANDS would require explicitly passing all## configure variables to config.status.## </NOTE>r_c_compiler="${CC} ${R_XTRA_CFLAGS} ${CFLAGS}"r_cxx_compiler="${CXX} ${R_XTRA_CXXFLAGS} ${CXXFLAGS}"r_f77_compiler="${F77} ${R_XTRA_FFLAGS} ${FFLAGS}"r_f95_compiler="${FC} ${FCFLAGS}"r_objc_compiler="${OBJC} ${OBJCFLAGS}"r_interfaces=## we will not have tested for X11 under some configure options, so## need to test protect the test.for item in X11 aqua tcltk; doif eval "test x\${use_${item}} = xyes"; thenR_SH_VAR_ADD(r_interfaces, [${item}], [, ])fidoner_external_libs=if test "${use_readline}" = yes; thenr_external_libs=readlinefiif test "${acx_blas_ok}" = "yes"; then## Try to figure out which BLAS was used.case "${BLAS_LIBS0}" in*-latlas*) r_blas=ATLAS ;;*-lsgemm*) r_blas=PhiPack ;;*sunperf*) r_blas=SunPerf ;;*-lessl*) r_blas=ESSL ;;*vecLib*) r_blas=vecLib ;;"") r_blas=none ;;*) r_blas=generic ;;esacR_SH_VAR_ADD(r_external_libs, [BLAS(${r_blas})], [, ])fiif test "${acx_lapack_ok}" = "yes"; then## Try to figure out which LAPACK was used.case "${LAPACK_LIBS}" in*sunperf*) r_lapack=SunPerf ;;"") r_lapack="in blas" ;;*) r_lapack=generic ;;esacR_SH_VAR_ADD(r_external_libs, [LAPACK(${r_lapack})], [, ])fir_capabilities=if test "${have_png}" = yes; thenR_SH_VAR_ADD(r_capabilities, [PNG], [, ])fiif test "${have_jpeg}" = yes; thenR_SH_VAR_ADD(r_capabilities, [JPEG], [, ])fiif test "${have_tiff}" = yes; thenR_SH_VAR_ADD(r_capabilities, [TIFF], [, ])fiif test "${r_cv_iconv_latin1}" = yes; thenR_SH_VAR_ADD(r_capabilities, [iconv], [, ])fiif test "${want_mbcs_support}" = yes; thenR_SH_VAR_ADD(r_capabilities, [MBCS], [, ])fiif test "${USE_NLS}" = yes; thenR_SH_VAR_ADD(r_capabilities, [NLS], [, ])fiif test "${r_cv_cairo_works}" = yes; thenR_SH_VAR_ADD(r_capabilities, [cairo], [, ])fiif test "${use_ICU}" = yes; thenR_SH_VAR_ADD(r_capabilities, [ICU], [, ])fir_options=if test "${want_R_framework}" = yes; thenR_SH_VAR_ADD(r_options, [framework], [, ])elif test "${want_R_shlib}" = yes; thenR_SH_VAR_ADD(r_options, [shared R library], [, ])elif test "${want_R_static}" = yes; thenR_SH_VAR_ADD(r_options, [static R library], [, ])fiif test "${use_blas_shlib}" = yes; thenR_SH_VAR_ADD(r_options, [shared BLAS], [, ])fiif test "${want_R_profiling}" = yes; thenR_SH_VAR_ADD(r_options, [R profiling], [, ])fiif test "${want_memory_profiling}" = yes; thenR_SH_VAR_ADD(r_options, [memory profiling], [, ])fiif test "${use_maintainer_mode}" = yes; thenR_SH_VAR_ADD(r_options, [maintainer mode], [, ])fiif test "${use_strict_barrier}" = yes; thenR_SH_VAR_ADD(r_options, [strict barrier], [, ])fiif test "${want_linux_lfs}" = yes; thenR_SH_VAR_ADD(r_options, [Linux LFS], [, ])fiif test -n "${JAVA}"; thenR_SH_VAR_ADD(r_options, [Java], [, ])fiAC_MSG_RESULT([R is now configured for ${host}Source directory: ${srcdir}Installation directory: ${prefix}C compiler: ${r_c_compiler}Fortran 77 compiler: ${r_f77_compiler}C++ compiler: ${r_cxx_compiler}Fortran 90/95 compiler: ${r_f95_compiler}Obj-C compiler: ${r_objc_compiler}Interfaces supported: ${r_interfaces}External libraries: ${r_external_libs}Additional capabilities: ${r_capabilities}Options enabled: ${r_options}Recommended packages: ${use_recommended_packages}])if test -n "${warn_f77_cc_double_complex}"; thenAC_MSG_WARN([${warn_f77_cc_double_complex}])fiif test -n "${warn_xcompile_sizeof_int}"; thenAC_MSG_WARN([${warn_xcompile_sizeof_int}])fiif test -n "${warn_xcompile_sizeof_long}"; thenAC_MSG_WARN([${warn_xcompile_sizeof_long}])fiif test -n "${warn_type_socklen}"; thenAC_MSG_WARN([${warn_type_socklen}])fiif test -n "${warn_cxxpicflags}"; thenAC_MSG_WARN([${warn_cxxpicflags}])fiif test -n "${warn_shlib_cxxldflags}"; thenAC_MSG_WARN([${warn_shlib_cxxldflags}])fiif test -n "${warn_cxxpicflags}"; thenAC_MSG_WARN([${warn_cxxpicflags}])fiif test -n "${warn_fcpicflags}"; thenAC_MSG_WARN([${warn_fcpicflags}])fiif test -n "${warn_libglade_version}"; thenAC_MSG_WARN([${warn_libglade_version}])fiif test -n "${warn_tcltk_version}"; thenAC_MSG_WARN([${warn_tcltk_version}])fiif test -n "${warn_perl5}"; thenAC_MSG_WARN([${warn_perl5}])fiif test -n "${warn_dvi}"; thenAC_MSG_WARN([${warn_dvi}])fiif test -n "${warn_info}"; thenAC_MSG_WARN([${warn_info}])fiif test -n "${warn_pdf}"; thenAC_MSG_WARN([${warn_pdf}])fiif test -n "${warn_pager}"; thenAC_MSG_WARN([${warn_pager}])fiif test -n "${warn_browser}"; thenAC_MSG_WARN([${warn_browser}])fiif test -n "${warn_pdfviewer}"; thenAC_MSG_WARN([${warn_pdfviewer}])fi### Local variables: ***### mode: outline-minor ***### outline-regexp: "### [*]+" ***### End: ***