]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - libctf/configure.ac
Fix libctf build on non-ELF targets.
[thirdparty/binutils-gdb.git] / libctf / configure.ac
CommitLineData
0e65dfba
NA
1dnl -*- Autoconf -*-
2dnl Process this file with autoconf to produce a configure script.
3dnl
4dnl Copyright (C) 2019 Free Software Foundation, Inc.
5dnl
6dnl This file is free software; you can redistribute it and/or modify
7dnl it under the terms of the GNU General Public License as published by
8dnl the Free Software Foundation; either version 2 of the License, or
9dnl (at your option) any later version.
10dnl
11dnl This program is distributed in the hope that it will be useful,
12dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14dnl GNU General Public License for more details.
15dnl
16dnl You should have received a copy of the GNU General Public License
17dnl along with this program; see the file COPYING. If not see
18dnl <http://www.gnu.org/licenses/>.
19dnl
20
21AC_PREREQ(2.64)
22AC_INIT([libctf library], 1.2.0-pre)
23AC_CONFIG_SRCDIR(ctf-impl.h)
24AC_CONFIG_MACRO_DIR(../config)
25AC_USE_SYSTEM_EXTENSIONS
26AM_INIT_AUTOMAKE
27
28# Checks for programs.
29AC_PROG_MAKE_SET
30AC_PROG_CC
31AC_PROG_RANLIB
32AM_PROG_AR
33
34AC_SYS_LARGEFILE
35
36MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing
37AC_CHECK_PROGS([ACLOCAL], [aclocal], [$MISSING aclocal])
38AC_CHECK_PROGS([AUTOCONF], [autoconf], [$MISSING autoconf])
39AC_CHECK_PROGS([AUTOHEADER], [autoheader], [$MISSING autoheader])
40
41# Figure out what compiler warnings we can enable.
42# See config/warnings.m4 for details.
43
44ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wno-narrowing -Wwrite-strings \
45 -Wmissing-format-attribute], [warn])
46ACX_PROG_CC_WARNING_OPTS([-Wstrict-prototypes -Wmissing-prototypes \
47 -Wold-style-definition], [c_warn])
48ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long])
49
50# Only enable with --enable-werror-always until existing warnings are
51# corrected.
52ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual])
53
54AM_MAINTAINER_MODE
55ACX_PROG_CC_WARNING_OPTS([-Wall], [ac_libctf_warn_cflags])
56
57AC_FUNC_MMAP
9698cf9b
NA
58AC_SEARCH_LIBS(dlopen, dl)
59
60# Similar to GDB_AC_CHECK_BFD.
61OLD_CFLAGS=$CFLAGS
62OLD_LDFLAGS=$LDFLAGS
63OLD_LIBS=$LIBS
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.
67CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS"
68ZLIBDIR=`echo $zlibdir | sed 's,\$(top_builddir)/,,g'`
69LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $LDFLAGS"
70intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
71LIBS="-lbfd -liberty -lz $intl $LIBS"
72AC_CACHE_CHECK([for ELF support in BFD], ac_cv_libctf_bfd_elf,
73[AC_TRY_LINK([#include <stdlib.h>
74 #include "bfd.h"
75 #include "elf-bfd.h"],
76 [(void) bfd_section_from_elf_index (NULL, 0);
77 return 0;],
78 [ac_cv_libctf_bfd_elf=yes],
79 [ac_cv_libctf_bfd_elf=no])])
80CFLAGS=$OLD_CFLAGS
81LDFLAGS=$OLD_LDFLAGS
82LIBS=$OLD_LIBS
83
84if test $ac_cv_libctf_bfd_elf = yes; then
85 AC_DEFINE([HAVE_BFD_ELF], 1,
86 [Whether libbfd was configured for an ELF target.])
87fi
88
0e65dfba
NA
89AC_CHECK_HEADERS(byteswap.h)
90AC_CHECK_FUNCS(pread)
91
92AC_CONFIG_FILES(Makefile)
93AC_CONFIG_HEADERS(config.h)
94AC_OUTPUT