Rev 47836 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
## config -- Simple shell script to get the values of basic R configure## variables, or the header and library flags necessary for linking## against R.#### Usage:## R CMD config [options] [VAR]## Copyright (C) 2002-6 The R Core Development Team#### This document 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, or (at your option)## any later version.#### This program 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.#### A copy of the GNU General Public License is available at## http://www.r-project.org/Licenses/revision='$Revision: 47836 $'version=`set - ${revision}; echo ${2}`version="R configuration information retrieval script: ${R_VERSION} (r${version})Copyright (C) 2002-6 The R Core Development Team.This is free software; see the GNU General Public License version 2or later for copying conditions. There is NO warranty."usage="Usage: R CMD config [options] [VAR]Get the value of a basic R configure variable VAR which must be amongthose listed in the 'Variables' section below, or the header andlibrary flags necessary for linking against R.Options:-h, --help print short help message and exit-v, --version print version info and exit--cppflags print pre-processor flags required to compilea program using R as a library--ldflags print linker flags needed for linking againstthe R libraryVariables:BLAS_LIBS flags needed for linking against external BLAS librariesCC C compiler commandCFLAGS C compiler flagsCPICFLAGS special flags for compiling C code to be turned into ashared libraryCPP C preprocessorCPPFLAGS C/C++ preprocessor flags, e.g. -I<dir> if you haveheaders in a nonstandard directory <dir>CXX C++ compiler commandCXXCPP C++ preprocessorCXXFLAGS C++ compiler flagsCXXPICFLAGS special flags for compiling C++ code to be turned into ashared libraryDYLIB_EXT file extension (including '.') for dynamic librariesDYLIB_LD command for linking dynamic libraries which containobject files from a C or Fortran compiler onlyDYLIB_LDFLAGSspecial flags used by DYLIB_LDF77 Fortran 77 compiler commandFFLAGS Fortran 77 compiler flagsFLIBS linker flags needed to link Fortran codeFPICFLAGS special flags for compiling Fortran code to be turnedinto a shared libraryFC Fortran 9x compiler commandFCFLAGS Fortran 9x compiler flagsFCPICFLAGS special flags for compiling Fortran 9x code to be turnedinto a shared libraryJAR Java archive tool commandJAVA Java interpreter commandJAVAC Java compiler commandJAVAH Java header and stub generator commandJAVA_HOME path to the home of Java distributionJAVA_LIBS flags needed for linking against Java librariesJAVA_CPPFLAGS C preprocessor flags needed for compiling JNI programsLAPACK_LIBS flags needed for linking against external LAPACK librariesLIBnn location for libraries, e.g. 'lib' or 'lib64' on this platformLDFLAGS linker flags, e.g. -L<dir> if you have libraries in anonstandard directory <dir>OBJC Objective C compiler commandOBJCFLAGS Objective C compiler flagsMAKE Make commandSAFE_FFLAGS Safe (as conformant as possible) Fortran 77 compiler flagsSHLIB_CFLAGS additional CFLAGS used when building shared objectsSHLIB_CXXLD command for linking shared objects which containobject files from a C++ compilerSHLIB_CXXLDFLAGSspecial flags used by SHLIB_CXXLDSHLIB_EXT file extension (including '.') for shared objectsSHLIB_FFLAGS additional FFLAGS used when building shared objectsSHLIB_LD command for linking shared objects which containobject files from a C or Fortran compiler onlySHLIB_LDFLAGSspecial flags used by SHLIB_LDSHLIB_FCLD, SHLIB_FCLDFLAGSditto when using Fortran 9xTCLTK_CPPFLAGSflags needed for finding the tcl.h and tk.h headersTCLTK_LIBS flags needed for linking against the Tcl and Tk librariesReport bugs to <r-bugs@r-project.org>."## <NOTE>## The variables are basically the precious configure variables (with## the R_* and MAIN_* ones removed), plus FLIBS and BLAS_LIBS.## One could use## precious_configure_vars=`~/src/R/configure --help \## | sed -n '/^Some influential/,/^[^ ]/p' \## | sed '/^[^ ]/d' \## | sed 's/^ //' \## | cut -f1 -d ' ' \## | grep -v '^MAIN_' \## | grep -v '^R_' \## | sort \## | uniq`## to obtain the configure vars and hence create most of the above usage## info as well as the list of accepted variables below automatically.## </NOTE>if test $# = 0; thenecho "${usage}"exit 1fiif test "${R_OSTYPE}" = "windows"; thenMAKE=makeR_DOC_DIR=${R_HOME}/docR_INCLUDE_DIR=${R_HOME}/includeR_SHARE_DIR=${R_HOME}/shareR_ARCH=fimakefiles="-f ${R_HOME}/etc${R_ARCH}/Makeconf -f ${R_SHARE_DIR}/make/config.mk"## avoid passing down -jNMAKEFLAGS=export MAKEFLAGSquery="${MAKE} -s ${makefiles} print R_HOME=${R_HOME}"LIBR=`eval $query VAR=LIBR`STATIC_LIBR=`eval $query VAR=STATIC_LIBR`if test -n "${R_ARCH}"; thenincludes="-I${R_INCLUDE_DIR} -I${R_INCLUDE_DIR}${R_ARCH}"elseincludes="-I${R_INCLUDE_DIR}"fivar=while test -n "${1}"; docase "${1}" in-h|--help)echo "${usage}"; exit 0 ;;-v|--version)echo "${version}"; exit 0 ;;--cppflags)if test -z "${LIBR}"; thenif test -z "${STATIC_LIBR}"; thenecho "R was not built as a library" >&2elseecho "${includes}"fielseecho "${includes}"fiexit 0;;--ldflags)if test -z "${LIBR}"; thenif test -z "${STATIC_LIBR}"; thenecho "R was not built as a library" >&2elseecho "${STATIC_LIBR}"fielseecho "${LIBR}"fiexit 0;;*)if test -z "${var}"; thenvar="${1}"elseecho "ERROR: cannot query more than one variable" >&2exit 1fi;;esacshiftdoneok_c_vars="CC CFLAGS CPICFLAGS CPP CPPFLAGS"ok_cxx_vars="CXX CXXCPP CXXFLAGS CXXPICFLAGS"ok_dylib_vars="DYLIB_EXT DYLIB_LD DYLIB_LDFLAGS"ok_objc_vars="OBJC OBJCFLAGS"ok_java_vars="JAVA JAVAC JAVAH JAR JAVA_HOME JAVA_LIBS JAVA_CPPFLAGS"ok_f77_vars="F77 FFLAGS FPICFLAGS FLIBS SAFE_FFLAGS FC FCFLAGS FCPICFLAGS"ok_ld_vars="LDFLAGS"ok_shlib_vars="SHLIB_CFLAGS SHLIB_CXXLD SHLIB_CXXLDFLAGS SHLIB_EXT SHLIB_FFLAGS SHLIB_LD SHLIB_LDFLAGS SHLIB_FCLD SHLIB_FCLDFLAGS"ok_tcltk_vars="TCLTK_CPPFLAGS TCLTK_LIBS"ok_other_vars="BLAS_LIBS LAPACK_LIBS MAKE LIBnn"## Can we do this elegantly using case?var_ok=nofor v in ${ok_c_vars} ${ok_cxx_vars} ${ok_dylib_vars} ${ok_f77_vars} \${ok_objc_vars} ${ok_java_vars} \${ok_ld_vars} ${ok_shlib_vars} ${ok_tcltk_vars} \${ok_other_vars}; doif test "${var}" = "${v}"; thenvar_ok=yesbreakfidoneif test "${var_ok}" = yes; theneval "${query} VAR=${var}"elseecho "ERROR: no information for variable '${var}'"exit 1fi### Local Variables: ***### mode: sh ***### sh-indentation: 2 ***### End: ***