This repository has been archived by the owner on Apr 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
/
configure.ac
173 lines (153 loc) · 4.76 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
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
AC_INIT([OMEdit],[dev],[https://trac.openmodelica.org/OpenModelica],[openmodelica],[https://openmodelica.org])
AC_SUBST(APP)
AC_SUBST(EXE)
AC_SUBST(IDLCMD)
AC_SUBST(RPATH_QMAKE)
AC_SUBST(host_short)
AC_SUBST(SOURCE_REVISION)
AC_SUBST(QT4BUILD)
AC_SUBST(QMAKE_CONFIG_OSG)
AC_SUBST(LIBOSG)
AC_SUBST(LSB_RELEASE)
AC_SUBST(LIB_BOOST_REGEX)
m4_include([common/m4/pre-commit.m4])
cp common/install-sh common/config.guess common/config.sub ./
m4_include([common/m4/ombuilddir.m4])
m4_include([common/m4/ax_cxx_compile_stdcxx_11.m4])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
dnl Checks for programs.
test -z "$CXXFLAGS" && CXXFLAGS="$CFLAGS"
AC_LANG([C++])
AC_PROG_CC
AC_PROG_CXX
AX_CXX_COMPILE_STDCXX_11([noext],[mandatory])
host_short=$host_cpu-$host_os
m4_include([common/m4/qmake.m4])
m4_include([common/m4/omhome.m4])
FIND_OPENMODELICAHOME()
FIND_LIBOPENMODELICACOMPILER()
FIND_LIBOMQWT()
if test -z "$WITH_OSG"; then
WITH_OSG=1
else
AC_MSG_RESULT([WITH_OSG=$WITH_OSG])
fi
if test "$WITH_OSG" = 1; then
AC_PREPROC_IFELSE(
[AC_LANG_PROGRAM([[]], [[]])],
[],
[AC_MSG_ERROR([C++ preprocessor broken?])]
)
AC_MSG_CHECKING([for osg/qt include order bugs (broken OSG version)])
AC_PREPROC_IFELSE(
[AC_LANG_PROGRAM([[
#include <osg/Version>
#if __arm__==1 && __clang_major__==3 && __clang_minor__==4 && OPENSCENEGRAPH_MAJOR_VERSION==3 && OPENSCENEGRAPH_MINOR_VERSION==2 && OPENSCENEGRAPH_PATCH_VERSION==0
#error "ARM+clang 3.4+OSG3.2.0 does not work together"
#endif
]],
[[]])],
[AC_MSG_RESULT([OK])],
[AC_MSG_RESULT([no (giving up on OSG)]); WITH_OSG=0]
)
CPPFLAGS="$OLD_CPPFLAGS"
fi
if test "$WITH_OSG" = 1; then
AC_MSG_CHECKING([for osg/qt broken OpenGL])
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -Wl,--unresolved-symbols=ignore-all"
AC_LINK_IFELSE( [AC_LANG_PROGRAM([[]], [[]])],
[],
[CPPFLAGS="$OLD_CPPFLAGS"]
)
CPPFLAGS="$CPPFLAGS -fPIC -I$QT_INSTALL_HEADERS -I$QT_INSTALL_HEADERS/QtOpenGL"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
#include <osgViewer/GraphicsWindow>
#include <QGLWidget>
]],
[[]])],
[AC_MSG_RESULT([OK])],
[AC_MSG_RESULT([no (giving up on OSG)]); WITH_OSG=0]
)
CPPFLAGS="$OLD_CPPFLAGS"
fi
if test "$WITH_OSG" = 1; then
AC_MSG_CHECKING([for osg/qt broken OpenGL])
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -Wl,--unresolved-symbols=ignore-all"
AC_LINK_IFELSE( [AC_LANG_PROGRAM([[]], [[]])],
[],
[CPPFLAGS="$OLD_CPPFLAGS"]
)
CPPFLAGS="$CPPFLAGS -fPIC -I$QT_INSTALL_HEADERS -I$QT_INSTALL_HEADERS/QtOpenGL -I$QT_INSTALL_HEADERS/QtWidgets"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
#include <osg/GL>
#include <QtWidgets>
]],
[[]])],
[AC_MSG_RESULT([OK])],
[AC_MSG_RESULT([no (giving up on OSG)]); WITH_OSG=0]
)
CPPFLAGS="$OLD_CPPFLAGS"
fi
if test "$WITH_OSG" = 1; then
AC_CHECK_HEADERS(osg/Uniform, [], [WITH_OSG=0])
fi
if test "$WITH_OSG" = 0; then
CPPFLAGS="$CPPFLAGS -DWITHOUT_OSG"
AC_MSG_RESULT("Disabled OSG")
else
QMAKE_CONFIG_OSG="CONFIG += osg"
LIBOSG="-losg -losgViewer -losgDB -losgGA -lOpenThreads"
AC_MSG_RESULT("OSG is enabled")
fi
AC_MSG_CHECKING([check if -lboost_regex is needed for OMSimulator])
AC_RUN_IFELSE( [AC_LANG_PROGRAM([[
#include <regex>
// adrpo: crap regex handling
#if __cplusplus >= 201103L && \
(!defined(__GLIBCXX__) || (__cplusplus >= 201402L) || \
(defined(_GLIBCXX_REGEX_DFS_QUANTIFIERS_LIMIT) || \
defined(_GLIBCXX_REGEX_STATE_LIMIT) || \
(defined(_GLIBCXX_RELEASE) && \
_GLIBCXX_RELEASE > 4)))
#define OMS_GOOD_REGEX 1
#else /* bad regex, filter by MSVC */
#if defined(_MSC_VER)
#define OMS_GOOD_REGEX 1
#else /* surely bad regex */
#define OMS_GOOD_REGEX 0
#endif
#endif
]],
[[
#if OMS_GOOD_REGEX
#else
exit(1);
#endif
]])],
[AC_MSG_RESULT([no need for -lboost_regex, std::regex is good enough])],
[AC_MSG_RESULT([bad std::regex, -lboost_regex is needed]); LIB_BOOST_REGEX=-lboost_regex]
)
for flag in -Wno-clobbered -Wno-unused-variable -Wno-unused-function -Wno-unused-parameter; do
OLD_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $flag -Werror"
AC_TRY_LINK([], [return 0;], [CXXFLAGS="$OLD_CXXFLAGS $flag"],[CXXFLAGS="$OLD_CXXFLAGS"])
done
AC_MSG_CHECKING([for LSB description])
LSB_RELEASE="`lsb_release -ds | tr -d '\"'`"
if test ! -z "$LSB_RELEASE"; then
AC_MSG_RESULT([$LSB_RELEASE])
LSB_RELEASE="#define LSB_RELEASE \"$LSB_RELEASE\""
else
AC_MSG_RESULT([no])
fi
m4_include([common/m4/semver.m4])
SOURCE_REVISION="$SOURCE_REVISION$NON_FREE_VERSION"
AC_OUTPUT(Makefile OMEdit/OMEditGUI/Makefile.unix OMEdit/OMEditGUI/OMEdit.config OMEdit/OMEditGUI/Debugger/Parser/Makefile.unix OMEdit/OMEditGUI/Debugger/Parser/Makefile.lib.unix OMEdit/OMEditGUI/omc_config.h)