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