forked from flintlib/flint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·172 lines (155 loc) · 4.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
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
#!/bin/sh
# (C) 2007, Robert Bradshaw, William Hart, William Stein, Michael Abshoff
# (C) 2011, William Hart
PREFIX="/usr/local"
MPIR_DIR="/usr"
MPFR_DIR="/usr"
NTL_DIR="/usr"
WANT_NTL=0
SHARED=1
STATIC=1
REENTRANT=0
usage()
{
echo "Usage: ./configure <options> <args>"
echo " where <options> may be"
echo " -h display usage information"
echo " where <args> may be:"
echo " --with-mpir=<path> Specify location of MPIR"
echo " --with-mpfr=<path> Specify location of MPFR"
echo " --with-ntl=<path> Specify location of NTL and build NTL interface"
echo " --prefix=<path> Specify path to installation location"
echo " --disable-shared Do not build a shared library"
echo " --disable-static Do not build a static library"
echo " --reentrant Build fully reentrant version of library"
echo " --single Faster non-reentrant version of library (default)"
echo " CC=<name> Use the C compiler with the given name"
echo " AR=<name> Use the AR library builder with the given name"
echo " CFLAGS=<flags> Pass the given flags to the compiler"
}
until [ -z "$1" ]; do
case $1 in
"-h") usage
exit 0
;;
"--with-mpir="*)
MPIR_DIR=`expr substr "$1" 13 length "$1"`
;;
"--with-mpfr="*)
MPFR_DIR=`expr substr "$1" 13 length "$1"`
;;
"--with-ntl="*)
NTL_DIR=`expr substr "$1" 12 length "$1"`
WANT_NTL=1
;;
"--prefix="*)
PREFIX=`expr substr "$1" 10 length "$1"`
;;
"--disable-shared")
SHARED=0
;;
"--disable-static")
STATIC=0
;;
"--reentrant")
REENTRANT=1
;;
"--single")
REENTRANT=0
;;
"AR="*)
AR=`expr substr "$1" 4 length "$1"`
;;
"CC="*)
CC=`expr substr "$1" 4 length "$1"`
;;
"CFLAGS="*)
CFLAGS=`expr substr "$1" 8 length "$1"`
;;
*) usage
exit 1
;;
esac
shift
done
if [ -d "${MPIR_DIR}/lib" ]; then
MPIR_LIB_DIR="${MPIR_DIR}/lib"
MPIR_INCLUDE_DIR="${MPIR_DIR}/include"
elif [ -d "${MPIR_DIR}/.libs" ]; then
MPIR_LIB_DIR="${MPIR_DIR}/.libs"
MPIR_INCLUDE_DIR="${MPIR_DIR}"
else
echo "Invalid MPIR directory"
exit 1
fi
if [ -d "${MPFR_DIR}/lib" ]; then
MPFR_LIB_DIR="${MPFR_DIR}/lib"
MPFR_INCLUDE_DIR="${MPFR_DIR}/include"
elif [ -d "${MPFR_DIR}/.libs" ]; then
MPFR_LIB_DIR="${MPFR_DIR}/.libs"
MPFR_INCLUDE_DIR="${MPFR_DIR}"
else
echo "Invalid MPFR directory"
exit 1
fi
if [ -d "${NTL_DIR}/lib" ]; then
NTL_LIB_DIR="${NTL_DIR}/lib"
NTL_INCLUDE_DIR="${NTL_DIR}/include"
else
echo "Invalid NTL directory"
exit 1
fi
if [ "`uname`" = "Linux" -a "`uname -m`" = "x86_64" ]; then
FLINT_TUNE="-funroll-loops "
elif [ "`uname`" = "Darwin" -a "`uname -m`" = "Power Macintosh" ]; then
FLINT_TUNE=" -funroll-loops "
elif [ "`uname -p`" = "powerpc" ]; then
FLINT_TUNE="-m64 -mcpu=970 -mtune=970 -mpowerpc64 -falign-loops=16 -falign-functions=16 -falign-labels=16 -falign-jumps=16"
elif [ "`uname -m`" = "ia64" ]; then
# -funroll-loops crashes the build on itanium under GCC-4.2.1, as reported by
# Kate Minola.
FLINT_TUNE=" "
else
FLINT_TUNE="-funroll-loops "
fi
if [ "`uname`" = "Darwin" ]; then
FLINT_LIB="libflint.dylib"
else
FLINT_LIB="libflint.so"
fi
if [ -z "$CFLAGS" ]; then
CFLAGS="-O2 -g -ansi -pedantic -Wall"
fi
if [ -z "$CC" ]; then
CC=gcc
fi
if [ -z "$CXX" ]; then
CXX=g++
fi
if [ "$REENTRANT" = "1" ]; then
cp fmpz/link/fmpz_reentrant.c fmpz/fmpz.c
REENTER="-DFLINT_REENTRANT"
else
cp fmpz/link/fmpz_single.c fmpz/fmpz.c
REENTER=""
fi
CFLAGS="$CFLAGS $FLINT_TUNE $REENTER"
echo "# This file is autogenerated by ./configure -- do not edit!" > Makefile
echo "" >> Makefile
echo "FLINT_STATIC=$STATIC" >> Makefile
echo "FLINT_SHARED=$SHARED" >> Makefile
echo "WANT_NTL=$WANT_NTL" >> Makefile
echo "FLINT_MPIR_LIB_DIR=$MPIR_LIB_DIR" >> Makefile
echo "FLINT_MPIR_INCLUDE_DIR=$MPIR_INCLUDE_DIR" >> Makefile
echo "FLINT_MPFR_LIB_DIR=$MPFR_LIB_DIR" >> Makefile
echo "FLINT_MPFR_INCLUDE_DIR=$MPFR_INCLUDE_DIR" >> Makefile
echo "FLINT_NTL_LIB_DIR=$NTL_LIB_DIR" >> Makefile
echo "FLINT_NTL_INCLUDE_DIR=$NTL_INCLUDE_DIR" >> Makefile
echo "" >> Makefile
echo "FLINT_LIB=$FLINT_LIB" >> Makefile
echo "CC=$CC" >> Makefile
echo "CXX=$CXX" >> Makefile
echo "CFLAGS=$CFLAGS" >> Makefile
echo "PREFIX=$PREFIX" >> Makefile
echo "" >> Makefile
cat Makefile.in >> Makefile