-
Notifications
You must be signed in to change notification settings - Fork 10
/
configure.ac
195 lines (168 loc) · 5.12 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
AC_INIT(README)
AC_CONFIG_AUX_DIR(build/autoconf)
AC_SUBST(ac_aux_dir)
AC_CANONICAL_SYSTEM
AC_CONFIG_SRCDIR([src])
AM_CONFIG_HEADER(include/carve_config.h include/carve/config.h)
AM_INIT_AUTOMAKE(carve, 1.1.0, toby@permuted.net)
AC_PROG_CC
AC_PROG_CPP
AM_PROG_LIBTOOL
AC_PROG_CXX
AM_MAINTAINER_MODE
AC_HEADER_STDC
AC_CHECK_HEADERS([stdint.h stdlib.h string.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_HEADER_STDBOOL
AC_C_BIGENDIAN
AC_TYPE_SIZE_T
AC_LANG_CPLUSPLUS
# Checks for library functions.
# AC_CHECK_FUNCS([floor getcwd getservbyname getaddrinfo gethostbyname gettimeofday memset select setlocale socket sqrt strerror strtoul inet_ntop inet_pton])
AC_CHECK_FUNCS([isatty])
AC_ARG_WITH(tr1-collections,
AC_HELP_STRING([--with-tr1-collections], [use tr1 collections, where available]),
with_TR1="$withval",
with_TR1="yes")
AC_ARG_WITH(boost-collections,
AC_HELP_STRING([--with-boost-collections], [use boost collections]),
with_BOOST="$withval",
with_BOOST="no")
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug], [compile in debug hooks [default=no]]))
AC_ARG_ENABLE(intersect-glu-triangulator,
AC_HELP_STRING([--enable-intersect-glu-triangulator], [compile GLU-based triangulation code into intersect [default=yes]]),
enable_GLU_tri="$enableval",
enable_GLU_tri="yes")
AC_ARG_WITH(gui,
AC_HELP_STRING([--with-gui], [compile gui code]),
with_GUI="$withval",
with_GUI="yes")
AC_MSG_CHECKING([for std collections])
AC_TRY_COMPILE([
#include <unordered_set>
#include <unordered_map>
], [
const std::unordered_map<int,int> a;
const std::unordered_set<int> b;
a.find(1);
b.find(1);
], [
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_STD_UNORDERED_COLLECTIONS], [], [Define if std::unordered_map and std::unordered_set are supported by your compiler.])
with_TR1=no
], [
AC_MSG_RESULT([no])
])
AC_MSG_CHECKING([for gnu libstdc++ collections])
AC_TRY_COMPILE([
#include <ext/hash_set>
#include <ext/hash_map>
], [
const __gnu_cxx::hash_map<int,int> a;
const __gnu_cxx::hash_set<int> b;
a.find(1);
b.find(1);
], [
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_LIBSTDCPP_UNORDERED_COLLECTIONS], [], [Define if using gnu libstdc++.])
with_TR1=no
], [
AC_MSG_RESULT([no])
])
if test "x$with_TR1" = "xyes"; then
AC_MSG_CHECKING([for TR1 collections])
AC_TRY_COMPILE([
#include <tr1/unordered_set>
#include <tr1/unordered_map>
],[
std::tr1::unordered_map<int,int> a;
std::tr1::unordered_set<int> b;
], [
AC_TRY_COMPILE([
#include <tr1/unordered_set>
#include <tr1/unordered_map>
],[
const std::tr1::unordered_map<int,int> a;
const std::tr1::unordered_set<int> b;
a.find(1);
b.find(1);
], [
AC_MSG_RESULT([yes])
with_TR1=yes
], [
AC_MSG_RESULT([yes, but unusable (const issues)])
with_TR1=no
])], [
AC_MSG_RESULT([no])
with_TR1=no
])
fi
if test "x$with_TR1" = "xyes"; then
AC_DEFINE([HAVE_TR1_UNORDERED_COLLECTIONS], [], [Define if TR1 collections are supportted by your compiler.])
fi
if test "x$with_BOOST" != "xno"; then
AC_DEFINE([HAVE_BOOST_UNORDERED_COLLECTIONS], [], [Define if using boost collections.])
CARVE_save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="${CPPFLAGS} -I$ac_confdir/include"
AC_MSG_CHECKING([for boost collections])
AC_TRY_COMPILE([
#include <carve/collection/external/boost/unordered_set.hpp>
#include <carve/collection/external/boost/unordered_map.hpp>
],[
const boost::unordered_map<int,int> a;
const boost::unordered_set<int> b;
a.find(1);
b.find(1);
], [
AC_MSG_RESULT([yes])
with_BOOST=yes
], [
AC_MSG_RESULT([no])
with_BOOST=no
])
CPPFLAGS=$CARVE_save_CPPFLAGS
fi
if test x$enable_debug = xyes; then
CPPFLAGS="${CPPFLAGS} -DDEBUG"
fi
CARVE_CHECK_OPENGL
if test x"$have_GL" = xno; then AC_MSG_NOTICE([missing GL]); with_GUI=no; fi
if test x"$have_GLU" = xno; then AC_MSG_NOTICE([missing GLU]); with_GUI=no; fi
if test x"$have_glut" = xno; then AC_MSG_NOTICE([missing glut]); with_GUI=no; fi
if test x"$have_GLU" = xyes; then
AC_MSG_CHECKING([glu callback prototype])
AC_TRY_COMPILE([
#if defined(__APPLE__)
#include <OpenGL/glu.h>
#else
#include <GL/glu.h>
#endif
],[
typedef GLvoid (*GLUTessCallback)(...);
gluTessCallback((GLUtesselator *)NULL, GLU_TESS_END_DATA, (GLUTessCallback)NULL);
], [
AC_MSG_RESULT([varargs])
AC_DEFINE([GLU_TESS_CALLBACK_VARARGS], [], [Define if gluTessCallback callback prototype needs (...).])
], [
AC_MSG_RESULT([no varargs])
])
fi
AM_CONDITIONAL(enable_GLU_tri, test "x$enable_GLU_tri" = "xyes")
AM_CONDITIONAL(with_GUI, test "x$with_GUI" = "xyes")
AM_CONDITIONAL(with_BOOST, test "x$with_BOOST" != "xno")
AC_SUBST(GL_CFLAGS)
AC_SUBST(GL_LIBS)
AC_SUBST(GLUT_CFLAGS)
AC_SUBST(GLUT_LIBS)
AC_OUTPUT([
Makefile lib/Makefile common/Makefile src/Makefile
tests/Makefile examples/Makefile
external/Makefile
external/GLEW/Makefile external/GLOOP/Makefile
external/GLUI/Makefile include/Makefile include/carve/Makefile
include/carve/collection/Makefile
include/carve/collection/unordered/Makefile
])