summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 48c09d8f4d9afbacf6bde7e10340d32e4bcc192c (plain)
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
dnl Copyright (C) 2007-2010 Hubert Figuiere
dnl Small portions are:
dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License.  As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.

AC_PREREQ(2.50)
AC_INIT(exempi, 2.4.5)
AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects])
AM_MAINTAINER_MODE
m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
AM_SILENT_RULES([yes])

dnl ---------------------------------------------------------------------------
dnl Advanced information about versioning:
dnl   * "Writing shared libraries" by Mike Hearn
dnl         http://plan99.net/~mike/writing-shared-libraries.html
dnl   * libtool.info chapter "Versioning"
dnl   * libtool.info chapter "Updating library version information"
dnl ---------------------------------------------------------------------------
dnl Versioning:
dnl  - CURRENT (Major):  Increment if the interface has changes. AGE is always
dnl                      *changed* at the same time.
dnl  - AGE (Micro):      Increment if any interfaces have been added; set to 0
dnl                      if any interfaces have been removed. Removal has
dnl                      precedence over adding, so set to 0 if both happened.
dnl                      It denotes upward compatibility.
dnl  - REVISION (Minor): Increment any time the source changes; set to
dnl                      0 if you incremented CURRENT.
dnl
dnl  To summarize. Any interface *change* increment CURRENT. If that interface
dnl  change does not break upward compatibility (ie it is an addition),
dnl  increment AGE, Otherwise AGE is reset to 0. If CURRENT has changed,
dnl  REVISION is set to 0, otherwise REVISION is incremented.
dnl ---------------------------------------------------------------------------
dnl 1.99.0 is the revision 2 0 0
dnl 1.99.1 is the revision 3 1 0
dnl 1.99.2 is the revision 4 2 0
dnl 1.99.3 is the revision 5 3 0
dnl 1.99.4 is the revision 6 4 0
dnl ABI breakage reset major to 3
dnl 1.99.5 is the revision 3.0.0
dnl 1.99.6 is the revision 3.1.0 WHICH IS WRONG!!!
dnl 1.99.7 is the revision 4.1.0
dnl 1.99.8 is the revision 4.1.1
dnl 1.99.9 is the revision 4.1.1 (no library change have been made)
dnl 2.0.0 is the revision 4.1.2
dnl 2.0.1 is the revision 4.1.3
dnl 2.0.2 is the revision 4.1.4
dnl 2.1.0 is the revision 5.2.0
dnl 2.1.1 is the revision 5.2.1
dnl 2.2.0 is the revision 5.2.2 -- no public API change
dnl 2.2.1 is the revision 5.2.3 -- no public API change
dnl 2.2.2 is the revision 5.2.4 -- no public API change
dnl 2.2.3 is the revision 5.2.5 -- no public API change
dnl 2.3.0 is the revision 6.3.0
dnl 2.4.0 is the revision 7.4.0
dnl 2.4.1 is the revision 7.4.1
dnl 2.4.2 is the revision 7.4.2
dnl 2.4.3 is the revision 7.4.3
dnl 2.4.4 is the revision 7.4.4
dnl 2.4.5 is the revision 7.4.5
AC_SUBST([EXEMPI_REVISION], [5])
AC_SUBST([EXEMPI_AGE],      [4])
AC_SUBST([EXEMPI_CURRENT],  [7])
AC_SUBST([EXEMPI_CURRENT_MIN],
         [`expr $EXEMPI_CURRENT - $EXEMPI_AGE`])
AC_SUBST([EXEMPI_VERSION_INFO],
         [$EXEMPI_CURRENT:$EXEMPI_REVISION:$EXEMPI_AGE])

dnl the major version. used for package names, etc
EXEMPI_MAJOR_VERSION=2.0
AC_SUBST(EXEMPI_MAJOR_VERSION)

dnl the path where includes are installed
EXEMPI_INCLUDE_BASE=exempi-$EXEMPI_MAJOR_VERSION
AC_SUBST(EXEMPI_INCLUDE_BASE)

dnl --------------------------------------------------------------------
dnl guess directory to install *.pc into
dnl --------------------------------------------------------------------
pkgconfigdir='${libdir}/pkgconfig'
AC_SUBST(pkgconfigdir)

AC_CONFIG_MACRO_DIR([m4])

AC_PROG_CC
AC_PROG_CXX
AC_PROG_LIBTOOL
AX_CXX_COMPILE_STDCXX_11(noext,mandatory)

AC_C_BIGENDIAN
AC_DEFINE(CHECKED_ENDIANNESS)

AC_ARG_WITH(darwinports,[  --with-darwinports     add /opt/local/... to CPP/LDFLAGS (Mac OSX)],[
        if test "x$withval" != "xno"; then
                CPPFLAGS="$CPPFLAGS -I/opt/local/include"
                LDFLAGS="$LDFLAGS -L/opt/local/lib"
		CC=g++
        fi
])
AC_ARG_WITH(fink,[  --with-fink          add /sw/... to CPP/LDFLAGS (Mac OSX)],[
        if test "x$withval" != "xno"; then
                CPPFLAGS="$CPPFLAGS -I/sw/include"
                LDFLAGS="$LDFLAGS -L/sw/lib"
		CC=g++
        fi
])


AC_CHECK_HEADER(expat.h, ,
	 AC_MSG_ERROR([expat headers missing]))
AC_CHECK_HEADER(iconv.h, ,
	 AC_MSG_ERROR([iconv headers missing]))
AC_CHECK_HEADER(zlib.h, ,
	 AC_MSG_ERROR([zlib headers missing]))

dnl Blatently copied from iconv.m4 to remove the crack about libtool
dnl But check for constness of the iconv parameters.
AC_MSG_CHECKING([for iconv declaration])
AC_CACHE_VAL(am_cv_proto_iconv, [
      AC_TRY_COMPILE([
#include <stdlib.h>
#include <iconv.h>
extern
#ifdef __cplusplus
"C"
#endif
#if defined(__STDC__) || defined(__cplusplus)
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
#else
size_t iconv();
#endif
], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
      am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
AC_MSG_RESULT([$]{ac_t:-
         }[$]am_cv_proto_iconv)
AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
      [Define as const if the declaration of iconv() needs const.])
dnl end iconv checks


dnl TLS.
AX_TLS
if test "$ac_cv_tls" != "none"; then
   AC_DEFINE(HAVE_NATIVE_TLS, [1], [Define if compiler has native TLS.])
fi
dnl end TLS

dnl check LD Flags
dnl we need a valid symfile. Make one.
cat >> _ac_foo.sym << _ACEOF
foo
_ACEOF
AX_LD_CHECK_FLAG([-Wl,--retain-symbols-file=_ac_foo.sym],[],[],[
dnl success
cv_support_symfile=yes
],[
dnl fail
cv_support_symfile=no
])
rm -f _ac_foo.sym
AM_CONDITIONAL(HAVE_SYMBOLS_FILE, test x$cv_support_symfile = "xyes")


AC_ARG_ENABLE(unittest,
              AC_HELP_STRING([--enable-unittest=yes|no],
                            [enable the unittest. requires boost (default is yes)]),
              ENABLE_UNITTEST=$enableval,
              ENABLE_UNITTEST=yes)
if test x$ENABLE_UNITTEST = xyes ; then
   BOOST_REQUIRE([1.48.0])
   BOOST_TEST([mt-s])
else
   ENABLE_UNITTEST=no
fi


case $build_vendor in
	apple)
		EXEMPI_PLATFORM_DEF=MAC_ENV
		LDFLAGS="$LDFLAGS -framework CoreServices -stdlib=libc++"
		CPPFLAGS="$CPPFLAGS -std=c++11 -stdlib=libc++"
		;;
	*)
		EXEMPI_PLATFORM_DEF=UNIX_ENV
		;;
esac

AC_SUBST(EXEMPI_PLATFORM_DEF)
AM_CONDITIONAL(MAC_ENV, test x$EXEMPI_PLATFORM_DEF = xMAC_ENV)
AM_CONDITIONAL(UNIX_ENV, test x$EXEMPI_PLATFORM_DEF = xUNIX_ENV)

AM_CONDITIONAL(WITH_UNIT_TEST, test x$ENABLE_UNITTEST = xyes)

dnl Check for valgrind (optional) for make check.
dnl AC_CHECK_PROG(VALGRIND, valgrind, valgrind)
AC_CHECK_HEADERS(valgrind/memcheck.h)
if test "$VALGRIND" = ""; then
        AC_MSG_WARN([Valgrind is missing. checks will run without])
fi
if test "$VALGRIND" != ""; then
dnl due to stupid m4 I had to double the [ and ] in the regexp
        vg_ver=`valgrind --version | sed -e  's/.*-\([[0-9]]\)\.[[0-9]].*/\1/'`
        VALGRIND="$VALGRIND --tool=memcheck --leak-check=yes --num-callers=10 --error-exitcode=100"
        if test "$vg_ver" != "3" ; then
           VALGRIND="$VALGRIND --logfile-fd=-1"
        fi
fi
AC_SUBST(VALGRIND)

AC_ARG_ENABLE(asan,[  --enable-asan    Turn on address sanitizer],[
    AX_CFLAGS_GCC_OPTION([-fsanitize=address -fno-omit-frame-pointer])
    AX_CXXFLAGS_GCC_OPTION([-fsanitize=address -fno-omit-frame-pointer])
]
,
[

])

XMPCORE_CPPFLAGS="-D$EXEMPI_PLATFORM_DEF=1 -DXMP_IMPL=1 -DXMP_ClientBuild=0 \
	-DXMP_StaticBuild=1 -DBanAllEntityUsage=1 \
	-D_FILE_OFFSET_BITS=64 -DHAVE_EXPAT_CONFIG_H=1 -DXML_STATIC=1 \
	-DDISABLE_QUICKTIME"
AC_SUBST(XMPCORE_CPPFLAGS)

AC_OUTPUT([
Makefile
third-party/Makefile
third-party/zuid/interfaces/Makefile
third-party/zlib/Makefile
third-party/expat/Makefile
source/Makefile
XMPCore/Makefile
XMPCore/source/Makefile
XMPFiles/Makefile
XMPFiles/source/Makefile
XMPFiles/source/FileHandlers/Makefile
XMPFiles/source/FormatSupport/Makefile
XMPFiles/source/NativeMetadataSupport/Makefile
XMPFiles/source/PluginHandler/Makefile
XMPFilesPlugins/Makefile
XMPFilesPlugins/api/Makefile
XMPFilesPlugins/api/source/Makefile
XMPFilesPlugins/PDF_Handler/Makefile
samples/Makefile
samples/source/Makefile
samples/testfiles/Makefile
build/GNUmakefile
public/Makefile
public/include/Makefile
public/include/client-glue/Makefile
exempi/Makefile
exempi/doc/Makefile
exempi/doc/Doxyfile
exempi/tests/Makefile
exempi/exempi-2.0.pc
])


echo "
Defines:

   EXEMPI_PLATFORM_DEF  = $EXEMPI_PLATFORM_DEF
   CPPFLAGS             = $CPPFLAGS
   LDFLAGS              = $LDFLAGS
   Thread Local Storage = $ac_cv_tls
   Run unit test        = $ENABLE_UNITTEST
"