make sqrt/libm detection work even in case of CPPFLAGS=-Werror
[platform/upstream/libexif.git] / configure.ac
1 AC_PREREQ(2.59)
2 AC_INIT([EXIF library],[0.6.13],[libexif-devel@lists.sourceforge.net],[libexif])
3 AC_CONFIG_SRCDIR([libexif/exif-data.h])
4 AC_CONFIG_HEADERS([config.h])
5 AM_INIT_AUTOMAKE([gnu 1.8 dist-bzip2])
6
7 GP_CHECK_SHELL_ENVIRONMENT
8 GP_CONFIG_MSG([Build])
9 GP_CONFIG_MSG([Source code location],[${srcdir}])
10
11 dnl ---------------------------------------------------------------------------
12 dnl Advanced information about versioning:
13 dnl   * "Writing shared libraries" by Mike Hearn
14 dnl         http://navi.cx/~mike/writing-shared-libraries.html
15 dnl   * libtool.info chapter "Versioning"
16 dnl ---------------------------------------------------------------------------
17 dnl Versioning:
18 dnl  - AGE (Micro):      Increment if any interfaces have been added; set to 0
19 dnl                      if any interfaces have been removed. Removal has 
20 dnl                      precedence over adding, so set to 0 if both happened.
21 dnl  - REVISION (Minor): Increment any time the source changes; set to 
22 dnl                      0 if you incremented CURRENT.
23 dnl  - CURRENT (Major):  Increment if the interface has changes or removals.
24 dnl ---------------------------------------------------------------------------
25 LIBEXIF_AGE=0
26 LIBEXIF_REVISION=0
27 LIBEXIF_CURRENT=12
28 AC_SUBST([LIBEXIF_AGE])
29 AC_SUBST([LIBEXIF_REVISION])
30 AC_SUBST([LIBEXIF_CURRENT])
31 LIBEXIF_VERSION_INFO=`expr $LIBEXIF_CURRENT + $LIBEXIF_REVISION`:$LIBEXIF_AGE:$LIBEXIF_REVISION
32 AC_SUBST([LIBEXIF_VERSION_INFO])
33
34 AC_PROG_CC
35 AC_C_CONST
36 dnl FIXME: AC_LIBTOOL_WIN32_DLL
37 AM_PROG_LIBTOOL
38 AM_CPPFLAGS="$CPPFLAGS"
39 GP_CONFIG_MSG([Compiler],[${CC}])
40
41
42 dnl Create a stdint.h-like file containing size-specific integer definitions
43 dnl that will always be available
44 AX_NEED_STDINT_H([libexif/_stdint.h])
45
46
47 dnl ---------------------------------------------------------------------------
48 dnl Whether -lm is required for our math functions
49 dnl ---------------------------------------------------------------------------
50
51 # we need sqrt and pow, but checking for sqrt should be sufficient
52 AC_ARG_VAR([MATHLIBS],[The libraries required for mathematical functions, e.g. -lm])
53 if test "x$MATHLIBS" = "x"; then
54         # We must not compile with -Wall -Werror here:
55         # char *sqrt() conflicts with double sin(const double xx) in any case.
56         CFLAGS_save="$CPPFLAGS"
57         CPPFLAGS_save="$CPPFLAGS"
58         CPPFLAGS=""
59         CFLAGS=""
60         AC_CHECK_FUNC([sqrt],[
61                 MATHLIBS=""
62         ],[
63                 AC_CHECK_LIB([m],[sqrt],[
64                         MATHLIBS="-lm"
65                 ],[
66                         AC_MSG_ERROR([
67 *** Could not find sqrt() function
68 ])
69                 ])
70         ])
71         CFLAGS="$CFLAGS_save"
72         CPPFLAGS="$CPPFLAGS_save"
73 fi
74 AC_SUBST([MATHLIBS])
75
76
77 # doc support
78 GP_CHECK_DOC_DIR
79 GP_CHECK_DOXYGEN
80
81
82 # ---------------------------------------------------------------------------
83 # i18n support
84 # ---------------------------------------------------------------------------
85 GP_GETTEXT_HACK([${PACKAGE}-${LIBEXIF_CURRENT}],
86                 [Lutz Müller and others])
87 ALL_LINGUAS="de es fr"
88 AM_GNU_GETTEXT_VERSION([0.14.1])
89 AM_GNU_GETTEXT([external])
90 AM_PO_SUBDIRS()
91 AM_ICONV()
92 GP_GETTEXT_FLAGS()
93
94 dnl We cannot use AC_DEFINE_UNQUOTED() for these definitions, as
95 dnl we require make to do insert the proper $(datadir) value
96 localedir="\$(datadir)/locale"
97 AC_SUBST(localedir)
98 AM_CPPFLAGS="$AM_CPPFLAGS -DLOCALEDIR=\\\"${localedir}\\\""
99
100
101 dnl ---------------------------------------------------------------------------
102 dnl Compiler/Linker Options and Warnings
103 dnl ---------------------------------------------------------------------------
104 AM_CPPFLAGS="$AM_CPPFLAGS -I\$(top_srcdir)"
105 AM_CPPFLAGS="$AM_CPPFLAGS -I\$(top_srcdir)/libexif"
106 AM_LDFLAGS="$LDFLAGS"
107 if test "x$GCC" = "xyes"; then
108     AM_CPPFLAGS="$AM_CPPFLAGS -g -Wall -Wmissing-declarations -Wmissing-prototypes"
109     AM_LDFLAGS="$AM_LDFLAGS -g -Wall"
110 fi
111
112
113
114 AC_SUBST(AM_CPPFLAGS)
115 AC_SUBST(AM_LDFLAGS)
116
117
118 dnl ---------------------------------------------------------------------------
119 dnl Output files
120 dnl ---------------------------------------------------------------------------
121 AC_CONFIG_FILES([ 
122   po/Makefile.in
123   Makefile
124   libexif.spec
125   libexif/Makefile
126   libexif/canon/Makefile
127   libexif/olympus/Makefile
128   libexif/pentax/Makefile
129   test/Makefile
130   test/nls/Makefile
131   m4m/Makefile
132   doc/Makefile
133   doc/Doxyfile
134   libexif/libexif.pc
135 ])
136 AC_OUTPUT
137
138 GP_CONFIG_OUTPUT