/usr/bin/mpicc.mpich is in libmpich-dev 3.2-6build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | #! /bin/bash
#
# (C) 2006 by Argonne National Laboratory.
# See COPYRIGHT in top-level directory.
#
# mpicc
# Simple script to compile and/or link MPI programs.
# This script knows the default flags and libraries, and can handle
# alternative C compilers and the associated flags and libraries.
# The important terms are:
# includedir, libdir - Directories containing an *installed* mpich
# prefix, execprefix - Often used to define includedir and libdir
# CC - C compiler
# WRAPPER_CFLAGS - Any special flags needed to compile
# WRAPPER_LDFLAGS - Any special flags needed to link
# WRAPPER_LIBS - Any special libraries needed in order to link
#
# We assume that (a) the C compiler can both compile and link programs
#
# Handling of command-line options:
# This is a little tricky because some options may contain blanks.
#
# Special issues with shared libraries - todo
#
# --------------------------------------------------------------------------
# Set the default values of all variables.
#
# Directory locations: Fixed for any MPI implementation.
# Set from the directory arguments to configure (e.g., --prefix=/usr/local)
prefix=/usr
exec_prefix=/usr
sysconfdir=/etc/mpich
includedir=/usr/include/mpich
libdir=/usr/lib/x86_64-linux-gnu
# Default settings for compiler, flags, and libraries.
# Determined by a combination of environment variables and tests within
# configure (e.g., determining whehter -lsocket is needee)
CC="gcc"
MPICH_VERSION="3.2"
enable_wrapper_rpath="no"
# How to pass a linker flag through the compiler.
wl="-Wl,"
# Static library suffix (normally "a").
libext="a"
# Shared library suffix (normally "so").
shlibext="so"
# Format of library name prefix.
libname_spec="lib\$name"
# Library names that the linker finds when passed -lNAME.
library_names_spec="\$libname\$shrext"
# Flag to hardcode $libdir into a binary during linking.
# This must work even if $libdir does not exist.
hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir -Wl,--enable-new-dtags"
# Whether we need a single -rpath flag with a separated argument.
hardcode_libdir_separator=""
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
# resulting binary.
hardcode_direct="no"
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
# resulting binary.
hardcode_minus_L="no"
# Internal variables
# Show is set to echo to cause the compilation command to be echoed instead
# of executed.
Show=
#
# End of initialization of variables
#---------------------------------------------------------------------
# Environment Variables.
# The environment variables MPICH_CC may be used to override the
# default choices.
# In addition, if there is a file $sysconfdir/mpicc-$CCname.conf,
# where CCname is the name of the compiler with all spaces replaced by hyphens
# (e.g., "cc -64" becomes "cc--64", that file is sources, allowing other
# changes to the compilation environment. See the variables used by the
# script (defined above)
# Added MPICH_CC_OLD, MPICH_CC can be used to prefix CC with external utility,
# e.g. setenv MPICH_CC 'eval linkcache $MPICH_CC_OLD'
if [ -n "$MPICH_CC" ] ; then
MPICH_CC_OLD="$CC"
CC="$MPICH_CC"
CCname=`echo $CC | sed 's/ /-/g'`
if [ -s $sysconfdir/mpicc-$CCname.conf ] ; then
. $sysconfdir/mpicc-$CCname.conf
fi
fi
# Allow a profiling option to be selected through an environment variable
if [ -n "$MPICC_PROFILE" ] ; then
profConf=$MPICC_PROFILE
fi
#
# ------------------------------------------------------------------------
# Argument processing.
# This is somewhat awkward because of the handling of arguments within
# the shell. We want to handle arguments that include spaces without
# loosing the spacing (an alternative would be to use a more powerful
# scripting language that would allow us to retain the array of values,
# which the basic (rather than enhanced) Bourne shell does not.
#
# Look through the arguments for arguments that indicate compile only.
# If these are *not* found, add the library options
linking=yes
allargs=("$@")
argno=0
interlib_deps=yes
for arg in "$@" ; do
# Set addarg to no if this arg should be ignored by the C compiler
addarg=yes
case "$arg" in
# ----------------------------------------------------------------
# Compiler options that affect whether we are linking or no
-c|-S|-E|-M|-MM)
# The compiler links by default
linking=no
;;
# ----------------------------------------------------------------
# Options that control how we use mpicc (e.g., -show,
# -cc=* -config=*
-static)
interlib_deps=no
;;
-echo)
addarg=no
set -x
;;
-cc=*)
CC=`echo A$arg | sed -e 's/A-cc=//g'`
addarg=no
;;
-show)
addarg=no
Show=echo
;;
-config=*)
addarg=no
CCname=`echo A$arg | sed -e 's/A-config=//g'`
if [ -s "$sysconfdir/mpicc-$CCname.conf" ] ; then
. "$sysconfdir/mpicc-$CCname.conf"
else
echo "Configuration file mpicc-$CCname.conf not found"
fi
;;
-compile-info|-compile_info)
# -compile_info included for backward compatibility
Show=echo
addarg=no
;;
-link-info|-link_info)
# -link_info included for backward compatibility
Show=echo
addarg=no
;;
-v)
# Pass this argument to the compiler as well.
echo "mpicc for MPICH version $MPICH_VERSION"
# if there is only 1 argument, it must be -v.
if [ "$#" -eq "1" ] ; then
linking=no
fi
;;
-profile=*)
# Pass the name of a profiling configuration. As
# a special case, lib<name>.so or lib<name>.la may be used
# if the library is in $libdir
profConf=`echo A$arg | sed -e 's/A-profile=//g'`
addarg=no
# Loading the profConf file is handled below
;;
-nativelinking)
# Internal option to use native compiler for linking without MPI libraries
nativelinking=yes
addarg=no
;;
-help)
NC=`echo "$CC" | sed 's%\/% %g' | awk '{print $NF}' -`
if [ -f "$sysconfdir/mpixxx_opts.conf" ] ; then
. $sysconfdir/mpixxx_opts.conf
echo " -cc=xxx - Reset the native compiler to xxx."
else
if [ -f "./mpixxx_opts.conf" ] ; then
. ./mpixxx_opts.conf
echo " -cc=xxx - Reset the native compiler to xxx."
fi
fi
exit 0
;;
*)
;;
esac
if [ $addarg = no ] ; then
unset allargs[$argno]
fi
# Some versions of bash do not accept ((argno++))
argno=`expr $argno + 1`
done
if [ $# -eq 0 ] ; then
echo "Error: Command line argument is needed!"
"$0" -help
exit 1
fi
# -----------------------------------------------------------------------
# Derived variables. These are assembled from variables set from the
# default, environment, configuration file (if any) and command-line
# options (if any)
PROFILE_FOO=
# Handle the case of a profile switch
if [ -n "$profConf" ] ; then
profConffile=
if [ -s "$libdir/lib$profConf.a" -o -s "$libdir/lib$profConf.so" ] ; then
PROFILE_FOO="-l$profConf"
elif [ -s "$sysconfdir/$profConf.conf" ] ; then
profConffile="$sysconfdir/$profConf.conf"
elif [ -s "$profConf.conf" ] ; then
profConffile="$profConf.conf"
else
echo "Profiling configuration file $profConf.conf not found in $sysconfdir"
fi
if [ -n "$profConffile" -a -s "$profConffile" ] ; then
. $profConffile
fi
fi
final_cflags=" "
final_cppflags=" "
final_ldflags=" -Wl,-Bsymbolic-functions -Wl,-z,relro"
final_libs=""
if test "yes" = "no" -o "${interlib_deps}" = "no" ; then
final_ldflags="${final_ldflags} -Wl,-Bsymbolic-functions -Wl,-z,relro"
final_libs="${final_libs} -lpthread -lcr -lrt -lpthread "
fi
# -----------------------------------------------------------------------
#
# A temporary statement to invoke the compiler
# Place the -L before any args incase there are any mpi libraries in there.
# Eventually, we'll want to move this after any non-MPI implementation
# libraries.
# We use a single invocation of the compiler. This will be adequate until
# we run into a system that uses a separate linking command. With any luck,
# such archaic systems are no longer with us. This also lets us
# accept any argument; we don't need to know if we've seen a source
# file or an object file. Instead, we just check for an option that
# suppressing linking, such as -c or -M.
if [ "$linking" = yes ] ; then
# Attempt to encode rpath info into the executable if the user has not
# disabled rpath usage and some flavor of rpath makes sense on this
# platform.
# TODO configure and config.rpath are computing more sophisticated rpath
# schemes than this simple one. Consider updating this logic accordingly.
if test "X$enable_wrapper_rpath" = "Xyes" ; then
eval rpath_flags=\"${hardcode_libdir_flag_spec}\"
else
rpath_flags=""
fi
if [ "$nativelinking" = yes ] ; then
$Show $CC ${final_cppflags} $PROFILE_INCPATHS ${final_cflags} ${final_ldflags} "${allargs[@]}" -I$includedir
rc=$?
else
$Show $CC ${final_cppflags} $PROFILE_INCPATHS ${final_cflags} ${final_ldflags} "${allargs[@]}" -I$includedir -L$libdir $PROFILE_PRELIB $PROFILE_FOO $rpath_flags -lmpich $PROFILE_POSTLIB ${final_libs}
rc=$?
fi
else
$Show $CC ${final_cppflags} $PROFILE_INCPATHS ${final_cflags} "${allargs[@]}" -I$includedir
rc=$?
fi
exit $rc
|