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