This repository has been archived by the owner on May 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathconfigure
executable file
·91 lines (77 loc) · 2.5 KB
/
configure
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
#! /bin/sh
set -e
curdir=`pwd`
base=$(cd $(dirname $0) && pwd)
src=$base
while [ "${1#-}" != "$1" ]; do
opt=$1
shift
case $opt in
--prefix=*) prefix=${opt#*=} ;;
--src=*) src=${opt#*=} ;;
-t) target=$1; shift ;;
-u) update=y ;;
-n) run=echo ;;
-j*) make_j=$opt ;;
esac
done
if [ "$update" = y ]; then
$base/update
fi
cross=${target:+${target}-}
machine=$(${cross}gcc -dumpmachine)
gcc=${machine}-gcc
prefix=${prefix:-/opt/path64}
if [ -z "$build" ]; then
build=$curdir/build
fi
$run mkdir -p $build
$run cd $build
case $machine in
mips64*) targets='mips_32=-mabi=n32 mips_64=-mabi=64' ;;
x86*64*|amd64*) targets='x86_64=-m64' ;;
*) echo "Unsupported machine $machine"; exit 1 ;;
esac
for t in $targets; do
name=${t%%=*}
flags=${t#$name}
flags=${flags#=}
path64_targets="${path64_targets:+${path64_targets};}$name"
libgcc=$($gcc $flags -print-libgcc-file-name)
crt=$($gcc $flags -print-file-name=crt1.o)
gcclib=$(dirname ${libgcc})
gcccrt=$(dirname ${crt})
ld_so=$($gcc $flags --help -v 2>&1 >/dev/null |
awk '/-dynamic-linker/ { match($0, "-dynamic-linker +[^ ]+");
print substr($0, RSTART+16, RLENGTH-16) }')
PATH64_DEFS="$PATH64_DEFS
-DPSC_CRT_PATH_${name}=${gcccrt}
-DPSC_CRTBEGIN_PATH_${name}=${gcclib}
-DPSC_DYNAMIC_LINKER_${name}=${ld_so}
"
done
if [ -n "${target}" ]; then
psc_target="-DPSC_TARGET=${machine}"
fi
$run cmake -DCMAKE_INSTALL_PREFIX=$prefix \
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Debug} \
${psc_target} \
-DPATH64_ENABLE_TARGETS="$path64_targets" \
${PATH64_DEFS} \
-DPATH64_ENABLE_PROFILING=ON \
-DPATH64_ENABLE_FORTRAN=ON \
-DPATH64_ENABLE_MATHLIBS=ON \
-DPATH64_ENABLE_OPENMP=ON \
-DPATH64_ENABLE_PATHOPT2=OFF \
-DCMAKE_C_COMPILER=${CC:-`which pathcc`} \
-DCMAKE_CXX_COMPILER=${CXX:-`which pathCC`} \
$src
makefile=$curdir/Makefile
cat - > $makefile <<EOF
# make this the default
all:
\$(MAKE) -C build \$@
install test:
\$(MAKE) -C build \$@
.PHONY: all install test
EOF