dnl Process this file with autoconf to produce a configure script. AC_INIT(src/include/Defn.h) AC_CONFIG_HEADER(src/include/Platform.h) . ./config.site AC_CONFIG_AUX_DIR(etc) # 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=`etc/config.guess` set `echo ${host} | tr '-' ' '` host_cpu=$1 host_vendor=$2 host_os=$3 AC_DEFINE(R_MAJOR, "0") AC_DEFINE(R_MINOR, "61.1") AC_DEFINE(R_STATUS, "Alpha") AC_DEFINE(R_STATUS_REV, "0") AC_DEFINE(R_DAY, "21") AC_DEFINE(R_MONTH, "December") AC_DEFINE(R_YEAR, "1997") 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}") # COMPILERS AND TOOLS # C: If a C compiler is specified in config.site we use that. # Otherwise, we use the autoconfigure procedures for C compiler # detection. if test -z "$CC" then AC_PROG_CC else AC_CHECK_PROG(CC, $CC) fi case $host in *hpux*) LIBS="-L/lib/pa1.1 $LIBS" case ${CC} in c89) CFLAGS="-D_HPUX_SOURCE ${CFLAGS}" ;; esac esac # Fortran: # Check whether there is a native fortran compiler. if test "$FC" = "no" then FC= else if test -z "$FC" then AC_CHECK_PROGS(FC, f77 g77 fc) fi fi # yacc et al: Note any of bison -y, yacc or byacc should do the job. # The results of byacc are most portable. Thats what we distribute. AC_PROG_YACC AC_PROG_RANLIB AC_CHECK_PROG(AR, ar, ar) # C AND FORTRAN LINKING # # Most UNIX Fortran compilers append an underscore to symbols # and this has to be taken into account in C functions which call # Fortran code. This check looks to see if this is the case. if test -z "$FC" then AC_DEFINE(HAVE_F77_UNDERSCORE) else 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_RESULT(nothing worked - won't use fortran) FC= fi fi rm -rf conftest conftest.* conftestf.* fi # 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 if test -z "$R_PAPERSIZE" then R_PAPERSIZE=a4 fi AC_SUBST(R_PAPERSIZE) # SAVE MODE AC_SUBST(R_BATCHSAVE) # 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 # LIBRARIES # # This is set up so we only get one of one of -ltermcap and -ltermlib AC_CHECK_LIB(m, sin) AC_CHECK_LIB(ncurses, main,, AC_CHECK_LIB(termcap, main,, AC_CHECK_LIB(termlib, main) )) AC_CHECK_LIB(readline, main) AC_CHECK_LIB(dl,dlopen) # AC_CHECK_FUNC(xdrstdio_creat) AC_CHECK_FUNCS(strcoll) if test -z "$FC" then BLAS="blas.o zblas.o" else AC_CHECK_LIB(blas, main, LIBS="-lblas $LIBS" BLAS="", BLAS="blas.o") fi # HEADER FILES AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h limits.h dlfcn.h dl.h elf.h time.h sys/times.h rpc/xdr.h readline/history.h locale.h) # TYPEDEFS, STRUCTURES, AND COMPILER CHARACTERISTICS AC_C_CONST # LIBRARY FUNCTIONS AC_TYPE_SIGNAL AC_FUNC_VFORK AC_FUNC_VPRINTF AC_CHECK_FUNCS(strtod strtol isnan finite matherr times) AC_CHECK_FUNCS(rint) AC_CHECK_FUNCS(asinh acosh atanh) AC_CHECK_FUNCS(regcomp) AC_CHECK_FUNCS(memmove memcpy bcopy) # CHECK FOR NASTY OSF SPRINTF BUG # AC_MSG_CHECKING(for osf sprintf bug) # AC_TRY_RUN( # changequote(<<, >>)dnl # << # #include # char buf[100]; # main() # { # sprintf(buf, "%*.*f",3,0,100.0); /* printf("%s\n", buf); */ # sprintf(buf, "%*.*f",1,0,1.0); /* printf("%s\n", buf); */ # if(strcmp(buf,"1")) exit(666); # else exit(0); # } # >>, # changequote([, ])dnl # AC_DEFINE(HAVE_OSF_SPRINTF_NOBUG) # AC_MSG_RESULT(no), # AC_DEFINE(HAVE_OSF_SPRINTF_BUG) # AC_MSG_RESULT(yes), # AC_MSG_ERROR(You can't cross compile R)) # If Fortran is not available or we were not able to find out # how to make Fortran and C communicate we use the smaller # C-only applications library. if test -z "$FC" then FFLAGS= APPL_DIR=applc LIBSRC=src-c LDCMD=${CC} else # FFLAGS="-O" APPL_DIR=appl LIBSRC=src LDCMD=${FC} fi AC_SUBST(APPL_DIR) AC_SUBST(FFLAGS) # DLL LINKING # # We create a fake Imakefile and then run xmkmf so that we can # determine PICFLAGS and SHLIBLDFLAGS. The only platform I know # of which uses DLLFLAGS is linux-elf which requires -rdynamic. # # DLLFLAGS - flags for loading the main # PICFLAGS - 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. USERPICFLAGS="$PICFLAGS" USERFPICFLAGS="$FPICFLAGS" USERSHLIBLDFLAGS="$SHLIBLDFLAGS" USERDLLFLAGS="$USERDLLFLAGS" AC_CHECK_PROG(XMKMF,xmkmf,xmkmf) if test -n "$XMKMF" then AC_MSG_CHECKING(how to make shared libraries) mv Makefile Makefile-SAFE echo > Imakefile xmkmf > /dev/null PICFLAGS=`grep '^ *PICFLAGS' Makefile | sed 's/^ *PICFLAGS *= *//'` SHLIBLDFLAGS=`grep 'SHLIBLDFLAGS' Makefile | sed 's/ *SHLIBLDFLAGS *= *//'` DLLFLAGS= rm Imakefile Makefile mv Makefile-SAFE Makefile AC_MSG_RESULT(done) else PICFLAGS= SHLIBLDFLAGS= DLLFLAGS= fi if test "${CC}" = gcc then PICFLAGS=-fpic fi FPICFLAGS="$PICFLAGS" if test -n "$USERPICFLAGS" then PICFLAGS="$USERPICFLAGS" fi if test -n "$USERFPICFLAGS" then FPICFLAGS="$USERFPICFLAGS" fi if test -n "$USERSHLIBLDFLAGS" then SHLIBLDFLAGS="$USERSHLIBLDFLAGS" fi if test -n "$USERDLLFLAGS" then DLLFLAGS="$USERDLLFLAGS" fi # # Individual platform overrides. # case $host in alpha*osf*) CFLAGS="-ieee_with_inexact $CFLAGS" AC_DEFINE(HAVE_NO_SYMBOL_UNDERSCORE) PICFLAGS= SHLIBLDFLAGS=-shared ;; *linuxaout) sed '/HAVE_ELF_H/d' confdefs.h > tmp.h ; mv tmp.h confdefs.h LDCMD=gcc LIBS="-lf2c $LIBS" ;; *linux) LDCMD=gcc LIBS="-lf2c $LIBS" DLLFLAGS=-rdynamic ;; *sgi*) SHLIBLDFLAGS="-shared" ;; *hpux*) AC_DEFINE(USE_BUILTIN_RINT) case "$CC" in c89*) PICFLAGS="+z" ;; gcc*) PICFLAGS="-fpic" ;; esac DLLFLAGS="-Wl,-E" SHLIBLDFLAGS=-b LIBS="$LIBS -ldld" ;; *solaris*) SHLIBLDFLAGS="-G" ;; esac for i in `ls src/appl.c|grep '.c$'` `ls src/appl.f|grep '\.f'` do rm -f src/appl/$i done if test -z "$FC" then ln src/appl.c/*.c src/appl else ln src/appl.f/*.f src/appl fi AC_PATH_PROG(PERL, perl) if test -n "$PERL" then AC_MSG_CHECKING(whether perl is perl 5) PERL_VERSION_NUMBER=`perl -v | sed -n 's/^.*perl.*version \(.\).*/\1/p'` if test $PERL_VERSION_NUMBER -ge 5 then NO_PERL5="" AC_MSG_RESULT(yes) else NO_PERL5="true" AC_MSG_RESULT(no) fi else NO_PERL5="true" fi AC_SUBST(LDCMD) AC_SUBST(DLLFLAGS) AC_SUBST(PICFLAGS) AC_SUBST(LIBSRC) AC_SUBST(SHLIBLDFLAGS) AC_SUBST(BLAS) AC_SUBST(FFLAGS) AC_SUBST(FPICFLAGS) AC_SUBST(PERL) AC_SUBST(NO_PERL5) AC_OUTPUT( src/main/Makefile src/graphics/Makefile src/math/Makefile src/appl/Makefile src/regex/Makefile src/unix/Makefile src/front/R.sh etc/SHLIB etc/COMPILE etc/INSTALL etc/REMOVE etc/Rdconv etc/Rdindex etc/Rman2Rd etc/Sd2Rd etc/build-help etc/build-htmlpkglist etc/help.pretty etc/html2dos demos/dynload/Makefile src/library/LIBCLEAN cmd/fwf2table ) AC_OUTPUT_COMMANDS( (cd etc; chmod +x INSTALL REMOVE Rdconv Rdindex Rman2Rd Sd2Rd \ build-help build-htmlpkglist help.pretty html2dos) (cd cmd; chmod +x fwf2table) mkdir -p bin include library src/lib )