Fix thinkos in DW_FORM_strx detection in configure.ac
[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    CXXFLAGS="$CXXFLAGS -std=c++11"
549    AC_DEFINE([WITH_CXX11], 1, [Defined to 1 if a C++11 compiler is used])
550 fi
551
552 AM_CONDITIONAL(ENABLE_CXX11, test x$ENABLE_CXX11 = xyes)
553
554 dnl Check for the presence of doxygen program
555
556 if test x$ENABLE_APIDOC != xno; then
557   AC_CHECK_PROG(FOUND_DOXYGEN, doxygen, yes, no)
558   if test x$ENABLE_APIDOC = xauto; then
559     if test x$FOUND_DOXYGEN = xyes; then
560       ENABLE_APIDOC=yes
561     else
562       ENABLE_APIDOC=no
563     fi
564   fi
565 fi
566 AM_CONDITIONAL(ENABLE_APIDOC, test x$ENABLE_APIDOC = xyes)
567
568 dnl Check for the presence of the sphinx-build program
569
570 if test x$ENABLE_MANUAL != xno; then
571   AC_CHECK_PROG(FOUND_SPHINX_BUILD, sphinx-build, yes, no)
572   if test x$ENABLE_MANUAL = xauto; then
573     if test x$FOUND_SPHINX_BUILD = xyes; then
574       ENABLE_MANUAL=yes
575     else
576       ENABLE_MANUAL=no
577     fi
578   fi
579 fi
580 AM_CONDITIONAL(ENABLE_MANUAL, test x$ENABLE_MANUAL = xyes)
581
582 dnl Check for the presence of Valgrind and do the plumbing to allow
583 dnl the running of "make check-valgrind".
584 AX_VALGRIND_DFLT(memcheck, on)
585 AX_VALGRIND_DFLT(helgrind, on)
586 AX_VALGRIND_DFLT(drd, off)
587 AX_VALGRIND_DFLT(sgcheck, off)
588
589 AX_VALGRIND_CHECK
590
591 dnl Set the list of libraries libabigail depends on
592
593 DEPS_LIBS="$XML_LIBS $LIBZIP_LIBS $ELF_LIBS $DW_LIBS"
594 AC_SUBST(DEPS_LIBS)
595
596 if test x$ABIGAIL_DEVEL != x; then
597    CFLAGS="-g -Wall -Wextra -Werror"
598    CXXFLAGS="-g -Wall -Wextra -Werror"
599 fi
600
601 if test x$ENABLE_ASAN = xyes; then
602     CFLAGS="$CFLAGS -fsanitize=address"
603     CXXFLAGS="$CXXFLAGS -fsanitize=address"
604 fi
605
606 if test x$ENABLE_UBSAN = xyes; then
607     CFLAGS="$CFLAGS -fsanitize=undefined"
608     CXXFLAGS="$CXXFLAGS -fsanitize=undefined"
609 fi
610
611 dnl Check if several decls and constant are defined in dependant
612 dnl libraries
613 HAS_EM_AARCH64=no
614 AC_CHECK_DECL([EM_AARCH64],
615               [HAS_EM_AARCH64=yes],
616               [HAS_EM_AARCH64=no],
617               [[#include <elf.h>]])
618
619 if test x$HAS_EM_AARCH64 = xyes; then
620   AC_DEFINE([HAVE_EM_AARCH64_MACRO],
621                  1,
622             [Defined to 1 if elf.h has EM_AARCH64 macro defined])
623 fi
624
625 HAS_EM_TILEPRO=no
626 AC_CHECK_DECL([EM_TILEPRO],
627               [HAS_EM_TILEPRO=yes],
628               [HAS_EM_TILEPRO=no],
629               [[#include <elf.h>]])
630
631 if test x$HAS_EM_TILEPRO = xyes; then
632   AC_DEFINE([HAVE_EM_TILEPRO_MACRO],
633                  1,
634             [Defined to 1 if elf.h has EM_TILEPR0 macro defined])
635 fi
636
637 HAS_EM_TILEGX=no
638 AC_CHECK_DECL([EM_TILEGX],
639               [HAS_EM_TILEGX=yes],
640               [HAS_EM_TILEGX=no],
641               [[#include <elf.h>]])
642
643 if test x$HAS_EM_TILEGX = xyes; then
644   AC_DEFINE([HAVE_EM_TILEGX_MACRO],
645                  1,
646             [Defined to 1 if elf.h has EM_TILEGX macro defined])
647 fi
648
649 HAS_R_AARCH64_ABS64=no
650 AC_CHECK_DECL([R_AARCH64_ABS64],
651               [HAS_R_AARCH64_ABS64=yes],
652               [HAS_R_AARCH64_ABS64=no],
653               [[#include <elf.h>]])
654
655 if test x$HAS_R_AARCH64_ABS64 = xyes; then
656    AC_DEFINE([HAVE_R_AARCH64_ABS64_MACRO],
657              1,
658              [Defined to 1 if elf.h has R_AARCH64_ABS64 macro defined])
659 fi
660
661 HAS_R_AARCH64_PREL32=no
662 AC_CHECK_DECL([R_AARCH64_PREL32],
663               [HAS_R_AARCH64_PREL32=yes],
664               [HAS_R_AARCH64_PREL32=no],
665               [[#include <elf.h>]])
666
667 if test x$HAS_R_AARCH64_PREL32 = xyes; then
668    AC_DEFINE([HAVE_R_AARCH64_PREL32_MACRO],
669              1,
670              [Defined to 1 if elf.h has R_AARCH64_PREL32 macro defined])
671 fi
672
673 HAS_DW_LANG_UPC=no
674 AC_CHECK_DECL([DW_LANG_UPC],
675               [HAS_DW_LANG_UPC=yes],
676               [HAS_DW_LANG_UPC=no],
677               [[#include <dwarf.h>]])
678 if test x$HAS_DW_LANG_UPC = xyes; then
679    AC_DEFINE([HAVE_DW_LANG_UPC_enumerator],
680              1,
681              [Define to 1 if dwarf.h has the DW_LANG_UPC enumerator])
682 fi
683
684 HAS_DW_LANG_D=no
685 AC_CHECK_DECL([DW_LANG_D],
686               [HAS_DW_LANG_D=yes],
687               [HAS_DW_LANG_D=no],
688               [[#include <dwarf.h>]])
689 if test x$HAS_DW_LANG_D = xyes; then
690    AC_DEFINE([HAVE_DW_LANG_D_enumerator],
691              1,
692              [Define to 1 if dwarf.h has the DW_LANG_D enumerator])
693 fi
694
695 HAS_DW_LANG_Python=no
696 AC_CHECK_DECL([DW_LANG_Python],
697               [HAS_DW_LANG_Python=yes],
698               [HAS_DW_LANG_Python=no],
699               [[#include <dwarf.h>]])
700 if test x$HAS_DW_LANG_Python = xyes; then
701    AC_DEFINE([HAVE_DW_LANG_Python_enumerator],
702              1,
703              [Define to 1 if dwarf.h has the DW_LANG_Python enumerator])
704 fi
705
706 HAS_DW_LANG_Go=no
707 AC_CHECK_DECL([DW_LANG_Go],
708               [HAS_DW_LANG_Go=yes],
709               [HAS_DW_LANG_Go=no],
710               [[#include <dwarf.h>]])
711 if test x$HAS_DW_LANG_Go = xyes; then
712    AC_DEFINE([HAVE_DW_LANG_Go_enumerator],
713              1,
714              [Define to 1 if dwarf.h has the DW_LANG_Go enumerator])
715 fi
716
717 HAS_DW_LANG_C11=no
718 AC_CHECK_DECL([DW_LANG_C11],
719               [HAS_DW_LANG_C11=yes],
720               [HAS_DW_LANG_C11=no],
721               [[#include <dwarf.h>]])
722 if test x$HAS_DW_LANG_C11 = xyes; then
723    AC_DEFINE([HAVE_DW_LANG_C11_enumerator],
724              1,
725              [Define to 1 if dwarf.h has the DW_LANG_C11 enumerator])
726 fi
727
728 HAS_DW_LANG_C_plus_plus_03=no
729 AC_CHECK_DECL([DW_LANG_C_plus_plus_03],
730               [HAS_DW_LANG_C_plus_plus_03=yes],
731               [HAS_DW_LANG_C_plus_plus_03=no],
732               [[#include <dwarf.h>]])
733 if test x$HAS_DW_LANG_C_plus_plus_03 = xyes; then
734    AC_DEFINE([HAVE_DW_LANG_C_plus_plus_03_enumerator],
735              1,
736              [Define to 1 if dwarf.h has the DW_LANG_C_plus_plus_03 enumerator])
737 fi
738
739 HAS_DW_LANG_C_plus_plus_11=no
740 AC_CHECK_DECL([DW_LANG_C_plus_plus_11],
741               [HAS_DW_LANG_C_plus_plus_11=yes],
742               [HAS_DW_LANG_C_plus_plus_11=no],
743               [[#include <dwarf.h>]])
744 if test x$HAS_DW_LANG_C_plus_plus_11 = xyes; then
745    AC_DEFINE([HAVE_DW_LANG_C_plus_plus_11_enumerator],
746              1,
747              [Define to 1 if dwarf.h has the DW_LANG_C_plus_plus_11 enumerator])
748 fi
749
750 HAS_DW_LANG_C_plus_plus_14=no
751 AC_CHECK_DECL([DW_LANG_C_plus_plus_14],
752               [HAS_DW_LANG_C_plus_plus_14=yes],
753               [HAS_DW_LANG_C_plus_plus_14=no],
754               [[#include <dwarf.h>]])
755 if test x$HAS_DW_LANG_C_plus_plus_14 = xyes; then
756    AC_DEFINE([HAVE_DW_LANG_C_plus_plus_14_enumerator],
757              1,
758              [Define to 1 if dwarf.h has the DW_LANG_C_plus_plus_14 enumerator])
759 fi
760
761 HAS_DW_LANG_Mips_Assembler=no
762 AC_CHECK_DECL([DW_LANG_Mips_Assembler],
763               [HAS_DW_LANG_Mips_Assembler=yes],
764               [HAS_DW_LANG_Mips_Assembler=no],
765               [[#include <dwarf.h>]])
766 if test x$HAS_DW_LANG_Mips_Assembler = xyes; then
767    AC_DEFINE([HAVE_DW_LANG_Mips_Assembler_enumerator],
768              1,
769              [Define to 1 if dwarf.h has the DW_LANG_Mips_Assembler enumerator])
770 fi
771
772 HAS_DW_LANG_Rust=no
773 AC_CHECK_DECL([DW_LANG_Rust],
774               [HAS_DW_LANG_Rust=yes],
775               [HAS_DW_LANG_Rust=no],
776               [[#include <dwarf.h>]])
777
778 if test x$HAS_DW_LANG_Rust = xyes; then
779   AC_DEFINE([HAVE_DW_LANG_Rust_enumerator], 
780             1,
781             [Define to 1 if dwarf.h has the DW_LANG_Rust enumerator])
782 fi
783
784 HAS_DW_FORM_strx1=no
785 HAS_DW_FORM_strx2=no
786 HAS_DW_FORM_strx3=no
787 HAS_DW_FORM_strx4=no
788
789 AC_CHECK_DECL([DW_FORM_strx1],
790               [HAS_DW_FORM_strx1=yes],
791               [HAS_DW_FORM_strx1=no],
792               [[#include <dwarf.h>]])
793
794 if test x$HAS_DW_FORM_strx1 = xyes; then
795    AC_DEFINE([HAVE_DW_FORM_strx1],
796              1,
797              [Define to 1 if dwarf.h has the DW_FORM_strx1 enumerator])
798 fi
799
800 AC_CHECK_DECL([DW_FORM_strx2],
801               [HAS_DW_FORM_strx2=yes],
802               [HAS_DW_FORM_strx2=no],
803               [[#include <dwarf.h>]])
804
805 if test x$HAS_DW_FORM_strx2 = xyes; then
806    AC_DEFINE([HAVE_DW_FORM_strx2],
807              1,
808              [Define to 1 if dwarf.h has the DW_FORM_strx2 enumerator])
809 fi
810
811 AC_CHECK_DECL([DW_FORM_strx3],
812               [HAS_DW_FORM_strx3=yes],
813               [HAS_DW_FORM_strx3=no],
814               [[#include <dwarf.h>]])
815
816 if test x$HAS_DW_FORM_strx3 = xyes; then
817    AC_DEFINE([HAVE_DW_FORM_strx3],
818              1,
819              [Define to 1 if dwarf.h has the DW_FORM_strx3 enumerator])
820 fi
821
822 AC_CHECK_DECL([DW_FORM_strx4],
823               [HAS_DW_FORM_strx4=yes],
824               [HAS_DW_FORM_strx4=no],
825               [[#include <dwarf.h>]])
826
827 if test x$HAS_DW_FORM_strx4 = xyes; then
828    AC_DEFINE([HAVE_DW_FORM_strx4],
829              1,
830              [Define to 1 if dwarf.h has the DW_FORM_strx4 enumerator])
831 fi
832
833 if test x$HAS_DW_FORM_strx1 = xyes -a \
834         x$HAS_DW_FORM_strx2 = xyes -a \
835         x$HAS_DW_FORM_strx3 = xyes -a \
836         x$HAS_DW_FORM_strx4 = xyes ; then
837    AC_DEFINE([HAVE_DW_FORM_strx],
838              1,
839              [Define to 1 if dwarf.h has the DW_FORM_strx enumerators])
840 fi
841
842 dnl Set large files support
843 AC_SYS_LARGEFILE
844
845 AC_CONFIG_FILES([Makefile
846 libabigail.pc
847   include/Makefile
848   include/abg-version.h
849   doc/Makefile
850     doc/manuals/Makefile
851   src/Makefile
852   tools/Makefile
853   tests/Makefile
854     tests/data/Makefile
855     bash-completion/Makefile])
856
857 dnl Some test scripts are generated by autofoo.
858 AC_CONFIG_FILES([tests/runtestcanonicalizetypes.sh],
859                 [chmod +x tests/runtestcanonicalizetypes.sh])
860 AC_CONFIG_FILES([tests/mockfedabipkgdiff],
861                 [chmod +x tests/mockfedabipkgdiff])
862 AC_CONFIG_FILES([tests/runtestfedabipkgdiff.py],
863                 [chmod +x tests/runtestfedabipkgdiff.py])
864 AC_CONFIG_FILES([tests/runtestfedabipkgdiffpy3.sh],
865                 [chmod +x tests/runtestfedabipkgdiffpy3.sh])
866 AC_CONFIG_FILES([tests/runtestdefaultsupprs.py],
867                 [chmod +x tests/runtestdefaultsupprs.py])
868 AC_CONFIG_FILES([tests/runtestdefaultsupprspy3.sh],
869                 [chmod +x tests/runtestdefaultsupprspy3.sh])
870
871 AC_OUTPUT
872
873 AC_MSG_NOTICE([
874 =====================================================================
875         Libabigail: $VERSION_MAJOR.$VERSION_MINOR.$VERSION_REVISION
876 =====================================================================
877
878                 Here is the configuration of the package:
879
880     Prefix                                         : ${prefix}
881     Source code location                           : ${srcdir}
882     C Compiler                                     : ${CC}
883     C++ Compiler                                   : ${CXX}
884     GCC visibility attribute supported             : ${SUPPORTS_GCC_VISIBILITY_ATTRIBUTE}
885     Python                                         : ${PYTHON}
886
887  OPTIONAL FEATURES:
888     Enable zip archives                            : ${ENABLE_ZIP_ARCHIVE}
889     Use a C++-11 compiler                          : ${ENABLE_CXX11}
890     libdw has the dwarf_getalt function            : ${FOUND_DWARF_GETALT_IN_LIBDW}
891     Enable rpm support in abipkgdiff               : ${ENABLE_RPM}
892     Enable deb support in abipkgdiff               : ${ENABLE_DEB}
893     Enable GNU tar archive support in abipkgdiff   : ${ENABLE_TAR}
894     Enable bash completion                         : ${ENABLE_BASH_COMPLETION}
895     Enable fedabipkgdiff                           : ${ENABLE_FEDABIPKGDIFF}
896     Enable python 3                                : ${ENABLE_PYTHON3}
897     Enable running tests under Valgrind            : ${enable_valgrind}
898     Enable build with -fsanitize=address           : ${ENABLE_ASAN}
899     Enable build with -fsanitize=undefined         : ${ENABLE_UBSAN}
900     Generate html apidoc                           : ${ENABLE_APIDOC}
901     Generate html manual                           : ${ENABLE_MANUAL}
902 ])