gdb: remove unused fetch_inferior_event and inferior_event_handler parameters
[deliverable/binutils-gdb.git] / libctf / configure.ac
CommitLineData
0e65dfba
NA
1dnl -*- Autoconf -*-
2dnl Process this file with autoconf to produce a configure script.
3dnl
b3adc24a 4dnl Copyright (C) 2019-2020 Free Software Foundation, Inc.
0e65dfba
NA
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)
87279e3c 25AC_CONFIG_MACRO_DIR(../bfd)
0e65dfba
NA
26AC_USE_SYSTEM_EXTENSIONS
27AM_INIT_AUTOMAKE
28
29# Checks for programs.
30AC_PROG_MAKE_SET
31AC_PROG_CC
32AC_PROG_RANLIB
33AM_PROG_AR
8e6635bd 34ZW_GNU_GETTEXT_SISTER_DIR
0e65dfba 35
87279e3c
NA
36dnl Default to a non shared library. This may be overridden by the
37dnl configure option --enable-shared.
38AC_DISABLE_SHARED
39
40LT_INIT
0e65dfba
NA
41AC_SYS_LARGEFILE
42
43MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing
44AC_CHECK_PROGS([ACLOCAL], [aclocal], [$MISSING aclocal])
45AC_CHECK_PROGS([AUTOCONF], [autoconf], [$MISSING autoconf])
46AC_CHECK_PROGS([AUTOHEADER], [autoheader], [$MISSING autoheader])
47
48# Figure out what compiler warnings we can enable.
49# See config/warnings.m4 for details.
50
51ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wno-narrowing -Wwrite-strings \
52 -Wmissing-format-attribute], [warn])
53ACX_PROG_CC_WARNING_OPTS([-Wstrict-prototypes -Wmissing-prototypes \
54 -Wold-style-definition], [c_warn])
55ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long])
56
57# Only enable with --enable-werror-always until existing warnings are
58# corrected.
59ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual])
60
61AM_MAINTAINER_MODE
87279e3c 62AM_INSTALL_LIBBFD
0e65dfba
NA
63ACX_PROG_CC_WARNING_OPTS([-Wall], [ac_libctf_warn_cflags])
64
65AC_FUNC_MMAP
87279e3c 66# Needed for BFD capability checks.
9698cf9b 67AC_SEARCH_LIBS(dlopen, dl)
a0486bac 68AM_ZLIB
9698cf9b
NA
69
70# Similar to GDB_AC_CHECK_BFD.
71OLD_CFLAGS=$CFLAGS
72OLD_LDFLAGS=$LDFLAGS
73OLD_LIBS=$LIBS
74# Put the old CFLAGS/LDFLAGS last, in case the user's (C|LD)FLAGS
75# points somewhere with bfd, with -I/foo/lib and -L/foo/lib. We
76# always want our bfd.
77CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS"
78ZLIBDIR=`echo $zlibdir | sed 's,\$(top_builddir)/,,g'`
79LDFLAGS="-L../bfd -L../libiberty $ZLIBDIR $LDFLAGS"
80intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
81LIBS="-lbfd -liberty -lz $intl $LIBS"
82AC_CACHE_CHECK([for ELF support in BFD], ac_cv_libctf_bfd_elf,
83[AC_TRY_LINK([#include <stdlib.h>
84 #include "bfd.h"
85 #include "elf-bfd.h"],
86 [(void) bfd_section_from_elf_index (NULL, 0);
87 return 0;],
88 [ac_cv_libctf_bfd_elf=yes],
89 [ac_cv_libctf_bfd_elf=no])])
90CFLAGS=$OLD_CFLAGS
91LDFLAGS=$OLD_LDFLAGS
92LIBS=$OLD_LIBS
93
94if test $ac_cv_libctf_bfd_elf = yes; then
95 AC_DEFINE([HAVE_BFD_ELF], 1,
96 [Whether libbfd was configured for an ELF target.])
97fi
98
a0486bac
JM
99AC_C_BIGENDIAN
100AC_CHECK_HEADERS(byteswap.h endian.h)
0e65dfba 101AC_CHECK_FUNCS(pread)
6b22174f 102
3a657c60 103AC_CHECK_DECLS([asprintf])
e755667f
NA
104dnl Check for bswap_{16,32,64}
105AC_CHECK_DECLS([bswap_16, bswap_32, bswap_64], [], [], [[#include <byteswap.h>]])
3a657c60 106
6b22174f
NA
107dnl Check for qsort_r. (Taken from gnulib.)
108AC_CHECK_FUNCS_ONCE([qsort_r])
109if test $ac_cv_func_qsort_r = yes; then
110 AC_CACHE_CHECK([for qsort_r signature], [ac_cv_libctf_qsort_r_signature],
111 [AC_LINK_IFELSE(
112 [AC_LANG_PROGRAM([[#undef qsort_r
113 #include <stdlib.h>
114 void qsort_r (void *, size_t, size_t,
115 int (*) (void const *, void const *,
116 void *),
117 void *);
118 void (*p) (void *, size_t, size_t,
119 int (*) (void const *, void const *,
120 void *),
121 void *) = qsort_r;
122 ]])],
123 [ac_cv_libctf_qsort_r_signature=GNU],
124 [AC_LINK_IFELSE(
125 [AC_LANG_PROGRAM([[#undef qsort_r
126 #include <stdlib.h>
127 void qsort_r (void *, size_t, size_t, void *,
128 int (*) (void *,
129 void const *,
130 void const *));
131 void (*p) (void *, size_t, size_t, void *,
132 int (*) (void *, void const *,
133 void const *)) = qsort_r;
134 ]])],
135 [ac_cv_libctf_qsort_r_signature=BSD],
136 [ac_cv_libctf_qsort_r_signature=unknown])])])
137fi
138
139case x$ac_cv_libctf_qsort_r_signature in
140 xGNU) AC_DEFINE([HAVE_QSORT_R_ARG_LAST], 1,
141 [Whether a qsort_r exists with a void *arg as its last arg.]);;
142 xBSD) AC_DEFINE([HAVE_QSORT_R_COMPAR_LAST], 1,
143 [Whether a qsort_r exists with the compar function as its last arg.]);;
144 *) ac_cv_libctf_qsort_r_signature=unknown;;
145esac
146
147AM_CONDITIONAL(NEED_CTF_QSORT_R, test "${ac_cv_libctf_qsort_r_signature}" = unknown)
0e65dfba 148
ad118caa
NA
149AC_CACHE_CHECK([for O_CLOEXEC], [ac_cv_libctf_macro_O_CLOEXEC],
150 [AC_LINK_IFELSE(
151 [AC_LANG_PROGRAM([[#include <fcntl.h>
152 #ifndef O_CLOEXEC
153 choke me;
154 #endif
155 ]],
156 [[return O_CLOEXEC;]])],
157 [ac_cv_libctf_macro_O_CLOEXEC=yes],
158 [ac_cv_libctf_macro_O_CLOEXEC=no])])
159
160if test $ac_cv_libctf_macro_O_CLOEXEC = yes; then
161 AC_DEFINE([HAVE_O_CLOEXEC], 1,
162 [Whether the platform has a definition of O_CLOEXEC.])
163fi
164
87279e3c
NA
165# Horrible hacks to build DLLs on Windows and a shared library elsewhere.
166SHARED_LIBADD=
167SHARED_LDFLAGS=
168BFD_LIBADD=
169BFD_DEPENDENCIES=
170if test "$enable_shared" = "yes"; then
171# When building a shared libctf, link against the pic version of libiberty
172# so that apps that use libctf won't need libiberty just to satisfy any
173# libctf references.
174# We can't do that if a pic libiberty is unavailable since including non-pic
175# code would insert text relocations into libctf.
176# Note that linking against libbfd as we do here, which is itself linked
177# against libiberty, may not satisfy all the libctf libiberty references
178# since libbfd may not pull in the entirety of libiberty.
179changequote(,)dnl
180 x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'`
181changequote([,])dnl
182 if test -n "$x"; then
183 SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty"
184 fi
185
186 case "${host}" in
187 # More hacks to build DLLs on Windows.
188 *-*-cygwin*)
189 SHARED_LDFLAGS="-no-undefined"
190 SHARED_LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin"
191 BFD_LIBADD="-L`pwd`/../bfd -lbfd"
192 ;;
193
194 *-*-darwin*)
195 BFD_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.dylib"
196 BFD_DEPENDENCIES="../bfd/libbfd.la"
197 ;;
198 *)
199 case "$host_vendor" in
200 hp)
201 BFD_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.sl"
202 ;;
203 *)
204 BFD_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.so"
205 ;;
206 esac
207 BFD_DEPENDENCIES="../bfd/libbfd.la"
208 ;;
209 esac
210fi
211AC_SUBST(SHARED_LDFLAGS)
212AC_SUBST(SHARED_LIBADD)
213AC_SUBST(BFD_LIBADD)
214AC_SUBST(BFD_DEPENDENCIES)
215
216# Use a version script, if possible, or an -export-symbols-regex otherwise.
217VERSION_FLAGS='-export-symbols-regex ctf_.*'
218if $LD --help 2>&1 | grep -- --version-script >/dev/null; then
219 VERSION_FLAGS="-Wl,--version-script='$srcdir/libctf.ver'"
220fi
221AC_SUBST(VERSION_FLAGS)
222
0e65dfba
NA
223AC_CONFIG_FILES(Makefile)
224AC_CONFIG_HEADERS(config.h)
225AC_OUTPUT
This page took 0.083356 seconds and 4 git commands to generate.