Make abidiff --harmless show harmless changes in unions
[platform/upstream/libabigail.git] / configure.ac
1 m4_define([version_major],   [1])
2 m4_define([version_minor],   [7])
3
4 AC_INIT([libabigail],
5         [version_major.version_minor],
6         [http://sourceware.org/bugzilla],
7         [libabigail],
8         [http://sourceware.org/libabigail])
9
10 AC_PREREQ([2.63])
11 AC_CONFIG_AUX_DIR([build-aux])
12 AC_CONFIG_HEADER([config.h])
13 AC_CONFIG_SRCDIR([README])
14 AC_CONFIG_MACRO_DIR([m4])
15
16 dnl Include some autoconf macros to check for python modules.
17 dnl
18 dnl These macros are coming from the autoconf archive at
19 dnl http://www.gnu.org/software/autoconf-archive
20
21 dnl This one is for the AX_CHECK_PYTHON_MODULES() macro.
22 m4_include([autoconf-archive/ax_check_python_modules.m4])
23
24 dnl These two below are for the AX_PROG_PYTHON_VERSION() module.
25 m4_include([autoconf-archive/ax_compare_version.m4])
26 m4_include([autoconf-archive/ax_prog_python_version.m4])
27
28 dnl This one is to be able to run "make check-valgrind"
29 dnl and have unit tests run under  der Valgrind.
30 m4_include([autoconf-archive/ax_valgrind_check.m4])
31
32 AM_INIT_AUTOMAKE([1.11.1 foreign subdir-objects tar-ustar parallel-tests])
33 AM_MAINTAINER_MODE([enable])
34
35 AM_SILENT_RULES([yes])
36
37 VERSION_MAJOR=version_major
38 VERSION_MINOR=version_minor
39 VERSION_REVISION=0
40
41 AC_SUBST(VERSION_MAJOR)
42 AC_SUBST(VERSION_MINOR)
43 AC_SUBST(VERSION_REVISION)
44
45 AC_ARG_ENABLE(rpm,
46               AS_HELP_STRING([--enable-rpm=yes|no|auto],
47                              [enable the support of rpm in abipkgdiff (default is auto)]),
48               ENABLE_RPM=$enableval,
49               ENABLE_RPM=auto)
50
51 AC_ARG_ENABLE(deb,
52               AS_HELP_STRING([--enable-deb=yes|no|auto],
53                              [enable the support of deb in abipkgdiff (default is auto)]),
54               ENABLE_DEB=$enableval,
55               ENABLE_DEB=auto)
56
57 AC_ARG_ENABLE(tar,
58               AS_HELP_STRING([--enable-tar=yes|no|auto],
59                              [enable the support of GNU tar archives in abipkgdiff (default is auto)]),
60               ENABLE_TAR=$enableval,
61               ENABLE_TAR=auto)
62
63 AC_ARG_ENABLE(zip-archive,
64               AS_HELP_STRING([--enable-zip-archive=yes|no|auto],
65                              [enable bundling of TUs in zip archives (default is no)]),
66               ENABLE_ZIP_ARCHIVE=$enableval,
67               ENABLE_ZIP_ARCHIVE=no)
68
69
70 AC_ARG_ENABLE(cxx11,
71               AS_HELP_STRING([--enable-cxx11=yes|no],
72                              [enable features that use the C++11 compiler]),
73               ENABLE_CXX11=$enableval,
74               ENABLE_CXX11=no)
75
76 AC_ARG_ENABLE(apidoc,
77               AS_HELP_STRING([--enable-apidoc=yes|no|auto],
78                              [enable generation of the apidoc in html]),
79               ENABLE_APIDOC=$enableval,
80               ENABLE_APIDOC=auto)
81
82 AC_ARG_ENABLE(manual,
83               AS_HELP_STRING([--enable-manual=yes|no|auto],
84                              [enable generation of the manual in html]),
85               ENABLE_MANUAL=$enableval,
86               ENABLE_MANUAL=auto)
87
88 AC_ARG_ENABLE([bash-completion],
89               AS_HELP_STRING([--enable-bash-completion=yes|no|auto],
90                              [enable using completion files for tools]),
91               ENABLE_BASH_COMPLETION=$enableval,
92               ENABLE_BASH_COMPLETION=auto)
93
94 AC_ARG_ENABLE([fedabipkgdiff],
95               AS_HELP_STRING([--enable-fedabipkgdiff=yes|no|auto],
96                              [enable the fedabipkgdiff tool]),
97               ENABLE_FEDABIPKGDIFF=$enableval,
98               ENABLE_FEDABIPKGDIFF=auto)
99
100 AC_ARG_ENABLE([python3],
101               AS_HELP_STRING([--enable-python3=yes|no|auto],
102                              [enable running abigail tools with python3 (default is auto)]),
103               ENABLE_PYTHON3=$enableval,
104               ENABLE_PYTHON3=auto)
105
106 AC_ARG_ENABLE(asan,
107               AS_HELP_STRING([--enable-asan=yes|no],
108                              [enable the support of building with -fsanitize=address)]),
109               ENABLE_ASAN=$enableval,
110               ENABLE_ASAN=no)
111
112 AC_ARG_ENABLE(ubsan,
113               AS_HELP_STRING([--enable-ubsan=yes|no],
114                              [enable the support of building with -fsanitize=undefined)]),
115               ENABLE_UBSAN=$enableval,
116               ENABLE_UBSAN=no)
117
118 dnl *************************************************
119 dnl check for dependencies
120 dnl *************************************************
121
122 AC_PROG_CXX
123 AC_USE_SYSTEM_EXTENSIONS
124 AC_PROG_INSTALL
125
126 LT_PREREQ([2.2])
127 LT_INIT
128
129 AC_LANG([C++])
130 AC_LANG_COMPILER_REQUIRE
131
132 dnl
133 dnl check if the c++ compiler has support __attribute__((visibility("hidden")))
134 dnl
135 AC_MSG_NOTICE([checking for GCC visibility attribute support ...])
136 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
137 struct __attribute__((visibility("hidden"))) Foo
138 {
139   int m0;
140
141   Foo()
142    : m0()
143   {}
144 };
145                  ]])],
146                  [SUPPORTS_GCC_VISIBILITY_ATTRIBUTE=yes],
147                  [SUPPORTS_GCC_VISIBILITY_ATTRIBUTE=no]
148 )
149
150 if test x$SUPPORTS_GCC_VISIBILITY_ATTRIBUTE = xyes; then
151    AC_MSG_NOTICE([GCC visibility attribute is supported])
152    AC_DEFINE([HAS_GCC_VISIBILITY_ATTRIBUTE], 1,
153              [Defined if the compiler supports the attribution visibility syntax __attribute__((visibility("hidden")))])
154    VISIBILITY_FLAGS="-fvisibility=hidden"
155 else
156    AC_MSG_NOTICE([GCC visibility attribute is not supported])
157    VISIBILITY_FLAGS=
158 fi
159
160 AC_SUBST(VISIBILITY_FLAGS)
161
162 dnl Older glibc had a broken fts that didn't work with Large File Systems.
163 dnl We want the version that can handler LFS, but include workaround if we
164 dnl get a bad one. Add define to CFLAGS (not AC_DEFINE it) since we need to
165 dnl check it before including config.h (which might define _FILE_OFFSET_BITS).
166 AC_CACHE_CHECK([whether including fts.h with _FILE_OFFSET_BITS set breaks], ac_cv_bad_fts,
167   [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
168         #define _FILE_OFFSET_BITS 64
169         #include <fts.h>
170         ]])],
171                      ac_cv_bad_fts=no, ac_cv_bad_fts=yes)])
172 AS_IF([test "x$ac_cv_bad_fts" = "xyes"],
173       [CFLAGS="$CFLAGS -DBAD_FTS=1",
174        CXXFLAGS="$CXXFLAGS -DBAD_FTS=1"])
175
176 dnl Check for dependency: libelf, libdw, libebl (elfutils)
177 dnl Note that we need to use at least elfutils 0.159 but
178 dnl at that time elfutils didnt have pkgconfig capabilities
179 dnl  to easily query for its version.
180 ELF_LIBS=
181 AC_CHECK_LIB([elf], [elf_end], [ELF_LIBS="-lelf"])
182 AC_CHECK_HEADER([libelf.h],
183                 [],
184                 [AC_MSG_ERROR([could not find libelf.h])])
185
186 DW_LIBS=
187 AC_CHECK_LIB(dw, dwfl_begin, [DW_LIBS=-ldw])
188 AC_CHECK_LIB(dw, dwarf_getalt,
189              [FOUND_DWARF_GETALT_IN_LIBDW=yes],
190              [FOUND_DWARF_GETALT_IN_LIBDW=no])
191
192 AC_CHECK_HEADER(elfutils/libdwfl.h,
193                 [],
194                 [AC_MSG_ERROR([could not find elfutils/libdwfl.h installed])])
195
196 dnl Allow users to compile with the NDEBUG macro defined,
197 dnl meaning they are compiling in a mode where the
198 dnl assert call does nothing.  With the directive below,
199 dnl users just need to pass the --disable-assert
200 dnl option to configure.
201 AC_HEADER_ASSERT
202
203 if test x$ELF_LIBS = x; then
204    AC_MSG_ERROR([could not find elfutils elf library installed])
205 fi
206
207 if test x$DW_LIBS = x; then
208    AC_MSG_ERROR([could not find elfutils dwarf library installed])
209 fi
210
211 if test x$FOUND_DWARF_GETALT_IN_LIBDW = xyes; then
212    AC_DEFINE([LIBDW_HAS_DWARF_GETALT], 1,
213              [Defined if libdw has the function dwarf_getalt])
214 fi
215
216 AC_SUBST(DW_LIBS)
217 AC_SUBST([ELF_LIBS])
218
219 dnl Check for dependency: libxml
220 LIBXML2_VERSION=2.6.22
221 PKG_CHECK_MODULES(XML, libxml-2.0 >= $LIBXML2_VERSION)
222
223 AC_SUBST(LIBXML2_VERSION)
224 AC_SUBST(XML_LIBS)
225 AC_SUBST(XML_CFLAGS)
226
227 dnl Check for some programs like rm, mkdir, etc ...
228 AC_CHECK_PROG(HAS_RM, rm, yes, no)
229 if test x$HAS_RM = xno; then
230    AC_MSG_ERROR([could not find the program 'rm' installed])
231 fi
232
233 AC_CHECK_PROG(HAS_MKDIR, mkdir, yes, no)
234 if test x$HAS_MKDIR = xno; then
235    AC_MSG_ERROR([could not find the program 'mkdir' installed])
236 fi
237
238 dnl Check for the rpm2cpio and cpio programs
239 if test x$ENABLE_RPM = xyes -o x$ENABLE_RPM = xauto; then
240   AC_CHECK_PROG(HAS_RPM2CPIO, rpm2cpio, yes, no)
241   AC_CHECK_PROG(HAS_CPIO, cpio, yes, no)
242   AC_CHECK_PROG(HAS_RPM, rpm, yes, no)
243
244   if test x$HAS_RPM2CPIO = xyes -a x$HAS_CPIO = xyes -a x$HAS_RPM = xyes; then
245      ENABLE_RPM=yes
246   else
247     if test x$ENABLE_RPM = xyes; then
248       AC_MSG_ERROR([rpm support in abipkgdiff needs 'rpm2cpio', 'cpio' and 'rpm' programs to be installed])
249     fi
250     ENABLE_RPM=no
251   fi
252 fi
253
254 if test x$ENABLE_RPM = xyes; then
255    AC_DEFINE([WITH_RPM], 1, [compile the rpm package support in abipkgdiff])
256    AC_MSG_NOTICE(rpm support in abipkgdiff is enabled);
257 else
258    AC_MSG_NOTICE(rpm support in abipkgdiff is disabled);
259 fi
260
261 AM_CONDITIONAL(ENABLE_RPM, test x$ENABLE_RPM = xyes)
262
263 dnl Check for the dpkg program
264 if test x$ENABLE_DEB = xauto -o x$ENABLE_DEB = xyes; then
265    AC_CHECK_PROG(HAS_DPKG, dpkg, yes, no)
266
267    if test x$ENABLE_DEB = xauto; then
268      if test x$HAS_DPKG = xyes; then
269        ENABLE_DEB=yes
270      else
271        ENABLE_DEB=no
272     fi
273    fi
274 fi
275
276 if test x$ENABLE_DEB = xyes; then
277    AC_DEFINE([WITH_DEB], 1, [compile the deb package support in abipkgdiff])
278    AC_MSG_NOTICE(deb support in abipkgdiff is enabled);
279 else
280    AC_MSG_NOTICE(deb support in abipkgdiff is disabled);
281 fi
282
283 AM_CONDITIONAL(ENABLE_DEB, test x$ENABLE_DEB = xyes)
284
285 dnl Check for the tar program
286 if test x$ENABLE_TAR = xauto -o x$ENABLE_TAR = xyes; then
287    AC_CHECK_PROG(HAS_TAR, tar, yes, no)
288
289    if test x$ENABLE_TAR = xauto; then
290      if test x$HAS_TAR = xyes; then
291        ENABLE_TAR=yes
292     fi
293    fi
294 fi
295
296 if test x$ENABLE_TAR = xyes; then
297    AC_DEFINE([WITH_TAR], 1, [compile the GNU tar archive support in abipkgdiff])
298    AC_MSG_NOTICE(GNU tar support in abipkgdiff is enabled);
299 else
300    AC_MSG_NOTICE(GNU tar support in abipkgdiff is disabled);
301 fi
302
303 AM_CONDITIONAL(ENABLE_TAR, test x$ENABLE_TAR = xyes)
304
305 dnl Check for the bash-completion package
306 if test x$ENABLE_BASH_COMPLETION = xauto -o x$ENABLE_BASH_COMPLETION = xyes; then
307    AC_CHECK_PROG(HAS_BASH_COMPLETION, bash-completion, yes, no)
308
309    if test x$ENABLE_BASH_COMPLETION = xauto; then
310      if test x$HAS_BASH_COMPLETION = xyes; then
311        ENABLE_BASH_COMPLETION=yes
312      else
313        ENABLE_BASH_COMPLETION=no
314     fi
315    fi
316 fi
317
318 if test x$ENABLE_BASH_COMPLETION = xyes; then
319    AC_MSG_NOTICE(bash-completion support in libabigail is enabled);
320 else
321    AC_MSG_NOTICE(bash-completion support in libabigail is disabled);
322 fi
323
324 AM_CONDITIONAL(ENABLE_BASH_COMPLETION, test x$ENABLE_BASH_COMPLETION = xyes)
325
326 # The minimal python 2 version we want to support is 2.6.6 because EL6
327 # distributions have that version installed.
328 MINIMAL_PYTHON2_VERSION="2.6.6"
329
330 AC_PATH_PROG(PYTHON, python, no)
331 AX_PROG_PYTHON_VERSION($MINIMAL_PYTHON2_VERSION,
332                          [MINIMAL_PYTHON_VERSION_FOUND=yes],
333                          [MINIMAL_PYTHON_VERSION_FOUND=no])
334
335 # The minimal python 3 version we want to support is 3.5, which is
336 # available in Fedora releases and in EL7.
337 if test x$ENABLE_PYTHON3 != xno; then
338   AC_CHECK_PROGS(PYTHON3_INTERPRETER, [python3 python3.5 python3.6 python3.7], no)
339 else
340   PYTHON3_INTERPRETER=no
341 fi
342
343 if test x$ENABLE_PYTHON3 = xauto; then
344     if test x$PYTHON3_INTERPRETER != xno; then
345       ENABLE_PYTHON3=yes
346     else
347       # When enabling python3 is auto, tests only run if the
348       # python3 interpreter was found on the system. Otherwise,
349       # just ignore it.
350         ENABLE_PYTHON3=no
351       AC_MSG_NOTICE([Python 3 was not found. Skip running tests with Python 3.])
352     fi
353 fi
354
355 if test x$ENABLE_PYTHON3 = xyes; then
356     if  test x$PYTHON3_INTERPRETER != xno; then
357       # We were asked to enable python3 implicitely (auto and
358       # python3 was found) or explicitly.  So enable running tests
359       # using python3 then.
360       RUN_TESTS_WITH_PY3=yes
361     else
362        AC_MSG_ERROR([Python 3 was not found])
363     fi
364 fi
365
366 if test x$PYTHON3_INTERPRETER = xyes; then
367    MINIMAL_PYTHON_VERSION_FOUND=yes
368 fi
369
370 if test x$MINIMAL_PYTHON_VERSION_FOUND = xno; then
371   AC_MSG_NOTICE([no minimal version of python found])
372   if test x$PYTHON = xno; then
373      AC_MSG_NOTICE([python binary wasn't found])
374      if test x$PYTHON3_INTERPRETER != xno; then
375           AC_MSG_NOTICE([using $PYTHON3_INTERPRETER instead])
376           PYTHON=$PYTHON3_INTERPRETER
377           MINIMAL_PYTHON_VERSION_FOUND=yes
378           MISSING_FEDABIPKGDIFF_DEP=no
379      fi
380   fi
381 else
382   AC_MSG_NOTICE([a minimal version of python was found ...])
383   if test x$PYTHON3_INTERPRETER != xno; then
384    # We were instructed to use python3 and it's present on the
385    # system.  Let's update the PYTHON variable that points to the
386    # actual python interpreter we are going to be using
387    AC_MSG_NOTICE([... and it was $PYTHON3_INTERPRETER])
388    PYTHON=$PYTHON3_INTERPRETER
389   fi
390 fi
391
392 dnl if --enable-fedabipkgdiff has the 'auto' value, then check for the required
393 dnl python modules.  If they are present, then enable the fedabipkgdiff program.
394 dnl If they are not then disable the program.
395 dnl
396 dnl If --enable-fedabipkgdiff has the 'yes' value, then check for the required
397 dnl python modules and whatever dependency fedabipkgdiff needs.  If they are
398 dnl not present then the configure script will error out.
399
400 if test x$ENABLE_FEDABIPKGDIFF = xauto -o x$ENABLE_FEDABIPKGDIFF = xyes; then
401    CHECK_DEPS_FOR_FEDABIPKGDIFF=yes
402 else
403    CHECK_DEPS_FOR_FEDABIPKGDIFF=no
404 fi
405
406 if test x$CHECK_DEPS_FOR_FEDABIPKGDIFF = xyes; then
407   MISSING_FEDABIPKGDIFF_DEP=no
408
409   if test x$ENABLE_FEDABIPKGDIFF = xyes; then
410      MISSING_FEDABIPKGDIFF_DEP_FATAL=yes
411   else
412      MISSING_FEDABIPKGDIFF_DEP_FATAL=no
413   fi
414
415   AC_PATH_PROG(WGET, wget, no)
416
417   if test x$WGET = xno; then
418     ENABLE_FEDABIPKGDIFF=no
419     if test x$MISSING_FEDABIPKGDIFF_DEP_FATAL = xyes; then
420       AC_MSG_ERROR(could not find the wget program)
421     else
422       MISSING_FEDABIPKGDIFF_DEP=yes
423       AC_MSG_NOTICE([could not find the wget program])
424       AC_MSG_NOTICE([disabling fedabipkgdiff as a result])
425     fi
426   fi
427
428   if test x$MINIMAL_PYTHON_VERSION_FOUND = xno; then
429     MISSING_FEDABIPKGDIFF_DEP=yes
430     if test x$MISSING_FEDABIPKGDIFF_DEP_FATAL = xyes; then
431       AC_MSG_ERROR([could not find a python program of version at least $MINIMAL_PYTHON2_VERSION])
432     fi
433   fi
434
435   ###################################################################
436   # Now we are going to check the presence of the required python
437   # modules using either python2 or python3 as required until now.
438   ###################################################################
439
440   # Grrr, the urlparse python2 module got renamed in python3 as
441   # urllib.parse.  Oh well.
442   if test x$PYTHON = xpython3; then
443      URLPARSE_MODULE=urllib.parse
444   else
445      URLPARSE_MODULE=urlparse
446   fi
447
448   REQUIRED_PYTHON_MODULES_FOR_FEDABIPKGDIFF="\
449    argparse logging os re subprocess sys $URLPARSE_MODULE \
450    xdg koji mock rpm imp tempfile mimetypes shutil six"
451
452   if test x$ENABLE_FEDABIPKGDIFF != xno; then
453     AX_CHECK_PYTHON_MODULES([$REQUIRED_PYTHON_MODULES_FOR_FEDABIPKGDIFF],
454                             [$PYTHON],
455                             [FOUND_ALL_PYTHON_MODULES=yes],
456                             [FOUND_ALL_PYTHON_MODULES=no])
457
458     if test x$FOUND_ALL_PYTHON_MODULES = xno; then
459        MISSING_FEDABIPKGDIFF_DEP=yes
460        if test x$MISSING_FEDABIPKGDIFF_DEP_FATAL = xyes; then
461          AC_MSG_ERROR([missing python modules: $MISSING_PYTHON_MODULES]);
462        else
463          AC_MSG_NOTICE([missing python modules: $MISSING_PYTHON_MODULES])
464          AC_MSG_NOTICE([disabling fedabipkgdiff as a result])
465        fi
466        ENABLE_FEDABIPKGDIFF=no
467     else
468         # On some old platforms, the koji client object doesn't have
469         # the required .read_config method.  Alas, that module doesn't
470         # have any __version__ string either.  So we do as well as we
471         # can to try and detect that case and disable fedabipkgdiff if
472         # necessary.
473         AC_MSG_CHECKING([checking if koji client is recent enough ...])
474         $PYTHON -c "
475 import koji
476 koji.read_config('koji')"
477         if test $? -eq 0; then
478            koji_version_check_ok=yes
479         else
480            koji_version_check_ok=no
481         fi
482
483         if test x$koji_version_check_ok = xno; then
484           AC_MSG_RESULT([no, disabling fedpkgdiff])
485           MISSING_FEDABIPKGDIFF_DEP=yes
486         else
487           AC_MSG_RESULT(yes)
488        fi
489        if test x$MISSING_FEDABIPKGDIFF_DEP = xno; then
490          ENABLE_FEDABIPKGDIFF=yes
491        fi
492     fi
493   fi
494 fi
495
496 AM_CONDITIONAL(ENABLE_FEDABIPKGDIFF, test x$ENABLE_FEDABIPKGDIFF = xyes)
497 AM_CONDITIONAL(ENABLE_RUNNING_TESTS_WITH_PY3, test x$RUN_TESTS_WITH_PY3 = xyes)
498 AM_CONDITIONAL(ENABLE_PYTHON3_INTERPRETER, test x$PYTHON3_INTERPRETER != xno)
499 AC_SUBST(PYTHON)
500
501 dnl Check for dependency: libzip
502 LIBZIP_VERSION=0.10.1
503
504 HAS_LIBZIP=no
505 # The below doesn't seem to work on my box for a reason.  Let's write
506 # the damn thing by hand:
507 # PKG_CHECK_EXISTS([libzip >= $LIBZIP_VERSION], [HAS_LIBZIP=yes], [HAS_LIBZIP=no])
508
509 if $PKG_CONFIG --exists --print-errors "libzip >= $LIBZIP_VERSION"; then
510    AC_MSG_NOTICE(found libzip version $LIBZIP_VERSION)
511    HAS_LIBZIP=yes
512 else
513    AC_MSG_NOTICE(no libzip >= $LIBZIP_VERSION has been found)
514    HAS_LIBZIP=no
515 fi
516
517 if test x$ENABLE_ZIP_ARCHIVE = xauto; then
518    if test x$HAS_LIBZIP = xyes; then
519       ENABLE_ZIP_ARCHIVE=yes;
520    else
521       ENABLE_ZIP_ARCHIVE=no
522    fi
523 fi
524
525 if test x$ENABLE_ZIP_ARCHIVE = xyes; then
526    AC_MSG_NOTICE(the zip-archive feature is enabled)
527 else
528    AC_MSG_NOTICE(the zip-archive feature is disabled)
529 fi
530
531 FOUND_LIBZIP=no
532 if test x$ENABLE_ZIP_ARCHIVE = xyes; then
533    PKG_CHECK_MODULES(LIBZIP, libzip >= $LIBZIP_VERSION)
534    FOUND_LIBZIP=yes
535    AC_SUBST(LIBZIP_VERSION)
536    AC_SUBST(LIBZIP_LIBS)
537    AC_SUBST(LIBZIP_CFLAGS)
538    AC_DEFINE([WITH_ZIP_ARCHIVE], 1, [compile the zip archive support])
539    AC_DEFINE([HAVE_LIBZIP], 1, [Defined to 1 if the libzip library is available])
540 fi
541
542 AM_CONDITIONAL(ENABLE_ZIP_ARCHIVE, test x$ENABLE_ZIP_ARCHIVE = xyes)
543 DEPS_CPPFLAGS="$XML_CFLAGS $LIBZIP_CFLAGS"
544 AC_SUBST(DEPS_CPPFLAGS)
545
546 dnl Handle conditional use of a C++11 compiler
547 if test x$ENABLE_CXX11 = xyes; then
548    AC_DEFINE([WITH_CXX11], 1, [Defined to 1 if a C++11 compiler is used])
549 fi
550
551 AM_CONDITIONAL(ENABLE_CXX11, test x$ENABLE_CXX11 = xyes)
552
553 dnl Check for the presence of doxygen program
554
555 if test x$ENABLE_APIDOC != xno; then
556   AC_CHECK_PROG(FOUND_DOXYGEN, doxygen, yes, no)
557   if test x$ENABLE_APIDOC = xauto; then
558     if test x$FOUND_DOXYGEN = xyes; then
559       ENABLE_APIDOC=yes
560     else
561       ENABLE_APIDOC=no
562     fi
563   fi
564 fi
565 AM_CONDITIONAL(ENABLE_APIDOC, test x$ENABLE_APIDOC = xyes)
566
567 dnl Check for the presence of the sphinx-build program
568
569 if test x$ENABLE_MANUAL != xno; then
570   AC_CHECK_PROG(FOUND_SPHINX_BUILD, sphinx-build, yes, no)
571   if test x$ENABLE_MANUAL = xauto; then
572     if test x$FOUND_SPHINX_BUILD = xyes; then
573       ENABLE_MANUAL=yes
574     else
575       ENABLE_MANUAL=no
576     fi
577   fi
578 fi
579 AM_CONDITIONAL(ENABLE_MANUAL, test x$ENABLE_MANUAL = xyes)
580
581 dnl Check for the presence of Valgrind and do the plumbing to allow
582 dnl the running of "make check-valgrind".
583 AX_VALGRIND_DFLT(memcheck, on)
584 AX_VALGRIND_DFLT(helgrind, on)
585 AX_VALGRIND_DFLT(drd, off)
586 AX_VALGRIND_DFLT(sgcheck, off)
587
588 AX_VALGRIND_CHECK
589
590 dnl Set the list of libraries libabigail depends on
591
592 DEPS_LIBS="$XML_LIBS $LIBZIP_LIBS $ELF_LIBS $DW_LIBS"
593 AC_SUBST(DEPS_LIBS)
594
595 if test x$ABIGAIL_DEVEL != x; then
596    CFLAGS="-g -Wall -Wextra -Werror"
597    CXXFLAGS="-g -Wall -Wextra -Werror"
598 fi
599
600 if test x$ENABLE_ASAN = xyes; then
601     CFLAGS="$CFLAGS -fsanitize=address"
602     CXXFLAGS="$CXXFLAGS -fsanitize=address"
603 fi
604
605 if test x$ENABLE_UBSAN = xyes; then
606     CFLAGS="$CFLAGS -fsanitize=undefined"
607     CXXFLAGS="$CXXFLAGS -fsanitize=undefined"
608 fi
609
610 dnl Check if several decls and constant are defined in dependant
611 dnl libraries
612 HAS_EM_AARCH64=no
613 AC_CHECK_DECL([EM_AARCH64],
614               [HAS_EM_AARCH64=yes],
615               [HAS_EM_AARCH64=no],
616               [[#include <elf.h>]])
617
618 if test x$HAS_EM_AARCH64 = xyes; then
619   AC_DEFINE([HAVE_EM_AARCH64_MACRO],
620                  1,
621             [Defined to 1 if elf.h has EM_AARCH64 macro defined])
622 fi
623
624 HAS_EM_TILEPRO=no
625 AC_CHECK_DECL([EM_TILEPRO],
626               [HAS_EM_TILEPRO=yes],
627               [HAS_EM_TILEPRO=no],
628               [[#include <elf.h>]])
629
630 if test x$HAS_EM_TILEPRO = xyes; then
631   AC_DEFINE([HAVE_EM_TILEPRO_MACRO],
632                  1,
633             [Defined to 1 if elf.h has EM_TILEPR0 macro defined])
634 fi
635
636 HAS_EM_TILEGX=no
637 AC_CHECK_DECL([EM_TILEGX],
638               [HAS_EM_TILEGX=yes],
639               [HAS_EM_TILEGX=no],
640               [[#include <elf.h>]])
641
642 if test x$HAS_EM_TILEGX = xyes; then
643   AC_DEFINE([HAVE_EM_TILEGX_MACRO],
644                  1,
645             [Defined to 1 if elf.h has EM_TILEGX macro defined])
646 fi
647
648 HAS_DW_LANG_UPC=no
649 AC_CHECK_DECL([DW_LANG_UPC],
650               [HAS_DW_LANG_UPC=yes],
651               [HAS_DW_LANG_UPC=no],
652               [[#include <dwarf.h>]])
653 if test x$HAS_DW_LANG_UPC = xyes; then
654    AC_DEFINE([HAVE_DW_LANG_UPC_enumerator],
655              1,
656              [Define to 1 if dwarf.h has the DW_LANG_UPC enumerator])
657 fi
658
659 HAS_DW_LANG_D=no
660 AC_CHECK_DECL([DW_LANG_D],
661               [HAS_DW_LANG_D=yes],
662               [HAS_DW_LANG_D=no],
663               [[#include <dwarf.h>]])
664 if test x$HAS_DW_LANG_D = xyes; then
665    AC_DEFINE([HAVE_DW_LANG_D_enumerator],
666              1,
667              [Define to 1 if dwarf.h has the DW_LANG_D enumerator])
668 fi
669
670 HAS_DW_LANG_Python=no
671 AC_CHECK_DECL([DW_LANG_Python],
672               [HAS_DW_LANG_Python=yes],
673               [HAS_DW_LANG_Python=no],
674               [[#include <dwarf.h>]])
675 if test x$HAS_DW_LANG_Python = xyes; then
676    AC_DEFINE([HAVE_DW_LANG_Python_enumerator],
677              1,
678              [Define to 1 if dwarf.h has the DW_LANG_Python enumerator])
679 fi
680
681 HAS_DW_LANG_Go=no
682 AC_CHECK_DECL([DW_LANG_Go],
683               [HAS_DW_LANG_Go=yes],
684               [HAS_DW_LANG_Go=no],
685               [[#include <dwarf.h>]])
686 if test x$HAS_DW_LANG_Go = xyes; then
687    AC_DEFINE([HAVE_DW_LANG_Go_enumerator],
688              1,
689              [Define to 1 if dwarf.h has the DW_LANG_Go enumerator])
690 fi
691
692 HAS_DW_LANG_C11=no
693 AC_CHECK_DECL([DW_LANG_C11],
694               [HAS_DW_LANG_C11=yes],
695               [HAS_DW_LANG_C11=no],
696               [[#include <dwarf.h>]])
697 if test x$HAS_DW_LANG_C11 = xyes; then
698    AC_DEFINE([HAVE_DW_LANG_C11_enumerator],
699              1,
700              [Define to 1 if dwarf.h has the DW_LANG_C11 enumerator])
701 fi
702
703 HAS_DW_LANG_C_plus_plus_03=no
704 AC_CHECK_DECL([DW_LANG_C_plus_plus_03],
705               [HAS_DW_LANG_C_plus_plus_03=yes],
706               [HAS_DW_LANG_C_plus_plus_03=no],
707               [[#include <dwarf.h>]])
708 if test x$HAS_DW_LANG_C_plus_plus_03 = xyes; then
709    AC_DEFINE([HAVE_DW_LANG_C_plus_plus_03_enumerator],
710              1,
711              [Define to 1 if dwarf.h has the DW_LANG_C_plus_plus_03 enumerator])
712 fi
713
714 HAS_DW_LANG_C_plus_plus_11=no
715 AC_CHECK_DECL([DW_LANG_C_plus_plus_11],
716               [HAS_DW_LANG_C_plus_plus_11=yes],
717               [HAS_DW_LANG_C_plus_plus_11=no],
718               [[#include <dwarf.h>]])
719 if test x$HAS_DW_LANG_C_plus_plus_11 = xyes; then
720    AC_DEFINE([HAVE_DW_LANG_C_plus_plus_11_enumerator],
721              1,
722              [Define to 1 if dwarf.h has the DW_LANG_C_plus_plus_11 enumerator])
723 fi
724
725 HAS_DW_LANG_C_plus_plus_14=no
726 AC_CHECK_DECL([DW_LANG_C_plus_plus_14],
727               [HAS_DW_LANG_C_plus_plus_14=yes],
728               [HAS_DW_LANG_C_plus_plus_14=no],
729               [[#include <dwarf.h>]])
730 if test x$HAS_DW_LANG_C_plus_plus_14 = xyes; then
731    AC_DEFINE([HAVE_DW_LANG_C_plus_plus_14_enumerator],
732              1,
733              [Define to 1 if dwarf.h has the DW_LANG_C_plus_plus_14 enumerator])
734 fi
735
736 HAS_DW_LANG_Mips_Assembler=no
737 AC_CHECK_DECL([DW_LANG_Mips_Assembler],
738               [HAS_DW_LANG_Mips_Assembler=yes],
739               [HAS_DW_LANG_Mips_Assembler=no],
740               [[#include <dwarf.h>]])
741 if test x$HAS_DW_LANG_Mips_Assembler = xyes; then
742    AC_DEFINE([HAVE_DW_LANG_Mips_Assembler_enumerator],
743              1,
744              [Define to 1 if dwarf.h has the DW_LANG_Mips_Assembler enumerator])
745 fi
746
747 HAS_DW_LANG_Rust=no
748 AC_CHECK_DECL([DW_LANG_Rust],
749               [HAS_DW_LANG_Rust=yes],
750               [HAS_DW_LANG_Rust=no],
751               [[#include <dwarf.h>]])
752
753 if test x$HAS_DW_LANG_Rust = xyes; then
754   AC_DEFINE([HAVE_DW_LANG_Rust_enumerator], 
755             1,
756             [Define to 1 if dwarf.h has the DW_LANG_Rust enumerator])
757 fi
758
759 dnl Set large files support
760 AC_SYS_LARGEFILE
761
762 AC_CONFIG_FILES([Makefile
763 libabigail.pc
764   include/Makefile
765   include/abg-version.h
766   doc/Makefile
767     doc/manuals/Makefile
768   src/Makefile
769   tools/Makefile
770   tests/Makefile
771     tests/data/Makefile
772     bash-completion/Makefile])
773
774 dnl Some test scripts are generated by autofoo.
775 AC_CONFIG_FILES([tests/runtestcanonicalizetypes.sh],
776                 [chmod +x tests/runtestcanonicalizetypes.sh])
777 AC_CONFIG_FILES([tests/mockfedabipkgdiff],
778                 [chmod +x tests/mockfedabipkgdiff])
779 AC_CONFIG_FILES([tests/runtestfedabipkgdiff.py],
780                 [chmod +x tests/runtestfedabipkgdiff.py])
781 AC_CONFIG_FILES([tests/runtestfedabipkgdiffpy3.sh],
782                 [chmod +x tests/runtestfedabipkgdiffpy3.sh])
783 AC_CONFIG_FILES([tests/runtestdefaultsupprs.py],
784                 [chmod +x tests/runtestdefaultsupprs.py])
785 AC_CONFIG_FILES([tests/runtestdefaultsupprspy3.sh],
786                 [chmod +x tests/runtestdefaultsupprspy3.sh])
787
788 AC_OUTPUT
789
790 AC_MSG_NOTICE([
791 =====================================================================
792         Libabigail: $VERSION_MAJOR.$VERSION_MINOR.$VERSION_REVISION
793 =====================================================================
794
795                 Here is the configuration of the package:
796
797     Prefix                                         : ${prefix}
798     Source code location                           : ${srcdir}
799     C Compiler                                     : ${CC}
800     C++ Compiler                                   : ${CXX}
801     GCC visibility attribute supported             : ${SUPPORTS_GCC_VISIBILITY_ATTRIBUTE}
802     Python                                         : ${PYTHON}
803
804  OPTIONAL FEATURES:
805     Enable zip archives                            : ${ENABLE_ZIP_ARCHIVE}
806     Use a C++-11 compiler                          : ${ENABLE_CXX11}
807     libdw has the dwarf_getalt function            : ${FOUND_DWARF_GETALT_IN_LIBDW}
808     Enable rpm support in abipkgdiff               : ${ENABLE_RPM}
809     Enable deb support in abipkgdiff               : ${ENABLE_DEB}
810     Enable GNU tar archive support in abipkgdiff   : ${ENABLE_TAR}
811     Enable bash completion                         : ${ENABLE_BASH_COMPLETION}
812     Enable fedabipkgdiff                           : ${ENABLE_FEDABIPKGDIFF}
813     Enable python 3                                : ${ENABLE_PYTHON3}
814     Enable running tests under Valgrind            : ${enable_valgrind}
815     Enable build with -fsanitize=address           : ${ENABLE_ASAN}
816     Enable build with -fsanitize=undefined         : ${ENABLE_UBSAN}
817     Generate html apidoc                           : ${ENABLE_APIDOC}
818     Generate html manual                           : ${ENABLE_MANUAL}
819 ])