dnl configure.in dnl dnl Process this file with autoconf to produce a configure script. dnl dnl Copyright (C) 1998, 1999 R Core Team ### ### This file is part of R. ### ### R is free software; you can redistribute it and/or modify it under ### the terms of the GNU General Public License as published by the Free ### Software Foundation; either version 2 of the License, or (at your ### option) any later version. ### ### R is distributed in the hope that it will be useful, but WITHOUT ANY ### WARRANTY; without even the implied warranty of MERCHANTABILITY or ### FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public ### License for more details. ### ### You should have received a copy of the GNU General Public License ### along with R; if not, you can obtain it via the World Wide Web at ### `http://www.gnu.org/copyleft/gpl.html', or by writing to the Free ### Software Foundation, 59 Temple Place -- Suite 330, Boston, MA ### 02111-3307, USE. AC_INIT(src/include/Defn.h) AC_CONFIG_HEADER(src/include/Platform.h) . ${srcdir}/config.site if test -f ${HOME}/.Rconf; then . ${HOME}/.Rconf; fi R_MAJOR="0" R_MINOR="64.2" R_STATUS="" #R_STATUS="Patched (unreleased snapshot)" R_STATUS_REV="0" AC_CONFIG_AUX_DIR(tools) ### Platform ### ### In an ideal world we would use AC_CANONICAL_HOST here, but this ### fails on platforms like the i686 (aka Pentium-Pro) because of some ### sort of sanity check written into configure. We bypass the check by ### invoking config.guess directly and parsing the results ourselves. host=`${srcdir}/tools/config.guess` set `echo ${host} | tr '-' ' '` host_cpu=$1 host_vendor=$2 host_os=$3 AC_DEFINE_UNQUOTED(R_MAJOR, "${R_MAJOR}") AC_DEFINE_UNQUOTED(R_MINOR, "${R_MINOR}") AC_DEFINE_UNQUOTED(R_STATUS, "${R_STATUS}") AC_DEFINE_UNQUOTED(R_STATUS_REV, "${R_STATUS_REV}") AC_DEFINE_UNQUOTED(R_DAY, "`awk -F/ '{print $3+0}' ${srcdir}/date-stamp`") AC_DEFINE_UNQUOTED(R_MONTH, "`awk -F/ '{print $2}' ${srcdir}/date-stamp`") AC_DEFINE_UNQUOTED(R_YEAR, "`awk -F/ '{print $1}' ${srcdir}/date-stamp`") AC_DEFINE_UNQUOTED(R_PLATFORM, "${host}") AC_DEFINE_UNQUOTED(R_CPU, "${host_cpu}") AC_DEFINE_UNQUOTED(R_VENDOR, "${host_vendor}") AC_DEFINE_UNQUOTED(R_OS, "${host_os}") PACKAGE="R" VERSION="${R_MAJOR}.${R_MINOR}" AC_SUBST(PACKAGE) AC_SUBST(VERSION) ### Handle arguments to configure config_opts=${ac_configure_args} AC_SUBST(config_opts) ## Allow the user to force us to use f2c. AC_ARG_WITH(f2c, [ --with-f2c use f2c even if FORTRAN compiler is available], [if test "${withval}" = no; then use_f2c=false; else use_f2c=true; fi], use_f2c=false) ## Allow the user to force us to use g77. AC_ARG_WITH(g77, [ --with-g77 use g77 to compile FORTRAN subroutines], [if test "${withval}" = no; then use_g77=false; else use_g77=true; fi], use_g77=false) ## Allow the user to force us to use f77. AC_ARG_WITH(f77, [ --with-f77 use f77 to compile FORTRAN subroutines], [if test "${withval}" = no; then use_f77=false; else use_f77=true; fi], use_f77=false) ## Here we should maybe check that only one of the above options for ## dealing with FORTRAN were specified. AC_ARG_WITH(libmoto, [ --with-libmoto use libmoto math library (if available)], [ if test "${withval}"=no; then use_libmoto=false; else use_libmoto=true; fi], use_libmoto=true) AC_ARG_WITH(blas, [ --with-blas use BLAS library (if available)], [if test "${withval}" = no; then use_blas=false; else use_blas=true; fi], use_blas=true) AC_ARG_WITH(blas_risc, [ --with-blas_risc use RISC Optimized BLAS library (if available)], [ if test "${withval}" = no; then use_blas_risc=false; else use_blas_risc=true; fi], use_blas_risc=true) AC_ARG_WITH(dxml, [ --with-dxml use DXML library (if available)], [if test "${withval}" = no; then use_dxml=false; else use_dxml=true; fi], use_dxml=true) AC_ARG_WITH(readline, [ --with-readline use readline library (if available)], [if test "${withval}" = no; then use_readline=false; else use_readline=true; fi], use_readline=true) AC_ARG_WITH(gnome, [ --with-gnome use GNOME (if available)], [if test "${withval}" = no; then use_gnome=false; else use_gnome=true; fi], use_gnome=false) ### Programs. AC_PROG_INSTALL ## Fix a bug in older versions of autoconf---the path of the install ## shell script is not cached. Could also use an absolute path in ## AC_CONFIG_AUX_DIR(). case ${INSTALL} in [[!/]]*install-sh*) INSTALL="\$\(top_srcdir\)/${INSTALL}" ;; esac ## Osman says that this is necessary. case ${host} in *hpux*) INSTALL="\$\(top_srcdir\)/tools/install-sh -c" ;; esac AC_PROG_LN_S AC_PROG_RANLIB AC_PROG_YACC AC_CHECK_PROG(AR, ar, ar) AC_SUBST(AR) ARFLAGS=${ARFLAGS-"rc"} AC_SUBST(ARFLAGS) AC_PATH_PROG(LATEX, latex, false) AC_PATH_PROG(DVIPS, dvips, false) AC_PATH_PROG(MAKEINDEX, makeindex, false) AC_PATH_PROG(R_UNZIPCMD, unzip, "") AC_PATH_PROG(R_ZIPCMD, zip, "") ## Make. MAKE=${MAKE-make} AC_SUBST(MAKE) ## Perl. AC_PATH_PROG(PERL, perl) if test -n "${PERL}"; then AC_MSG_CHECKING(whether perl is perl 5) perl_version=`${PERL} -v | sed -n 's/^.*perl.*version \(.\).*/\1/p'` if test ${perl_version} -ge 5; then NO_PERL5=false AC_MSG_RESULT(yes) else NO_PERL5=true AC_MSG_RESULT(no) fi else NO_PERL5=true fi AC_SUBST(NO_PERL5) ## Tar. TAR=${TAR-tar} AC_SUBST(TAR) ## C compiler. ## ## If a C compiler is specified in config.site we use that. ## Otherwise, we use the autoconfigure procedures for detecting one. if test -z "${CC}" then AC_PROG_CC else AC_CHECK_PROG(CC, ${CC}) fi CFLAGS=${CFLAGS-"-g"} cc_is_gcc=false cc_output=`${CC} -v 2>&1 | grep gcc` if test -n "${cc_output}"; then cc_is_gcc=true fi case ${host} in *hpux*) LIBS="-L/lib/pa1.1 ${LIBS}" case ${CC} in c89) CFLAGS="-D_HPUX_SOURCE ${CFLAGS}" ;; esac esac ## FORTRAN compiler ## If we haven't been forced to use a particular FORTRAN compiler, try ## to find one using one of the several common names. ## ## The configure options `--with-g77', `--with-f77', or `--with-f2c' ## force g77, f77, or f2c to be used. It is also possible to use these ## options to specify the full path name of the compiler. f77_is_g77=false if ${use_f77}; then if test "${with_f77}" = yes; then F77=f77 else F77="${with_f77}" fi AC_MSG_RESULT([defining F77 to be ${F77}]) elif ${use_g77}; then if test "${with_g77}" = yes; then F77=g77 else F77="${with_g77}" fi AC_MSG_RESULT([defining F77 to be ${F77}]) elif ${use_f2c}; then F77= if test "${with_f2c}" = yes; then F2C=f2c else F2C="${with_f2c}" fi AC_MSG_RESULT([defining F2C to be ${F2C}]) else if test -z "${FC}"; then AC_PATH_PROGS(F77, g77 f77 fort77 f90 xlf cf77 fc) if test -n "${F77}"; then if test -n "`file ${F77} | grep script`"; then ## If F77 found above is a shell or perl script, don't use it. F77= else F77=`basename ${F77}` fi fi else F77=${FC} fi if test -z "${F77}"; then AC_CHECK_PROGS(F2C, f2c) else f77_output=`${F77} -v 2>&1 | egrep "GNU F77|egcs|g77"` if test -n "${f77_output}"; then f77_is_g77=true fi fi fi if test -n "${F77}"; then FC=${F77} LDCMD=${LDCMD-${FC}} AC_MSG_CHECKING(for underscore after Fortran symbols) cat > conftestf.f </dev/null 1>/dev/null cat > conftest.c </dev/null 2>/dev/null if test ${?} = 0; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_F77_UNDERSCORE) else cat > conftest.c </dev/null 2>/dev/null if test ${?} = 0; then AC_MSG_RESULT(no) else AC_MSG_ERROR([Nothing worked - cannot use FORTRAN]) fi fi rm -rf conftest conftest.* conftestf.* f77_rules_frag_top=Makefrag.top cat << \EOF > ${f77_rules_frag_top} .f.c: .f.o: $(FC) $(FFLAGS) -c $< -o $@ EOF f77_rules_frag_etc=Makefrag.etc cat << \EOF > ${f77_rules_frag_etc} .f.c: .f.o: $(FC) $(FFLAGS) $(FPICFLAGS) -c $< -o $@ EOF elif test -n "${F2C}"; then ## I cannibalized most of the following out of octave 2.0.5, I have ## only a vague idea how it works... (-pd) ## ## This seems to be necessary on some Linux system. ## -- you bet! -pd cat > conftest.${ac_ext} << EOF int MAIN_ () { return 0; } int MAIN__ () { return 0; } EOF ## XXX FIXME XXX -- these shouldn't be fixed names, eh? R_conflib=libconflib.a R_obj_ext=o if AC_TRY_EVAL(ac_compile); then $AR $ARFLAGS $R_conflib conftest.$R_obj_ext 1>&AC_FD_CC if test -n "$RANLIB"; then $RANLIB $R_conflib 1>&AC_FD_CC fi fi rm -f conftest* LDCMD=${LDCMD-${CC}} AC_DEFINE(HAVE_F77_UNDERSCORE) AC_CHECK_LIB(f2c, f_open, FLIBS=-lf2c, FLIBS=, -L. -lconflib -lm) if test -z "${FLIBS}"; then AC_CHECK_LIB(F77, d_sin, FLIBS=-lF77, FLIBS=, -lm) if test -n "${FLIBS}"; then AC_CHECK_LIB(I77, f_rew, FLIBS="${FLIBS} -lI77", FLIBS=, -lF77) fi fi if test -z "${FLIBS}"; then AC_MSG_WARN([I found f2c but not libf2c, or libF77 and libI77]) fi f77_rules_frag_top=Makefrag.top ## for some reason these can't be .f.c/.f.o, at least in GNU make ## this probably makes *other* makes useless... (-pd) cat << \EOF > ${f77_rules_frag_top} %.c : %.f cat $< | $(F2C) $(F2CFLAGS) > $(@F) %.o : %.f EOF f77_rules_frag_etc=Makefrag.etc cat << \EOF > ${f77_rules_frag_etc} %.c : %.f cat $< | $(F2C) $(F2CFLAGS) > $(@F) %.o : %.f EOF else AC_MSG_ERROR([Neither an F77 compiler nor f2c found]) fi if test "${FC}" = g77; then FFLAGS=${FFLAGS-"-O2"} fi AC_SUBST(FC) AC_SUBST(F2C) AC_SUBST_FILE(f77_rules_frag_top) AC_SUBST_FILE(f77_rules_frag_etc) ### Libraries. ## Make sure that non-standard directories specified via `-L' are really ## searched in the tests for arg in ${LIBS}; do case ${arg} in -L*) lib=`echo ${arg} | sed 's/^-L//'` if test -z "${LD_LIBRARY_PATH}"; then LD_LIBRARY_PATH="${lib}" else LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${lib}" fi ;; esac done export LD_LIBRARY_PATH AC_CHECK_LIB(m, sin) if ${use_libmoto}; then AC_CHECK_LIB(moto, sin) fi AC_CHECK_LIB(ncurses, main,, AC_CHECK_LIB(termcap, main,, AC_CHECK_LIB(termlib, main) )) AC_CHECK_LIB(dl, dlopen) AC_CHECK_LIB(z, main) AC_CHECK_LIB(hdf5, main) BLAS="blas.o" if ${use_dxml}; then AC_CHECK_LIB(dxml, main, FLIBS="-ldxml ${FLIBS}" BLAS="") fi if test -n "${BLAS}" && ${use_blas}; then AC_CHECK_LIB(blas, main, [ FLIBS="-lblas ${FLIBS}" BLAS="" if ${use_blas_risc}; then AC_CHECK_LIB(blas_risc, main, FLIBS="-lblas_risc ${FLIBS}", , -lblas -lf2c) fi ]) fi AC_SUBST(BLAS) for arg in ${LIBS}; do case ${arg} in -L*) FLIBS="${arg} ${FLIBS}" ;; esac done AC_SUBST(FLIBS) if ${use_readline}; then AC_CHECK_LIB(readline, rl_callback_read_char) fi if ${use_gnome}; then GNOME_INIT_HOOK([],cont) fi if test "${GNOMEUI_LIBS}" = ""; then use_gnome="no" RGNOMEDIR="" RGNOMEBIN="" else use_gnome="yes" RGNOMEDIR="gnome" RGNOMEBIN="\$(top_builddir)/bin/R.gnome" fi AC_SUBST(RGNOMEDIR) AC_SUBST(RGNOMEBIN) ### Library functions. AC_FUNC_VFORK AC_FUNC_VPRINTF AC_CHECK_FUNCS(acosh asinh atanh bcopy finite isfinite isnan\ matherr memcpy \ memmove regcomp rint strcoll strtod strtol system times sigsetjmp\ siglongjmp __setfpucw) ### Header files AC_HEADER_STDC AC_CHECK_HEADERS(dl.h dlfcn.h elf.h locale.h readline/history.h \ rpc/xdr.h sys/times.h time.h ieeefp.h ieee754.h unistd.h hdf5.h) case ${host} in *sunos4*) AC_DEFINE(SunOS4) ;; esac ### Typedefs AC_TYPE_SIGNAL ### Compiler characteristics. AC_C_CONST AC_CHECK_SIZEOF(long, 4) SIZEOF_LONG=`grep SIZEOF_LONG confdefs.h | sed 's/.* //'` if test ${SIZEOF_LONG} -lt 4; then echo "Size of long must be at least 32 bits" exit 32 elif test ${SIZEOF_LONG} -eq 4; then AC_DEFINE(LONG_32_BITS) fi case ${host} in *irix*) AC_MSG_CHECKING(whether compilers need -OPT:IEEE_NaN_inf=ON) AC_TRY_RUN( changequote(<<, >>)dnl << #include #include int main () { double x = 0; fpsetmask(0); x = x / x; return (x != x); } >>, changequote([, ])dnl AC_MSG_RESULT(yes) CFLAGS="${CFLAGS} -OPT:IEEE_NaN_inf=ON" FFLAGS="${FFLAGS} -OPT:IEEE_NaN_inf=ON", AC_MSG_RESULT(no), AC_MSG_WARN(cannot determine when cross-compiling)) ;; esac ## DLL linking. SHLIBLD=ld SHLIBEXT=so # We create a fake Imakefile and then run xmkmf so that we can # determine PICFLAGS and SHLIBLDFLAGS. # # DLLFLAGS - flags for loading the main # CPICFLAGS - flags for compiling C library code # FPICFLAGS - flags for compiling Fortran library code # SHLIBLDFLAGS - flags for creating DLLs # # Damn! It seems that this can lead to using the wrong options # if the CC we have differs from that which imake knows about. # Lets always use -fpic when CC=gcc. # # As a final safeguard, any options specified in config.site will # override anything we discover below. AC_PATH_PROG(XMKMF, xmkmf, , ${PATH}:/usr/bin/X11:/usr/X11R6/bin) if test -n "${XMKMF}"; then AC_MSG_CHECKING(how to make shared libraries) # mv ${srcdir}/Makefile ${srcdir}/Makefile-SAFE echo > Imakefile ${XMKMF} > /dev/null cpicflags=`grep '^ *PICFLAGS' Makefile | sed 's/^ *PICFLAGS *= *//'` shlibldflags=`grep 'SHLIBLDFLAGS' Makefile | sed 's/ *SHLIBLDFLAGS *= *//'` rm Imakefile Makefile # mv ${srcdir}/Makefile-SAFE ${srcdir}/Makefile AC_MSG_RESULT(done) else cpicflags= shlibldflags= AC_MSG_WARN([Cannot determine how to create shared libraries. Please set CPICFLAGS, FPICFLAGS and SHLIBLDFLAGS in \`config.site'.]) fi if test "${CC}" = gcc; then cpicflags=-fpic fi CPICFLAGS=${CPICFLAGS-${cpicflags}} FPICFLAGS=${FPICFLAGS-${CPICFLAGS}} SHLIBLDFLAGS=${SHLIBLDFLAGS-${shlibldflags}} ## Individual platform overrides. case "${host}" in alpha*osf*) CFLAGS="-ieee_with_inexact ${CFLAGS}" AC_DEFINE(HAVE_NO_SYMBOL_UNDERSCORE) CPICFLAGS= SHLIBLDFLAGS=-shared ;; alpha*linux) CFLAGS="-mieee ${CFLAGS}" DLLFLAGS=-export-dynamic ;; *linuxaout) sed '/HAVE_ELF_H/d' confdefs.h > tmp.h ; mv tmp.h confdefs.h LDCMD=gcc LIBS="-lf2c ${LIBS}" ;; *linux) DLLFLAGS=-export-dynamic ;; *netbsd*) if ${CPP} - -dM < /dev/null | grep -q __ELF__; then DLLFLAGS="-export-dynamic" SHLIBLDFLAGS="-shared" else SHLIBLDFLAGS="-Bshareable" fi ;; *sgi*) SHLIBLDFLAGS="-shared" if ${cc_is_gcc}; then CPICFLAGS=-fPIC else CPICFLAGS=-KPIC fi if ${f77_is_g77}; then FPICFLAGS=-fPIC else FPICFLAGS=-KPIC fi ;; *hpux*) AC_DEFINE(USE_BUILTIN_RINT) case "${CC}" in c89*) CPICFLAGS="+z" ;; gcc*) CPICFLAGS="-fpic" ;; esac DLLFLAGS="-Wl,-E" SHLIBLDFLAGS=-b SHLIBEXT=sl LIBS="${LIBS} -ldld" ;; *solaris*) SHLIBLDFLAGS="-G" if ${cc_is_gcc}; then CPICFLAGS=-fPIC else CPICFLAGS=-KPIC fi if ${f77_is_g77}; then FPICFLAGS=-fPIC else FPICFLAGS=-PIC fi ;; esac AC_SUBST(LDCMD) AC_SUBST(DLLFLAGS) AC_SUBST(CPICFLAGS) AC_SUBST(FPICFLAGS) AC_SUBST(SHLIBLDFLAGS) AC_SUBST(SHLIBEXT) AC_SUBST(SHLIBLD) AC_DEFINE_UNQUOTED(SHLIBEXT, "${SHLIBEXT}") ### System services. ## X11 locations ## ## Here we use the standard X11 search macro. ## We force the use of -lX11 (perhaps this is not necessary). AC_PATH_XTRA if test -z "${no_x}"; then X_LIBS="${X_LIBS} -lX11" fi ### 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}") if test -z "${R_PAPERSIZE}"; then R_PAPERSIZE=a4 fi AC_SUBST(R_PAPERSIZE) ## Saving. AC_SUBST(R_BATCHSAVE) ### Output. AC_SUBST(CFLAGS) AC_SUBST(FFLAGS) AC_SUBST(F2CFLAGS) AC_OUTPUT(Makeconf Makefile afm/Makefile demos/Makefile doc/Makefile doc/keyword-test doc/manual/Makefile doc/manual/lib2tex doc/manual/Reference.tex doc/manual/Manual.tex etc/Makefile etc/Makeconf src/Makefile src/appl/Makefile src/include/Makefile src/library/Makefile src/main/Makefile src/nmath/Makefile src/scripts/Makefile src/unix/Makefile src/gnome/Makefile src/library/base/Makefile src/library/profile/Makefile src/library/eda/Makefile src/library/eda/src/Makefile src/library/lqs/Makefile src/library/lqs/src/Makefile src/library/modreg/Makefile src/library/modreg/src/Makefile src/library/mva/Makefile src/library/mva/src/Makefile src/library/stepfun/Makefile src/scripts/COMPILE src/scripts/INSTALL src/scripts/REMOVE src/scripts/R.sh src/scripts/Rdconv src/scripts/Rdindex src/scripts/Rman2Rd src/scripts/SHLIB src/scripts/Sd2Rd src/scripts/build-help src/scripts/fwf2table src/scripts/help.pretty src/scripts/html2dos src/scripts/Rd2contents tests/Makefile tests/Examples/Makefile ) AC_OUTPUT_COMMANDS( chmod +x doc/keyword-test doc/manual/lib2tex ) if test -z "${F77}"; then FORT="${F2C} ${F2CFLAGS}" else FORT="${F77} ${FFLAGS}" fi AC_MSG_RESULT([ R is now configured for ${host} Source directory: ${srcdir} Installation directory: ${prefix} C compiler: ${CC} ${CFLAGS} FORTRAN compiler: ${FORT} Gnome support: ${use_gnome} ])