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