/
configure.in
336 lines (292 loc) · 9.83 KB
/
configure.in
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.65])
AC_INIT(c_runtime/boolean_array.c)
AC_SUBST(date)
AC_SUBST(rmlc_bin)
AC_SUBST(rmlhome)
AC_SUBST(rmlinc)
AC_SUBST(omc_antlr_jar)
AC_SUBST(antlrinc)
AC_SUBST(antlrlib)
AC_SUBST(LIBSOCKET)
AC_SUBST(LIBNSL)
AC_SUBST(LIBLPSOLVE55)
AC_SUBST(USE_CORBA)
AC_SUBST(QT_USE_CORBA)
AC_SUBST(CORBACFLAGS)
AC_SUBST(CORBALIBS)
AC_SUBST(IDLCMD)
AC_SUBST(USE_MODPAR)
AC_SUBST(BOOSTHOME)
AC_SUBST(GENERATED_AUTOCONF_FILES)
AC_SUBST(COIN_LIBS)
AC_SUBST(SOQT_LIBS)
AC_SUBST(COIN_INCLUDE)
AC_SUBST(SOQT_INCLUDE)
AC_SUBST(HAVE_COIN)
AC_SUBST(LIBSENDDATA)
AC_SUBST(LIBSENDDATA_LDFLAGS)
AC_SUBST(QMAKE)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_MAKE_SET
AC_PROG_LEX
dnl check for environment variables
AC_MSG_CHECKING([for \$RMLHOME])
if test ! -z "$RMLHOME" ; then
rmlhome=$RMLHOME
AC_MSG_RESULT([$RMLHOME])
else
AC_MSG_RESULT([/usr])
rmlhome=/usr
fi
AC_MSG_CHECKING([for rmlc])
if test -x $rmlhome/bin/rmlc ; then
rmlc_bin=$rmlhome/bin/rmlc
AC_MSG_RESULT([yes])
else
AC_MSG_ERROR([rmlc not found in \$rmlhome/bin])
fi
dnl Checks for libraries.
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/time.h)
AC_MSG_CHECKING([for rml includefiles in $rmlhome])
rmlinc=`find $rmlhome/include -follow -type d -name plain |grep include/plain`
if test -z "$rmlinc" ; then
AC_MSG_ERROR([rml headers not found])
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
fi
if test ! -z "$ANTLRHOME" ; then
antlrhome=$ANTLRHOME
antlrmsg=""
else
antlrhome=/usr/
antlrmsg=". \$ANTLRHOME was not set, looked in $antlrhome."
fi
AC_MSG_CHECKING([for antlr headers])
antlrinc=`find $antlrhome/include/ -type f -name TreeParser.hpp -print | head -1 | awk -F/ '{ total="";for (i = 1 ; i < NF-1; i++) total= total $i "/"; print total}'`
if test -z "$antlrinc" ; then
AC_MSG_ERROR([Could not find antlr include files$antlrmsg])
else
AC_MSG_RESULT([yes])
fi
AC_MSG_CHECKING([for antlr libs])
antlrlib=`find $antlrhome/lib/ -type f -name libantlr.a -print | head -1 | awk -F/ '{ total="";for (i = 1 ; i < NF; i++) total= total $i "/"; print total}'`
if test -z "$antlrlib" ; then
AC_MSG_ERROR([Could not find antlr lib file$antlrmsg])
else
AC_MSG_RESULT([yes])
fi
AC_MSG_CHECKING([for antlr.Tool support])
omc_antlr_jar=build/share/omc/java/antlr-3.1.3.jar
mkdir -p build/share/omc/java
cp c_runtime/java_interface/antlr-3.1.3.jar $omc_antlr_jar
echo "" > $$grammar.g
if java -cp $omc_antlr_jar antlr.Tool $$grammar.g ; then
rm -f $$grammar.g
AC_MSG_RESULT([yes])
else
rm -f $$grammar.g
AC_MSG_ERROR([no antlr.Tool support])
AC_MSG_RESULT([no])
fi
AC_CHECK_HEADER(readline/readline.h,,AC_MSG_ERROR([readline missing]))
AC_CHECK_HEADER(readline/history.h,,AC_MSG_ERROR([readline missing]))
AC_SEARCH_LIBS(readline,readline,,[AC_MSG_ERROR([readline missing])])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
dnl Checks for library functions.
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(getcwd select strdup strerror)
dnl Check if scandir is available
AC_MSG_CHECKING([for scandir])
AC_TRY_LINK([
#include <dirent.h>
], [
int file_select_directories(const struct dirent *entry) {
return 0;
}
int main() {
char dir[]=".";
int count;
struct dirent **files;
scandir(dir, &files, file_select_directories, 0);
return 0;
}
], [AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_SCANDIR])],
[AC_MSG_RESULT([no])])
dnl check for lpsolve55
AC_ARG_WITH(static-lpsolve, [ --with-static-lpsolve=DIR (default to dynamic linking; searches /usr if no other directory is provided)],[WANT_STATIC_LPSOLVE="$withval"],[WANT_STATIC_LPSOLVE="no"])
if test "$WANT_STATIC_LPSOLVE" = "no"; then
AC_SEARCH_LIBS(dlopen,dl)
AC_SEARCH_LIBS(sqrt,m)
AC_SEARCH_LIBS(colamd,colamd)
AC_SEARCH_LIBS(make_lp,lpsolve55,[],[AC_MSG_ERROR([linking failed])])
LIBLPSOLVE55=$LIBS
LIBS=""
else
if test "$WANT_STATIC_LPSOLVE" = "yes"; then
LPLIB=/usr/lib;
else
LPLIB=$WANT_STATIC_LPSOLVE/lib
fi
LIBS=""
AC_SEARCH_LIBS(dlopen,dl)
AC_SEARCH_LIBS(sqrt,m)
LIBS="$LPLIB/liblpsolve55.a $LPLIB/libcolamd.a $LIBS"
AC_MSG_CHECKING([for static lpsolve55])
AC_LINK_IFELSE([AC_LANG_CALL([], [make_lp])], [LIBLPSOLVE55=$LIBS], [AC_MSG_ERROR([failed])])
AC_MSG_RESULT([$LIBLPSOLVE55])
LIBS=""
fi
dnl check for socket
AC_CHECK_FUNC(socket,[LIBSOCKET=""],
[AC_MSG_CHECKING([for libsocket]);
AC_CHECK_LIB(socket, socket,[AC_MSG_RESULT([yes]); LIBSOCKET="-lsocket"],[AC_MSG_ERROR([neither socket nor libsocket.a found])])
])
dnl check for gethostbyname
AC_CHECK_FUNC(gethostbyname,
[LIBNSL=""],
[AC_MSG_CHECKING([for libnsl]);
AC_CHECK_LIB(nsl,gethostbyname, [AC_MSG_RESULT([yes]); LIBNSL="-lnsl"],[AC_MSG_ERROR([neither gethostbyname nor libnsl.a found])])
])
dnl should we use corba?
AC_ARG_WITH(CORBA, [ --with-CORBA=DIR use mico corba installed in DIR (or use mico-config)],[WANT_MICO="$withval"],[WANT_MICO="no"])
AC_ARG_WITH(MICO, [ --with-MICO=DIR use mico corba installed in DIR (or use mico-config)],[WANT_MICO="$withval"],[])
AC_ARG_WITH(ORBIT2, [ --with-ORBIT2=DIR use orbit2 installed in DIR (or use orbit2-config)],[WANT_ORBIT2="$withval"],[WANT_ORBIT2="no"])
AC_ARG_WITH(omniORB,[ --with-omniORB=DIR use omniORB installed in DIR],[WANT_OMNIORB="$withval"],[WANT_OMNIORB="no"])
if test ! "$WANT_MICO" = "no"; then
if test "$WANT_MICO" = "yes"; then
MICO="mico-config";
else
MICO="$WANT_MICO/bin/mico-config";
fi
if test "$USE_CORBA" = "no"; then
AC_MSG_ERROR([failed to find mico-corba])
fi
AC_MSG_CHECKING([mico version])
if ! $MICO --version; then
AC_MSG_ERROR([failed to call $MICO])
fi
USE_CORBA="-DUSE_CORBA -DUSE_MICO"
QT_USE_CORBA="USE_MICO"
CORBACFLAGS=-I`mico-config --prefix`/include;
CORBALIBS=`mico-config --libs`;
IDLCMD="idl";
DESIRED_CORBA="mico"
elif test ! "$WANT_ORBIT2" = "no"; then
if test "$WANT_ORBIT2" = "yes"; then
ORBIT2="orbit2-config";
else
ORBIT2="$withval/bin/orbit2-config";
fi
AC_CHECK_PROG(USE_CORBA,$ORBIT2,[-DUSE_CORBA -DUSE_ORBIT2],[no])
if test "$USE_CORBA" = "no"; then
AC_MSG_ERROR([failed to find orbit2])
fi
USE_CORBA="-DUSE_CORBA -DUSE_ORBIT"
QT_USE_CORBA="USE_ORBIT2"
CORBACFLAGS=`orbit2-config --cflags`;
CORBALIBS=`orbit2-config --libs`;
IDLCMD="orbit-idl-2";
DESIRED_CORBA="orbit2"
AC_MSG_ERROR([ORBIT2 is not supported yet])
elif test ! "$WANT_OMNIORB" = "no"; then
if test "$WANT_OMNIORB" = "yes"; then
WANT_OMNIORB="/usr";
fi
USE_CORBA="-DUSE_CORBA -DUSE_OMNIORB";
QT_USE_CORBA="USE_OMNIORB"
CORBALIBS="-lomniORB4 -lomnithread -lpthread";
CORBACFLAGS="-I$WANT_OMNIORB/include";
IDLCMD="omniidl -bcxx -Wbh=.h -Wbs=.cc";
DESIRED_CORBA="omniorb"
else
USE_CORBA="";
CORBACFLAGS="";
CORBALIBS="";
IDLCMD="";
DESIRED_CORBA="none"
fi
AC_MSG_CHECKING([for CORBA]);
AC_MSG_RESULT([$DESIRED_CORBA]);
dnl Check for Qt
AC_CHECK_PROGS(QMAKE,qmake-qt4 qmake qmake-mac,"")
if test -n "$QMAKE"; then
AC_MSG_CHECKING([for qmake arguments])
if test "Darwin" = `uname`; then
QMAKE="$QMAKE -spec macx-g++ -macx -o Makefile"
fi
AC_MSG_RESULT([$QMAKE])
fi
AC_MSG_CHECKING([for sendData-Qt]);
AC_ARG_WITH(sendData-Qt, [ --with-sendData-Qt Compile with support for plot().],
[
if test -z "$QMAKE"; then
AC_MSG_ERROR("Cannot compile with libSendData unless qmake is present.");
fi
LIBSENDDATA="sendData"
if test "Darwin" = `uname`; then
LIBSENDDATA_LDFLAGS="-lsendData -framework QtNetwork -framework QtCore -framework QtGui -lz -framework Carbon"
if test -d /opt/local/Library/Frameworks/; then
LIBSENDDATA_LDFLAGS="-F/opt/local/Library/Frameworks/ $LIBSENDDATA_LDFLAGS"
fi
else
LIBSENDDATA_LDFLAGS="-lsendData -lQtNetwork -lQtCore -lQtGui"
fi
AC_MSG_RESULT([ok])
],
[
LIBSENDDATA="sendDataHumbug"
LIBSENDDATA_LDFLAGS="-lsendDataHumbug"
AC_MSG_RESULT([disabled])
])
dnl Check for libCoin
AC_MSG_CHECKING([for libCoin])
AC_ARG_WITH(Coin, [ --with-Coin Compile with support for plotting in 3D.],
[
if test -z "$QMAKE"; then
AC_MSG_ERROR("Cannot compile with libCoin unless qmake is present.");
fi
COIN_LIBS=`coin-config --ldflags --libs | tr \\\\n \\ `
SOQT_LIBS=`soqt-config --ldflags --libs | tr \\\\n \\ `
COIN_INCLUDE=`coin-config --includedir | tr \\\\n \\ `
SOQT_INCLUDE=`soqt-config --includedir | tr \\\\n \\ `
HAVE_COIN="HAVE_COIN"
if test -z "$COIN_INCLUDE" || test -z "$SOQT_INCLUDE" || test -z "$COIN_LIBS" || test -z "$SOQT_LIBS"; then
AC_MSG_ERROR([failure]);
fi
AC_MSG_RESULT([ok])
],
[
AC_MSG_RESULT([disabled])
])
dnl should we compile modpar
AC_ARG_WITH(MODPAR, [ --with-MODPAR Compile with automatic parallelization, requires boost],
[
USE_MODPAR="-DUSE_MODPAR"
], [
AC_MSG_RESULT([Not compiling ModPar]); USE_MODPAR=""; BOOSTHOME=""
])
AC_ARG_WITH(BOOST, [ --with-BOOST=DIR With BOOST library in DIR],
[
if test "$USE_MODPAR" = "-DUSE_MODPAR" ; then
AC_MSG_RESULT([enabling BOOST... BOOSTHOME="$withval"]);
BOOSTHOME="$withval";
else
AC_MSG_RESULT([ Warning, MODPAR requires BOOST, disabling MODPAR ] )
USE_MODPAR="";
BOOSTHOME="";
fi
], [
AC_MSG_RESULT([Not compiling with BOOST]); USE_MODPAR=""; BOOSTHOME=""
])
date=`date "+%Y-%m-%d %H:%M:%S"`
GENERATED_AUTOCONF_FILES="Makefile c_runtime/Makefile Compiler/rml2sig/Makefile modelica_parser/test/parser/Makefile mosh/src/Makefile Compiler/Makefile Compiler/omc_release/Makefile Compiler/omc_debug/Makefile Compiler/omc_profiler/Makefile Compiler/absyn_builder/Makefile modelica_parser/test/lexer/Makefile Compiler/test_codegen/Makefile Compiler/runtime/Makefile modelica_parser/src/Makefile Compiler/modpar/Makefile flat_modelica_parser/src/Makefile c_runtime/interactive/Makefile OMNotebook/ext/OMPlotWindow.config OMNotebook/OMNotebookQT4/OMNotebook.config OMShell/OMShell.config Compiler/runtime/config.unix.h"
AC_CONFIG_COMMANDS([config.unix.h.fix],[./configure-post.sh $ac_cs_config])
AC_OUTPUT(${GENERATED_AUTOCONF_FILES})