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, USA. AC_INIT(src/include/Defn.h) AC_CONFIG_HEADER(src/include/Rconfig.h) AC_CONFIG_AUX_DIR(tools) ### Platform & Version ## 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. AC_MSG_CHECKING(host system type) host=`${srcdir}/tools/config.guess` set `echo ${host} | tr '-' ' '` host_cpu=${1} host_vendor=${2} host_os=${3} 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}") AC_MSG_RESULT([${host}]) PACKAGE="R" VERSION=`cat ${srcdir}/VERSION | cut -d' ' -f1` AC_SUBST(PACKAGE) AC_SUBST(VERSION) ### Defaults if test -r "${srcdir}/config.site"; then echo "loading site script ${srcdir}/config.site" . ${srcdir}/config.site fi if test -r "${HOME}/.Rconf"; then echo "loading user script ${HOME}/.Rconf" . ${HOME}/.Rconf fi ### 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_AWK AC_PROG_INSTALL warn_install="redefining INSTALL to be `pwd`/tools/install-sh -c" case "${INSTALL}" in [[!/]]*install-sh*) ## 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(). INSTALL="\$\(top_srcdir\)/tools/install-sh -c" AC_MSG_WARN([${warn_install}]) ;; esac case "${host}" in *aix*|*hpux*) ## installbsd on AIX does not seem to work? INSTALL="\$\(top_srcdir\)/tools/install-sh -c" AC_MSG_WARN([${warn_install}]) ;; esac AC_PROG_LN_S AC_PROG_RANLIB AC_PROG_YACC ## Ar. AC_CHECK_PROG(AR, [${AR} ar], ar) : ${ARFLAGS="rc"} AC_SUBST(ARFLAGS) ## LaTeX && friends AC_PATH_PROG(LATEX, [${LATEX} latex], false) AC_PATH_PROG(DVIPS, [${DVIPS} dvips], false) AC_PATH_PROG(MAKEINDEX, [${MAKEINDEX} makeindex], false) ## Nroff && friends AC_PATH_PROG(NROFF, [${NROFF} nroff], false) AC_PATH_PROG(TBL, [${TBL} tbl], false) ## Unzip && zip AC_PATH_PROG(R_UNZIPCMD, [${UNZIP} unzip], "") AC_PATH_PROG(R_ZIPCMD, [${ZIP} zip], "") ## Echo. R_PROG_ECHO_N ## Make. : ${MAKE=make} AC_SUBST(MAKE) ## Perl. R_PROG_PERL ## Tar. : ${TAR=tar} AC_SUBST(TAR) ## C compiler. AC_PROG_CC AC_PROG_CPP AC_PROG_GCC_TRADITIONAL dnl Yes, we already need this at configure time ... case "${host}" in *aix*) AC_AIX ;; *hpux*) LIBS="-L/lib/pa1.1 ${LIBS}" case "${CC}" in cc) if test `echo ${CFLAGS} | grep -c -e "-A[ae] "` = 0; then CFLAGS="${CFLAGS} -Aa" fi AC_DEFINE(_HPUX_SOURCE) ;; c89) AC_DEFINE(_HPUX_SOURCE) ;; esac ;; esac R_PROG_CC_M ## 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. if test -n "${FC}"; then F77=${FC} AC_MSG_RESULT([defining F77 to be ${F77}]) elif ${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 AC_PATH_PROGS(F77, g77 f77 fort77 f90 xlf cf77 fc) if test -n "${F77}"; then if test -n "`file ${F77} | grep script`"; then dnl If F77 found above is a shell or perl script, don't use it. F77= else F77=`basename ${F77}` fi fi if test -z "${F77}"; then AC_CHECK_PROGS(F2C, f2c) fi fi if test -n "${F77}"; then FC=${F77} OCTAVE_FLIBS R_PROG_F77_G77 R_PROG_F77_APPEND_UNDERSCORE R_PROG_F77_CC_COMPAT f77_rules_frag=Makefrag.f77 cat << \EOF > ${f77_rules_frag} .f.c: .f.o: $(FC) $(ALL_FFLAGS) -c $< -o $@ EOF elif test -n "${F2C}"; then R_PROG_F2C_FLIBS f77_rules_frag=Makefrag.f77 cat << \EOF > ${f77_rules_frag} .f.o: $(F2C) $(F2CFLAGS) < $< > $*.c $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c $*.c -o $@ @rm -f $*.c EOF else AC_MSG_ERROR([Neither an F77 compiler nor f2c found]) fi AC_SUBST(FC) AC_SUBST(F2C) AC_SUBST_FILE(f77_rules_frag) ### 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) R_LIB_HDF5 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 R_GNOME ### Library functions. AC_FUNC_ALLOCA AC_FUNC_VFORK AC_FUNC_VPRINTF AC_CHECK_FUNCS(acosh asinh atanh bcopy finite getcwd isnan matherr \ memcpy memmove regcomp rint strcoll system times) R_FUNC___SETFPUCW R_FUNC_CALLOC R_FUNC_FINITE R_FUNC_LOG ### Header files AC_HEADER_STDC AC_HEADER_TIME AC_HEADER_DIRENT AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(dl.h dlfcn.h elf.h floatingpoint.h fpu_control.h \ hdf5.h ieee754.h ieeefp.h readline/history.h readline/readline.h \ rpc/rpc.h rpc/xdr.h sys/param.h sys/stat.h sys/time.h sys/times.h \ sys/types.h unistd.h locale.h) case "${host}" in *sunos4*) AC_DEFINE(SunOS4) ;; esac R_HEADER_SETJMP ### Typedefs. AC_TYPE_SIGNAL AC_TYPE_PID_T AC_TYPE_SIZE_T AC_CHECK_TYPE(blkcnt_t, long) ### Compiler characteristics. AC_C_CONST AC_CHECK_SIZEOF(long, 4) if test "${GCC}" = yes; then case "${host}" in i[[3456789]]86-*-*) R_PROG_CC_FLAG(-mieee-fp, R_XTRA_CFLAGS="${R_XTRA_CFLAGS} -mieee-fp") ;; esac fi case "${host}" in *aix4.[[2-9]]*) AC_DEFINE(HAVE_NO_SYMBOL_UNDERSCORE) if test "${GCC}" = yes; then R_PROG_CC_FLAG(-mno-fp-in-toc, R_XTRA_CFLAGS="${R_XTRA_CFLAGS} -mno-fp-in-toc") fi R_XTRA_LIBS="${R_XTRA_LIBS} /lib/crt0.o" ;; alpha*osf*) AC_DEFINE(HAVE_NO_SYMBOL_UNDERSCORE) R_PROG_CC_FLAG(-ieee_with_inexact, R_XTRA_CFLAGS="${R_XTRA_CFLAGS} -ieee_with_inexact") ;; alpha*linux) R_PROG_CC_FLAG(-mieee, R_XTRA_CFLAGS="${R_XTRA_CFLAGS} -mieee" R_XTRA_FFLAGS="${R_XTRA_FFLAGS} -mieee") ;; *hpux*) AC_DEFINE(USE_BUILTIN_RINT) case "${CC}" in cc|c89) R_XTRA_CFLAGS="${R_XTRA_CFLAGS} -D_HPUX_SOURCE" ;; esac AC_CHECK_LIB(dld, shl_load, R_XTRA_LIBS="${R_XTRA_LIBS} -ldld") ;; *irix*) R_C_OPTIEEE ;; esac AC_SUBST(CFLAGS) AC_SUBST(FFLAGS) AC_SUBST(F2CFLAGS) AC_SUBST(R_XTRA_CFLAGS) AC_SUBST(R_XTRA_FFLAGS) AC_SUBST(R_XTRA_LIBS) ## DLL stuff ## We need to determine the following: ## ## LDCMD, DLLFLAGS ## command and flags for loading the main binary so that it will load ## shared libraries (DLLs) at runtime ## CPICFLAGS, FPICFLAGS ## flags for compiling C and Fortran library code ## SHLIBLD, SHLIBLDFLAGS ## command and flags for creating DLLs ## ## The following procedure is as follows. ## *) We think we know what to do if CC is gcc. Otherwise, try using ## imake values in case its CC is ours. ## *) Then, use platform specific overrides. ## *) As a final safeguard, values from the environment (as specified in ## one of the configuration files) override anything we figure out. ldcmd=${CC} shlibld=${CC} SHLIBEXT=so AC_PATH_PROG(XMKMF, xmkmf, , ${PATH}:/usr/bin/X11:/usr/X11R6/bin:/usr/openwin/bin) AC_MSG_CHECKING([how to deal with shared libraries]) if test -n "${XMKMF}"; then echo > Imakefile ${XMKMF} > /dev/null cc=`${srcdir}/tools/GETMAKEVAL CC` if test "`which ${cc}`" = "`which ${CC}`"; then shlibldflags=`${srcdir}/tools/GETMAKEVAL SHLIBLDFLAGS` cpicflags=`${srcdir}/tools/GETMAKEVAL PICFLAGS` fpicflags=${cpicflags} fi rm -f Imakefile Makefile fi if test "${GCC}" = yes; then cpicflags=-fPIC shlibldflags=-shared fi if test "${G77}" = yes; then fpicflags=-fPIC fi AC_MSG_RESULT(done) ## Individual platform overrides. case "${host}" in *aix4.[[2-9]]*) EXPORTFILE="\$(top_builddir)/etc/R.exp" ldcmd=ld dllflags="-bdynamic -bE:${EXPORTFILE} -bM:SRE -lc -lm" if test "${GCC}" = yes; then dllflags="${dllflags} `${CC} -print-libgcc-file-name`" fi shlibld=ld shlibldflags="-bM:SRE -H512 -T512 -bnoentry -bexpall \ -bI:\$(R_HOME)/etc/R.exp -lc -lm" ;; alpha*osf*) cpicflags= shlibldflags=-shared ;; alpha*linux) dllflags=-export-dynamic ;; *freebsd3.*) dllflags=-export-dynamic shlibldflags="-shared" ;; *hpux*) case "${CC}" in cc|c89) cpicflags="+z" ;; esac case "${FC}" in f77) fpicflags="+z" ;; esac dllflags="-Wl,-E" shlibld=ld shlibldflags="-b" SHLIBEXT=sl ;; *linuxaout) sed '/HAVE_ELF_H/d' confdefs.h > tmp.h ; mv tmp.h confdefs.h ;; *linux) dllflags=-export-dynamic ;; *netbsd*) if ${CPP} - -dM < /dev/null | grep -q __ELF__; then dllflags="-export-dynamic" shlibldflags="-shared" else shlibldflags="-Bshareable" fi ;; *sgi*) if test "${GCC}" = yes; then cpicflags=-fPIC else cpicflags=-KPIC fi if test "${G77}" = yes; then fpicflags=-fPIC else fpicflags=-KPIC fi shlibldflags="-shared" ;; *solaris*) if test "${GCC}" = yes; then cpicflags=-fPIC else cpicflags=-KPIC fi if test "${G77}" = yes; then fpicflags=-fPIC else fpicflags=-PIC fi shlibldflags="-G" ;; esac : ${LDCMD=${ldcmd}} : ${DLLFLAGS=${dllflags}} : ${CPICFLAGS=${cpicflags}} if test -z "${CPICFLAGS}"; then AC_MSG_WARN([Could not determine CPICFLAGS.]) AC_MSG_ERROR([See the file INSTALL for more information.]) fi : ${FPICFLAGS=${fpicflags}} : ${SHLIBLD=${shlibld}} : ${SHLIBLDFLAGS=${shlibldflags}} if test -z "${SHLIBLDFLAGS}"; then AC_MSG_WARN([Could not determine SHLIBLDFLAGS.]) AC_MSG_ERROR([See the file INSTALL for more information.]) fi 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}") AC_SUBST(EXPORTFILE) ### 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}") : ${R_PAPERSIZE=a4} AC_SUBST(R_PAPERSIZE) ## Saving. AC_SUBST(R_BATCHSAVE) ### Output. AC_OUTPUT(Makeconf Makefile afm/Makefile demos/Makefile doc/Makefile doc/keyword-test doc/manual/Makefile doc/manual/Reference.tex doc/manual/Manual.tex doc/manual/lib2tex etc/Makefile etc/Makeconf src/Makefile src/appl/Makefile src/gnome/Makefile src/include/Makefile src/library/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/library/ts/Makefile src/library/ts/src/Makefile src/main/Makefile src/nmath/Makefile src/scripts/Makefile src/scripts/COMPILE src/scripts/INSTALL src/scripts/REMOVE src/scripts/R.sh src/scripts/Rd2contents src/scripts/Rd2txt 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/unix/Makefile 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} ${R_XTRA_FFLAGS} ${FFLAGS}" fi AC_MSG_RESULT([ R is now configured for ${host} Source directory: ${srcdir} Installation directory: ${prefix} C compiler: ${CC} ${R_XTRA_CFLAGS} ${CFLAGS} FORTRAN compiler: ${FORT} Gnome support: ${use_gnome} ])