-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfigure.ac
233 lines (217 loc) · 6.14 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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
AC_INIT([LoopChainIR],[version-0.1])
dnl m4_include([m4/ax_require_defined.m4])
dnl m4_include([m4/ax_cxx_compile_stdcxx.m4])
dnl m4_include([m4/ax_cxx_compile_stdcxx_11.m4])
dnl m4_include([m4/ax_cxx_check_lib.m4])
dnl m4_include([m4/ax_try_link.m4])
AC_CONFIG_MACRO_DIR([m4])
dnl Set language to C++
AC_LANG([C++])
AC_PROG_CXX
AX_CXX_COMPILE_STDCXX_11([noext])
dnl Create command line flags
dnl Create flags for all linear solver backends
dnl Create --with-ortools-backend flag
dnl TODO Prove that solver is present
OR_TOOLS_USE_SOLVERS=""
AC_ARG_WITH(
[scip_solver],
[AS_HELP_STRING(
[--with-scip-solver],
[Use scip as the linear solver backend]
)],
[OR_TOOLS_USE_SOLVERS+="-DUSE_SCIP "]
)
AC_ARG_WITH(
[glpk_solver],
[AS_HELP_STRING(
[--with-glpk-solver],
[Use glpk as the linear solver backend]
)],
[OR_TOOLS_USE_SOLVERS+="-DUSE_GLPK "]
)
AC_ARG_WITH(
[cbc_solver],
[AS_HELP_STRING(
[--with-cbc-solver],
[Use cbc as the linear solver backend]
)],
[OR_TOOLS_USE_SOLVERS+="-DUSE_CBC "]
)
AC_ARG_WITH(
[slm_solver],
[AS_HELP_STRING(
[--with-slm-solver],
[Use slm as the linear solver backend]
)],
[OR_TOOLS_USE_SOLVERS+="-DUSE_SLM "]
)
AC_ARG_WITH(
[gurobi_solver],
[AS_HELP_STRING(
[--with-gurobi-solver],
[Use gurobi as the linear solver backend]
)],
[OR_TOOLS_USE_SOLVERS+="-DUSE_GUROBI "]
)
AC_ARG_WITH(
[cplex_solver],
[AS_HELP_STRING(
[--with-cplex-solver],
[Use cplex as the linear solver backend]
)],
[OR_TOOLS_USE_SOLVERS+="-DUSE_CPLEX "]
)
dnl TODO Automatically find and determine a solver to use
AS_IF(
[test x"$OR_TOOLS_USE_SOLVERS" == x""],
[AC_MSG_NOTICE([No solver specified, defaulting to CBC])]
OR_TOOLS_USE_SOLVERS="-DUSE_CBC"
)
dnl Create --enable-debugging
AC_ARG_ENABLE(
[debugging],
[AS_HELP_STRING(
[--enable-debugging],
[Enable gdb debugging options. Default=no]
)],
CXX_DEBUG_FLAGS="-ggdb",
CXX_DEBUG_FLAGS=""
)
dnl Create --enable-rose
AC_ARG_ENABLE(
[rose],
[AS_HELP_STRING(
[--enable-rose],
[Enable using Rose and Rose dependent parts of library. (Default=yes)]
)]
)
dnl set CXXFLAGS
CXX_BASE_FLAGS="-fPIC"
CXX_WARNING_LEVEL="-Wall -Wno-deprecated -Wextra"
CXX_OPTIMIZATION_LEVEL="-O3"
CXXFLAGS="${CXX_BASE_FLAGS} ${CXX_WARNING_LEVEL} ${CXX_OPTIMIZATION_LEVEL} ${CXX_DEBUG_FLAGS} ${OR_TOOLS_USE_SOLVERS} ${CXXFLAGS}"
dnl Check existance of libraries
dnl Check for ISL
dnl Check for ISL headers
AC_CHECK_HEADERS(
[isl/version.h],
[],
[AC_MSG_ERROR(A Working Integer Set Library (ISL) installation is required. (Missing isl/version.h.))]
)
dnl Check for ISL Library
AC_SEARCH_LIBS(
isl_version,
isl,
[],
[AC_MSG_ERROR(A Working Integer Set Library (ISL) installation is required. (Cannot find isl_version in libisl.))]
)
dnl Check for OR-Tools
dnl Check for OR-Tools headers
AC_CHECK_HEADERS(
[ortools/linear_solver/linear_solver.h],
[],
[AC_MSG_ERROR(A Working Google Optimization Tools (Google OR-Tools) installation is required. (Missing ortools/linear_solver/linear_solver.h.))]
)
dnl Check for OR-Tools Library
dnl TODO better way of doing this
AX_TRY_LINK(
[ortools],
[ #include <ortools/linear_solver/linear_solver.h> #include <string> ],
[
#if defined USE_SCIP
operations_research::MPSolver::OptimizationProblemType optimizationProblemType = operations_research::MPSolver::SCIP_MIXED_INTEGER_PROGRAMMING;
#elif defined USE_GLPK
operations_research::MPSolver::OptimizationProblemType optimizationProblemType = operations_research::MPSolver::GLPK_MIXED_INTEGER_PROGRAMMING;
#elif defined USE_CBC
operations_research::MPSolver::OptimizationProblemType optimizationProblemType = operations_research::MPSolver::CBC_MIXED_INTEGER_PROGRAMMING;
#elif defined USE_SLM
operations_research::MPSolver::OptimizationProblemType optimizationProblemType = operations_research::MPSolver::SULUM_MIXED_INTEGER_PROGRAMMING;
#elif defined USE_GUROBI
operations_research::MPSolver::OptimizationProblemType optimizationProblemType = operations_research::MPSolver::GUROBI_MIXED_INTEGER_PROGRAMMING;
#elif defined USE_CPLEX
operations_research::MPSolver::OptimizationProblemType optimizationProblemType = operations_research::MPSolver::CPLEX_MIXED_INTEGER_PROGRAMMING;
#else
#error "Google Optimization Tools has no proper backend!"
#endif
operations_research::MPSolver( std::string("test"), optimizationProblemType );
],
[],
[AC_MSG_ERROR(A Working Google Optimization Tools (Google OR-Tools) installation is required. (Cannot find MPSolver in libortools.))],
)
dnl Check for Rose
dnl Check for Rose headers
AS_IF(
[test x"$enable_rose" != x"no"],
[
AC_CHECK_HEADERS(
[rose.h],
[],
[AC_MSG_ERROR(A Working Rose installation is required. (Missing rose.h.))],
[
[ #undef HAVE_SYS_STAT_H ]
AC_INCLUDES_DEFAULT
]
)
]
)
dnl Check for software
dnl Check and set python
dnl TODO Better way of doing this.
AC_SUBST( PYTHON, missing )
AS_IF(
[test x"$PYTHON" == x"missing"],
AC_CHECK_PROG(
_PYTHON2_maybe,
python2,
[python2],
[missing]
)
AS_IF(
[test x"$_PYTHON2_maybe" != x"missing"],
AC_SUBST( PYTHON, $_PYTHON2_maybe )
)
)
AS_IF([test x"$PYTHON" == x"missing"],
AC_CHECK_PROG(
_PYTHON_maybe,
python,
[python],
[missing]
)
AS_IF(
[test x"$_PYTHON_maybe" != x"missing"],
AC_SUBST( PYTHON, $_PYTHON_maybe )
)
)
AS_IF(
[test x"$PYTHON" == x"missing"],
AC_CHECK_PROG( _PYPY_maybe, pypy, [pypy], [missing], )
AS_IF([test x"$_PYPY_maybe" != x"missing"],
AC_SUBST( PYTHON, $_PYPY_maybe )
)
)
dnl Check for unzip
AC_SUBST( UNZIP, missing )
AS_IF(
[test x"$UNZIP" == x"missing"],
AC_CHECK_PROG(
_UNZIP_maybe,
unzip,
[unzip],
[missing]
)
AS_IF([test x"$_UNZIP_maybe" != x"missing"],
AC_SUBST( UNZIP, $_UNZIP_maybe )
)
)
dnl Process Makefile.in to create Makefile
dnl If rose is enabled include the rose dependent sources to be compiled.
AS_IF(
[test x"$enable_rose" != x"no"],
[SOURCE_SELECTION="\$(BASE_SRC) \$(ROSE_DEPENDENT_SRC)"],
[SOURCE_SELECTION="\$(BASE_SRC)"],
)
AC_SUBST(SOURCE_SELECTION, $SOURCE_SELECTION)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT