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