-
Notifications
You must be signed in to change notification settings - Fork 0
/
mpicc.in
81 lines (76 loc) · 1.85 KB
/
mpicc.in
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
#!/bin/bash
# install-dirs
includedir="@includedir@"
libdir="@libdir@"
@CC@=@cc@
if [[ -n "$MPI_@CC@" ]]; then
# shellcheck disable=SC2034
MPI_@CC@_OLD="$@CC@"
@CC@="$MPI_@CC@"
fi
Exec="exec"
mode="link"
arglist=("$@")
argindex=0
for arg in "$@" ; do
addarg=no
case "$arg" in
-c|-S|-E|-M|-MM)
mode="compile"
addarg=yes
;;
-@op@=*)
@CC@="${arg#*=}"
;;
-show|-showme)
Exec="echo"
;;
-show-compile-info|-showme:compile)
mode="show-compile"
;;
-show-link-info|-showme:link)
mode="show-link"
;;
-show-incdir|-showme:incdir)
mode="show-incdir"
;;
-show-libdir|-showme:libdir)
mode="show-libdir"
;;
-show-libs|-showme:libs)
mode="show-libs"
;;
*)
addarg=yes
;;
esac
if [[ "$addarg" = "no" ]]; then
unset 'arglist[$argindex]'
fi
argindex=$((argindex + 1))
unset addarg
done
unset argindex
if [[ $# -eq 0 ]]; then
printf "%s: command line argument is required\n" "$0"
"$@CC@" --help
exit 1
fi
if [[ "@${arglist[*]}" = "@-v" ]]; then
mode=""
fi
if [[ "$mode" = "compile" ]]; then
$Exec "${@CC@}" "${arglist[@]}" -I"${includedir}"
elif [[ "$mode" = "link" ]]; then
$Exec "${@CC@}" "${arglist[@]}" -I"${includedir}" -L"${libdir}" -lmpi_abi
elif [[ "$mode" = "" ]]; then
$Exec "${@CC@}" "${arglist[@]}"
else
case "$mode" in
show-compile) printf -- "-I%s\n" "${includedir}";;
show-link) printf -- "-L%s -l%s\n" "${libdir}" mpi_abi;;
show-incdir) printf -- "%s\n" "${includedir}";;
show-libdir) printf -- "%s\n" "${libdir}";;
show-libs) printf -- "%s\n" mpi_abi;;
esac
fi