-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfigure.ac
338 lines (282 loc) · 10.5 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
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
337
338
dnl Process this file with autoconf to produce a configure script.
AC_INIT(IlmBase, 2.0.0)
AC_SUBST(ILMBASE_VERSION, 2.0.0)
AC_SUBST(ILMBASE_VERSION_SAFE, 2_0_0)
AC_CANONICAL_HOST
AC_CONFIG_SRCDIR(ImathTest/main.cpp)
AM_CONFIG_HEADER(config/IlmBaseConfig.h)
AM_INIT_AUTOMAKE(1.6.3) dnl Require automake 1.6.3 or better
AM_MAINTAINER_MODE
LIBTOOL_CURRENT=10
LIBTOOL_REVISION=0
LIBTOOL_AGE=0
LIBTOOL_VERSION=$LIBTOOL_CURRENT:$LIBTOOL_REVISION:$LIBTOOL_AGE
AC_SUBST(LIBTOOL_VERSION)
dnl Checks for programs.
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_CC
AC_PROG_LN_S
AC_PROG_LIBTOOL
AC_PROG_MAKE_SET
dnl
dnl PKGCONFIG preparations
dnl
if test -z "${PKG_CONFIG_PATH}"; then
PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig
fi
export PKG_CONFIG_PATH
dnl Checks for libraries.
dnl --enable-threading
AC_ARG_ENABLE(threading,
AC_HELP_STRING([--enable-threading],
[enable multi-threading [[default=yes]]]),
[multithread="${enableval}"], [multithread=yes])
if test "${multithread}" != no ; then
ACX_PTHREAD(
[
AC_DEFINE(HAVE_PTHREAD)
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
AM_POSIX_SEM()
],
[AC_MSG_ERROR([POSIX thread support required])])
AC_MSG_NOTICE([multithread true, LIBS = $LIBS, CC = $CC, CXXFLAGS = $CXXFLAGS])
fi
dnl
dnl Checks for header files.
dnl
AC_HEADER_STDC
AC_CHECK_HEADERS(limits.h unistd.h ucontext.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
dnl Checks for library functions.
AC_CHECK_FUNCS(strerror)
dnl Checks for std::right etc. in iomanip
AC_MSG_CHECKING(for complete iomanip support in C++ standard library)
complete_iomanip="no"
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <iomanip>],[
std::right;
],
AC_DEFINE(HAVE_COMPLETE_IOMANIP) complete_iomanip=yes)
AC_MSG_RESULT($complete_iomanip)
AC_LANG_RESTORE
dnl --enable-large-stack
case "$host" in
*linux*)
AC_ARG_ENABLE(large-stack,
AC_HELP_STRING([--enable-large-stack],
[enable optimizations for systems that support
large stack sizes [[default=yes]]]),
[large_stack="${enableval}"],
[large_stack=yes])
;;
*)
AC_ARG_ENABLE(large-stack,
AC_HELP_STRING([--enable-large-stack],
[enable optimizations for systems that support
large stack sizes [[default=no]]]),
[large_stack="${enableval}"],
[large_stack=no])
;;
esac
if test "x${large_stack}" != xno ; then
AC_DEFINE(ILMBASE_HAVE_LARGE_STACK)
fi
dnl Define the version string
AC_DEFINE_UNQUOTED(ILMBASE_VERSION_STRING, "${VERSION}")
AC_DEFINE_UNQUOTED(ILMBASE_PACKAGE_STRING, "${PACKAGE_STRING}")
AC_MSG_CHECKING(for gcc optimization flags)
old_cflags=$CFLAGS
CFLAGS="$CFLAGS -pipe"
AC_TRY_COMPILE([#include <stdio.h>],
[ printf ("hello, world"); ],
[ EXTRA_OPT_CFLAGS="-pipe"],[ EXTRA_OPT_CFLAGS=""])
CFLAGS=$old_cflags
AC_MSG_RESULT([$EXTRA_OPT_CFLAGS])
dnl
dnl Handle namespacing configuration : internal library namespace
dnl public namespace
dnl
library_namespace_versioning="no"
AC_ARG_ENABLE(namespaceversioning,
AC_HELP_STRING([--enable-namespaceversioning],
[enable symbol versioning via versioned/custom namespace to prevent runtime conflicts <no/yes/custom> [[default=no]]] ),
[library_namespace_versioning="${enableval}"],
[library_namespace_versioning=no])
dnl Suffix for the shared library via the '-release' option
LIB_SUFFIX=""
lib_suffix_valid="no"
dnl Internal library namespace
dnl
lib_namespace=""
if test "x${library_namespace_versioning}" == xyes ; then
AC_DEFINE_UNQUOTED(IMATH_INTERNAL_NAMESPACE, Imath_${ILMBASE_VERSION_SAFE})
AC_DEFINE_UNQUOTED(IEX_INTERNAL_NAMESPACE, Iex_${ILMBASE_VERSION_SAFE})
AC_DEFINE_UNQUOTED(ILMTHREAD_INTERNAL_NAMESPACE, IlmThread_${ILMBASE_VERSION_SAFE})
AC_DEFINE(ILMBASE_INTERNAL_NAMESPACE_CUSTOM)
lib_namespace="${ILMBASE_VERSION_SAFE}"
LIB_SUFFIX="${ILMBASE_VERSION_SAFE}"
lib_suffix_valid="yes"
elif test "x${library_namespace_versioning}" == xno ; then
AC_DEFINE_UNQUOTED(IMATH_INTERNAL_NAMESPACE, Imath)
AC_DEFINE_UNQUOTED(IEX_INTERNAL_NAMESPACE, Iex)
AC_DEFINE_UNQUOTED(ILMTHREAD_INTERNAL_NAMESPACE, IlmThread)
lib_namespace=""
else
AC_DEFINE_UNQUOTED(IMATH_INTERNAL_NAMESPACE, Imath_${library_namespace_versioning})
AC_DEFINE_UNQUOTED(IEX_INTERNAL_NAMESPACE, Iex_${library_namespace_versioning})
AC_DEFINE_UNQUOTED(ILMTHREAD_INTERNAL_NAMESPACE, IlmThread_${library_namespace_versioning})
AC_DEFINE(ILMBASE_INTERNAL_NAMESPACE_CUSTOM)
lib_namespace="${library_namespace_versioning}"
LIB_SUFFIX="${library_namespace_versioning}"
lib_suffix_valid="yes"
fi
AC_SUBST(LIB_SUFFIX)
if test "x${lib_suffix_valid}" == xyes ; then
AC_SUBST(LIB_SUFFIX_DASH,"-${LIB_SUFFIX}")
AM_CONDITIONAL(LIB_SUFFIX_EXISTS,true)
else
AC_SUBST(LIB_SUFFIX_DASH,"")
AM_CONDITIONAL(LIB_SUFFIX_EXISTS,false)
fi
dnl Public User namespace
dnl
custom_public_namespace="no"
public_namespace=""
AC_ARG_ENABLE(customusernamespace,
AC_HELP_STRING([--enable-customusernamespace],
[user namespace; this is the namespace into which the library namespace will be exported to <no/custom> [[default=Imf]]] ),
[custom_public_namespace="${enableval}"],
[custom_public_namespace=no])
if test "x${custom_public_namespace}" == xyes ; then
AC_MSG_WARN([Enabling 'custom user namespace' requires an additional argument, reverting to default])
AC_DEFINE(IMATH_NAMESPACE, Imath)
AC_DEFINE(IEX_NAMESPACE, Iex)
AC_DEFINE(ILMTHREAD_NAMESPACE, IlmThread)
public_namespace=""
custom_public_namespace=no
elif test "x${custom_public_namespace}" == xno ; then
AC_DEFINE(IMATH_NAMESPACE, Imath)
AC_DEFINE(IEX_NAMESPACE, Iex)
AC_DEFINE(ILMTHREAD_NAMESPACE, IlmThread)
public_namespace=""
else
AC_DEFINE_UNQUOTED(IMATH_NAMESPACE, Imath_${custom_public_namespace})
AC_DEFINE_UNQUOTED(IEX_NAMESPACE, Iex_${custom_public_namespace})
AC_DEFINE_UNQUOTED(ILMTHREAD_NAMESPACE, IlmThread_${custom_public_namespace})
AC_DEFINE(ILMBASE_NAMESPACE_CUSTOM)
public_namespace=${custom_public_namespace}
fi
dnl Platform-specific stuff
case "$host" in
*darwin*)
dnl Compiler flags for all OS X builds
dnl OSX architectures specification
dnl NOTE: multiple architectures requires --disable-dependency-tracking
dnl For more information: http://developer.apple.com/documentation/Porting/Conceptual/PortingUNIX/compiling/chapter_4_section_3.html
AC_ARG_ENABLE(osx-arch,
AC_HELP_STRING([--enable-osx-arch],
[specify the architecture(s) for OS X builds. Ex: --enable-osx-arch="ppc i386"]),
[osx_arch="${enableval}"], [osx_arch=default])
if test "${osx_arch}" != default ; then
dnl Replace "a b c" with "-arch a -arch b -arch c". Should probably use an all-whitespace regexp rather than a single character for the search string.
osx_arch_flags="-arch ${osx_arch// / -arch }"
CXXFLAGS="$CXXFLAGS $osx_arch_flags"
dnl If multiple archs specified, make sure that --disable-dependency-tracking was also specified
if test "$enable_dependency_tracking" != no ; then
osx_arch_array=( ${osx_arch} )
if test ${#osx_arch_array[@]} -gt 1 ; then
AC_MSG_ERROR([building multiple OS X architectures requires --disable-dependency-tracking.
Please re-run configure with these options:
--enable-osx-arch="${osx_arch}" --disable-dependency-tracking
])
fi
fi
fi
dnl OSX SDK specification
AC_ARG_ENABLE(osx-sdk,
AC_HELP_STRING([--enable-osx-sdk],
[specify the sdk (sysroot) for use with OS X. Ex: --enable-osx-sdk=MacOSX10.5]),
[osx_sdk="${enableval}"], [osx_sdk=default])
if test "${osx_sdk}" != default ; then
CXXFLAGS="$CXXFLAGS -isysroot /Developer/SDKs/${osx_sdk}"
fi
dnl OS X universal binary support, requires --disable-dependency-tracking
dnl NOTE: this argument is obsolete, and has been replaced by --enable-osx-sdk and --enable-osx-arch
dnl This is equivalent to --enable-osx-sdk=MacOSX10.4u.sdk --enable-osx-arch="ppc i386"
AC_ARG_ENABLE(osx-universal-binaries,
AC_HELP_STRING([--enable-osx-universal-binaries],
[build two-way universal (ppc, i386) binaries on OS X. OBSOLETE: Consider using --enable-osx-sdk and --enable-osx-arch instead. [[default=no]]]),
[build_osxuniversal="${enableval}"], [build_osxuniversal=no])
if test "${build_osxuniversal}" != no ; then
if test "$enable_dependency_tracking" != no ; then
AC_MSG_ERROR([--enable-osx-universal-binary requires --disable-dependency-tracking.
Please re-run configure with these options:
--disable-dependency-tracking --enable-osx-universal-binary
])
fi
CXXFLAGS="$CXXFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386"
dnl LDFLAGS="$LDFLAGS -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386"
fi
;;
esac
AM_CFLAGS="$EXTRA_OPT_CFLAGS"
AM_CXXFLAGS="$EXTRA_OPT_CFLAGS"
AC_SUBST(AM_CFLAGS)
AC_SUBST(AM_CXXFLAGS)
AC_SUBST(HAVE_UCONTEXT_H)
AC_OUTPUT([
Makefile
IlmBase.pc
config/Makefile
Half/Makefile
HalfTest/Makefile
Iex/Makefile
IexMath/Makefile
IexTest/Makefile
IlmThread/Makefile
Imath/Makefile
ImathTest/Makefile
vc/Makefile
])
dnl
dnl Summary Configuration Messages
dnl
AC_MSG_RESULT([
---------------------------------------------
Summary for IlmBase features:
enable large stack optimizations $large_stack])
if test "x${library_namespace_versioning}" != xno ; then
AC_MSG_RESULT([
internal library namespaces Imath_$lib_namespace
Iex_$lib_namespace
IlmThread_$lib_namespace])
else
AC_MSG_RESULT([
internal library namespaces Imath Iex IlmThread])
fi
if test "x${custom_public_namespace}" != xno ; then
AC_MSG_RESULT([
public namespaces Imath_$public_namespace
Iex_$public_namespace
IlmThread_$public_namespace])
else
AC_MSG_RESULT([
public namespaces Imath Iex IlmThread])
fi
if test "$osx_arch"; then
AC_MSG_RESULT([
OS X architectures $osx_arch
OS X SDK $osx_sdk
OS X two-way universal build (deprecated) $build_osxuniversal])
fi
AC_MSG_RESULT([
---------------------------------------------
])