2004-09-08 18:52:44 +08:00
|
|
|
----------------------------------------------------------------------
|
|
|
|
HOW TO EDIT THE "configure" SCRIPT
|
|
|
|
----------------------------------------------------------------------
|
2004-02-13 23:27:30 +08:00
|
|
|
|
2004-09-08 18:52:44 +08:00
|
|
|
The "configure" script is generated from its source file
|
|
|
|
"configure.ac" by the GNU Autoconf utility
|
|
|
|
(http://www.gnu.org/software/autoconf/). Don't edit "configure"
|
|
|
|
directly: whenever it gets regenerated, your changes will be lost.
|
|
|
|
Instead, edit "configure.ac", then run "autoconf" to regenerate
|
|
|
|
"configure". (If you want to keep the old "configure", make a copy
|
|
|
|
first.)
|
2004-02-13 23:27:30 +08:00
|
|
|
|
2004-09-08 18:52:44 +08:00
|
|
|
GNU Autoconf is installed by default on most Unix/Linux systems. If
|
|
|
|
you don't have it on your system, you'll have to install it. Also, if
|
|
|
|
it bumps an error message saying "configure.in not found", you'll have
|
|
|
|
to install a more recent version. Version 2.53 at least is known to
|
|
|
|
work.
|
2004-02-13 23:27:30 +08:00
|
|
|
|
2004-09-08 18:52:44 +08:00
|
|
|
"configure.ac" is a regular Bourne shell script (i.e., "sh" -- not
|
|
|
|
csh!), except that capitalized names starting with "AC_" are Autoconf
|
|
|
|
macros. Normally you shouldn't have to touch them. You may refer to
|
|
|
|
the GNU Autoconf Manual for more info.
|
2004-02-13 23:27:30 +08:00
|
|
|
|
2004-09-08 18:52:44 +08:00
|
|
|
"make.sys.in" and "make.rules.in" are the source files for "make.sys"
|
|
|
|
and "make.rules", that "configure" generates: you might want to edit
|
|
|
|
those files as well. The generation procedure is as follows: if
|
|
|
|
"configure.ac" contains the macro "AC_SUBST(name)", then every
|
|
|
|
occurrence of "@name@" in the source files will be substituted with
|
|
|
|
the value of the shell variable "name" at the point where AC_SUBST was
|
|
|
|
called.
|
|
|
|
|
|
|
|
"configure" writes a detailed log of its operation to "config.log".
|
|
|
|
When any configuration step fails, you may look there for the relevant
|
|
|
|
error messages. Note that it is normal for some checks to fail.
|
|
|
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
HOW TO ADD SUPPORT FOR A NEW ARCHITECTURE
|
|
|
|
|
|
|
|
In order to support a previously unsupported architecture, first you
|
|
|
|
have to figure out which compilers, compilation flags, libraries
|
|
|
|
etc. should be used for compiling ESPRESSO on that architecture.
|
|
|
|
In other words, you have to write a "make.sys" that works: use the
|
|
|
|
manual configuration procedure for that (see the ESPRESSO User's
|
|
|
|
Guide). Then, you have to modify "configure" so that it can generate
|
|
|
|
that "make.sys" automatically.
|
|
|
|
|
|
|
|
To do that, you have to add the case for your architecture in several
|
|
|
|
places throughout "configure.ac":
|
|
|
|
|
|
|
|
*** 1: Select compilers. ***
|
|
|
|
|
|
|
|
Look for these lines:
|
2004-02-13 23:27:30 +08:00
|
|
|
|
|
|
|
# check compiling environment
|
|
|
|
case $build in
|
2004-09-08 18:52:44 +08:00
|
|
|
ia64-*-linux-gnu )
|
|
|
|
...
|
|
|
|
x86_64-*-linux-gnu )
|
|
|
|
...
|
2004-06-10 22:58:51 +08:00
|
|
|
*-pc-linux-gnu )
|
2004-02-13 23:27:30 +08:00
|
|
|
...
|
2004-09-08 18:52:44 +08:00
|
|
|
etc.
|
|
|
|
|
|
|
|
Here you must add an entry corresponding to your architecture and
|
|
|
|
operating system. Run "config.guess" to obtain the string identifying
|
|
|
|
your system.
|
|
|
|
For instance on a PC it may be "i686-pc-linux-gnu", while on IBM SP4
|
|
|
|
"powerpc-ibm-aix5.1.0.0". It is convenient to put some asterisks to
|
|
|
|
account for small variations of the string for different machines of
|
|
|
|
the same family. For instance, it could be "aix4.3" instead of
|
|
|
|
"aix5.1", or "athlon" instead of "i686"...
|
|
|
|
|
|
|
|
There you have to set the appropriate values for several variables:
|
|
|
|
|
|
|
|
- "try_f90" should contain the list of candidate Fortran 90 compilers,
|
|
|
|
in order of decreasing preference (i.e. configure will use the first
|
|
|
|
it finds). If your system has parallel compilers, you should list
|
|
|
|
them in "try_f90_parallel".
|
|
|
|
|
|
|
|
- "try_ar", "try_arflags": for these, the values "ar" and "ruv" should
|
|
|
|
be always fine, unless some special flag is required (e.g., -X64
|
|
|
|
with sp4). You should also set "ranlib=ranlib" if needed;
|
|
|
|
otherwise, the default of "ranlib=echo" will be used (i.e., don't
|
|
|
|
use ranlib).
|
|
|
|
|
|
|
|
- you should define "try_dflags" if the ESPRESSO codes contain any
|
|
|
|
"#ifdef" specific to your machine: for instance "try_dflags=-D__AIX"
|
|
|
|
(on IBM machines) or "try_dflags=-D__LINUX" (on 32-bit PCs with
|
|
|
|
Linux) or "try_dflags=-D__LINUX64" (Linux on Itanium and Opteron).
|
|
|
|
|
|
|
|
- you may also define "is_arch=1" where "arch" is the architecture
|
|
|
|
name (i.e., is_linux, is_aix, is_mips...); but this is only needed
|
|
|
|
if you plan to use it later in order to select some library that is
|
|
|
|
specific to that architecture.
|
|
|
|
|
|
|
|
For example, here's the entry for Mac OS X:
|
|
|
|
|
|
|
|
powerpc-apple-darwin* )
|
|
|
|
is_mac=1
|
|
|
|
try_f90="xlf90 f90"
|
|
|
|
try_ar="ar"
|
|
|
|
try_arflags="ruv"
|
|
|
|
try_dflags="-D__MAC"
|
|
|
|
ranlib="ranlib"
|
|
|
|
;;
|
|
|
|
|
|
|
|
Then look for these lines:
|
2004-02-13 23:27:30 +08:00
|
|
|
|
|
|
|
# check Fortran 90 compiler
|
2004-09-08 18:52:44 +08:00
|
|
|
...
|
2004-02-13 23:27:30 +08:00
|
|
|
AC_PROG_F77($f90)
|
2004-09-08 18:52:44 +08:00
|
|
|
...
|
2004-02-13 23:27:30 +08:00
|
|
|
|
|
|
|
case "$build:$f90" in
|
2004-09-08 18:52:44 +08:00
|
|
|
ia64-*-linux-gnu:* | x86_64-*-linux-gnu:* | *-pc-linux-gnu:* )
|
|
|
|
...
|
|
|
|
*-ibm-aix*:*xlf*_r )
|
|
|
|
...
|
|
|
|
etc.
|
|
|
|
|
|
|
|
and just below:
|
|
|
|
|
|
|
|
case "$build:$f90" in
|
|
|
|
*:mpif90 )
|
|
|
|
....
|
|
|
|
etc.
|
|
|
|
|
|
|
|
In these two case blocks you have to add an entry for your
|
|
|
|
architecture *and* Fortran 90 compiler. There you have to set:
|
|
|
|
|
|
|
|
In the first case block:
|
|
|
|
|
|
|
|
- "try_cc", "try_f77": list of C and Fortran 77 compilers, also in
|
|
|
|
decreasing order of preference. This is done at this later stage
|
|
|
|
because the choice depends on the Fortran 90 compiler. For
|
|
|
|
instance, if $f90=ifort you'll want to use icc, while if $f90=pgf90
|
|
|
|
you'll want pgcc.
|
|
|
|
|
|
|
|
In the second case block:
|
|
|
|
|
|
|
|
- "try_cc_parallel", "try_f77_parallel": list of parallel C and
|
|
|
|
Fortran 77 compilers (if any).
|
|
|
|
|
|
|
|
A few compilers require some extra work here: for instance, if the
|
|
|
|
Intel Fortran compiler was selected, you need to know the version
|
|
|
|
because different versions need different flags.
|
|
|
|
|
|
|
|
For example, here are the entries for XL compilers on AIX:
|
2004-02-13 23:27:30 +08:00
|
|
|
|
2004-09-08 18:52:44 +08:00
|
|
|
*-ibm-aix*:*xlf*_r )
|
|
|
|
try_cc="xlc_r cc gcc"
|
|
|
|
try_f77="xlf_r f77 $f90"
|
|
|
|
;;
|
2004-02-13 23:27:30 +08:00
|
|
|
|
2004-09-08 18:52:44 +08:00
|
|
|
*-ibm-aix*:mpxlf*_r )
|
|
|
|
try_cc_parallel="mpcc_r"
|
|
|
|
try_f77_parallel="mpxlf_r"
|
|
|
|
;;
|
|
|
|
|
|
|
|
Finally, at this point:
|
2004-02-13 23:27:30 +08:00
|
|
|
|
|
|
|
# check whether the C and Fortran compilers are compatible
|
|
|
|
case "$build:$cc:$f90" in
|
|
|
|
# list supported combinations here
|
|
|
|
...
|
|
|
|
|
2004-09-08 18:52:44 +08:00
|
|
|
you may insert the case corresponding to your architecture, with the
|
|
|
|
compilers that are known to work. Otherwise "configure" will write a
|
|
|
|
message like this:
|
|
|
|
|
|
|
|
----------------------------------------------
|
|
|
|
WARNING: the following problems were detected:
|
2004-02-13 23:27:30 +08:00
|
|
|
|
2004-09-08 18:52:44 +08:00
|
|
|
unsupported C/Fortran compilers combination:
|
|
|
|
CC=gcc, F77=f77, F90=g77
|
|
|
|
|
|
|
|
you may not be able to compile this program
|
|
|
|
----------------------------------------------
|
2004-02-13 23:27:30 +08:00
|
|
|
|
|
|
|
which you may however ignore.
|
|
|
|
|
2004-09-08 18:52:44 +08:00
|
|
|
*** 2: Specify compilation flags. ***
|
2004-02-13 23:27:30 +08:00
|
|
|
|
2004-09-08 18:52:44 +08:00
|
|
|
Look for these lines:
|
|
|
|
|
|
|
|
# check Fortran compiler flags
|
|
|
|
case "$build:$f90_id" in
|
|
|
|
ia64-*-linux-gnu:ifort | ia64-*-linux-gnu:efc )
|
|
|
|
...
|
|
|
|
x86_64-*-linux-gnu:pgf* )
|
|
|
|
...
|
|
|
|
etc.
|
|
|
|
|
|
|
|
Add an entry for your case and define:
|
|
|
|
|
|
|
|
- "try_fflags": flags for Fortran 77 compiler.
|
|
|
|
|
|
|
|
- "try_f90flags": flags for Fortran 90 compiler.
|
|
|
|
In most cases they will be the same as in Fortran 77 plus some
|
|
|
|
others. In that case, define them as "\$(FFLAGS) -something_else".
|
|
|
|
|
|
|
|
- "try_fflags_noopt": flags for Fortran 77 with all optimizations
|
|
|
|
turned off: this is usually "-O0".
|
|
|
|
These flags must be used for compiling flib/dlamch.f (part of our
|
|
|
|
version of Lapack): it won't compile properly with optimizations.
|
|
|
|
|
|
|
|
- "try_ldflags": flags for the linking phase (not including the list
|
|
|
|
of libraries, that is compiled later). Note that $f90 will be used
|
|
|
|
as the linker, if not specified otherwise.
|
|
|
|
|
|
|
|
- "try_ldflags_static": additional flags to select static compilation
|
|
|
|
(i.e., don't use shared libraries).
|
|
|
|
|
|
|
|
- "try_dflags": must be defined if there is in the code any #ifdef
|
|
|
|
specific to your compiler (for instance, -D__INTEL for Intel
|
|
|
|
compilers). Define it as "$try_dflags -D..." so that pre-existing
|
|
|
|
flags, if any, are conserved.
|
|
|
|
|
|
|
|
- if the Fortran 90 compiler is able to invoke the C preprocessor
|
|
|
|
automatically before compiling, define "have_cpp=1"; otherwise,
|
|
|
|
leave it undefined (I mean it -- *don't* define it as 0).
|
|
|
|
The appropriate "make.rules" will be generated accordingly.
|
|
|
|
If the compiler requires that any flags be specified in order to
|
|
|
|
invoke the preprocessor (for example, "-fpp " -- note the space),
|
|
|
|
specify them in "pre_fdflags".
|
|
|
|
|
|
|
|
For example, here's the entry for ifort on Linux PC:
|
|
|
|
|
|
|
|
*-pc-linux-gnu:ifort )
|
|
|
|
try_fflags="-Vaxlib -O2 -tpp6 -assume byterecl"
|
|
|
|
try_f90flags="\$(FFLAGS) -nomodule"
|
|
|
|
try_fflags_noopt="-O0"
|
|
|
|
try_ldflags="-Vaxlib"
|
|
|
|
try_ldflags_static="-static"
|
|
|
|
try_dflags="$try_dflags -D__INTEL"
|
|
|
|
pre_fdflags="-fpp "
|
|
|
|
have_cpp=1
|
|
|
|
;;
|
|
|
|
|
|
|
|
Then, look for these lines:
|
|
|
|
|
|
|
|
case "$build:$cc_id" in
|
|
|
|
ia64-*-linux-gnu:icc )
|
2004-02-13 23:27:30 +08:00
|
|
|
...
|
2004-09-08 18:52:44 +08:00
|
|
|
x86_64-*-linux-gnu:pgcc )
|
2004-02-13 23:27:30 +08:00
|
|
|
...
|
2004-09-08 18:52:44 +08:00
|
|
|
etc.
|
|
|
|
|
|
|
|
Add an entry for your case and define:
|
|
|
|
|
|
|
|
- "try_cflags": flags for C compiler.
|
|
|
|
|
|
|
|
- "c_ldflags": flags for linking, when using the C compiler as linker.
|
|
|
|
This is needed to check for libraries written in C, such as FFTW.
|
|
|
|
|
2004-02-13 23:27:30 +08:00
|
|
|
- if you need a different preprocessor from the standard one ($CC -E),
|
|
|
|
define it in "try_cpp".
|
|
|
|
|
2004-09-08 18:52:44 +08:00
|
|
|
For example for XLC on AIX:
|
2004-02-13 23:27:30 +08:00
|
|
|
|
2004-09-08 18:52:44 +08:00
|
|
|
*-ibm-aix*:mpcc* | *-ibm-aix*:xlc* | *-ibm-aix*:cc )
|
|
|
|
try_cflags="-q64 -O2"
|
|
|
|
c_ldflags="-q64"
|
|
|
|
;;
|
2004-02-13 23:27:30 +08:00
|
|
|
|
2004-09-08 18:52:44 +08:00
|
|
|
Finally, if you have to use a nonstandard preprocessor, look for these
|
|
|
|
lines:
|
2004-02-13 23:27:30 +08:00
|
|
|
|
|
|
|
# preprocessor
|
|
|
|
AC_PROG_CPP
|
|
|
|
if test "$cpp" = "" ; then cpp=$try_cpp; fi
|
|
|
|
if test "$cpp" = "" ; then cpp=$CPP; fi
|
|
|
|
|
|
|
|
echo $ECHO_N "setting CPPFLAGS... $ECHO_C"
|
|
|
|
case $cpp in
|
|
|
|
cpp) try_cppflags="-P -traditional" ;;
|
|
|
|
fpp) try_cppflags="-P" ;;
|
|
|
|
...
|
|
|
|
|
2004-09-08 18:52:44 +08:00
|
|
|
and set "try_cppflags" as appropriate.
|
|
|
|
|
|
|
|
*** 3. Search for libraries. ***
|
|
|
|
|
|
|
|
To instruct "configure" to search for libraries, you must tell it two
|
|
|
|
things: the names of libraries it should search for, and where it
|
|
|
|
should search.
|
|
|
|
First, look for these lines:
|
|
|
|
|
|
|
|
# build list of directories to search
|
|
|
|
if test $is_linux64 && test $is_ifort
|
|
|
|
then
|
|
|
|
...
|
|
|
|
elif test $is_linux64 && test $is_pgf
|
|
|
|
then
|
|
|
|
...
|
2004-02-13 23:27:30 +08:00
|
|
|
|
2004-09-08 18:52:44 +08:00
|
|
|
insert an entry for your architecture (and your compiler, if the
|
|
|
|
library to be searched for is compiler-specific), and define:
|
|
|
|
|
|
|
|
- "try_libdirs": a list of directories to search, separated by spaces.
|
|
|
|
|
|
|
|
Then, look for these lines:
|
2004-02-13 23:27:30 +08:00
|
|
|
|
|
|
|
# use vendor libraries if available
|
2004-09-08 18:52:44 +08:00
|
|
|
if test $is_linux64 && test $is_ifort
|
|
|
|
then
|
|
|
|
...
|
|
|
|
elif test $is_linux && test $is_ifort
|
|
|
|
then
|
2004-02-13 23:27:30 +08:00
|
|
|
...
|
2004-09-08 18:52:44 +08:00
|
|
|
etc.
|
2004-02-13 23:27:30 +08:00
|
|
|
|
2004-09-08 18:52:44 +08:00
|
|
|
If you want to search for a vendor-specific library, you'll have to
|
|
|
|
add an entry for that library here.
|
2004-02-13 23:27:30 +08:00
|
|
|
|
2004-09-08 18:52:44 +08:00
|
|
|
This is unfortunately a little bit too complex to explain.
|
|
|
|
Basic info: "AC_SEARCH_LIBS(function, name, ...)" looks for symbol
|
|
|
|
"function" in library "libname". If that is found, "-lname" is
|
|
|
|
appended to the LIBS environment variable (initially empty).
|
|
|
|
The real thing is more complicated than just that because the
|
|
|
|
"-Ldirectory" option must be added to search in a nonstandard
|
|
|
|
directory, and because a given library may require other libraries as
|
|
|
|
prerequisites (for example, Lapack requires BLAS). Hope this helps.
|