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