2 dnl Process this file with autoconf to produce a configure script.
4 dnl Copyright (C) 2019 Free Software Foundation, Inc.
6 dnl This file is free software; you can redistribute it and/or modify
7 dnl it under the terms of the GNU General Public License as published by
8 dnl the Free Software Foundation; either version 2 of the License, or
9 dnl (at your option) any later version.
11 dnl This program is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 dnl GNU General Public License for more details.
16 dnl You should have received a copy of the GNU General Public License
17 dnl along with this program; see the file COPYING. If not see
18 dnl <http://www.gnu.org/licenses/>.
22 AC_INIT([libctf library], 1.2.0-pre)
23 AC_CONFIG_SRCDIR(ctf-impl.h)
24 AC_CONFIG_MACRO_DIR(../config)
25 AC_USE_SYSTEM_EXTENSIONS
28 # Checks for programs.
36 MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing
37 AC_CHECK_PROGS([ACLOCAL], [aclocal], [$MISSING aclocal])
38 AC_CHECK_PROGS([AUTOCONF], [autoconf], [$MISSING autoconf])
39 AC_CHECK_PROGS([AUTOHEADER], [autoheader], [$MISSING autoheader])
41 # Figure out what compiler warnings we can enable.
42 # See config/warnings.m4 for details.
44 ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wno-narrowing -Wwrite-strings \
45 -Wmissing-format-attribute], [warn])
46 ACX_PROG_CC_WARNING_OPTS([-Wstrict-prototypes -Wmissing-prototypes \
47 -Wold-style-definition], [c_warn])
48 ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long])
50 # Only enable with --enable-werror-always until existing warnings are
52 ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual])
55 ACX_PROG_CC_WARNING_OPTS([-Wall], [ac_libctf_warn_cflags])
58 AC_SEARCH_LIBS(dlopen, dl)
60 # Similar to GDB_AC_CHECK_BFD.
64 # Put the old CFLAGS/LDFLAGS last, in case the user's (C|LD)FLAGS
65 # points somewhere with bfd, with -I/foo/lib and -L/foo/lib. We
66 # always want our bfd.
67 CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS"
68 ZLIBDIR=`echo $zlibdir | sed 's,\$(top_builddir)/,,g'`
69 LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $LDFLAGS"
70 intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
71 LIBS="-lbfd -liberty -lz $intl $LIBS"
72 AC_CACHE_CHECK([for ELF support in BFD], ac_cv_libctf_bfd_elf,
73 [AC_TRY_LINK([#include <stdlib.h>
75 #include "elf-bfd.h"],
76 [(void) bfd_section_from_elf_index (NULL, 0);
78 [ac_cv_libctf_bfd_elf=yes],
79 [ac_cv_libctf_bfd_elf=no])])
84 if test $ac_cv_libctf_bfd_elf = yes; then
85 AC_DEFINE([HAVE_BFD_ELF], 1,
86 [Whether libbfd was configured for an ELF target.])
89 AC_CHECK_HEADERS(byteswap.h)
92 AC_CONFIG_FILES(Makefile)
93 AC_CONFIG_HEADERS(config.h)