1AC_PREREQ(2.69)
2AC_INIT([EXIF library],
3        [0.6.23],
4        [libexif-devel@lists.sourceforge.net],
5        [libexif],
6        [https://libexif.github.io/])
7AC_CONFIG_SRCDIR([libexif/exif-data.h])
8AC_CONFIG_HEADERS([config.h])
9AC_CONFIG_MACRO_DIR([auto-m4])
10AM_INIT_AUTOMAKE([
11  -Wall
12  gnu
13  1.14.1
14  dist-xz
15  dist-bzip2
16  dist-zip
17  check-news
18  subdir-objects
19])
20AM_MAINTAINER_MODE
21
22# Use the silent-rules feature when possible.
23m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
24AM_SILENT_RULES([yes])
25
26GP_CHECK_SHELL_ENVIRONMENT
27GP_CONFIG_MSG([Build])
28GP_CONFIG_MSG([Source code location], [${srcdir}])
29
30dnl ---------------------------------------------------------------------------
31dnl Advanced information about versioning:
32dnl   * "Writing shared libraries" by Mike Hearn
33dnl         http://plan99.net/~mike/writing-shared-libraries.html
34dnl   * libtool.info chapter "Versioning"
35dnl   * libtool.info chapter "Updating library version information"
36dnl ---------------------------------------------------------------------------
37dnl Versioning:
38dnl  - CURRENT (Major):  Increment if the interface has changes. AGE is always
39dnl                      *changed* at the same time.
40dnl  - AGE (Micro):      Increment if any interfaces have been added; set to 0
41dnl		         if any interfaces have been removed. Removal has
42dnl                      precedence over adding, so set to 0 if both happened.
43dnl                      It denotes upward compatibility.
44dnl  - REVISION (Minor): Increment any time the source changes; set to
45dnl			 0 if you incremented CURRENT.
46dnl
47dnl  To summarize. Any interface *change* increment CURRENT. If that interface
48dnl  change does not break upward compatibility (ie it is an addition),
49dnl  increment AGE, Otherwise AGE is reset to 0. If CURRENT has changed,
50dnl  REVISION is set to 0, otherwise REVISION is incremented.
51dnl ---------------------------------------------------------------------------
52dnl C:A:R
53dnl 12:0:1   0.6.13
54dnl 13:1:0   added EXIF_DATA_OPTION_DONT_CHANGE_MAKER_NOTE (for 0.6.14)
55dnl 14:2:0   added XP_ WinXP tags (for 0.6.15)
56dnl 14:2:1   0.6.17
57dnl 15:3:0   added exif_loader_get_buf (for 0.6.18)
58dnl 15:3:1   0.6.19
59dnl 15:3:2   0.6.20
60dnl 15:3:3   0.6.21
61dnl 15:3:4   0.6.22
62LIBEXIF_CURRENT=15
63LIBEXIF_AGE=3
64LIBEXIF_REVISION=4
65AC_SUBST([LIBEXIF_AGE])
66AC_SUBST([LIBEXIF_REVISION])
67AC_SUBST([LIBEXIF_CURRENT])
68AC_SUBST([LIBEXIF_CURRENT_MIN],[`expr $LIBEXIF_CURRENT - $LIBEXIF_AGE`])
69LIBEXIF_VERSION_INFO="$LIBEXIF_CURRENT:$LIBEXIF_REVISION:$LIBEXIF_AGE"
70AC_SUBST([LIBEXIF_VERSION_INFO])
71
72AC_C_INLINE
73AM_PROG_AR
74LT_INIT([win32-dll])
75AM_CPPFLAGS="$CPPFLAGS"
76GP_CONFIG_MSG([Compiler], [${CC}])
77
78
79dnl --------------------------------------------------------------------
80dnl check for "diff" and "diff -u"
81dnl --------------------------------------------------------------------
82
83AC_ARG_VAR([DIFF], [path to diff utility (default: no)])
84AC_PATH_PROG([DIFF], [diff], [no])
85AM_CONDITIONAL([HAVE_DIFF], [test "x$DIFF" != xno])
86
87DIFF_U="no"
88AS_IF([test "x$DIFF" != xno], [dnl
89AC_MSG_CHECKING([whether diff supports -u])
90echo moo > conftest-a.c
91echo moo > conftest-b.c
92AS_IF([${DIFF} -u conftest-a.c conftest-b.c], [dnl
93  AC_MSG_RESULT([yes])
94  DIFF_U="$DIFF -u"
95], [dnl
96  AC_MSG_RESULT([no])
97])
98rm -f conftest-a.c conftest-b.c
99])
100AC_SUBST([DIFF_U])
101AM_CONDITIONAL([HAVE_DIFF_U], [test "x$DIFF_U" != xno])
102
103
104dnl --------------------------------------------------------------------
105
106AC_SYS_LARGEFILE
107
108dnl Create a stdint.h-like file containing size-specific integer definitions
109dnl that will always be available
110AX_NEED_STDINT_H([libexif/_stdint.h])
111
112
113dnl ------------------------------------------------------------------------
114dnl Whether we're supposed to ship binaries in the tarball
115dnl ------------------------------------------------------------------------
116
117ship_binaries=false
118AC_ARG_ENABLE([ship-binaries],
119[AS_HELP_STRING([--enable-ship-binaries],
120                [Whether to ship binaries in the tarball [default=no]])], [
121AS_VAR_IF([enableval], [yes], [ship_binaries=true])
122])
123AM_CONDITIONAL([SHIP_BINARIES], [$ship_binaries])
124GP_CONFIG_MSG([Ship binaries in tarball], [$ship_binaries])
125
126
127dnl ---------------------------------------------------------------------------
128dnl Whether -lm is required for our math functions
129dnl ---------------------------------------------------------------------------
130
131# we need sqrt and pow which may be in libm
132# We cannot use AC_CHECK_FUNC because if CFLAGS contains
133# -Wall -Werror here the check fails because
134# char *sqrt() conflicts with double sqrt(double xx)
135
136# Start by assuming -lm is needed, because it's possible that the little
137# test program below will be optimized to in-line floating point code that
138# doesn't require -lm, whereas the library itself cannot be so optimized
139# (this actually seems to be the case on x86 with gcc 4.2). Assuming the
140# reverse means that -lm could be needed but wouldn't be detected below.
141
142LIBS_orig="$LIBS"
143LIBS="$LIBS -lm"
144AC_MSG_CHECKING([for math functions in libm])
145AC_LINK_IFELSE([AC_LANG_PROGRAM([
146	  #include <math.h>
147	  ],[
148	    double s = sqrt(0);
149	    double p = pow(s,s);
150	  ])],
151	[AC_MSG_RESULT([yes])], [
152	AC_MSG_RESULT([no])
153	LIBS="$LIBS_orig"
154	AC_MSG_CHECKING([for math functions without libm])
155	AC_LINK_IFELSE([AC_LANG_PROGRAM([
156		#include <math.h>
157		],[
158		  double s = sqrt(0);
159		  double p = pow(s,s);
160		])],
161	[
162		AC_MSG_RESULT([yes])
163	],[
164		AC_MSG_RESULT([no])
165		AC_MSG_ERROR([*** Could not find sqrt() & pow() functions])
166	])
167])
168
169# Check whether libfailmalloc is available for tests
170CHECK_FAILMALLOC
171
172# doc support
173GP_CHECK_DOC_DIR
174GP_CHECK_DOXYGEN
175
176# Whether to enable the internal docs build.
177#
178# This takes quite some time due to the generation of lots of call
179# graphs, so it is disabled by default.
180set_enable_internal_docs=no
181AC_ARG_ENABLE([internal-docs], [dnl
182AS_HELP_STRING([--enable-internal-docs],
183               [Build internal code docs if doxygen available])], [
184dnl If either --enable-foo nor --disable-foo were given, execute this.
185AS_CASE(["$enableval"],
186        [no|off|false], [set_enable_internal_docs=no],
187        [yes|on|true],  [set_enable_internal_docs=yes])
188])
189AC_MSG_CHECKING([whether to create internal code docs])
190AC_MSG_RESULT([${set_enable_internal_docs}])
191AM_CONDITIONAL([ENABLE_INTERNAL_DOCS],
192               [test "x${set_enable_internal_docs}" = "xyes"])
193
194
195# ---------------------------------------------------------------------------
196# i18n support
197# ---------------------------------------------------------------------------
198ALL_LINGUAS="be bs cs da de en_AU en_CA en_GB es fr it ja ms nl pl pt pt_BR ru sk sq sr sv tr uk vi zh_CN"
199AM_PO_SUBDIRS
200GP_GETTEXT_HACK([${PACKAGE}-${LIBEXIF_CURRENT_MIN}],
201                [Lutz Mueller and others])
202AM_GNU_GETTEXT_VERSION([0.18.3])
203AM_GNU_GETTEXT([external])
204AM_ICONV()
205GP_GETTEXT_FLAGS()
206
207
208dnl ---------------------------------------------------------------------------
209dnl Thread-safe functions
210dnl ---------------------------------------------------------------------------
211AC_MSG_CHECKING([for localtime_s])
212AC_LINK_IFELSE([AC_LANG_PROGRAM([[
213  #include <time.h>
214]], [[
215  localtime_s(NULL, NULL);
216]])], [dnl
217  have_localtime_s="yes"
218  AC_DEFINE([HAVE_LOCALTIME_S], [1], [Define to 1 if you have localtime_s()])
219], [dnl
220  have_localtime_s="no"
221])
222AC_MSG_RESULT([$have_localtime_s])
223
224AC_CHECK_FUNCS([localtime_r])
225
226
227dnl ---------------------------------------------------------------------------
228dnl Compiler/Linker Options and Warnings
229dnl ---------------------------------------------------------------------------
230AM_CPPFLAGS="$AM_CPPFLAGS -I\$(top_srcdir)"
231AM_CPPFLAGS="$AM_CPPFLAGS -I\$(top_builddir)"
232AM_LDFLAGS="$LDFLAGS"
233AS_VAR_IF([GCC], [yes], [dnl
234    AM_CFLAGS="$AM_CFLAGS -ansi -pedantic-error"
235    AM_CXXFLAGS="$AM_CXXFLAGS -ansi -pedantic-error"
236    AM_CPPFLAGS="$AM_CPPFLAGS -g -Wall -Wmissing-declarations -Wmissing-prototypes"
237    AM_LDFLAGS="$AM_LDFLAGS -g -Wall"
238])
239
240AC_SUBST([AM_CPPFLAGS])
241AC_SUBST([AM_LDFLAGS])
242
243
244dnl ---------------------------------------------------------------------------
245dnl Output files
246dnl ---------------------------------------------------------------------------
247AC_CONFIG_FILES([
248  po/Makefile.in
249  Makefile
250  libexif.spec
251  libexif/Makefile
252  test/Makefile
253  test/nls/Makefile
254  m4m/Makefile
255  doc/Makefile
256  doc/Doxyfile
257  doc/Doxyfile-internals
258  libexif.pc
259  libexif-uninstalled.pc
260  binary-dist/Makefile
261  contrib/Makefile
262  contrib/examples/Makefile
263])
264AC_OUTPUT
265
266GP_CONFIG_OUTPUT
267