Simplify creation of Fortran function wrappers

The old version invoked a Fortran compiler to figure out the bindings
necessary to link to a Fortran function. This creates a dependency on
having a Fortran compiler, even though the project may not have any
Fortran source it needs to compile!

Also, the Fortran compiler that is installed on the system may not be
the same as was used to compile the library anyway, so we are not even
sure that this is correct!

Furthermore, FindLAPACK operates on the assumption that names in that
library is suffixed with a single underscore, so if that is not correct,
we won't find any of the functions in that library anyway!

Thus, this patch enables us to assume that appending an underscore is
the right thing to do without using the compiler. This option is off by
default, but can be activated with USE_UNDERSCORING=ON (named after the
GFortran option).
This commit is contained in:
Roland Kaufmann
2013-08-21 23:00:29 +02:00
parent 9d19b116d7
commit a64118cb81
2 changed files with 24 additions and 1 deletions

View File

@@ -30,7 +30,9 @@ Optional Features:
--enable-parallel process in parallel using MPI [default=no]
--enable-openmp activate experimental support for OpenMP
--disable-option-checking ignore unrecognized --enable/--with options
--enable-underscoring assume Fortran routines have _ suffix [default=no]
--enable-ninja use Ninja build generator [default=no]
(automatically implies --enable-underscoring)
Optional Packages:
--with-alugrid=PATH use the ALUGrid library from a specified location
@@ -116,6 +118,8 @@ use_tests=
use_samples=
#use_ninja="-G\"Unix Makefiles\" "
use_ninja=
#use_underscoring=" -DUSE_UNDERSCORING=OFF"
use_underscoring=
# default is to warn for unknown options, but this can be disabled
option_check=yes
@@ -348,7 +352,14 @@ for OPT in "$@"; do
use_samples=" -DBUILD_EXAMPLES=ON"
pkgname=""
;;
underscoring)
use_underscoring=" -DUSE_UNDERSCORING=ON"
pkgname=""
;;
ninja)
# Ninja doesn't support using the Fortran compiler, so
# we'll have to resort to making this assumption
use_underscoring=" -DUSE_UNDERSCORING=ON"
use_ninja="-GNinja "
pkgname=""
;;
@@ -400,7 +411,7 @@ for a in "${VARS[@]}"; do
done
# pass everything on to CMake
CMDLINE="env ${ENVVARS} ${CMAKE_COMMAND} \"${srcdir}\" ${use_ninja}\"-DCMAKE_INSTALL_PREFIX=$prefix\"${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp}${use_mpi}${use_lto}${use_runpath}${use_tests}${use_samples} ${FEATURES}"
CMDLINE="env ${ENVVARS} ${CMAKE_COMMAND} \"${srcdir}\" ${use_ninja}\"-DCMAKE_INSTALL_PREFIX=$prefix\"${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp}${use_mpi}${use_lto}${use_runpath}${use_tests}${use_samples}${use_underscoring} ${FEATURES}"
echo --- calling CMake ---
echo ${CMDLINE}
eval exec ${CMDLINE}