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