CERNLIB(1) | General Commands Manual | CERNLIB(1) |
cernlib - print CERN library dependencies
cernlib [options] libraries
cernlib is a tool to list the compiler and linker options necessary to compile a CERNLIB program that has the given library dependencies. It is generally used within a command substitution, as in the following example:
gfortran -o myprogram myprogram.F `cernlib -G Motif pawlib`
This version of cernlib has been completely rewritten from the original script provided by CERN. It now does recursive library dependency checking and removes duplicate entries.
Note that by default, the cernlib script assumes that the CERN libraries are to be linked against statically; if the environment variables $CERN or $CERN_ROOT are specified, it looks for the libraries only in the "lib" subdirectory of those locations, not any "shlib" subdirectory. Furthermore, the script brackets the CERN libraries with linker instructions to link statically. This is done to preserve the original upstream behavior, in which all CERNLIB libraries exist only in static form. For instance, "cernlib packlib" outputs:
-Wl,-static -lpacklib -lkernlib -Wl,-dy -lm -lnsl -lcrypt -ldl -lg2c
If you want to link against ALL libraries (including CERNLIB) either statically or dynamically, call the cernlib script with its -safe flag to omit these bracketing linker flags. That is: if you want to link against all libraries (not just CERNLIB) statically, use the -static compiler flag and call cernlib with its -safe flag:
gfortran -o myprogram myprogram.F -static `cernlib -safe -G Motif pawlib`
and if you want to link against all libraries (including the CERN libraries) dynamically, use the same command without the -static compiler flag (the linker assumes dynamic linking by default):
gfortran -o myprogram myprogram.F `cernlib -safe -G Motif pawlib`
The following library names are recognized by this version of the cernlib script. These names may be used exactly as shown here, or prefixed by "-l".
/usr/share/doc/cernlib-base/README.Debian describes some of the changes that have been made to the CERN libraries in order to comply with Debian policy and the Filesystem Hierarchy Standard.
CERNLIB documentation for all related libraries and programs is available at the following URL: http://cern.ch/cernlib/
This manual page and the version of the cernlib script that it describes were written by Kevin McCarty <kmccarty@debian.org> for the Debian GNU/Linux system (but may be used by others). They are licensed under the GNU General Public License, version 2 or later (at your choice).
Copyright (C) Kevin B. McCarty, 2002, 2003, 2004, 2005, 2006.
January 6, 2005 |