-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
185 lines (153 loc) · 4.98 KB
/
configure.ac
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
dnl
dnl configure.in
dnl
dnl SMO - Storage Optimizer (experimental)
dnl
dnl Copyright (C) 2014-2016 Somashekaracharya G B
dnl
dnl See file LICENSE
dnl
AC_PREREQ(2.13)
AC_INIT(smo, 0.1, [[email protected]])
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE()
dnl AM_SILENT_RULES([yes])
AM_CONFIG_HEADER(config.h)
dnl clan, candl, cloog are all configured with 64-bit data type support
dnl NOTE: configuring these 64-bit data type support has nothing to do with arch
dnl being 32-bit/64-bit
CFLAGS="$CLAGS -Wall"
if test CC = icc; then
LDFLAGS="$LDFLAGS -lirc -limf"
fi
debug="false"
dnl debugging flag
AC_ARG_ENABLE(debug,
[ --enable-debug enable compilation with debugging info ],
debug="true")
if test $debug = "true"; then
CFLAGS="$CFLAGS -g -DDEBUG"
fi
dnl check for programs
AC_CHECK_PROG(CC,gcc,gcc)
AC_PROG_CXX
dnl AC_CHECK_PROG(CXX,g++,g++)
AC_CHECK_PROG(LD,ld,ld)
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_LIBTOOL
dnl check for some compiler characteristics
dnl MC_CHECK_GUIDING_DECLS
AC_SUBST(GUIDING_DECLS)
dnl check for typedefs, structures, compiler features
AC_C_CONST
AC_CHECK_HEADERS(math.h stdlib.h stdio.h assert.h string.h)
dnl set SOURCE_DIR to current directory
SOURCE_DIR=`pwd`
AC_SUBST(SOURCE_DIR)
AC_CHECK_PROG(CP,cp,cp)
AC_CHECK_PROG(RM,rm,rm -f)
AC_CHECK_PROG(MV,mv,mv)
AC_CHECK_PROG(CAT,cat,cat)
AC_CHECK_PROG(AR,ar,ar)
AC_CHECK_PROG(STRIP,strip,strip)
AC_CHECK_PROG(SED,sed,sed)
dnl Offer --with-gmp-prefix.
AC_ARG_WITH(gmp-prefix,
AC_HELP_STRING([--with-gmp-prefix=DIR],
[DIR Location of GMP package]),
[CPPFLAGS="${CPPFLAGS} -I$withval/include";
LDFLAGS="${LDFLAGS} -L$withval/lib";
LIBS="-lgmp $LIBS";
GMP_PREFIX="$withval";
])
AC_CHECK_HEADER(gmp.h,
[AC_CHECK_LIB(gmp,main,
[poly_cv_gmpfatal="no"],
[poly_cv_gmpfatal="yes"])],
[poly_cv_gmpfatal="yes"])
dnl Request arch flag
ARCHGIVEN="false"
AC_ARG_WITH(gcc-arch,
AC_HELP_STRING([--with-gcc-arch=ARCH],
[ARCH Architecture to compile smo for (march, mcpu etc.]),
[ARCHGIVEN="true";
ARCH="$withval";])
archopts=""
if test $ARCHGIVEN = "true"; then
archopts="--with-gcc-arch=$ARCH"
fi
if test "$poly_cv_gmpfatal" = "yes"; then
AC_MSG_ERROR([GMP not found])
else
AC_CHECK_DECLS(mp_get_memory_functions,[],[
AC_LIBOBJ(mp_get_memory_functions)
],[#include <gmp.h>
])
fi
AC_SUBST(ISL_INCLUDE)
AC_SUBST(ISL_LDFLAGS)
AC_SUBST(ISL_LIBADD)
dnl Provide --with-isl-prefix
AC_ARG_WITH(isl-prefix,
AC_HELP_STRING([--with-isl-prefix=DIR],
[DIR location where isl is installed]),
[isl_prefix=$withval;
ISL_INCLUDE="-I$withval/include";
ISL_LDFLAGS="-L$withval/lib";
ISL_LIBADD="$withval/lib/libisl.la";
external_isl=true
],
[external_isl=false])
AM_CONDITIONAL(EXTERNAL_ISL, test x$external_isl = xtrue)
if test x$external_isl = xfalse; then
dnl Configuring isl
dnl the current isl submodule still supports the piplib
dnl options, but the trunk of isl doesn't
echo ""
echo "======================"
echo "Configuring isl"
echo "======================"
configureopts="--with-gmp=system \
--with-gmp-prefix=$GMP_PREFIX \
--with-gmp-exec-prefix=$GMP_PREFIX \
--with-piplib=no \
--prefix=$prefix"
(cd isl/
./configure ${configureopts} ${archopts}
)
fi
dnl Offer --with-clang-prefix
AC_ARG_WITH(clang-prefix,
AC_HELP_STRING([--with-clang-prefix=DIR], [DIR location of clang install]),
[
CLANG_PREFIX="$withval";
external_clang=true
],
[external_clang=false]
)
AM_CONDITIONAL(EXTERNAL_CLANG, test x$external_clang = xtrue)
dnl Configure PET
echo -e "\n=========================="
echo "Configuring PET"
echo "=========================="
if test x$external_clang = xtrue; then
configureopts="CXXFLAGS=-fno-rtti --with-clang-prefix=$CLANG_PREFIX --with-clang-exec-prefix=$CLANG_PREFIX --with-isl-builddir=../isl --prefix=$prefix"
else
configureopts="CXXFLAGS=-fno-rtti --with-isl-builddir=../isl --prefix=$prefix"
fi
(cd pet && ./configure ${configureopts})
AC_PATH_PROGS(BASH, bash)
AC_CONFIG_FILES([getversion.sh], [chmod +x ./getversion.sh])
AC_CONFIG_COMMANDS([version.h],
[echo '#define SMO_VERSION "'`./getversion.sh`'"' > src/version.h])
AC_OUTPUT(Makefile \
src/Makefile \
)
echo " /*-----------------------------------------------*"
echo " * SMO configuration is OK *"
echo " *-----------------------------------------------*/"
echo "Your system is ready to compile SMO"
echo "Run 'make' next to compile"
echo "Use src/smo (see README)"