-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure
72 lines (55 loc) · 2.02 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
#!/bin/sh
if [ ! -d "./tmp" ]; then
mkdir tmp
fi
sed "s/@FUNC@/`basename $1 .f`/" < tmp/pot.tm.in > tmp/pot.tm
#Figure out which kernel to build for
OS=`uname | cut -c 1`
# C = CYGWIN
# L = Linux
# D = Darwin (Macintosh)
case $OS in
"C") osc="/Windows" ;;
"L") osc="/Linux" ;;
"D") osc="";;
esac
if [ ! -e "mathdir" ]; then #find out if the install dir is known. if not, find using env variable
if [ $OS = "C" ]; then
echo "You are running cygwin, which makes finding the default path of Mathematica difficult."
echo "Please enter the install directory of Mathematica (this is stored as '\$InstallationDirectory' in Mathematica)"
echo "in Linux form. You can access Windows drives in Cygwin through /cygdrive/(drive letter)"
read -p ": " mathdir
elif [ $OS = "D" ]; then
mathdir="/Applications/Mathematica.app"
else
mathdir=`math -run 'Write["stdout", $InstallationDirectory]; Exit[]' -noprompt`
mathdir=`echo $mathdir | sed "s/^\"\(.*\)\"$/\1/"`
fi
echo $mathdir/SystemFiles/Links/MathLink/DeveloperKit$osc/CompilerAdditions > mathdir
fi
mathdir=`cat mathdir`
if [ $OS = "C" ]; then
"$mathdir/cygwin/bin/mprep.exe" tmp/pot.tm -o src/pot.tm.c
else
$mathdir/mprep tmp/pot.tm -o src/pot.tm.c
fi
#Escape out all of the backslashes and periods
mathdir=`echo $mathdir | sed 's/\//\\\\\//g'`
mathdir=`echo $mathdir | sed 's/\./\\\./g'`
mathdir=`echo $mathdir | sed 's/ /\\ /g'`
case $OS in
"C") cflags="-mwindows -mwin32 -L\"$mathdir\/cygwin\/lib\" -I\"$mathdir\/cygwin\/include\" -lML32i3 -static" ;;
"L") cflags="-L$mathdir -I$mathdir -lML64i3 -lpthread -lrt" ;;
"D") cflags="-L$mathdir -I$mathdir -lMLi3 -lstdc++ -framework Foundation";;
esac
sed -e "s/@ffile@/`basename $1`/" -e "s/@cflags@/$cflags/" < tmp/Makefile.in > Makefile
cp $1 ./src
if [ ! -d "bin" ]; then
mkdir bin
fi
if [ $OS = "C" ]; then
mv Makefile Makefile~
sed -e "s/gcc/i686\-pc\-mingw32\-gcc/g" -e "s/gfortran/i686\-pc\-mingw32\-gfortran/g" <Makefile~ >Makefile
rm Makefile~
cp /bin/cygwin1.dll /bin/cyggcc_s-1.dll /bin/cyggfortran-3.dll ./
fi