X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=libctf%2Fconfigure.ac;h=7f2a713b93d17c0192056ec84175df6feda4ae71;hb=5beb4d17717570c28e9bf290c64428fda65095b9;hp=2a1a80b7ecbb667f56dbc40293e73c788dc25d58;hpb=ad118caa9f690114d11384b0813f30980cc333f3;p=deliverable%2Fbinutils-gdb.git diff --git a/libctf/configure.ac b/libctf/configure.ac index 2a1a80b7ec..7f2a713b93 100644 --- a/libctf/configure.ac +++ b/libctf/configure.ac @@ -1,7 +1,7 @@ dnl -*- Autoconf -*- dnl Process this file with autoconf to produce a configure script. dnl -dnl Copyright (C) 2019 Free Software Foundation, Inc. +dnl Copyright (C) 2019-2020 Free Software Foundation, Inc. dnl dnl This file is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by @@ -22,6 +22,7 @@ AC_PREREQ(2.64) AC_INIT([libctf library], 1.2.0-pre) AC_CONFIG_SRCDIR(ctf-impl.h) AC_CONFIG_MACRO_DIR(../config) +AC_CONFIG_MACRO_DIR(../bfd) AC_USE_SYSTEM_EXTENSIONS AM_INIT_AUTOMAKE @@ -31,6 +32,11 @@ AC_PROG_CC AC_PROG_RANLIB AM_PROG_AR +dnl Default to a non shared library. This may be overridden by the +dnl configure option --enable-shared. +AC_DISABLE_SHARED + +LT_INIT AC_SYS_LARGEFILE MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing @@ -52,9 +58,11 @@ ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long]) ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual]) AM_MAINTAINER_MODE +AM_INSTALL_LIBBFD ACX_PROG_CC_WARNING_OPTS([-Wall], [ac_libctf_warn_cflags]) AC_FUNC_MMAP +# Needed for BFD capability checks. AC_SEARCH_LIBS(dlopen, dl) AM_ZLIB @@ -91,6 +99,8 @@ AC_C_BIGENDIAN AC_CHECK_HEADERS(byteswap.h endian.h) AC_CHECK_FUNCS(pread) +AC_CHECK_DECLS([asprintf]) + dnl Check for qsort_r. (Taken from gnulib.) AC_CHECK_FUNCS_ONCE([qsort_r]) if test $ac_cv_func_qsort_r = yes; then @@ -149,6 +159,64 @@ if test $ac_cv_libctf_macro_O_CLOEXEC = yes; then [Whether the platform has a definition of O_CLOEXEC.]) fi +# Horrible hacks to build DLLs on Windows and a shared library elsewhere. +SHARED_LIBADD= +SHARED_LDFLAGS= +BFD_LIBADD= +BFD_DEPENDENCIES= +if test "$enable_shared" = "yes"; then +# When building a shared libctf, link against the pic version of libiberty +# so that apps that use libctf won't need libiberty just to satisfy any +# libctf references. +# We can't do that if a pic libiberty is unavailable since including non-pic +# code would insert text relocations into libctf. +# Note that linking against libbfd as we do here, which is itself linked +# against libiberty, may not satisfy all the libctf libiberty references +# since libbfd may not pull in the entirety of libiberty. +changequote(,)dnl + x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'` +changequote([,])dnl + if test -n "$x"; then + SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty" + fi + + case "${host}" in + # More hacks to build DLLs on Windows. + *-*-cygwin*) + SHARED_LDFLAGS="-no-undefined" + SHARED_LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin" + BFD_LIBADD="-L`pwd`/../bfd -lbfd" + ;; + + *-*-darwin*) + BFD_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.dylib" + BFD_DEPENDENCIES="../bfd/libbfd.la" + ;; + *) + case "$host_vendor" in + hp) + BFD_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.sl" + ;; + *) + BFD_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.so" + ;; + esac + BFD_DEPENDENCIES="../bfd/libbfd.la" + ;; + esac +fi +AC_SUBST(SHARED_LDFLAGS) +AC_SUBST(SHARED_LIBADD) +AC_SUBST(BFD_LIBADD) +AC_SUBST(BFD_DEPENDENCIES) + +# Use a version script, if possible, or an -export-symbols-regex otherwise. +VERSION_FLAGS='-export-symbols-regex ctf_.*' +if $LD --help 2>&1 | grep -- --version-script >/dev/null; then + VERSION_FLAGS="-Wl,--version-script='$srcdir/libctf.ver'" +fi +AC_SUBST(VERSION_FLAGS) + AC_CONFIG_FILES(Makefile) AC_CONFIG_HEADERS(config.h) AC_OUTPUT