configure.in -> configure.ac
[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_CANONICAL_BUILD
8 AC_CANONICAL_HOST
9 AC_ISC_POSIX
10
11 AM_INIT_AUTOMAKE(1.6 dist-bzip2)
12 AM_CONFIG_HEADER(config.h)
13
14 AC_PROG_CC
15 AM_PROG_CC_STDC
16 AC_HEADER_STDC
17 AC_C_CONST
18 AM_PROG_CC_C_O
19
20 AC_LIBTOOL_WIN32_DLL
21 define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
22 define([AC_LIBTOOL_LANG_F77_CONFIG], [:])dnl
23 AC_PROG_LIBTOOL
24
25 VMAJ=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $1);}'`
26 VMIN=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $2);}'`
27 VMIC=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $3);}'`
28 SNAP=`echo $PACKAGE_VERSION | awk -F. '{printf("%s", $4);}'`
29 version_info=`expr $VMAJ + $VMIN`":$VMIC:$VMIN"
30 AC_SUBST(version_info)
31
32 PKG_PROG_PKG_CONFIG
33
34 WIN32_CFLAGS=""
35 WIN32_LIBS=""
36 lt_no_undefined=""
37 lt_enable_auto_import=""
38 case "$host_os" in
39         mingw*|cegcc)
40                 PKG_CHECK_MODULES([EVIL], [evil])
41                 AC_DEFINE(HAVE_EVIL, 1, [Set to 1 if evil package is installed])
42                 dnl needed for correct definition of EAPI
43                 AC_DEFINE(EFL_EET_BUILD, 1, [Define to mention that eet is built])
44                 if test "$host_os" = "cegcc" ; then
45                         WIN32_CFLAGS="-mwin32"
46                         WIN32_LIBS="-lws2"
47                         lt_enable_auto_import="-Wl,--enable-auto-import"
48                 else
49                         WIN32_LIBS="-lws2_32"
50                 fi
51                 lt_no_undefined="-no-undefined"
52                 ;;
53 esac
54 AC_SUBST(WIN32_CFLAGS)
55 AC_SUBST(WIN32_LIBS)
56 AC_SUBST(lt_no_undefined)
57 AC_SUBST(lt_enable_auto_import)
58
59 dnl Checking for __attribute__ support
60 AC_MSG_CHECKING([for __attribute__])
61 AC_CACHE_VAL(_cv_have___attribute__,
62   [
63     AC_TRY_COMPILE([#include <stdlib.h>],
64       [int func(int x); int foo(int x __attribute__ ((unused))) { exit(1); }],
65       [_cv_have___attribute__="yes"],
66       [_cv_have___attribute__="no"])
67   ]
68 )
69
70 if test "x${_cv_have___attribute__}" = "xyes" ; then
71    AC_DEFINE(HAVE___ATTRIBUTE__, 1, [Define to 1 if your compiler has __attribute__])
72 fi
73 AC_MSG_RESULT(${_cv_have___attribute__})
74
75 AC_FUNC_ALLOCA
76
77 AC_CHECK_HEADER(zlib.h,, AC_MSG_ERROR("Cannot find zlib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file"))
78 AC_CHECK_HEADER(jpeglib.h,, AC_MSG_ERROR("Cannot find jpeglib.h. Make sure your CFLAGS environment variable contains include lines for the location of this file"))
79
80 AC_CHECK_HEADERS(netinet/in.h)
81
82 AC_CHECK_HEADER(fnmatch.h,, 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]))
83
84 fnmatch_libs=""
85 AC_CHECK_FUNCS(fnmatch, res=yes, res=no)
86 if test "x$res" = "xno"; then
87         AC_CHECK_LIB(fnmatch, fnmatch, res=yes fnmatch_libs="-lfnmatch", res=no)
88 dnl Test for compilation with MinGW.
89 dnl fnmatch function is in the libiberty library
90         if test "x$res" = "xno"; then
91                 AC_CHECK_LIB(iberty, fnmatch, res=yes fnmatch_libs="-liberty", res=no)
92         fi
93         if test "x$res" = "xno"; then
94                 AC_MSG_ERROR([Cannot find fnmatch() in neither libc nor libfnmatch, nor libiberty])
95         fi
96 fi
97
98 AC_SUBST(fnmatch_libs)
99
100 dnl These are needed for fmemopen/open_memstream
101 AC_DEFINE(_GNU_SOURCE, , [Enable GNU extensions])
102
103 AC_CHECK_FUNCS(fmemopen open_memstream realpath)
104
105 dnl Check whether the null pointer is zero on this arch
106 AC_MSG_CHECKING([value of the null pointer])
107 AC_TRY_RUN([
108 #include <stdlib.h>
109 int main (int argc, char **argv) {
110   void *foo = NULL;
111   int bar = (int)foo;
112   return (int)foo;
113 }
114 ], AC_MSG_RESULT([yes]), [
115         AC_MSG_RESULT([no])
116         AC_MSG_WARN([Your system is a bit too funny, eet might not work properly])
117 ], AC_MSG_WARN([Cannot check when cross-compiling -- assuming null is okay])
118 )
119
120 dnl Unit Tests
121
122 AC_ARG_ENABLE(tests,
123   [AC_HELP_STRING([--enable-tests], [Enable tests @<:@default=no@:>@])],
124   [
125    if test "x${enableval}" = "xyes" ; then
126      enable_tests="yes"
127    else
128      enable_tests="no"
129    fi
130   ],
131   [enable_tests="no"]
132 )
133 AC_MSG_CHECKING([if tests are built])
134 AC_MSG_RESULT([${enable_tests}])
135
136 if test "x${enable_tests}" = "xyes" ; then
137   PKG_CHECK_MODULES([CHECK],
138     [check >= 0.9.5],
139     [dummy="yes"],
140     [enable_tests="no"]
141   )
142 fi
143
144 AM_CONDITIONAL(EET_ENABLE_TESTS, test "x${enable_tests}" = "xyes")
145
146 dnl Openssl support
147 want_openssl="auto"
148 have_openssl="no"
149 AC_ARG_ENABLE(openssl,
150   [AC_HELP_STRING([--disable-openssl], [disable openssl eet support])],
151   [ want_openssl=$enableval ]
152 )
153 if test "x$want_openssl" = "xyes" -o "x$want_openssl" = "xauto"; then
154   PKG_CHECK_MODULES(OPENSSL, openssl,
155     [
156       have_openssl="yes"
157       AC_DEFINE(HAVE_OPENSSL, 1, [Have Openssl support])
158     ],
159     [
160       if test "x$use_strict" = "xyes"; then
161         AC_MSG_ERROR([Openssl not found (strict dependencies checking)])
162       fi
163     ])
164 fi
165
166 dnl Crypto option
167 want_cypher="yes"
168 have_cypher="no"
169 want_signature="yes"
170 have_signature="no"
171
172 AC_MSG_CHECKING(whether to activate cypher support in eet)
173 AC_ARG_ENABLE(cypher,
174   [AC_HELP_STRING([--disable-cypher], [disable cypher support for eet API])],
175   [ want_cypher=$enableval ]
176 )
177 if test "x$have_openssl" = "xyes" -a "x$want_cypher" = "xyes"; then
178   have_cypher="yes"
179   AC_DEFINE(HAVE_CYPHER, 1, [Have cypher support built in eet])
180 fi
181 AC_MSG_RESULT($have_cypher)
182
183 AC_MSG_CHECKING(whether to activate signature support in eet)
184 AC_ARG_ENABLE(signature,
185   [AC_HELP_STRING([--disable-signature], [disable signature file support for eet])],
186   [ want_signature=$enableval ]
187 )
188 if test "x$have_openssl" = "xyes" -a "x$want_signature" = "xyes"; then
189   have_signature="yes"
190   AC_DEFINE(HAVE_SIGNATURE, 1, [Have signature support for eet file])
191 fi
192 AC_MSG_RESULT($have_signature)
193
194 dnl Coverage
195
196 AC_ARG_ENABLE(coverage,
197   [AC_HELP_STRING([--enable-coverage],
198     [compile with coverage profiling instrumentation @<:@default=no@:>@])],
199   [
200    if test "x${enableval}" = "xyes" ; then
201      enable_coverage="yes"
202    else
203      enable_coverage="no"
204    fi],
205   [enable_coverage="no"]
206 )
207 AC_MSG_CHECKING([whether to use profiling instrumentation])
208 AC_MSG_RESULT($enable_coverage)
209
210 if test "x$enable_tests" = "xno" -a "x$enable_coverage" = "xyes"; then
211   enable_coverage="no"
212 fi
213
214 if test "x$enable_coverage" = "xyes"; then
215   AC_CHECK_PROG(have_lcov,
216     [lcov],
217     [yes],
218     [no]
219   )
220   if test "x$have_lcov" = "xyes" ; then
221     COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage"
222     COVERAGE_LIBS="-lgcov"
223 dnl remove any optimisation flag and force debug symbols
224     CFLAGS="-g -O0"
225   else
226     AC_MSG_WARN([lcov is not found, disable profiling instrumentation])
227     enable_coverage="no"
228   fi
229 fi
230 AC_SUBST(COVERAGE_CFLAGS)
231 AC_SUBST(COVERAGE_LIBS)
232
233 AM_CONDITIONAL(EET_ENABLE_COVERAGE, test "x$enable_coverage" = "xyes")
234
235 dnl Disable support for old eet file format.
236 old_eet_file_format="yes"
237 AC_ARG_ENABLE(old-eet-file-format,
238   AC_HELP_STRING(
239     [--disable-old-eet-file-format],
240     [disable old eet file format support. [[default=enabled]]]
241   ),
242   [ old_eet_file_format=$enableval ]
243 )
244 AM_CONDITIONAL(EET_OLD_EET_FILE_FORMAT, test "x$old_eet_file_format" = "xyes")
245 if test "x$old_eet_file_format" = "xyes"; then
246   AC_DEFINE(EET_OLD_EET_FILE_FORMAT, 1, [support old eet file format])
247 else
248   AC_DEFINE(EET_OLD_EET_FILE_FORMAT, 0, [support old eet file format])
249 fi
250
251 dnl Assert or fail.
252 prefer_assert="no"
253 AC_ARG_ENABLE(assert,
254   AC_HELP_STRING(
255     [--enable-assert],
256     [enable assert, [[default=disabled]]]
257   ),
258   [ prefer_assert=$enableval ]
259 )
260 AM_CONDITIONAL(EET_ASSERT, test "x$prefer_assert" = "xyes")
261 if test "x$prefer_assert" = "xno"; then
262   cflags="$cflags -DNDEBUG"
263 fi
264
265 #AM_CHECK_DOXYGEN()
266
267 AC_OUTPUT([
268 Makefile
269 eet.pc
270 eet.c
271 src/Makefile
272 src/lib/Makefile
273 src/bin/Makefile
274 src/tests/Makefile
275 README
276 eet.spec
277 ])
278
279
280 #####################################################################
281 ## Info
282
283 echo
284 echo
285 echo
286 echo "------------------------------------------------------------------------"
287 echo "$PACKAGE_NAME $PACKAGE_VERSION"
288 echo "------------------------------------------------------------------------"
289 echo
290 echo "Configuration Options Summary:"
291 echo
292 echo "  Openssl..............: ${have_openssl}"
293 echo "    Cypher support.....: ${have_cypher}"
294 echo "    Signature..........: ${have_signature}"
295
296 echo "  Tests................: ${enable_tests}"
297 echo "  Coverage.............: ${enable_coverage}"
298 echo
299 echo "  Old eet file format..: ${old_eet_file_format}"
300 echo
301 echo "  Compilation..........: make"
302 echo
303 echo "  Installation.........: make install"
304 echo
305 echo "    prefix.............: $prefix"
306 echo