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