configure.ac 90.7 KB
Newer Older
Radford Neal's avatar
Radford Neal committed
1
### configure.ac					-*- Autoconf -*-
Radford Neal's avatar
Radford Neal committed
2 3 4
###
### Process this file with autoconf to produce a configure script.
###
Radford Neal's avatar
Radford Neal committed
5
### Copyright (C) 1998-2011 R Core Team
Radford Neal's avatar
Radford Neal committed
6
### Modifications for pqR copyright (C) 2012-2017 Radford Neal
Radford Neal's avatar
Radford Neal committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
###
### 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/

Radford Neal's avatar
Radford Neal committed
24
AC_PREREQ(2.62)
Radford Neal's avatar
Radford Neal committed
25 26

## We want to get the version number from file 'VERSION' (rather than
27
# specifying the version info in 'configure.ac'.  Hence, we need a bit
Radford Neal's avatar
Radford Neal committed
28 29 30 31 32 33
## 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]))
34
AC_INIT([pqR],[R_VERSION],[http://github.com/radfordneal/pqR/issues],[pqR],[http://pqR-project.org])
Radford Neal's avatar
Radford Neal committed
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
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 scripts
dnl 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_HOST
AC_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.])

Radford Neal's avatar
Radford Neal committed
77 78 79 80 81 82
## exclude some unsupported OSes
case "${host_os}" in
   ## Darwin 1.3.1 was OS X 10.0, 1.4.1 was 10.1, 5 is 10.2 etc
   ## with 11 being 10.7.  We no longer support < 10.4 (Tiger)
   ## http://en.wikipedia.org/wiki/Darwin_OS
   darwin1.*)
83
     AC_MSG_ERROR([The earliest supported MacOS X is 10.4.])
Radford Neal's avatar
Radford Neal committed
84 85
     ;; 
  darwin[[567]]*)
86
     AC_MSG_ERROR([The earliest supported MacOS X is 10.4.])
Radford Neal's avatar
Radford Neal committed
87 88 89 90 91 92 93
     ;; 
  aix[123]*|aix4.[01]*)
    ## These need a form of linking we no longer support
    AC_MSG_ERROR([AIX prior to 4.2 is not supported])
    ;;
esac

Radford Neal's avatar
Radford Neal committed
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
R_PLATFORM="${host}"
AC_SUBST(R_PLATFORM)
R_OS="${host_os}"
AC_SUBST(R_OS)

case "${host_os}" in
  mingw*|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"
   ;;
esac
AC_SUBST(R_OSTYPE)

Radford Neal's avatar
Radford Neal committed
113 114 115
R_CONFIG_ARGS="${ac_configure_args}"
AC_SUBST(R_CONFIG_ARGS)

Radford Neal's avatar
Radford Neal committed
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
### ** Defaults.

## NB: autoconf loads such files too
cfile="${srcdir}/config.site"
if test -r "${cfile}"; then
  echo "loading site script '${cfile}'"
  . "${cfile}"
fi
cfile="${HOME}/.R/config"
if test -r "${cfile}"; then
  echo "loading user script '${cfile}'"
  . "${cfile}"
else
  ## NB: undocumented, replaced ~/.Rconf in late 2004, latter removed in 2009
  cfile="${HOME}/.Rconfig"
  if test -r "${cfile}"; then
    echo "loading user script '${cfile}'"
    . "${cfile}"
  fi
fi
cfile="./config.site"
if test -r "${cfile}"; then
  echo "loading build-specific script '${cfile}'"
  . "${cfile}"
fi

## We need to establish suitable defaults for a 64-bit OS
libnn=lib
case "${host_os}" in
  linux*)
    ## Not all distros use this: some choose to march out of step  
    case "${host_cpu}" in
      x86_64|mips64|ppc64|powerpc64|sparc64|s390x)
Radford Neal's avatar
Radford Neal committed
149 150 151
        if test -d /usr/lib64; then
          libnn=lib64
	fi
Radford Neal's avatar
Radford Neal committed
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
      ;;
    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}"}
fi
AC_SUBST(LIBnn)
## take care not to  override the command-line setting
if test "${libdir}" = '${exec_prefix}/lib'; then
  libdir='${exec_prefix}/${LIBnn}'
fi

## R installation directories
m4_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@:>@])dnl

if test -z "${rdocdir}"; then
  rdocdir='${rhome}/doc'
fi
AC_SUBST([rdocdir])

if test -z "${rincludedir}"; then
  rincludedir='${rhome}/include'
fi
AC_SUBST([rincludedir])

if test -z "${rsharedir}"; then
  rsharedir='${rhome}/share'
fi
AC_SUBST([rsharedir])

### ** Handle arguments to configure.

config_opts="${ac_configure_args}"
AC_SUBST(config_opts)

### ** Optional features.

205 206 207 208 209 210 211 212 213 214 215
## Enable use of compressed pointers.
AC_ARG_ENABLE([compressed-pointers],
[AS_HELP_STRING([--enable-compressed-pointers],[use compressed pointers
                 @<:@no@:>@])],
[use_compressed_pointers="${enableval}"],
[use_compressed_pointers=no])
if test x"${use_compressed_pointers}" = xyes; then
  AC_DEFINE(USE_COMPRESSED_POINTERS, 1,
            [Define to 1 to enable use of compressed pointers.])
fi

216 217 218 219 220 221 222 223 224 225 226
## Enable use aux1 for attributes in builds with 64-bit uncompressed pointers
AC_ARG_ENABLE([aux-for-attrib],
[AS_HELP_STRING([--enable-aux-for-attrib],[use auxiliary info for attributes
                 @<:@no@:>@])],
[use_aux_for_attrib="${enableval}"],
[use_aux_for_attrib=no])
if test x"${use_aux_for_attrib}" = xyes; then
  AC_DEFINE(USE_AUX_FOR_ATTRIB, 1,
            [Define to 1 to enable use of auxiliary info for attributes.])
fi

227
## Allow the user to specify that the helpers apparatus can use multithreading.
228 229 230 231 232 233 234 235 236 237 238
AC_ARG_ENABLE([helper_threads],
[AS_HELP_STRING([--enable-helper-threads],[support use of helper threads @<:@yes@:>@])],
[if test "${enableval}" = no; then
  want_helper_threads=no
elif test "${enableval}" = yes; then
  want_helper_threads=yes
else
  want_helper_threads=yes
fi],
[want_helper_threads=yes])

239 240 241 242 243 244 245 246 247 248 249 250
## Allow the user to specify that task merging will be attempted.
AC_ARG_ENABLE([task_merging],
[AS_HELP_STRING([--enable-task-merging],[support merging of tasks @<:@yes@:>@])],
[if test "${enableval}" = no; then
  want_task_merging=no
elif test "${enableval}" = yes; then
  want_task_merging=yes
else
  want_task_merging=yes
fi],
[want_task_merging=yes])

251
## Allow the user to specify support for deferred evaluation & helpers apparatus
252
## with lack of support implying also no helper threads and no task merging.
253
AC_ARG_ENABLE([deferred-evaluation],
254
[AS_HELP_STRING([--enable-deferred-evaluation],[support deferred evaluation @<:@yes@:>@])],
255 256 257
[if test "${enableval}" = no; then
  want_deferred_eval=no
  want_helper_threads=no
258
  want_task_merging=no
259 260 261 262 263 264 265
elif test "${enableval}" = yes; then
  want_deferred_eval=yes
else
  want_deferred_eval=yes
fi],
[want_deferred_eval=yes])

Radford Neal's avatar
Radford Neal committed
266 267 268 269 270 271 272 273 274 275 276 277 278
## 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; then
  want_R_profiling=no
elif test "${enableval}" = yes; then
  want_R_profiling=yes
else
  want_R_profiling=yes
fi],
[want_R_profiling=yes])

## Allow the user to specify support for memory profiling.
279 280 281 282 283 284 285 286 287 288
#AC_ARG_ENABLE([memory-profiling],
#[AS_HELP_STRING([--enable-memory-profiling],[attempt to compile support for tracemem() @<:@no@:>@])],
#[if test "${enableval}" = no; then
#  want_memory_profiling=no
#elif test "${enableval}" = yes; then
#  want_memory_profiling=yes
#else
#  want_memory_profiling=no
#fi],
#[want_memory_profiling=no])
Radford Neal's avatar
Radford Neal committed
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321

## 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 specify
                 its 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; then
  case "${host_os}" in
    darwin*)
      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; then
          prefix="/Library/Frameworks"
        fi
      else
	prefix="${want_R_framework}"
	want_R_framework=yes
      fi
      ## 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
      ;;
  esac
fi
322 323


Radford Neal's avatar
Radford Neal committed
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
AM_CONDITIONAL(WANT_R_FRAMEWORK, [test "x${want_R_framework}" = xyes])

## Allow the user to specify building R as a shared library.
## (but a 'dynamic library' in the terminology of Mac OS X).
## <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; then
  if test "x${want_R_shlib}" = xyes; then
    AC_MSG_WARN([--enable-R-static-lib conflicts with --enable-R-shlib and will be ignored])
    want_R_static=no
  fi
fi
AM_CONDITIONAL(WANT_R_STATIC, [test "x${want_R_static}" = xyes])

## Build separate shared/dynamic library containing R's BLAS if desired 
AC_ARG_ENABLE([BLAS-shlib],
[AS_HELP_STRING([--enable-BLAS-shlib],[build BLAS into a shared/dynamic library @<:@perhaps@:>@])],
[use_blas_shlib="${enableval}"],
[use_blas_shlib="unset"])

if test "${want_R_shlib}" = yes; then
  LIBR="-L\$(R_HOME)/lib\$(R_ARCH) -lR"
else
  LIBR=
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 (and
                 maybe confusing) to the casual installer @<:@no@:>@])],
[use_maintainer_mode="${enableval}"],
[use_maintainer_mode=no])
AM_CONDITIONAL(MAINTAINER_MODE, [test "x${use_maintainer_mode}" = xyes])

AC_ARG_ENABLE([prebuilt-html],
[AS_HELP_STRING([--enable-prebuilt-html],[build static HTML help pages @<:@no@:>@])],
[want_prebuilt_html="${enableval}"],
[want_prebuilt_html=no])
AM_CONDITIONAL(BUILD_HTML, [test "x${want_prebuilt_html}" = xyes])


Radford Neal's avatar
Radford Neal committed
379 380 381 382 383 384 385
AC_ARG_ENABLE([lto],
[AS_HELP_STRING([--enable-lto],[enable link-time optimization @<:@no@:>@])],
[want_lto="${enableval}"], [want_lto=no])
## FIXME: add a test for gcc >= 4.5.0
if test "x${want_lto}" != xno; then
  LTO=-flto
fi
386
if test "x${want_lto}" = xyes; then
Radford Neal's avatar
Radford Neal committed
387 388 389 390 391 392 393
  LTOALL=-flto
fi
AC_SUBST(LTO)
AC_SUBST(LTOALL)
AM_CONDITIONAL(BUILD_LTO, [test "x${want_lto}" != xno])


Radford Neal's avatar
Radford Neal committed
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447
### ** 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; then
  want_aqua=no
else
  want_aqua=yes
fi],
[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; then
  want_tcltk=no
elif test "${withval}" = yes; then
  want_tcltk=yes
else
  want_tcltk=yes
  LDFLAGS="${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=""])

Radford Neal's avatar
Radford Neal committed
448
## cairographics etc
Radford Neal's avatar
Radford Neal committed
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465
AC_ARG_WITH([cairo],
[AS_HELP_STRING([--with-cairo],[use cairo (and pango) if available @<:@yes@:>@])],
[if test "${withval}" = no; then
  want_cairo=no
else
  want_cairo=yes
fi], [want_cairo=yes])

## other libraries
AC_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])
466 467 468 469
AC_ARG_WITH([libtiff],
[AS_HELP_STRING([--with-libtiff],[use libtiff library (if available) @<:@yes@:>@])],
[R_ARG_USE(libtiff)],
[use_libtiff=yes])
Radford Neal's avatar
Radford Neal committed
470
AC_ARG_WITH([system-zlib],
471
[AS_HELP_STRING([--with-system-zlib],[use system zlib library (if available) @<:@yes@:>@])],
Radford Neal's avatar
Radford Neal committed
472
[R_ARG_USE_SYSTEM(zlib)],
473
[use_system_zlib=yes])
Radford Neal's avatar
Radford Neal committed
474
AC_ARG_WITH([system-bzlib],
475
[AS_HELP_STRING([--with-system-bzlib],[use system bzlib library (if available) @<:@yes@:>@])],
Radford Neal's avatar
Radford Neal committed
476
[R_ARG_USE_SYSTEM(bzlib)],
477
[use_system_bzlib=yes])
Radford Neal's avatar
Radford Neal committed
478
AC_ARG_WITH([system-pcre],
479
[AS_HELP_STRING([--with-system-pcre],[use system PCRE library (if available) @<:@yes@:>@])],
Radford Neal's avatar
Radford Neal committed
480
[R_ARG_USE_SYSTEM(pcre)],
481
[use_system_pcre=yes])
Radford Neal's avatar
Radford Neal committed
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510
AC_ARG_WITH([system-xz],
[AS_HELP_STRING([--with-system-xz],[use system xz (lzma) library (if available) @<:@yes@:>@])],
[R_ARG_USE_SYSTEM(xz)],
[use_system_xz=yes])

## Valgrind instrumentation
AC_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])

## ICU
AC_ARG_WITH([ICU],
Radford Neal's avatar
Radford Neal committed
511
[AS_HELP_STRING([--with-ICU],[use ICU library (if available) @<:@yes@:>@])],
Radford Neal's avatar
Radford Neal committed
512 513 514
[R_ARG_USE(ICU)],
[use_ICU=yes])

Radford Neal's avatar
Radford Neal committed
515 516 517
## Byte-compilation of packages.
AC_ARG_ENABLE([byte-compiled-packages],
[AS_HELP_STRING([--enable-byte-compiled-packages],
518
                [byte-compile base and recommended packages @<:@no@:>@])],
Radford Neal's avatar
Radford Neal committed
519
[want_byte_compiled_packages="${enableval}"],
520
[want_byte_compiled_packages=no])
Radford Neal's avatar
Radford Neal committed
521 522 523
AM_CONDITIONAL(BYTE_COMPILE_PACKAGES,
               [test "x${want_byte_compiled_packages}" = xyes])

524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580

## BLAS matrix multiply options.

m4_divert_once([HELP_BEGIN], [
Defaults for options regarding BLAS usage:
  mat_mult_with_BLAS=v  Default mat_mult_with_BLAS @<:@NA if --with-blas, else F@:>@
  BLAS_in_helpers=v     Default BLAS_in_helpers @<:@F if --with-blas, else T@:>@])dnl

if test "${use_blas}" = unset; then
  if test "x${mat_mult_with_BLAS}" = x; then
    mat_mult_with_BLAS=FALSE
  fi
  if test "x${BLAS_in_helpers}" = x; then
    BLAS_in_helpers=TRUE
  fi
else
  if test "x${mat_mult_with_BLAS}" = x; then
    mat_mult_with_BLAS=NA
  fi
  if test "x${BLAS_in_helpers}" = x; then
    BLAS_in_helpers=FALSE
  fi
fi

if test "${mat_mult_with_BLAS}" != TRUE -a \
        "${mat_mult_with_BLAS}" != FALSE -a \
        "${mat_mult_with_BLAS}" != T -a \
        "${mat_mult_with_BLAS}" != F -a \
        "${mat_mult_with_BLAS}" != NA; then 
  if test "${mat_mult_with_BLAS}" = T; then
    mat_mult_with_BLAS=TRUE
  fi
  if test "${mat_mult_with_BLAS}" = F; then
    mat_mult_with_BLAS=FALSE
  fi
  AC_MSG_ERROR([Invalid value for mat_mult_with_BLAS: ${mat_mult_with_BLAS}])
else
  AC_DEFINE_UNQUOTED(R_MAT_MULT_WITH_BLAS_DEFAULT, ${mat_mult_with_BLAS}, 
   [Define this to the default for mat_mult_with_BLAS.])
fi

if test "${BLAS_in_helpers}" != TRUE -a \
        "${BLAS_in_helpers}" != FALSE -a \
        "${BLAS_in_helpers}" != T -a \
        "${BLAS_in_helpers}" != F; then 
  AC_MSG_ERROR([Invalid value for BLAS_in_helpers: ${BLAS_in_helpers}])
else
  if test "${BLAS_in_helpers}" = T; then
    BLAS_in_helpers=TRUE
  fi
  if test "${BLAS_in_helpers}" = F; then
    BLAS_in_helpers=FALSE
  fi
  AC_DEFINE_UNQUOTED(R_BLAS_IN_HELPERS_DEFAULT, ${BLAS_in_helpers}, 
                     [Define this to the default for BLAS_in_helpers.])
fi

Radford Neal's avatar
Radford Neal committed
581 582 583 584 585 586 587 588 589 590 591
### ** 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],
Radford Neal's avatar
Radford Neal committed
592
           [additional CFLAGS used when building shared objects])
Radford Neal's avatar
Radford Neal committed
593 594 595
AC_ARG_VAR([MAIN_FFLAGS],
           [additional FFLAGS used when compiling the main binary])
AC_ARG_VAR([SHLIB_FFLAGS],
Radford Neal's avatar
Radford Neal committed
596
           [additional FFLAGS used when building shared objects])
Radford Neal's avatar
Radford Neal committed
597 598 599 600
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 which
Radford Neal's avatar
Radford Neal committed
601
            will load shared objects (DLLs) at runtime])
Radford Neal's avatar
Radford Neal committed
602 603
AC_ARG_VAR([CPICFLAGS],
           [special flags for compiling C code to be turned into a
Radford Neal's avatar
Radford Neal committed
604
            shared object.])
Radford Neal's avatar
Radford Neal committed
605 606
AC_ARG_VAR([FPICFLAGS],
           [special flags for compiling Fortran code to be turned into a
Radford Neal's avatar
Radford Neal committed
607
            shared object.])
Radford Neal's avatar
Radford Neal committed
608 609
AC_ARG_VAR([FCPICFLAGS],
           [special flags for compiling Fortran 95 code to be turned into a
Radford Neal's avatar
Radford Neal committed
610
            shared object.])
Radford Neal's avatar
Radford Neal committed
611
AC_ARG_VAR([SHLIB_LD],
Radford Neal's avatar
Radford Neal committed
612
           [command for linking shared objects which contain object
Radford Neal's avatar
Radford Neal committed
613 614 615 616 617 618 619 620 621 622
            files 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 object
            files 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 a
Radford Neal's avatar
Radford Neal committed
623
            shared object])
Radford Neal's avatar
Radford Neal committed
624
AC_ARG_VAR([SHLIB_CXXLD],
Radford Neal's avatar
Radford Neal committed
625 626
           [command for linking shared objects which contain object
            files from the C++ compiler])
Radford Neal's avatar
Radford Neal committed
627 628
AC_ARG_VAR([SHLIB_CXXLDFLAGS],
           [special flags used by SHLIB_CXXLD])
Radford Neal's avatar
Radford Neal committed
629
AC_ARG_VAR([SHLIB_FCLD],
Radford Neal's avatar
Radford Neal committed
630
           [command for linking shared objects which contain object
Radford Neal's avatar
Radford Neal committed
631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672
            files 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([TAR], [tar command])
AC_ARG_VAR([R_BROWSER], [default browser])
AC_ARG_VAR([R_PDFVIEWER], [default PDF viewer])
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])
AC_ARG_VAR([R_SHELL],
           [shell to be used for shell scripts, including 'R'])

if test -z "${r_arch}"; then
  R_ARCH=
  R_XTRA_CPPFLAGS2="-I\$(R_INCLUDE_DIR)"
else
  R_ARCH="/${r_arch}"
  R_XTRA_CPPFLAGS2="-I\$(R_INCLUDE_DIR) -I\$(R_INCLUDE_DIR)/${r_arch}"
fi
AC_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])
Radford Neal's avatar
Radford Neal committed
673
if test "`cd \"${srcdir}\" && ${GETWD}`" = "`${GETWD}`"; then
Radford Neal's avatar
Radford Neal committed
674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694
  BUILDDIR_IS_SRCDIR=yes
else
  BUILDDIR_IS_SRCDIR=no
fi
AC_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_AWK
AC_PROG_LN_S
AC_PROG_YACC
R_PROG_AR
R_PROG_INSTALL

## we would like a POSIX sed, and need one on Solaris
AC_PATH_PROGS(SED, sed, /bin/sed, [/usr/xpg4/bin:$PATH])
Radford Neal's avatar
Radford Neal committed
695 696 697
## 'which' is not POSIX, and might be a shell builtin or alias
##  (but should not be in 'sh')
AC_PATH_PROGS(WHICH, which, which)
Radford Neal's avatar
Radford Neal committed
698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715
## Make
: ${MAKE=make}
AC_SUBST(MAKE)
## Pager
R_PROG_PAGER
## Tar -- we prefer a GNU version
AC_PATH_PROGS(TAR, [${TAR} gtar gnutar tar], "")
## TeXMF stuff
R_PROG_TEXMF
## Unzip && zip && gzip && bip2
AC_PATH_PROGS(R_UNZIPCMD, [${UNZIP} unzip], "")
AC_PATH_PROGS(R_ZIPCMD, [${ZIP} zip], "")
AC_PATH_PROGS(R_GZIPCMD, [${GZIP} gzip], true)
AC_PATH_PROGS(R_BZIPCMD, [${BZIP} bzip2], "")
## Browser
R_PROG_BROWSER
## PDF viewer
R_PROG_PDFVIEWER
Radford Neal's avatar
Radford Neal committed
716 717
## Noweb
AC_PATH_PROG(NOTANGLE, notangle, false)
Radford Neal's avatar
Radford Neal committed
718

Radford Neal's avatar
Radford Neal committed
719 720 721
## cairographics needs pkg-config
AC_PATH_PROG(PKGCONF, pkg-config , [], 
	     [$PATH:/usr/local/bin:/ext/bin:/ext:/sw/bin:/opt/bin])
Radford Neal's avatar
Radford Neal committed
722 723 724 725 726 727

AC_PROG_CC

AC_PROG_GCC_TRADITIONAL
AC_PROG_CPP
R_PROG_CPP_CPPFLAGS
Radford Neal's avatar
Radford Neal committed
728
## see if the user set FFLAGS: used for Intel compilers
Radford Neal's avatar
Radford Neal committed
729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769
userFFLAGS=${FFLAGS}
R_PROG_F77
AC_PROG_CXX
AC_PROG_CXXCPP
R_GCC4_VISIBILITY
AC_GNU_SOURCE ## needed to libintl

AC_PROG_OBJC
## unfortunately autoconf sets OBJC to gcc even if there is no working compiler
if test "${OBJC}" = gcc; then
  AC_LANG_PUSH([Objective C])
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[id foo;])],,[OBJC=''])
  AC_LANG_POP([Objective C])
fi
R_PROG_OBJCXX

## This has to be R_DEFS as autoconf overrrides DEFS
R_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_STATIC
LT_INIT
AC_SUBST(LIBTOOL_DEPS)

## cross-compiling: added May 2007, not actually used
R_CROSS_COMPILING
AC_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.
Radford Neal's avatar
Radford Neal committed
770 771 772
## OTOH, R_LD_LIBRARY_PATH in the environment is meant to be the final version.
R_LD_LIBRARY_PATH_save=${R_LD_LIBRARY_PATH}
R_LD_LIBRARY_PATH=
Radford Neal's avatar
Radford Neal committed
773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821
case "${host_os}" in
  darwin*)
    ## 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}; do
      case "${arg}" in
        -L*)
	  lib=`echo ${arg} | sed "s/^-L//"`
	  R_SH_VAR_ADD(R_LD_LIBRARY_PATH, [${lib}], [${PATH_SEPARATOR}])
	  ;;
      esac
    done
    ;;
esac

## 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}}\""; then
  eval "${shlibpath_var}=\"${R_LD_LIBRARY_PATH}\""
else
  eval "${shlibpath_var}=\"${R_LD_LIBRARY_PATH}${PATH_SEPARATOR}\${${shlibpath_var}}\""
fi
eval "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_LIBM
AC_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}" in
  darwin*)
Radford Neal's avatar
Radford Neal committed
822 823
    ## MacOS <= 10.2 dlcompat, >= 10.3 included dlcompat in libSystem
    AC_SEARCH_LIBS(dlopen, dl,,[AC_MSG_ERROR([Your OS X is too old.])])
Radford Neal's avatar
Radford Neal committed
824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876
    ## 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; then
      case "${CC_VERSION}" in
        2.*|3.*)
          AC_CHECK_LIB(cc_dynamic, main) ;;
      esac
    fi
    ;;
  *)
    AC_CHECK_LIB(dl, dlopen)
    ;;
esac

## Readline.
if test "${use_readline}" = yes; then
  AC_CHECK_HEADERS(readline/history.h readline/readline.h)
  r_save_LIBS="${LIBS}"
  LIBS=
  ## don't use the cached value as we need to rebuild LIBS
  unset ac_cv_lib_readline_rl_callback_read_char
  AC_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 it
    unset ac_cv_lib_readline_rl_callback_read_char
    AC_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 this
  AC_CHECK_FUNCS(history_truncate_file)
  if test "${use_readline}" = no; then
    AC_MSG_ERROR([--with-readline=yes (default) and headers/libs are not available])
  else
    R_CHECK_FUNCS([rl_completion_matches], 
[#include <stdio.h>
#include <readline/readline.h>]
                 )
  fi
  READLINE_LIBS="${LIBS}"
  LIBS="${r_save_LIBS}"
fi
AC_SUBST(READLINE_LIBS)

### * Checks for header files.

AC_HEADER_STDC
AC_HEADER_DIRENT
Radford Neal's avatar
Radford Neal committed
877
## we also assume readdir and closedir
Radford Neal's avatar
Radford Neal committed
878 879 880
if test "${ac_cv_search_opendir}" = "no"; then
   AC_MSG_ERROR([Building R requires the 'opendir' system call])
fi
Radford Neal's avatar
Radford Neal committed
881 882 883 884
AC_HEADER_SYS_WAIT
## <NOTE>
## Some of these are also checked for when Autoconf computes the default
## includes.
Radford Neal's avatar
Radford Neal committed
885 886 887 888 889 890 891 892 893
##
## The following headers are POSIX: dlfcn.h fcntl.h glob.h grp.h
## pwd.h strings.h sys/resource.h sys/select.h sys/socket.h 
## sys/stat.h sys/time.h sys/times.h sys/utsname.h unistd.h utime.h
## dl.h seems to be for HP-UX
## floatingpoint.h is on FreeBSD and Solaris, originating in SysV.  
## (It is probably only used for fpsetmask on FreeBSD).
## fpu_control.h is only used on Linux, for the obsolete __setfpucw.
## sys/param.h is one way to get PATH_MAX.
Radford Neal's avatar
Radford Neal committed
894
AC_CHECK_HEADERS(arpa/inet.h dl.h dlfcn.h elf.h fcntl.h floatingpoint.h \
Radford Neal's avatar
Radford Neal committed
895 896 897
  fpu_control.h glob.h grp.h netdb.h netinet/in.h pwd.h strings.h \
  sys/param.h sys/resource.h sys/select.h sys/socket.h \
  sys/stat.h sys/time.h sys/times.h sys/utsname.h unistd.h utime.h)
Radford Neal's avatar
Radford Neal committed
898 899 900 901
## </NOTE>
## <NOTE>
## These are C99 headers but some C code (written to work also
## without assuming C99) may need the corresponding conditionals.
Radford Neal's avatar
Radford Neal committed
902
AC_CHECK_HEADERS(errno.h inttypes.h limits.h locale.h stdarg.h stdbool.h \
Radford Neal's avatar
Radford Neal committed
903
                 stdint.h string.h)
Radford Neal's avatar
Radford Neal committed
904
## only vsnprintf.c requires stdarg.h
Radford Neal's avatar
Radford Neal committed
905 906
## </NOTE>

907 908 909
## Header file for C11 "noreturn" facility.
AC_CHECK_HEADERS([stdnoreturn.h])

Radford Neal's avatar
Radford Neal committed
910 911 912 913 914 915
R_HEADER_SETJMP
R_HEADER_GLIBC2

### * Checks for types.

AC_TYPE_SIGNAL
Radford Neal's avatar
Radford Neal committed
916 917
## xz needs uint64_t
AC_TYPE_UINT64_T
Radford Neal's avatar
Radford Neal committed
918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959
AC_TYPE_PID_T
AC_TYPE_SIZE_T
R_SIZE_MAX
AC_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_SOCKLEN
AC_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.

R_BIGENDIAN
AC_C_CONST
R_C_INLINE
AC_CHECK_SIZEOF(int)
## on some platforms this gives a trailing lf, so
case "${ac_cv_sizeof_int}" in
    4*)
    AC_DEFINE(INT_32_BITS, 1, [Define if you have 32 bit ints.])
    ;;
esac
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(double)
AC_CHECK_SIZEOF(long double)
AC_CHECK_SIZEOF(size_t)
960
AC_CHECK_SIZEOF(char *)
Radford Neal's avatar
Radford Neal committed
961 962 963 964

R_PROG_CC_MAKEFRAG
R_PROG_CC_LO_MAKEFRAG

Radford Neal's avatar
Radford Neal committed
965 966
AC_OPENMP

Radford Neal's avatar
Radford Neal committed
967 968 969
### *** Fortran 77 compiler.

R_PROG_F77_FLIBS
Radford Neal's avatar
Radford Neal committed
970 971 972 973
if test -z "$FLIBS_IN_SO"; then
  FLIBS_IN_SO=${FLIBS}
fi
AC_SUBST(FLIBS_IN_SO)
Radford Neal's avatar
Radford Neal committed
974 975 976 977 978 979 980 981
R_PROG_F77_APPEND_UNDERSCORE
R_PROG_F77_CAN_RUN
R_PROG_F77_CC_COMPAT
R_PROG_F77_CC_COMPAT_COMPLEX

AM_CONDITIONAL(COMPILE_FORTRAN_DOUBLE_COMPLEX,
               [test "x${HAVE_FORTRAN_DOUBLE_COMPLEX}" != x])

Radford Neal's avatar
Radford Neal committed
982 983 984 985 986
AC_LANG_PUSH(Fortran 77)
AC_OPENMP
AC_LANG_POP(Fortran 77)


Radford Neal's avatar
Radford Neal committed
987 988 989 990
### *** C++ compiler.

R_PROG_CXX_MAKEFRAG

Radford Neal's avatar
Radford Neal committed
991 992 993 994
AC_LANG_PUSH(C++)
AC_OPENMP
AC_LANG_POP(C++)

Radford Neal's avatar
Radford Neal committed
995 996 997 998
### *** ObjC compiler

R_PROG_OBJC_MAKEFRAG
R_PROG_OBJC_RUNTIME
Radford Neal's avatar
Radford Neal committed
999 1000 1001 1002 1003 1004 1005 1006
## FSF builds of gcc (and maybe others?) need -fobjc-exceptions otherwise
## @try and friends don't work
R_PROG_OBJC_FLAG([-fobjc-exceptions],
		 R_SH_VAR_ADD(OBJCFLAGS, [-fobjc-exceptions]))
## FIXME: checks for Foundation are not darwin-specifc at all. In fact the whole
##        point of R_OBJC_FOUNDATION is to detect foundation classes on other
##        platforms (on Darwin we already *know* that is it -framework Foundation
##        but not so on Linux!), so the following was not intended to be conditonal.
Radford Neal's avatar
Radford Neal committed
1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135
case "${host_os}" in
  darwin*)
    R_OBJC_FOUNDATION
  ;;
esac

### ** Platform-specific overrides for the C, Fortran 77 and C++ compilers.

case "${host_cpu}" in
  i*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; then
      R_PROG_CC_FLAG([-mieee-with-inexact],
                     R_SH_VAR_ADD(R_XTRA_CFLAGS, [-mieee-with-inexact]))
    else
      R_PROG_CC_FLAG([-ieee_with_inexact],
                     R_SH_VAR_ADD(R_XTRA_CFLAGS, [-ieee_with_inexact]))
    fi
    if test "${G77}" = yes; then
      R_PROG_F77_FLAG([-mieee],
                      R_SH_VAR_ADD(R_XTRA_FFLAGS, [-mieee]))
    else
      R_PROG_F77_FLAG([-fpe3],
                      R_SH_VAR_ADD(R_XTRA_FFLAGS, [-fpe3]))
    fi
    if test "${GXX}" = yes; then
      R_PROG_CXX_FLAG([-mieee],
                      R_SH_VAR_ADD(R_XTRA_CXXFLAGS, [-mieee]))
    else
      R_PROG_CXX_FLAG([-ieee],
                      R_SH_VAR_ADD(R_XTRA_CXXFLAGS, [-ieee]))
    fi
    ## </NOTE>
    ;;
esac

AH_TEMPLATE([HAVE_NO_SYMBOL_UNDERSCORE],
            [Define if module-loading does not need an underscore to
             be prepended to external names.])

case "${host_os}" in
  aix*)
    AC_DEFINE(HAVE_NO_SYMBOL_UNDERSCORE)
    if test "${GCC}" = yes; then
      if test "x${OBJECT_MODE}" = "x64"; then
        R_PROG_CC_FLAG([-mminimal-toc],
                       R_SH_VAR_ADD(R_XTRA_CFLAGS, [-mminimal-toc]))
      else
        R_PROG_CC_FLAG([-mno-fp-in-toc],
                       R_SH_VAR_ADD(R_XTRA_CFLAGS, [-mno-fp-in-toc]))
      fi
    fi
    ;;
  cygwin*|mingw*|windows*|winnt)
    AC_DEFINE(HAVE_NO_SYMBOL_UNDERSCORE)
    ;;
  darwin*)
    AC_DEFINE(HAVE_NO_SYMBOL_UNDERSCORE)
    ;;
  hpux*)
    AC_DEFINE(HAVE_NO_SYMBOL_UNDERSCORE)
    case "${CC}" in
      cc|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])
	;;
    esac
    AC_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; then
      R_PROG_F77_FLAG([-OPT:IEEE_NaN_inf=ON],
                      R_SH_VAR_ADD(R_XTRA_FFLAGS, [-OPT:IEEE_NaN_inf=ON]))
    fi
    if test "${GXX}" != yes; then
      R_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; then
          if test $ac_cv_prog_cc_g = yes; then
	    case "${host_cpu}" in
	      x86_64)
	        CFLAGS="-g -O2 -std=c99"
		;;
	      *)
	        ## on ix86 optimization fails
                CFLAGS="-g -std=c99"
		;;
	    esac
          else
	    case "${host_cpu}" in
	      x86_64)
	        CFLAGS="-O2 -std=c99"
		;;
	      *)
                CFLAGS="-std=c99"
		;;
	    esac
          fi
        fi
Radford Neal's avatar
Radford Neal committed
1136
	## used to set IEEE flag, but this is version-dependent.
Radford Neal's avatar
Radford Neal committed
1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229
        ;;
    esac
    case  "${F77}" in
      ## Intel compilers
      *ifc|*ifort)
	if test "x$userFFLAGS" = x; then
          if test $ac_cv_prog_f77_g = yes; then
	    case "${host_cpu}" in
	      x86_64)
	        FFLAGS="-g -O2"
		;;
	      *)
                FFLAGS="-g"
		;;
	    esac
          else
	    case "${host_cpu}" in
	      x86_64)
	        FFLAGS="-O2"
		;;
	      *)
	        ## on ix86 optimization of dlamc.f fails
                FFLAGS=
		;;
	    esac
          fi
        fi
        ;;
    esac
    case  "${CXX}" in
      ## Intel compilers
      *icpc|*icc)
	if test "$ac_test_CXXFLAGS" != set; then
          if test $ac_cv_prog_cxx_g = yes; then
	    case "${host_cpu}" in
	      x86_64)
	        CXXFLAGS="-g -O2"
		;;
	      *)
                CXXFLAGS="-g"
		;;
	    esac
          else
	    case "${host_cpu}" in
	      x86_64)
	        CXXFLAGS="-O2"
		;;
	      *)
                CXXFLAGS=
		;;
	    esac
          fi
        fi
        ;;
    esac
    ;;
  openbsd*)
    if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then
      AC_DEFINE(HAVE_NO_SYMBOL_UNDERSCORE)
    fi
    ;;
  osf*)
    AC_DEFINE(HAVE_NO_SYMBOL_UNDERSCORE)
    ;;  
esac

if test "${SAFE_FFLAGS+set}" != set; then
  if test "x${ac_cv_f77_compiler_gnu}" = xyes; then
    SAFE_FFLAGS="${FFLAGS} -ffloat-store"
  else
    SAFE_FFLAGS=${FFLAGS}
  fi
fi


AC_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)

Radford Neal's avatar
Radford Neal committed
1230 1231
R_ABI

Radford Neal's avatar
Radford Neal committed
1232 1233 1234 1235 1236 1237
### ** 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
Radford Neal's avatar
Radford Neal committed
1238
##   shared objects (DLLs) at runtime, also for profiling.
Radford Neal's avatar
Radford Neal committed
1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293
## 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; do
  r_xtra_path="${r_xtra_path}${PATH_SEPARATOR}${dir}"
done
AC_PATH_PROG(XMKMF, xmkmf, [], [${r_xtra_path}])
if test -n "${XMKMF}"; then
  echo > Imakefile
  ${XMKMF} > /dev/null 2>&1 || echo > Makefile
Radford Neal's avatar
Radford Neal committed
1294
  cc=`"${srcdir}/tools/GETMAKEVAL" CC`
Radford Neal's avatar
Radford Neal committed
1295 1296 1297 1298 1299
  cc=`echo ${cc} | sed "s/ .*//"`
  ## Paul Gilbert reported on R-devel 2006-04-13 a system with cc=""
  if test -n "${cc}" ; then
    r_cc_cmd=`echo ${CC} | sed "s/ .*//"`
    if test "`which ${cc}`" = "`which ${r_cc_cmd}`"; then
Radford Neal's avatar
Radford Neal committed
1300 1301
      shlib_ldflags=`"${srcdir}/tools/GETMAKEVAL" SHLIBLDFLAGS`
      cpicflags=`"${srcdir}/tools/GETMAKEVAL" PICFLAGS`
Radford Neal's avatar
Radford Neal committed
1302 1303
    fi
  fi
Radford Neal's avatar
Radford Neal committed
1304
  cxx=`"${srcdir}/tools/GETMAKEVAL" CXX`
Radford Neal's avatar
Radford Neal committed
1305 1306 1307 1308
  cxx=`echo ${cxx} | sed "s/ .*//"`
  if test -n "${cxx}" ; then
    r_cxx_cmd=`echo ${CXX} | sed "s/ .*//"`
    if test "`which ${cxx}`" = "`which ${r_cxx_cmd}`"; then
Radford Neal's avatar
Radford Neal committed
1309
      cxxpicflags=`"${srcdir}/tools/GETMAKEVAL" CXXPICFLAGS`
Radford Neal's avatar
Radford Neal committed
1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597
    fi
  fi
  rm -f Imakefile Makefile
fi

## Step 2.  GNU compilers.
if test "${GCC}" = yes; then
  case "${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 -fPIC
    sparc*|ppc64|powerpc64|s390*)
      cpicflags="-fPIC"
      ;;
    *)
      cpicflags="-fpic"
      ;;
  esac
  shlib_ldflags="-shared"
fi
if test "${G77}" = yes; then
  case "${host_cpu}" in
    sparc*|ppc64|powerpc64|s390*)
      fpicflags="-fPIC"
      ;;
    *)
      fpicflags="-fpic"
      ;;
  esac
fi
if test "${GXX}" = yes; then
  case "${host_cpu}" in
    sparc*|ppc64|powerpc64|s390*)
      cxxpicflags="-fPIC"
      ;;
    *)
      cxxpicflags="-fpic"
      ;;
  esac
  shlib_cxxldflags="-shared"
fi

## Step 3.  Individual platform overrides.
dylib_undefined_allowed=yes
is_cygwin=no
case "${host_os}" in
  aix*)
    use_exportfiles=yes
    ## All AIX code is PIC.
    cpicflags=
    cxxpicflags=
    fpicflags=
    ## not clear if this is correct for native compilers
    wl="-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"; then
      main_ldflags="${wl}-brtl ${wl}-bexpall ${wl}-bpT:0x100000000 ${wl}-bpD:0x110000000 -lc"
    else
      main_ldflags="${wl}-brtl ${wl}-bexpall -lc"
    fi
    shlib_ldflags="${wl}-brtl ${wl}-G ${wl}-bexpall ${wl}-bnoentry -lc"
    SHLIB_LIBADD="\$(LIBM)"
    shlib_cxxldflags="${shlib_ldflags}"
    if test "${GCC}" = yes; then
      shlib_ldflags="-shared ${shlib_ldflags}"
    fi
    if test "${GXX}" = yes; then
      shlib_cxxldflags="-shared ${shlib_cxxldflags}"
    fi 
    ;;
  cygwin*)
    ## All Windows code is PIC
    cpicflags=
    cxxpicflags=
    fpicflags=
    fcpicflags=
    SHLIB_EXT=".dll"
    dylib_undefined_allowed=no
    is_cygwin=yes
    main_ldflags="${wl}--large-address-aware ${wl}--stack=0xA00000"
    ;;
  darwin*)
    darwin_pic="-fPIC"
    dylib_undefined_allowed=no
    darwin_dylib_ldflags="-dynamiclib"
    ## Want '-mdynamic-no-pic' for GCC 3, says Jan de Leeuw.
    if test "${GCC}" = yes; then
      case "${CC_VERSION}" in
        3.*)
          R_SH_VAR_ADD(main_ldflags, [-mdynamic-no-pic]) ;;
      esac
    fi
    ## some linkers are broken and need to be set to a specific
    ## Mac OS X version to work better
    case "${host_os}" in
       darwin8*)
          # 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}"; then
	      darwin_min_flag='-mmacosx-version-min=10.4'
	  fi
	  ;;
       *)
	  darwin_min_flag=''
	  ;;
    esac
    case "${host_os}" in
      ## * 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 used
	AC_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 <<EOF
  void dummy() { }
EOF]
echo "${CC} ${CFLAGS} conftest.c ${shlib_ldflags} -o libconftest${DYLIB_EXT} ${LIBS}" >&AS_MESSAGE_LOG_FD
if ${CC} ${CFLAGS} conftest.c ${shlib_ldflags} -o libconftest${DYLIB_EXT} ${LIBS} 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
   r_cv_has_dynlookup=yes
   AC_MSG_RESULT([yes])
else
   r_cv_has_dynlookup=no
   AC_MSG_RESULT([no])
   AC_MSG_WARN([***  Please consider updating your Xcode tools. ***])
fi
rm -f libconftest${DYLIB_EXT} conftest.c
])
	if test -n "${FORCE_FLAT_NAMESPACE}"; then
	   AC_MSG_WARN([Use of flat namespace is requested by user.])
	   r_cv_has_dynlookup=forced-no
	fi
	if test "${r_cv_has_dynlookup}" != "yes"; then
	   shlib_ldflags="-dynamiclib -flat_namespace -undefined suppress -single_module -multiply_defined suppress"
	   dylib_undefined_allowed=yes
	fi
	
	## we use the same method for shlib and dylib now
	darwin_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
        ;;
    esac
    cpicflags="${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*)
    main_ldflags="-export-dynamic"
    shlib_ldflags="-shared"
    ;;
  gnu*)				# GNU Hurd
    main_ldflags="-export-dynamic"
    ;;
  hpux*)
    SHLIB_EXT=".sl"
    case "${CC}" in
      cc|c89)
        cpicflags="+Z"
        ;;
    esac
    case "${F77}" in
      f77|fort77|f90)
        fpicflags="+Z"
        ;;
    esac
    main_ldflags="-Wl,-E"
    if test "${GCC}" = yes; then
      shlib_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=ld
      shlib_ldflags="-b -Bsymbolic"
      ## </NOTE>
    fi
    if test "${GXX}" = yes; then
      shlib_cxxldflags="-shared -fPIC"
    fi
    ;;
  irix*)
    cpicflags=
    cxxpicflags=
    fpicflags=
    shlib_ldflags="-shared"
    shlib_cxxldflags="-shared"
    ;;
  linux*aout)			# GNU Linux/aout
    sed '/HAVE_ELF_H/d' confdefs.h > tmp.h ; mv tmp.h confdefs.h
    ;;
  linux*)			# GNU Linux/ELF
    case  "${CC}" in
      ## Intel compiler: note that -c99 may have been appended
      *icc*)
        cpicflags="-fpic"
        ;;
      ## Portland Group
      *pgcc*)
        cpicflags="-fpic"
	;;
    esac
    case  "${F77}" in
      ## Intel compilers
      *ifc|*ifort)
        fpicflags="-fpic"
        ;;
      ## Portland Group
      *pgf77|*pgf90|*pgf95)
        fpicflags="-fpic"
        ;;
    esac
    case  "${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 ; then
      main_ldflags="-export-dynamic"
      shlib_ldflags="-shared"
    else
      shlib_ldflags="-Bshareable"
    fi
    ;;
  openbsd*)
    ## looks like ${wl} is not defined here.  Perhaps in libtool code?
    if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then
      main_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; then
1598
      cpicflags="-fPIC"
Radford Neal's avatar
Radford Neal committed
1599 1600 1601 1602 1603
      ld=`${CC} -print-prog-name=ld`
      ldoutput=`${ld} -v 2>&1 | grep GNU`
      if test -n "${ldoutput}"; then
	main_ldflags="-Wl,-export-dynamic"
	shlib_ldflags="-shared"
1604 1605 1606 1607 1608
        shlib_cxxldflags="-shared"
      else
        ## it seems gcc c 4.6.2 needs this with Solaris linker
	shlib_ldflags="-shared"
        shlib_cxxldflags="-shared"
Radford Neal's avatar
Radford Neal committed
1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619
      fi
    else
      cpicflags="-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}" ; then
          shlib_cxxldflags="-G -lCstd"
        fi
      fi
    fi
1620
    ## G77 include gfortran
Radford Neal's avatar
Radford Neal committed
1621 1622
    if test "${G77}" != yes; then
      fpicflags="-PIC"
1623 1624
    else
      fpicflags="-fPIC"
Radford Neal's avatar
Radford Neal committed
1625 1626
    fi
    if test "${GXX}" = yes; then
1627
      cxxpicflags="-fPIC"
Radford Neal's avatar
Radford Neal committed
1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652
      ld=`${CXX} -print-prog-name=ld`
      ldoutput=`${ld} -v 2>&1 | grep GNU`
      if test -n "${ldoutput}"; then
        shlib_cxxldflags="-shared"
      fi
    else
      cxxpicflags="-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}"; then
Radford Neal's avatar
Radford Neal committed
1653
  main_ld_was_given=no
Radford Neal's avatar
Radford Neal committed
1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694
  MAIN_LD="${main_ld}"
  R_SH_VAR_ADD(MAIN_LDFLAGS, [${main_ldflags}])
fi

: ${CPICFLAGS="${cpicflags}"}
if test -z "${CPICFLAGS}"; then
  case "${host_os}" in
    aix*|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.])
      ;;
  esac
fi

: ${FPICFLAGS="${fpicflags}"}
if test -z "${FPICFLAGS}"; then
  case "${host_os}" in
    aix*|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.])
      ;;
  esac
fi

: ${CXXPICFLAGS="${cxxpicflags}"}
if test -z "${CXXPICFLAGS}"; then
  case "${host_os}" in
    aix*|cygwin*|irix*|mingw*|osf*)
      ;;
    *)
      warn_cxxpicflags="I could not determine CXXPICFLAGS."
      AC_MSG_WARN([${warn_cxxpicflags}])
      ;;
  esac
fi

if test -z "${SHLIB_LD}"; then
Radford Neal's avatar
Radford Neal committed
1695
  shlib_ld_was_given=no
Radford Neal's avatar
Radford Neal committed
1696 1697 1698 1699 1700 1701 1702 1703 1704
  SHLIB_LD="${shlib_ld}"
  R_SH_VAR_ADD(SHLIB_LDFLAGS, [${shlib_ldflags}])
fi
if test -z "${SHLIB_LDFLAGS}"; then
  AC_MSG_WARN([I could not determine SHLIB_LDFLAGS.])
  AC_MSG_ERROR([See the file doc/html/R-admin.html for more information.])
fi

if test -z "${SHLIB_CXXLD}"; then
Radford Neal's avatar
Radford Neal committed
1705
  shlib_cxxld_was_given=no
Radford Neal's avatar
Radford Neal committed
1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759
  SHLIB_CXXLD="${shlib_cxxld}"
  R_SH_VAR_ADD(SHLIB_CXXLDFLAGS, [${shlib_cxxldflags}])
fi
if test -z "${SHLIB_CXXLDFLAGS}"; then
  warn_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}" in
  aix*)
    ## 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 implementation
    RBLAS_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; then
      LAPACK_LDFLAGS="-Wl,+s"
    else
      LAPACK_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}"
    ;;
esac

if test -z "${DYLIB_LD}"; then
Radford Neal's avatar
Radford Neal committed
1760
  dylib_ld_was_given=no
Radford Neal's avatar
Radford Neal committed
1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786
  DYLIB_LD="${SHLIB_LD}"
  R_SH_VAR_ADD(DYLIB_LDFLAGS, [${dylib_ldflags}])
else
  if test -z "${DYLIB_LDFLAGS}"; then
    DYLIB_LDFLAGS="${dylib_ldflags}"
  fi
fi

AM_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}",
Radford Neal's avatar
Radford Neal committed
1787
[Define this to be the extension used for shared objects on your system.])
Radford Neal's avatar
Radford Neal committed
1788 1789 1790 1791 1792 1793 1794 1795
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)

Radford Neal's avatar
Radford Neal committed
1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818
### OpenMP.

## The basic checking is performed via AC_OPENMP added in Autoconf 2.62,
## which we already called for determining the appropriate flags for the
## C, C++, Fortran 77, Fortran compiler/linker.  Note that this gives
## variables OPENMP_CFLAGS etc., which are meant to be used for *both*
## compiling and linking.  So we can really only used them provided that
## we use the respective compilers for linking as well (or we need a
## different mechanism for determining what is needed).
##
## For compiling R itself, we use MAIN_LD and DYLIB_LD for linking, both
## defaulting to CC.  Hence:
## 
##    If both MAIN_LD and DYLIB_LD were not specified by the user and
##    equal CC and this was determined to support OpenMP, then we (try
##    to) provide OpenMP support by adding OPENMP_CFLAGS to the linker
##    flags and OPENMP_CFLAGS and OPENMP_FFLAGS to the C and Fortran 77
##    compiler flags, and defining HAVE_OPENMP.
##
## (The Fortran 77 compiler is never used for linking by default.)

if test "x${main_ld_was_given}" = xno -a "${MAIN_LD}" = "${CC}" -a \
        "x${dylib_ld_was_given}" = xno -a "${DYLIB_LD}" = "${CC}" -a \
Radford Neal's avatar
Radford Neal committed
1819 1820
        "x${ac_cv_prog_c_openmp}" != "xunsupported" -a \
        "x${ac_cv_prog_c_openmp}" != "x"; then
Radford Neal's avatar
Radford Neal committed
1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851
  R_OPENMP_CFLAGS="${OPENMP_CFLAGS}"
  R_OPENMP_FFLAGS="${OPENMP_FFLAGS}"
  R_SH_VAR_ADD(MAIN_LDFLAGS, [${OPENMP_CFLAGS}])
  R_SH_VAR_ADD(DYLIB_LDFLAGS, [${OPENMP_CFLAGS}])
  AC_DEFINE(HAVE_OPENMP, 1, 
            [Define if you have C OpenMP support.])
else
  R_OPENMP_CFLAGS=
  R_OPENMP_FFLAGS=
fi
AC_SUBST(R_OPENMP_CFLAGS)
AC_SUBST(R_OPENMP_FFLAGS)

## For compiling package code, we use SHLIB_FCLD, SHLIB_CXXLD or
## SHLIB_LD for linking, depending on whether the package contains
## Fortran (90/95) code, C++ (or ObjC) code, or "just" C and Fortran 77.
## However, we (currently) do not conditionalize compilation flags.  So
## the only "safe" thing we can do for now is:
##
##    If none of SHLIB_LD, SHLIB_CXXLD and SHLIB_FCLD were specified by
##    the user and equal CC, CXX and FC, respectively, and these were
##    determined to support OpenMP, the we try to provide OpenMP support
##    for packages by adding OPENMP_FCFLAGS, OPENMP_CXXFLAGS and
##    OPENMP_CFLAGS to the respective linker flags, and add the OPENMP
##    flags to all (C, C++, Fortran and Fortran 77) compiler flags.

## <FIXME>
## Need to do this after configuring Fortran 90/95 support, which comes
## way below: should this be moved up to the compiler section?
## </FIXME>

Radford Neal's avatar
Radford Neal committed
1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879
### 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; then
  CFLAGS="${CFLAGS} ${CPICFLAGS} ${R_XTRA_CFLAGS}"
  FFLAGS="${FFLAGS} ${FPICFLAGS} ${R_XTRA_FFLAGS}"
  CXXFLAGS="${CXXFLAGS} ${CXXPICFLAGS} ${R_XTRA_CXXFLAGS}"
else
  CFLAGS="${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_ALLOCA
AC_CHECK_DECLS([alloca], , , 
[#ifdef HAVE_ALLOCA_H
# include <alloca.h>
#endif])

Radford Neal's avatar
Radford Neal committed
1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899
## C99 functions: 
## not all C99 runtimes are complete,
## but we have substitutes for expm1 hypot log1p and (internally) nearbyint[l]
## FreeBSD 8.2 lacks log2
## FreeBSD 7.3 lacks nearbyintl/rintl (nearbyint appeared in 5.2)
## Apparently rint was once broken on HP-UX: undefine HAVE_RINT for such platforms
## Cygwin and FreeBSD lack powl
## Cygwin has rintl but not nearbyintl
R_CHECK_FUNCS([expm1 hypot log1p log2 log10 nearbyint nearbyintl powl rint rintl], [#include <math.h>])
## va_copy is C99: required as from R 2.13.0
R_CHECK_FUNCS([va_copy], [#include <stdarg.h>])
if test "${ac_cv_have_decl_va_copy}" = "no"; then
   AC_MSG_ERROR([Building R requires the 'va_copy' system call])
fi
## isblank should be a macro according to C99.  It was missing on Solaris 8
AC_CHECK_FUNCS(isblank)

## fseeko/ftello are POSIX, may be macros
## matherr is SVID, redefined in arithmetic.c if present
AC_CHECK_FUNCS(fseeko ftello matherr)
Radford Neal's avatar
Radford Neal committed
1900

Radford Neal's avatar
Radford Neal committed
1901
## POSIX functions
Radford Neal's avatar
Radford Neal committed
1902 1903 1904
R_CHECK_FUNCS([fcntl], [#include <fcntl.h>])
R_CHECK_FUNCS([getgrgid], [#include <grp.h>])
R_CHECK_FUNCS([getpwuid], [#include <pwd.h>])
Radford Neal's avatar
Radford Neal committed
1905
R_CHECK_FUNCS([kill sigaction sigaltstack sigemptyset], [#include <signal.h>])
Radford Neal's avatar
Radford Neal committed
1906
R_CHECK_FUNCS([fdopen popen], [#include <stdio.h>])
Radford Neal's avatar
Radford Neal committed
1907
if test "${ac_cv_have_decl_popen}" = "no"; then
Radford Neal's avatar
Radford Neal committed
1908
   AC_MSG_ERROR([Building R requires the 'popen' system call])
Radford Neal's avatar
Radford Neal committed
1909
fi
Radford Neal's avatar
Radford Neal committed
1910 1911
## Windows has neither setenv nor unsetenv
R_CHECK_FUNCS([setenv unsetenv], [#include <stdlib.h>])
Radford Neal's avatar
Radford Neal committed
1912
R_CHECK_FUNCS([getrlimit getrusage getpriority], [#include <sys/resource.h>])
Radford Neal's avatar
Radford Neal committed
1913
R_CHECK_FUNCS([chmod mkfifo stat umask], [#include <sys/stat.h>])
Radford Neal's avatar
Radford Neal committed
1914 1915 1916
if test "${ac_cv_have_decl_stat}" = "no"; then
   AC_MSG_ERROR([Building R requires the 'stat' system call])
fi
Radford Neal's avatar
Radford Neal committed
1917
R_CHECK_FUNCS([gettimeofday utimes], [#include <sys/time.h>])
Radford Neal's avatar
Radford Neal committed
1918
R_CHECK_FUNCS([times], [#include <sys/times.h>])
Radford Neal's avatar
Radford Neal committed
1919
R_CHECK_FUNCS([access chdir execv ftruncate getcwd geteuid getuid link readlink symlink sysconf],
Radford Neal's avatar
Radford Neal committed
1920 1921 1922
[#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif])
Radford Neal's avatar
Radford Neal committed
1923
## utime was declared obsolescent in POSIX 2008 (use utimes instead)
Radford Neal's avatar
Radford Neal committed
1924 1925 1926 1927
R_CHECK_FUNCS([utime], [#include <utime.h>])
## clock_gettime is POSIX 1993, but not on MacOS X
## Some OSes need -lrt: Linux, Solaris, not FreeBSD.
## Unsurprising, as POSIX 2008 moved it from its timers section to base.
Radford Neal's avatar
Radford Neal committed
1928 1929
## timespec_get is C11.
R_CHECK_FUNCS([clock_gettime timespec_get], [#include <time.h>])
Radford Neal's avatar
Radford Neal committed
1930 1931 1932
if test "${ac_cv_have_decl_clock_gettime}" = "yes"; then
AC_CHECK_LIB(rt, clock_gettime)
fi
Radford Neal's avatar
Radford Neal committed
1933 1934 1935 1936 1937
## 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>])
Radford Neal's avatar
Radford Neal committed
1938
## this is a GNU extension so usually hidden.  Not on Solaris
Radford Neal's avatar
Radford Neal committed
1939 1940
AC_CHECK_FUNCS(vasprintf)
AC_CHECK_DECLS([vasprintf], , , [#include <stdio.h>])
Radford Neal's avatar
Radford Neal committed
1941
## mempcpy is a GNU extension used by the included gettext.  Not on Solaris
Radford Neal's avatar
Radford Neal committed
1942
AC_CHECK_FUNCS(mempcpy)
Radford Neal's avatar
Radford Neal committed
1943
## realpath is POSIX 2001 (and BSD)
Radford Neal's avatar
Radford Neal committed
1944 1945 1946 1947 1948 1949
## 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])
Radford Neal's avatar
Radford Neal committed
1950
## glob is POSIX: we have a substitute on Windows
Radford Neal's avatar
Radford Neal committed
1951
## assume without checking that if we have glob we also have globfree
Radford Neal's avatar
Radford Neal committed
1952 1953 1954 1955
R_CHECK_FUNCS([glob], [#ifdef HAVE_GLOB_H
# include <glob.h>
#endif])

Radford Neal's avatar
Radford Neal committed
1956 1957 1958
## Lots of uses of getwd(), file.access(), Sys.glob().
## We don't need times() except as a fallback for getrusage and
## clock_gettime/gettimeofday -- but it is older and always there.
Radford Neal's avatar
Radford Neal committed
1959 1960 1961 1962 1963 1964 1965
case "${host_os}" in
  mingw*)
  ;;
  *)
    if test "${ac_cv_search_glob}" = "no"; then
       AC_MSG_ERROR([Building R requires the 'glob' system call])
    fi
Radford Neal's avatar
Radford Neal committed
1966 1967 1968 1969 1970 1971 1972 1973 1974
    if test "${ac_cv_search_access}" = "no"; then
       AC_MSG_ERROR([Building R requires the 'access' system call])
    fi
    if test "${ac_cv_search_getcwd}" = "no"; then
       AC_MSG_ERROR([Building R requires the 'getcwd' system call])
    fi
    if test "${ac_cv_search_chdir}" = "no"; then
       AC_MSG_ERROR([Building R requires the 'chdir' system call])
    fi
Radford Neal's avatar
Radford Neal committed
1975 1976 1977
    if test "${ac_cv_search_times}" = "no"; then
      AC_MSG_ERROR([Building R requires the 'times' system call])
    fi
Radford Neal's avatar
Radford Neal committed
1978 1979
  ;;
esac
Radford Neal's avatar
Radford Neal committed
1980
## We also use getlogin isatty rename unlink without checking.
Radford Neal's avatar
Radford Neal committed
1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015

## <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; then
   AC_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 unsetenv
R_PUTENV_AS_UNSETENV


## check whether nl_langinfo(CODESET) is in langinfo.h
## defines HAVE_LANGINFO_CODESET if it's there
AM_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; then
  RMATH_HAVE_EXPM1="# define HAVE_EXPM1 1"
else
  RMATH_HAVE_EXPM1="# undef HAVE_EXPM1"
fi
AC_SUBST(RMATH_HAVE_EXPM1)
Radford Neal's avatar
Radford Neal committed
2016 2017 2018 2019 2020 2021
if test "${ac_cv_have_decl_hypot}" = yes; then
  RMATH_HAVE_HYPOT="# define HAVE_HYPOT 1"
else
  RMATH_HAVE_HYPOT="# undef HAVE_HYPOT"
fi
AC_SUBST(RMATH_HAVE_HYPOT)
Radford Neal's avatar
Radford Neal committed
2022 2023 2024 2025 2026 2027 2028 2029
if test "${ac_cv_have_decl_log1p}" = yes; then
  RMATH_HAVE_LOG1P="# define HAVE_LOG1P 1"
else
  RMATH_HAVE_LOG1P="# undef HAVE_LOG1P"
fi
AC_SUBST(RMATH_HAVE_LOG1P)

## Do we need substitutes?
Radford Neal's avatar
Radford Neal committed
2030 2031 2032
## mkdtemp is not on Solaris, added in POSIX 2008
## strdup strncasecmp were first required in POSIX 2008.
AC_REPLACE_FUNCS([mkdtemp strdup strncasecmp])
Radford Neal's avatar
Radford Neal committed
2033
## Enable declarations in Defn.h?
Radford Neal's avatar
Radford Neal committed
2034
AC_CHECK_DECLS([mkdtemp, strdup, strncasecmp])
Radford Neal's avatar
Radford Neal committed
2035 2036

AC_SEARCH_LIBS(connect, [socket])
Radford Neal's avatar
Radford Neal committed
2037
# gethostbyname was removed in POSIX 2008 (in favour of getaddrinfo, POSIX 2004)
Radford Neal's avatar
Radford Neal committed
2038
AC_SEARCH_LIBS(gethostbyname, [nsl socket])
Radford Neal's avatar
Radford Neal committed
2039
AC_SEARCH_LIBS(xdr_string, [nsl tirpc])
Radford Neal's avatar
Radford Neal committed
2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065
R_FUNC___SETFPUCW
R_FUNC_CALLOC
if test "${ac_cv_have_decl_isfinite}" = "yes"; then
R_FUNC_ISFINITE
fi
## check accuracy of log1p
R_FUNC_LOG1P
R_FUNC_FTELL
R_FUNC_SIGACTION
R_MKTIME_ERRNO

R_C99_COMPLEX

## 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 yes
  R_BLAS_LIBS
fi

if test "${acx_blas_ok}" != "yes"; then
  case "${host_os}" in
Radford Neal's avatar
Radford Neal committed
2066
    aix*)
Radford Neal's avatar
Radford Neal committed
2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232
      ;;
    *)
      if test "${use_blas_shlib}" = "unset"; then
        use_blas_shlib="yes"
      fi
      ;;
  esac
fi

AM_CONDITIONAL(BLAS_SHLIB, [test "x${use_blas_shlib}" = xyes])

case "${host_os}" in
  darwin*)
    ## 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; then
      LIBR="${LIBR} -dylib_file libRblas.dylib:\$(R_HOME)/lib\$(R_ARCH)/libRblas.dylib"
    fi
  ;;
esac
AC_SUBST(LIBR)

## This version is used to build a shared BLAS lib
BLAS_LIBS0=${BLAS_LIBS}

## external BLAS + shared BLAS lib = we need to pass symbols through
## this may require some magic
if test "${acx_blas_ok}" = yes -a "${use_blas_shlib}" = yes; then
  case "${host_os}" in
    darwin*)
    ## 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-specific
    if test "${r_cv_prog_f77_append_underscore}" = yes; then
      dgemm=dgemm_
      xerbla=xerbla_
    else
      dgemm=dgemm
      xerbla=xerbla
    fi
    AC_MSG_CHECKING([whether external BLAS is visible through libRblas])
    AC_CACHE_VAL([r_cv_blas0_passthrough],[
[cat > conftestl.c <<EOF
  void ${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 <<EOF
void ${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; then
  if ${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.log
    output=`./conftest${ac_exeext} 2>&AS_MESSAGE_LOG_FD`
    if test ${?} = 0; then
	r_cv_blas0_passthrough=yes
    fi
  fi
fi
])
if test -n "${r_cv_blas0_passthrough}"; then
r_cv_blas0_passthrough=yes
AC_MSG_RESULT([yes])
else
AC_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.dylib
echo "${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_FD
if ${CC} ${CFLAGS} -c conftest.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
  if ${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.log
    output=`./conftest${ac_exeext} 2>&AS_MESSAGE_LOG_FD`
    if test ${?} = 0; then
        r_cv_blas0_passthrough=yes
    fi
  fi
fi
if test -n "${r_cv_blas0_passthrough}"; then
r_cv_blas0_passthrough=yes
AC_MSG_RESULT([yes])
BLAS_LIBS0="${BLAS_LIBS} ${ac_test_BLAS_LIBS}"
else
AC_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 replace
libRblas.dylib with the external BLAS library after R is built.])
fi
fi
    rm -f conftest.c conftest.o conftestl.c libconftest.dylib
    ;;
  esac
fi
AC_SUBST(BLAS_LIBS0)

if test "${use_blas_shlib}" = yes; then
  ## set BLAS_LIBS to point at local version
  BLAS_LIBS="-L\$(R_HOME)/lib\$(R_ARCH) -lRblas"
fi

AM_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"; then
  R_LAPACK_LIBS
fi
if test "${acx_lapack_ok}" != "yes"; then
  LAPACK_LIBS="-L\$(R_HOME)/lib\$(R_ARCH) -lRlapack"
fi
AC_SUBST(LAPACK_LIBS)
AM_CONDITIONAL(USE_EXTERNAL_LAPACK, [test "${acx_lapack_ok}" = "yes"])

### * Checks for system services.

## iconv headers and function.
R_ICONV

## check sufficient support for MBCS
R_MBCS

## support for ICU
if test "$use_ICU" = yes ; then
  R_ICU
  if test "$use_ICU" = no ; then
    case "${host_os}" in
      ## darwin has ICU 3.2 in 10.4, 3.6 in 10.5
      darwin*)
        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
      ;;
    esac
  fi
fi
AC_SUBST(USE_ICU)
AC_SUBST(USE_ICU_APPLE)

## X11.
R_X11
AM_CONDITIONAL(BUILD_X11, [test "x${use_X11}" = "xyes"])
## check if X11 typedefs KeySym
R_TYPE_KEYSYM
## check if Xmu is supported
R_X11_Xmu

if test "x${want_cairo}" = "xyes"; then
R_PANGO_CAIRO
fi
Radford Neal's avatar
Radford Neal committed
2233
AM_CONDITIONAL(BUILD_DEVCAIRO, [test "x${r_cv_cairo_works}" = xyes])
Radford Neal's avatar
Radford Neal committed
2234 2235 2236 2237 2238 2239 2240 2241


## Aqua
case "${host_os}" in
  darwin*)
    ## check for CoreFoundation framework (chances are much higher
    ## that we can build AQUA if this one is present)
    R_CHECK_FRAMEWORK(CFStringGetSystemEncoding, CoreFoundation)
Radford Neal's avatar
Radford Neal committed
2242 2243 2244 2245
    ## FIXME: we should verify that we can use Obj-C exceptions
    ##        such as @try and friends. The OBJC compiler tests
    ##	      above add -fobjc-exceptions where possible, but
    ##	      they don't check that the exceptions are available.
Radford Neal's avatar
Radford Neal committed
2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279
    R_AQUA
  ;;
  *)
    use_aqua=no
  ;;
esac
## Now used only in etc/Renviron to set the personal library,
## and in grDevices to select building quartz()
AM_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

## zlib headers and libraries.
R_ZLIB

## bzlib headers and libraries.
R_BZLIB

## LZMA headers and libraries from xz-utils
R_LZMA

## PCRE headers and libraries.
R_PCRE

## POSIX times.
R_SYS_POSIX_LEAPSECONDS
Radford Neal's avatar
Radford Neal committed
2280 2281 2282

## stat times
gl_STAT_TIME
2283

2284
## deferred evaluation.
2285
if test "${want_deferred_eval}" = yes; then
2286
  AC_DEFINE(R_DEFERRED_EVAL, 1, [Define this to enable deferred evaluation.])
2287 2288
fi

2289 2290 2291 2292
## helper threads.
if test "${want_helper_threads}" = yes; then
  AC_DEFINE(R_HELPER_THREADS, 1, [Define this to enable helper threads.])
fi
2293 2294 2295 2296 2297

## task merging.
if test "${want_task_merging}" = yes; then
  AC_DEFINE(R_TASK_MERGING, 1, [Define this to enable task merging.])
fi
Radford Neal's avatar
Radford Neal committed
2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376
 
## R profiling.
if test "${want_R_profiling}" = yes; then
  AC_CHECK_FUNCS(setitimer,
                 [AC_DEFINE(R_PROFILING, 1,
		            [Define this to enable R-level profiling.])],
                 [want_R_profiling="no"])
fi
AC_SUBST(R_PROFILING)

## R profiling.
if test "${want_memory_profiling}" = yes; then
  AC_DEFINE(R_MEMORY_PROFILING, 1, [Define this to enable memory profiling.])
fi

## Large-file-support
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO

## Valgrind instrumentation
if test ${valgrind_level} -eq 0; then
  AC_DEFINE(NVALGRIND, 1, [Define to disable Valgrind instrumentation])
fi
AC_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 Linux
case "${host_os}" in
  linux*)
    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; then
    AC_DEFINE(HAVE_LIBC_STACK_END, 1, [Define if __libc_stack_end is visible.])
  fi
esac

### * 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}"; then
  AC_CHECK_PROGS(R_PRINTCMD, [lpr lp])
fi
AC_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 support
R_JAVA

## F90/F95 support
AC_PROG_FC()
AC_LANG_PUSH(Fortran)
AC_FC_SRCEXT(f90, [dummy=1], [dummy=0])
AC_FC_SRCEXT(f95, [dummy=1], [dummy=0])
Radford Neal's avatar
Radford Neal committed
2377
AC_OPENMP
Radford Neal's avatar
Radford Neal committed
2378
AC_LANG_POP()
Radford Neal's avatar
Radford Neal committed
2379 2380 2381 2382
if test -z "${SHLIB_FCLD}"; then
  shlib_fcld_was_given=no
  SHLIB_FCLD="${FC}"
fi
Radford Neal's avatar
Radford Neal committed
2383 2384 2385
: ${SHLIB_FCLDFLAGS="${SHLIB_LDFLAGS}"}
AC_SUBST(SHLIB_FCLD)
AC_SUBST(SHLIB_FCLDFLAGS)
Radford Neal's avatar
Radford Neal committed
2386 2387 2388
## x86 Solaris' f95 needs additional libs when building a DSO
FCLIBS=${FCLIBS}
AC_SUBST(FCLIBS)
Radford Neal's avatar
Radford Neal committed
2389

Radford Neal's avatar
Radford Neal committed
2390 2391 2392 2393 2394
## OpenMP package stuff (needs to come *after* configuration of all
## compilers).
if test "x${shlib_ld_was_given}" = xno -a \
        "${SHLIB_LD}" = "${CC}" -a \
        "x${ac_cv_prog_c_openmp}" != "xunsupported" -a \
Radford Neal's avatar
Radford Neal committed
2395
        "x${ac_cv_prog_c_openmp}" != "x" -a \
Radford Neal's avatar
Radford Neal committed
2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419
        "x${shlib_cxxld_was_given}" = xno -a \
        "${SHLIB_CXXLD}" = "${CXX}" -a \
        "x${ac_cv_prog_cxx_openmp}" != "xunsupported" -a \
        "x${shlib_fcld_was_given}" = xno -a \
        "${SHLIB_FCLD}" = "${FC}" -a \
        "x${ac_cv_prog_fc_openmp}" != "xunsupported"; then
  SHLIB_OPENMP_CFLAGS="${OPENMP_CFLAGS}"
  SHLIB_OPENMP_CXXFLAGS="${OPENMP_CXXFLAGS}"
  SHLIB_OPENMP_FCFLAGS="${OPENMP_FCFLAGS}"
  SHLIB_OPENMP_FFLAGS="${OPENMP_FFLAGS}"
  ## next macro is copied into Rconfig.h
  AC_DEFINE(SUPPORT_OPENMP, 1,
            [Define if you have C/C++/Fortran OpenMP support for package code.])
else
  SHLIB_OPENMP_CFLAGS=
  SHLIB_OPENMP_CXXFLAGS=
  SHLIB_OPENMP_FCFLAGS=
  SHLIB_OPENMP_FFLAGS=
fi
AC_SUBST(SHLIB_OPENMP_CFLAGS)
AC_SUBST(SHLIB_OPENMP_CXXFLAGS)
AC_SUBST(SHLIB_OPENMP_FCFLAGS)
AC_SUBST(SHLIB_OPENMP_FFLAGS)

Radford Neal's avatar
Radford Neal committed
2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492

## 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; then
  case "${host_cpu}" in
    sparc*|ppc64|powerpc64|s390*)
      fcpicflags="-fPIC"
      ;;
    *)
      fcpicflags="-fpic"
      ;;
  esac
fi
case "${host_os}" in
  darwin*)
    fcpicflags="-fno-common"
    ;;
  hpux*)
    case "${FC}" in
      f90)
        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; then
      fcpicflags="-fPIC"
    else
      fcpicflags="-PIC"
    fi
    ;;
esac
: ${FCPICFLAGS="${fcpicflags}"}
if test -z "${FCPICFLAGS}"; then
  case "${host_os}" in
    aix*|cygwin*|irix*|mingw*|osf*)
      ;;
    *)
      AC_MSG_WARN([I could not determine FCPICFLAGS.])
      ;;
  esac
fi


## Make sure -L terms come first in LIBS.
LIBS1=""
LIBS2=""
for arg in ${LIBS}; do
  case "${arg}" in
    -L*)
      R_SH_VAR_ADD(LIBS1, [${arg}])
      ;;
    *)
      R_SH_VAR_ADD(LIBS2, [${arg}])
      ;;
  esac
done
LIBS="${LIBS1} ${LIBS2}"

## R_LD_LIBRARY_PATH.
Radford Neal's avatar
Radford Neal committed
2493 2494

## On Linux, do not add the ld.so system directories such as '/lib' and
Radford Neal's avatar
Radford Neal committed
2495 2496
## '/usr/lib', so that the entries from '/etc/ld.so.conf' are not
## shadowed (otherwise, e.g. optimized ATLAS libs would not be used).
Radford Neal's avatar
Radford Neal committed
2497
## On OS X (Darwin) /usr/X11R6/lib shadows the OpenGL framework and is not
Radford Neal's avatar
Radford Neal committed
2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512
## needed in DYLD_LIBRARY_PATH.
case "${host_os}" in
  linux*)
    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=
    ;;
esac
Radford Neal's avatar
Radford Neal committed
2513 2514 2515 2516 2517
if test -n "${R_LD_LIBRARY_PATH_save}"; then
  R_LD_LIBRARY_PATH=${R_LD_LIBRARY_PATH_save}
else
## We already added -L's from LDFLAGS (except on Darwin): 
## seem to be doing it again
Radford Neal's avatar
Radford Neal committed
2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546
for arg in ${LDFLAGS} ${FLIBS} ${BLAS_LIBS} ${LAPACK_LIBS} ${X_LIBS} \
           ${TCLTK_LIBS}; do
  case "${arg}" in
    -L*)
      lib=`echo ${arg} | sed "s/^-L//"`
      r_want_lib=true
      ## don't add anything for Darwin
      case "${host_os}" in darwin*) r_want_lib=false ;; esac
      ## Do not add non-existent directories.
      test -d "${lib}" || r_want_lib=false
      if 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}; do
          if test x"${dir}" = x"${lib}"; then
            r_want_lib=false
            break
          fi
        done
        IFS="${r_save_IFS}"
        if test x"${r_want_lib}" = xtrue; then
          R_SH_VAR_ADD(R_LD_LIBRARY_PATH, [${lib}], [${PATH_SEPARATOR}])
        fi
      fi
      ;;
  esac
done
Radford Neal's avatar
Radford Neal committed
2547 2548
fi

Radford Neal's avatar
Radford Neal committed
2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593
## 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}"; then
   args=`echo ${JAVA_LD_LIBRARY_PATH} | sed -e s:\$\(JAVA_HOME\):${JAVA_HOME}:g`
   r_save_IFS="${IFS}"; IFS="${PATH_SEPARATOR}"
   for lib in ${args}; do
      r_want_lib=true
      ## Do not add non-existent directories.
      test -d "${lib}" || r_want_lib=false
      if 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}; do
          if test x"${dir}" = x"${lib}"; then
             r_want_lib=false
             break
          fi
        done
        if test x"${r_want_lib}" = xtrue; then
	  lib=`echo ${lib}|sed -e s:${JAVA_HOME}:\$\{JAVA_HOME\}:g`
          R_SH_VAR_ADD(R_JAVA_LD_LIBRARY_PATH, [${lib}], [${PATH_SEPARATOR}])
        fi
      fi
   done
   IFS="${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; then
  R_RECOMMENDED_PACKAGES
fi
AM_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 --intl
AM_NLS
if test "${USE_NLS}" = "yes"; then
Radford Neal's avatar
Radford Neal committed
2594 2595
  echo
  echo "Configuring src/extra/intl directory"
Radford Neal's avatar
Radford Neal committed
2596
  AM_GNU_GETTEXT_VERSION(0.14.5)
Radford Neal's avatar
Radford Neal committed
2597
  AM_GNU_GETTEXT([no-libtool], [need-ngettext], [../extra/intl])
Radford Neal's avatar
Radford Neal committed
2598 2599 2600
  if test -n "$INTL_MACOSX_LIBS"; then
    XTRA_INTL_CPPFLAGS=-I/System/Library/Frameworks/CoreFoundation.framework/Headers
  fi
Radford Neal's avatar
Radford Neal committed
2601 2602
  echo "Finished configuring src/extra/intl directory"
  echo
Radford Neal's avatar
Radford Neal committed
2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663
else
  USE_INCLUDED_LIBINTL=no
fi
AC_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 OSes
case "${host_os}" in
  osf*)
    OSF_SH_BUG='"${1+@}"'
  ;;
  *)
    OSF_SH_BUG='"${@}"'
  ;;
esac
AC_SUBST(OSF_SH_BUG)

### shell for use in scripts: we allow R_SHELL to set the script,
### since some AIX systems have zsh as sh.
: ${R_SHELL=${SHELL}}
AC_SUBST(R_SHELL)
AC_MSG_RESULT([using as R_SHELL for scripts ... ${R_SHELL}])


### * Win32 overrides
case "${host_os}" in
  mingw*)
    AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
    AC_DEFINE(HAVE_ICONVLIST, 1, [Define if you have the `iconvlist' function.])
    AC_DEFINE(HAVE_ICONV_H, 1, [Define to 1 if you have the <iconv.h> header file.])
    AC_DEFINE(HAVE_INTERNET, 1, [Define if you have support for ftp/http
                                 access.])
    AC_DEFINE(HAVE_JPEG, 1,[Define if you have the JPEG headers and libraries.])
    AC_DEFINE(HAVE_PNG, 1, [Define if you have the PNG headers and libraries.])
    AC_DEFINE(HAVE_POSIX_SETJMP, 1, [Define if you have POSIX.1 compatible
                                     sigsetjmp/siglongjmp.])
    AC_DEFINE(HAVE_SOCKETS, 1, [Define if you have support for sockets.])
    AC_DEFINE(HAVE_TCLTK, 1, [Define if you have the Tcl/Tk headers and 
                              libraries and want Tcl/Tk support to be built.] )
    AC_DEFINE(HAVE_TIFF, 1, [Define this if libtiff is available.])
    AC_DEFINE(HAVE_TIMES, 1, [Define to 1 if you have the `times' function.])
    want_R_profiling=yes
    AC_DEFINE(R_PROFILING, 1, [Define this to enable R-level profiling.])
    AC_DEFINE(SUPPORT_LIBXML, 1, [Define if you provide support for the libxml
                                  ftp/http functions.])
    ;;
esac

### * Output.

AC_CONFIG_HEADERS([src/include/config.h])
AC_CONFIG_FILES(
[Makeconf
  Makefile
  doc/Makefile
  doc/html/Makefile
  doc/manual/Makefile
2664
  doc/manual/.texinfo/htmlxref.cnf
Radford Neal's avatar
Radford Neal committed
2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681
  etc/Makefile
  etc/Makeconf
  etc/Renviron
  etc/ldpaths
  m4/Makefile
  po/Makefile.in 
  share/Makefile
  src/Makefile
  src/appl/Makefile
  src/extra/Makefile
  src/extra/blas/Makefile
  src/extra/bzip2/Makefile
  src/extra/intl/Makefile
  src/extra/pcre/Makefile
  src/extra/tre/Makefile
  src/extra/xz/Makefile
  src/extra/zlib/Makefile
2682
  src/extra/matprod/Makefile
2683
  src/extra/helpers/Makefile
Radford Neal's avatar
Radford Neal committed
2684
  src/extra/sggc/Makefile
2685
  src/extra/lphash/Makefile
Radford Neal's avatar
Radford Neal committed
2686 2687 2688 2689 2690 2691 2692
  src/include/Makefile
  src/include/Rmath.h0
  src/include/R_ext/Makefile
  src/library/Recommended/Makefile
  src/library/Makefile
  src/library/base/DESCRIPTION
  src/library/base/Makefile
Radford Neal's avatar
Radford Neal committed
2693 2694
  src/library/compiler/DESCRIPTION
  src/library/compiler/Makefile
Radford Neal's avatar
Radford Neal committed
2695 2696 2697 2698 2699 2700 2701
  src/library/datasets/DESCRIPTION
  src/library/datasets/Makefile
  src/library/graphics/DESCRIPTION
  src/library/graphics/Makefile
  src/library/grDevices/DESCRIPTION
  src/library/grDevices/Makefile
  src/library/grDevices/src/Makefile
Radford Neal's avatar
Radford Neal committed
2702
  src/library/grDevices/src/cairo/Makefile
Radford Neal's avatar
Radford Neal committed
2703 2704 2705 2706 2707 2708
  src/library/grid/DESCRIPTION
  src/library/grid/Makefile
  src/library/grid/src/Makefile
  src/library/methods/DESCRIPTION
  src/library/methods/Makefile
  src/library/methods/src/Makefile
Radford Neal's avatar
Radford Neal committed
2709 2710 2711
  src/library/parallel/DESCRIPTION
  src/library/parallel/Makefile
  src/library/parallel/src/Makefile
Radford Neal's avatar
Radford Neal committed
2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794
  src/library/profile/Makefile
  src/library/stats/DESCRIPTION
  src/library/stats/Makefile
  src/library/stats/src/Makefile
  src/library/stats4/DESCRIPTION
  src/library/stats4/Makefile
  src/library/splines/DESCRIPTION
  src/library/splines/Makefile
  src/library/splines/src/Makefile
  src/library/tcltk/DESCRIPTION
  src/library/tcltk/Makefile
  src/library/tcltk/src/Makefile
  src/library/tools/DESCRIPTION
  src/library/tools/Makefile
  src/library/tools/src/Makefile
  src/library/utils/DESCRIPTION
  src/library/utils/Makefile
  src/main/Makefile
  src/modules/Makefile
  src/modules/X11/Makefile
  src/modules/internet/Makefile
  src/modules/lapack/Makefile
  src/modules/vfonts/Makefile
  src/nmath/Makefile
  src/nmath/standalone/Makefile
  src/scripts/Makefile
  src/scripts/R.sh
  src/scripts/Rcmd
  src/scripts/f77_f2c
  src/scripts/mkinstalldirs
  src/scripts/pager
  src/unix/Makefile
  tests/Makefile
  tests/Embedding/Makefile
  tests/Examples/Makefile
  tests/Native/Makefile
  tools/Makefile
])

AC_CONFIG_COMMANDS([stamp-h],
[test -f src/include/stamp-h || echo timestamp > src/include/stamp-h])

### now reset flags
CPPFLAGS=${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; do
  if eval "test x\${use_${item}} = xyes"; then
    R_SH_VAR_ADD(r_interfaces, [${item}], [, ])
  fi
done
r_external_libs=
if test "${use_readline}" = yes; then
  r_external_libs=readline
fi
if 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 ;;
  esac
2795
  ## R_SH_VAR_ADD(r_external_libs, [BLAS(${r_blas})], [, ])
Radford Neal's avatar
Radford Neal committed
2796 2797 2798 2799 2800 2801 2802 2803
fi
if 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 ;;
  esac
2804
  ## R_SH_VAR_ADD(r_external_libs, [LAPACK(${r_lapack})], [, ])
Radford Neal's avatar
Radford Neal committed
2805 2806 2807 2808 2809 2810 2811
fi
if test "${use_ICU}" = yes; then
  R_SH_VAR_ADD(r_external_libs, [ICU], [, ])
fi
if test "${have_lzma}" = yes; then
  R_SH_VAR_ADD(r_external_libs, [lzma], [, ])
fi
2812

Radford Neal's avatar
Radford Neal committed
2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828
r_capabilities=
if test "${have_png}" = yes; then
  R_SH_VAR_ADD(r_capabilities, [PNG], [, ])
fi
if test "${have_jpeg}" = yes; then
  R_SH_VAR_ADD(r_capabilities, [JPEG], [, ])
fi
if test "${have_tiff}" = yes; then
  R_SH_VAR_ADD(r_capabilities, [TIFF], [, ])
fi
if test "${USE_NLS}" = yes; then
  R_SH_VAR_ADD(r_capabilities, [NLS], [, ])
fi
if test "${r_cv_cairo_works}" = yes; then
  R_SH_VAR_ADD(r_capabilities, [cairo], [, ])
fi
Radford Neal's avatar
Radford Neal committed
2829 2830 2831
if test "${use_ICU}" = yes; then
  R_SH_VAR_ADD(r_capabilities, [ICU], [, ])
fi
2832

Radford Neal's avatar
Radford Neal committed
2833
r_options=
2834 2835
if test "${want_helper_threads}" = yes; then
  R_SH_VAR_ADD(r_options, [helper threads], [, ])
2836 2837 2838 2839 2840 2841 2842 2843
fi
if test "${want_task_merging}" = yes; then
  R_SH_VAR_ADD(r_options, [task merging], [, ])
fi
if test "${want_helper_threads}" = no -a \
        "${want_task_merging}" = no -a \
        "${want_deferred_eval}" = yes; then
  R_SH_VAR_ADD(r_options, [deferred evaluation], [, ])
2844
fi
Radford Neal's avatar
Radford Neal committed
2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873
if test "${want_R_framework}" = yes; then
  R_SH_VAR_ADD(r_options, [framework], [, ])
elif test "${want_R_shlib}" = yes; then
  R_SH_VAR_ADD(r_options, [shared R library], [, ])
elif test "${want_R_static}" = yes; then
  R_SH_VAR_ADD(r_options, [static R library], [, ])
fi
if test "${want_R_profiling}" = yes; then
  R_SH_VAR_ADD(r_options, [R profiling], [, ])
fi
if test "${want_memory_profiling}" = yes; then
  R_SH_VAR_ADD(r_options, [memory profiling], [, ])
fi
if test "${use_maintainer_mode}" = yes; then
  R_SH_VAR_ADD(r_options, [maintainer mode], [, ])
fi
if test "${use_strict_barrier}" = yes; then
  R_SH_VAR_ADD(r_options, [strict barrier], [, ])
fi
if test "${want_linux_lfs}" = yes; then
  R_SH_VAR_ADD(r_options, [Linux LFS], [, ])
fi
if test -n "${JAVA}"; then
  R_SH_VAR_ADD(r_options, [Java], [, ])
fi
if test "${want_prebuilt_html}" = yes; then
  R_SH_VAR_ADD(r_options, [static HTML], [, ])
fi

2874
r_blas_info1="mat_mult_with_BLAS=${mat_mult_with_BLAS}"
2875
if test "${want_helper_threads}" = yes; then
2876
  R_SH_VAR_ADD(r_blas_info1, [BLAS_in_helpers=${BLAS_in_helpers}], [, ])
2877 2878 2879 2880 2881 2882
fi
r_blas_info2=
if test "${use_blas_shlib}" = yes; then
  R_SH_VAR_ADD(r_blas_info2, [shared], [ ])
fi
if test "${use_blas_shlib}" = yes -a "x${BLAS_LIBS0}" != x; then
2883
  if test "${BLAS_LIBS0}" = "-L\$(R_HOME)/lib\$(R_ARCH) -lRblas"; then
2884 2885 2886 2887 2888
    R_SH_VAR_ADD(r_blas_info2, [BLAS: built-in], [ ])
  else
    R_SH_VAR_ADD(r_blas_info2, [BLAS: ${BLAS_LIBS0}], [ ])
  fi
else
2889
  if test "x${BLAS_LIBS}" = x; then
2890
    R_SH_VAR_ADD(r_blas_info2, [BLAS: none], [ ])
2891
  elif test "${BLAS_LIBS}" = "-L\$(R_HOME)/lib\$(R_ARCH) -lRblas"; then
2892 2893 2894 2895 2896
    R_SH_VAR_ADD(r_blas_info2, [BLAS: built-in], [ ])
  else
    R_SH_VAR_ADD(r_blas_info2, [BLAS: ${BLAS_LIBS}], [ ])
  fi
fi
2897
if test "x${LAPACK_LIBS}" = x; then
2898
  R_SH_VAR_ADD(r_blas_info2, [LAPACK: in BLAS], [, ])
2899
elif test "${LAPACK_LIBS}" = "-L\$(R_HOME)/lib\$(R_ARCH) -lRlapack"; then
2900 2901 2902 2903 2904
  R_SH_VAR_ADD(r_blas_info2, [LAPACK: built-in], [, ])
else
  R_SH_VAR_ADD(r_blas_info2, [LAPACK: ${LAPACK_LIBS}], [, ])
fi

2905 2906 2907 2908 2909 2910 2911
cptr_msg=${use_compressed_pointers}
if test x"${use_aux_for_attrib}" = xyes; then
  if test x"${use_compressed_pointers}" = xno; then
    cptr_msg="no  (auxiliary information used for attributes)"
  fi
fi