autotools cleanups:
[framework/uifw/eet.git] / configure.ac
1 # get rid of that stupid cache mechanism
2 rm -f config.cache
3
4 AC_INIT([eet], [1.1.0], [enlightenment-devel@lists.sourceforge.net])
5 AC_PREREQ([2.52])
6 AC_CONFIG_SRCDIR([configure.ac])
7 AC_CONFIG_MACRO_DIR([m4])
8 AC_CANONICAL_BUILD
9 AC_CANONICAL_HOST
10 AC_ISC_POSIX
11
12 AM_INIT_AUTOMAKE(1.6 dist-bzip2)
13 AM_CONFIG_HEADER(config.h)
14
15 AC_LIBTOOL_WIN32_DLL
16 define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
17 define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
18 AC_PROG_LIBTOOL
19
20 VMAJ=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $1);}'`
21 VMIN=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $2);}'`
22 VMIC=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $3);}'`
23 SNAP=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $4);}'`
24 version_info=`expr $VMAJ + $VMIN`":$VMIC:$VMIN"
25 AC_SUBST(version_info)
26
27
28 ### Default options with respect to host
29
30 case "$host_os" in
31    mingw32ce* | cegcc*)
32       want_openssl="no"
33       want_cypher="no"
34       want_signature="no"
35       ;;
36    *)
37       want_openssl="auto"
38       want_cypher="yes"
39       want_signature="yes"
40       ;;
41 esac
42
43 requirement_eet=""
44
45
46 ### Additional options to configure
47
48 # Old eet file format support
49
50 old_eet_file_format="yes"
51 AC_ARG_ENABLE(old-eet-file-format,
52    [AC_HELP_STRING(
53       [--disable-old-eet-file-format],
54       [disable old eet file format support. [[default=enabled]]]
55     )],
56    [old_eet_file_format=$enableval]
57 )
58 AC_MSG_CHECKING([whether to support old eet file format])
59 AC_MSG_RESULT([${old_eet_file_format=$enableval}])
60
61 if test "x${old_eet_file_format}" = "xyes" ; then
62    AC_DEFINE(EET_OLD_EET_FILE_FORMAT, 1, [support old eet file format])
63 else
64    AC_DEFINE(EET_OLD_EET_FILE_FORMAT, 0, [support old eet file format])
65 fi
66
67 # Openssl support
68
69 AC_ARG_ENABLE([openssl],
70    [AC_HELP_STRING([--disable-openssl], [disable openssl eet support])],
71    [want_openssl=$enableval]
72 )
73 AC_MSG_CHECKING([whether to use OpenSSL])
74 AC_MSG_RESULT([${want_openssl}])
75
76 # Cryptography support
77
78 AC_ARG_ENABLE([cypher],
79    [AC_HELP_STRING([--disable-cypher], [disable cypher support for eet API])],
80    [want_cypher=$enableval]
81 )
82 AC_MSG_CHECKING([whether to use cypher])
83 AC_MSG_RESULT([${want_cypher}])
84
85 AC_ARG_ENABLE([signature],
86    [AC_HELP_STRING([--disable-signature], [disable signature file support for eet])],
87    [want_signature=$enableval]
88 )
89 AC_MSG_CHECKING([whether to use signature])
90 AC_MSG_RESULT([${want_signature}])
91
92 # Assert or fail.
93 prefer_assert="no"
94 AC_ARG_ENABLE([assert],
95    [AC_HELP_STRING([--enable-assert], [enable assert, [[default=disabled]]])],
96    [prefer_assert=$enableval]
97 )
98
99 # Unit tests, coverage and benchmarking
100
101 EFL_CHECK_TESTS([enable_tests="yes"], [enable_tests="no"])
102 EFL_CHECK_COVERAGE([${enable_tests}], [enable_coverage="yes"], [enable_coverage="no"])
103
104 if test "x${prefer_assert}" = "xno"; then
105    DEBUG_CFLAGS="-DNDEBUG"
106 else
107 # use debug symbols and set DEBUG if coverage support is enabled
108    DEBUG_CFLAGS="${EFL_DEBUG_CFLAGS}"
109 fi
110 AC_SUBST(DEBUG_CFLAGS)
111
112
113 ### Checks for libraries
114
115 PKG_PROG_PKG_CONFIG
116
117 # Evil library for compilation on Windows
118
119 EFL_EET_BUILD=""
120 case "$host_os" in
121    mingw* | cegcc*)
122    PKG_CHECK_MODULES([EVIL], [evil])
123    AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if Evil library is installed])
124    requirement_eet="evil ${requirement_eet}"
125    EFL_EET_BUILD="-DEFL_EET_BUILD"
126    ;;
127 esac
128 AC_SUBST(EFL_EET_BUILD)
129
130 # Eina library
131
132 PKG_CHECK_MODULES(EINA, [eina-0])
133 requirement_eet="eina-0 ${requirement_eet}"
134
135 # Openssl library
136 have_openssl="no"
137 if test "x${want_openssl}" = "xyes" -o "x${want_openssl}" = "xauto" ; then
138    PKG_CHECK_MODULES(OPENSSL, openssl,
139       [
140        have_openssl="yes"
141        AC_DEFINE(HAVE_OPENSSL, 1, [Have Openssl support])
142        requirement_eet="openssl ${requirement_eet}"
143       ])
144 fi
145
146 have_cypher="no"
147 if test "x${have_openssl}" = "xyes" -a "x${want_cypher}" = "xyes" ; then
148    have_cypher="yes"
149    AC_DEFINE(HAVE_CYPHER, 1, [Have cypher support built in eet])
150 fi
151
152 AC_MSG_CHECKING(whether to activate cypher support in eet)
153 AC_MSG_RESULT(${have_cypher})
154
155 have_signature="no"
156 if test "x${have_openssl}" = "xyes" -a "x${want_signature}" = "xyes" ; then
157    have_signature="yes"
158    AC_DEFINE(HAVE_SIGNATURE, 1, [Have signature support for eet file])
159 fi
160
161 AC_MSG_CHECKING(whether to activate signature support in eet)
162 AC_MSG_RESULT(${have_signature})
163
164
165 ### Checks for header files
166
167 AC_CHECK_HEADER([zlib.h],
168    [dummy="yes"],
169    [AC_MSG_ERROR("Cannot find zlib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file")])
170
171 AC_CHECK_HEADER([jpeglib.h],
172    [dummy="yes"],
173    [AC_MSG_ERROR("Cannot find jpeglib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file")])
174
175 AC_CHECK_HEADERS(netinet/in.h)
176
177 AC_CHECK_HEADER([fnmatch.h],
178    [dummy="yes"],
179    [AC_MSG_ERROR([Cannot find fnmatch.h. Make sure your CFLAGS environment variable contains include lines for the location of this file. MinGW users: see the INSTALL file])])
180
181
182 ### Checks for programs
183 AC_PROG_CC
184
185 # doxygen program for documentation building
186
187 EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"])
188
189
190 ### Checks for types
191
192
193 ### Checks for structures
194
195
196 ### Checks for compiler characteristics
197 AM_PROG_CC_C_O
198 AC_C_CONST
199 AC_C_INLINE
200 AC_PROG_CC_STDC
201 AC_C___ATTRIBUTE__
202
203 # Check whether the null pointer is zero on this arch
204 AC_TRY_RUN(
205    [
206 #include <stdlib.h>
207 int main (int argc, char **argv) {
208   void *foo = NULL;
209   int bar = (int)foo;
210   return (int)foo;
211 }
212    ],
213    [have_null="yes"],
214    [have_null="no"],
215    [
216     AC_MSG_WARN([Cannot check when cross-compiling -- assuming null is okay])
217     have_null="yes"
218    ])
219 AC_MSG_CHECKING([value of the null pointer])
220 AC_MSG_RESULT([${have_null}])
221
222 if test ! "x${have_null}" = "xyes" ; then
223    AC_MSG_WARN([Your system is a bit too funny, eet might not work properly])
224 fi
225
226 # These are needed for fmemopen/open_memstream
227 AC_DEFINE(_GNU_SOURCE, , [Enable GNU extensions])
228
229 EET_CPPFLAGS=""
230 EET_CFLAGS=""
231 case "$host_os" in
232    mingw32ce*)
233       EET_CPPFLAGS="-D_WIN32_WCE=0x0420"
234       ;;
235    cegcc*)
236       EET_CPPFLAGS="-D_WIN32_WCE=0x0420"
237       EET_CFLAGS="-mwin32"
238       ;;
239 esac
240 AC_SUBST(EET_CPPFLAGS)
241 AC_SUBST(EET_CFLAGS)
242
243
244 ### Checks for linker characteristics
245
246 EET_LIBS=""
247 case "$host_os" in
248    mingw32ce*)
249       EET_LIBS="-lws2"
250       ;;
251    cegcc*)
252       EET_LIBS="-lws2"
253       ;;
254    mingw*)
255       EET_LIBS="-lws2_32"
256       ;;
257 esac
258 AC_SUBST(EET_LIBS)
259
260 lt_enable_auto_import=""
261 case "$host_os" in
262    mingw* | cegcc*)
263       lt_enable_auto_import="-Wl,--enable-auto-import"
264       ;;
265 esac
266 AC_SUBST(lt_enable_auto_import)
267
268
269 ### Checks for library functions
270 AC_FUNC_ALLOCA
271
272 AC_CHECK_FUNCS(fmemopen open_memstream realpath)
273
274 fnmatch_libs=""
275 AC_CHECK_FUNCS([fnmatch], [res="yes"], [res="no"])
276 if test "x$res" = "xno"; then
277    AC_SEARCH_LIBS([fnmatch],
278       [fnmatch iberty evil],
279       [res="yes"],
280       [res="no"])
281    if test "x$res" = "xno"; then
282       AC_MSG_ERROR([Cannot find fnmatch() in neither libc nor libfnmatch, nor libiberty, nor libevil])
283    fi
284    fnmatch_libs="${ac_cv_search_fnmatch}"
285 fi
286 AC_SUBST(fnmatch_libs)
287
288
289 AC_SUBST(requirement_eet)
290
291 AC_OUTPUT([
292 Makefile
293 eet.pc
294 doc/Makefile
295 doc/eet.dox
296 src/Makefile
297 src/lib/Makefile
298 src/bin/Makefile
299 src/tests/Makefile
300 README
301 eet.spec
302 ])
303
304
305 #####################################################################
306 ## Info
307
308 echo
309 echo
310 echo
311 echo "------------------------------------------------------------------------"
312 echo "$PACKAGE_NAME $PACKAGE_VERSION"
313 echo "------------------------------------------------------------------------"
314 echo
315 echo "Configuration Options Summary:"
316 echo
317 echo "  Openssl..............: ${have_openssl}"
318 echo "    Cypher support.....: ${have_cypher}"
319 echo "    Signature..........: ${have_signature}"
320 echo
321 echo "  Documentation........: ${enable_doc}"
322 echo "  Tests................: ${enable_tests}"
323 echo "  Coverage.............: ${enable_coverage}"
324 echo
325 echo "  Old eet file format..: ${old_eet_file_format}"
326 echo
327 echo "  Compilation..........: make"
328 echo
329 echo "  Installation.........: make install"
330 echo
331 echo "    prefix.............: $prefix"
332 echo