dnl -*- Autoconf -*-
dnl Process this file with autoconf to produce a configure script.
dnl
-dnl Copyright (C) 2019-2021 Free Software Foundation, Inc.
+dnl Copyright (C) 2019-2022 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
AC_CANONICAL_TARGET
AC_USE_SYSTEM_EXTENSIONS
AM_INIT_AUTOMAKE
+AM_SILENT_RULES([yes])
# Checks for programs.
AC_PROG_MAKE_SET
[Whether the platform has a definition of O_CLOEXEC.])
fi
+build_info=
+makeinfo_too_old=
+AC_CHECK_PROGS([MAKEINFO], makeinfo, [$MISSING makeinfo])
+case " $build_configdirs " in
+ *" texinfo "*) MAKEINFO='$$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo' ;;
+esac
+changequote(,)
+ # We require texinfo to be 6.3 or later, for a working synindex
+ # and validatemenus: otherwise we fall back to /bin/true.
+ if ${MAKEINFO} --version \
+ | egrep 'texinfo[^0-9]*(6\.[3-9]|[7-9][0-9])' >/dev/null 2>&1; then
+ build_info=yes
+ else
+ build_info=
+ makeinfo_too_old=t
+ fi
+changequote([,])
+if test -n "$makeinfo_too_old"; then
+ AC_MSG_WARN([
+*** Makeinfo is too old. Info documentation will not be built.])
+fi
+AC_SUBST(MAKEINFO)
+AM_CONDITIONAL(BUILD_INFO, test "${build_info}" = yes)
+
CTF_LIBADD="-L`pwd`/../libiberty -liberty"
SHARED_LDFLAGS=
AM_CONDITIONAL(TCL_TRY, test "${ac_cv_libctf_tcl_try}" = yes)
# 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'"
+decommented_version_script=
+AC_CACHE_CHECK([for linker versioning flags], [ac_cv_libctf_version_script],
+ [echo 'FOO { global: mai*; local: ctf_fo*; };' > conftest.ver
+ old_LDFLAGS="$LDFLAGS"
+ old_CFLAGS="$CFLAGS"
+ LDFLAGS="$LDFLAGS -shared -Wl,--version-script=conftest.ver"
+ CFLAGS="$CFLAGS -fPIC"
+ AC_LINK_IFELSE([AC_LANG_SOURCE([[int ctf_foo (void) { return 0; }
+ int main (void) { return ctf_foo(); }]])],
+ [ac_cv_libctf_version_script="-Wl,--version-script='$srcdir/libctf.ver'"],
+ [])
+ LDFLAGS="$old_LDFLAGS"
+
+ if test -z "$ac_cv_libctf_version_script"; then
+ LDFLAGS="$LDFLAGS -shared -Wl,-B,local -Wl,-z,gnu-version-script=conftest.ver"
+ AC_LINK_IFELSE([AC_LANG_SOURCE([[int ctf_foo (void) { return 0; }
+ int main (void) { return ctf_foo(); }]])],
+ [ac_cv_libctf_version_script="-Wl,-B,local -Wl,-z,gnu-version-script"
+ decommented_version_script=t],
+ [])
+ LDFLAGS="$old_LDFLAGS"
+ fi
+ CFLAGS="$old_CFLAGS"
+
+ if test -z "$ac_cv_libctf_version_script"; then
+ ac_cv_libctf_version_script='-export-symbols-regex ctf_.*'
+ fi
+ rm -f conftest.ver])
+if test -n "$decommented_version_script"; then
+ # Solaris's version scripts use shell-style comments rather than the C-style
+ # used by GNU ld. Use cpp to strip the comments out. (cpp exists under this
+ # name on all platforms that support ld -z gnu-version-script.)
+ # Also ensure that no symbols exist in the version script for libctf-nobfd.so
+ # that do not exist in the shared library itself, since some linkers add such
+ # symbols with type NOTYPE.
+ /lib/cpp < $srcdir/libctf.ver > libctf-decommented.ver
+ grep -v 'libctf only' $srcdir/libctf.ver | /lib/cpp > libctf-nobfd-decommented.ver
+ VERSION_FLAGS="$ac_cv_libctf_version_script='libctf-decommented.ver'"
+ VERSION_FLAGS_NOBFD="$ac_cv_libctf_version_script='libctf-nobfd-decommented.ver'"
+else
+ VERSION_FLAGS="$ac_cv_libctf_version_script"
+ VERSION_FLAGS_NOBFD="$ac_cv_libctf_version_script"
fi
AC_SUBST(VERSION_FLAGS)
+AC_SUBST(VERSION_FLAGS_NOBFD)
AC_CONFIG_FILES(Makefile)
AC_CONFIG_HEADERS(config.h)