-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·131 lines (105 loc) · 3.28 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
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
#!/bin/bash
CC=g++
CFLAGS="-fPIC -c"
SWIG=swig
SWIGFLAGS="-c++ -python -o"
PYTHON=python
PYTHON_VERSION=
PYTHON_ROOT=
PYTHON_INCLUDE=
# Internal flags
flag_no_python=
for option
do
case $option in
-help | --help | -h)
want_help=yes ;;
-with-python=* | --with-pyton=* )
PYTHON=`expr "x$option" : "x-*with-python=\(.*\)"`
;;
-with-python-root=* | --with-python-root=* )
PYTHON_ROOT=`expr "x$option" : "x-*with-python-root=\(.*\)"`
;;
-with-python-version=* | --whith-python-version=* )
PYTHON_VERSION=`expr "x$option" : "x-*with-python-version=\(.*\)"`
;;
-*)
{ echo "error: unrecognized option: $option
Try \`$0 --help' for more information." >&2
{ (exit 1); exit 1; }; }
;;
esac
done
if test "x$want_help" = xyes; then
cat <<EOF
\`configure' configures stein to adapt to a few kinds of systems.
Usage: $0 [OPTION]...
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--with-python=PYTHON specify the Python executable [python]
--with-python-root=DIR specify the root of the Python installation
[automatically detected]
--with-python-version=X.Y specify the Python version as X.Y
[automatically detected]
EOF
fi
test -n "$want_help" && exit 0
# Find python
if test "x$flag_no_python" = x; then
result=`$PYTHON -c "exit" > /dev/null 2>&1`
if [ "$?" -ne "0" ]; then
flag_no_python=yes
fi
fi
if test "x$flag_no_python" = x; then
if test "x$PYTHON_VERSION" = x; then
echo -n "Detecting Python version... "
PYTHON_VERSION=`$PYTHON -c "import sys; print (\"%d.%d\" %
(sys.version_info[0], sys.version_info[1]))"`
echo $PYTHON_VERSION
fi
if test "x$PYTHON_ROOT" = x; then
echo -n "Detecting Python root... "
PYTHON_ROOT=`$PYTHON -c "import sys; print sys.prefix"`
echo $PYTHON_ROOT
fi
if test "x$PYTHON_INCLUDE" = x; then
echo -n "Detecting Python libraries... "
if test -e $PYTHON_ROOT/include/python$PYTHON_VERSION/Python.h; then
PYTHON_INCLUDE="$PYTHON_ROOT/include/python$PYTHON_VERSION"
else
PYTHON_INCLUDE="./python"
fi
echo $PYTHON_INCLUDE
fi
fi
# Generate the Makefile
echo "Generating Makefile..."
cat > Makefile <<EOF
CC=$CC
CFLAGS=$CFLAGS
SWIG=$SWIG
SWIGFLAGS=$SWIGFLAGS
PYTHON=$PYTHON
PYTHON_VERSION=$PYTHON_VERSION
PYTHON_ROOT=$PYTHON_ROOT
PYTHON_INCLUDE=$PYTHON_INCLUDE
all: floydwarshall
@echo "chmod u+x stein.py"
@chmod u+x stein.py
swig: .dummy
@echo "\$(SWIG) \$(SWIGFLAGS) floydwarshall_wrap.cpp floydwarshall.i"
@\$(SWIG) \$(SWIGFLAGS) floydwarshall_wrap.cpp floydwarshall.i
floydwarshall: .dummy
@echo "\$(CC) \$(CFLAGS) floydwarshall.cpp floydwarshall_wrap.cpp -I\$(PYTHON_INCLUDE) -I\$(PYTHON_ROOT)/lib/python\$(PYTHON_VERSION)"
@\$(CC) \$(CFLAGS) floydwarshall.cpp floydwarshall_wrap.cpp -I\$(PYTHON_INCLUDE) -I\$(PYTHON_ROOT)/lib/python\$(PYTHON_VERSION)
@echo "\$(CC) -shared floydwarshall.o floydwarshall_wrap.o -o _floydwarshall.so"
@\$(CC) -shared floydwarshall.o floydwarshall_wrap.o -o _floydwarshall.so
clean: .dummy
rm -f *.pyc *.o *.so
distclean: clean
rm -f Makefile
.dummy:
.PHONY: clean distclean
EOF