summaryrefslogtreecommitdiff
path: root/libbacktrace/configure.ac
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2012-09-17 16:38:38 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2012-09-17 16:38:38 +0000
commitecd3459e7bb829202601e3274411135a15c64dde (patch)
treefaa7758f2b343cc2da8066591b1f81f7833aca15 /libbacktrace/configure.ac
parentb2fc08645fd2a9733a81bb8f058df9c76afcc087 (diff)
downloadgcc-ecd3459e7bb829202601e3274411135a15c64dde.tar.gz
libbacktrace/:
* Initial implementation. ./: * MAINTAINERS (Various Maintainers): Add libbacktrace. * configure.ac (host_libs): Add libbacktrace. (target_libraries): Add libbacktrace. * Makefile.def (host_modules): Add libbacktrace. (target_modules): Likewise. * configure, Makefile.in: Rebuild. gcc/go: * config-lang.in (target_libs): Add target-libbacktrace. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@191397 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libbacktrace/configure.ac')
-rw-r--r--libbacktrace/configure.ac253
1 files changed, 253 insertions, 0 deletions
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
new file mode 100644
index 00000000000..7a44fdfc7a8
--- /dev/null
+++ b/libbacktrace/configure.ac
@@ -0,0 +1,253 @@
+# configure.ac -- Backtrace configure script.
+# Copyright (C) 2012 Free Software Foundation, Inc.
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+
+# (1) Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+
+# (2) Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+
+# (3) The name of the author may not be used to
+# endorse or promote products derived from this software without
+# specific prior written permission.
+
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+AC_PREREQ(2.64)
+AC_INIT(package-unused, version-unused,, libbacktrace)
+AC_CONFIG_SRCDIR(backtrace.h)
+AC_CONFIG_HEADER(config.h)
+
+AC_CANONICAL_SYSTEM
+target_alias=${target_alias-$host_alias}
+
+libtool_VERSION=1:0:0
+AC_SUBST(libtool_VERSION)
+
+AM_INIT_AUTOMAKE([1.11.1 foreign no-dist no-define -Wall -Wno-portability])
+
+AM_MAINTAINER_MODE
+
+AC_ARG_WITH(target-subdir,
+[ --with-target-subdir=SUBDIR Configuring in a subdirectory for target])
+
+# We must force CC to /not/ be precious variables; otherwise
+# the wrong, non-multilib-adjusted value will be used in multilibs.
+# As a side effect, we have to subst CFLAGS ourselves.
+m4_rename([_AC_ARG_VAR_PRECIOUS],[backtrace_PRECIOUS])
+m4_define([_AC_ARG_VAR_PRECIOUS],[])
+AC_PROG_CC
+m4_rename_force([backtrace_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+
+AC_SUBST(CFLAGS)
+
+AC_PROG_RANLIB
+
+AC_PROG_AWK
+case "$AWK" in
+"") AC_MSG_ERROR([can't build without awk]) ;;
+esac
+
+LT_INIT([disable-shared])
+AM_PROG_LIBTOOL
+
+backtrace_supported=yes
+
+if test -n "${with_target_subdir}"; then
+ # We are compiling a GCC library. We can assume that the unwind
+ # library exists.
+ AM_ENABLE_MULTILIB(, ..)
+ BACKTRACE_FILE="backtrace.lo simple.lo"
+else
+ AC_CHECK_HEADER([unwind.h],
+ [AC_CHECK_FUNC([_Unwind_Backtrace],
+ [BACKTRACE_FILE="backtrace.lo simple.lo"],
+ [BACKTRACE_FILE="nounwind.lo"
+ backtrace_supported=no])],
+ [BACKTRACE_FILE="nounwind.lo"
+ backtrace_supported=no])
+fi
+AC_SUBST(BACKTRACE_FILE)
+
+ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \
+ -Wmissing-prototypes -Wold-style-definition \
+ -Wmissing-format-attribute -Wcast-qual],
+ [WARN_FLAGS])
+
+if test "x$GCC" = "xyes"; then
+ WARN_FLAGS="$WARN_FLAGS -Werror"
+fi
+
+AC_SUBST(WARN_FLAGS)
+
+GCC_CHECK_UNWIND_GETIPINFO
+
+# When building as a target library, shared libraries may want to link
+# this in. We don't want to provide another shared library to
+# complicate dependencies. Instead, we just compile with -fPIC.
+PIC_FLAG=
+if test -n "${with_target_subdir}"; then
+ PIC_FLAG=-fPIC
+fi
+AC_SUBST(PIC_FLAG)
+
+# Test for __sync support.
+AC_CACHE_CHECK([__sync extensions],
+[libbacktrace_cv_sys_sync],
+[if test -n "${with_target_subdir}"; then
+ libbacktrace_cv_sys_sync=yes
+ else
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([int i;],
+ [__sync_bool_compare_and_swap (&i, i, i);
+ __sync_lock_test_and_set (&i, 1);
+ __sync_lock_release (&i);])],
+ [libbacktrace_cv_sys_sync=yes],
+ [libbacktrace_cv_sys_sync=no])
+ fi])
+BACKTRACE_SUPPORTS_THREADS=0
+if test "$libbacktrace_cv_sys_sync" = "yes"; then
+ BACKTRACE_SUPPORTS_THREADS=1
+ AC_DEFINE([HAVE_SYNC_FUNCTIONS], 1,
+ [Define to 1 if you have the __sync functions])
+fi
+AC_SUBST(BACKTRACE_SUPPORTS_THREADS)
+
+# The library needs to be able to read the executable itself. Compile
+# a file to determine the executable format. The awk script
+# filetype.awk prints out the file type.
+AC_CACHE_CHECK([output filetype],
+[libbacktrace_cv_sys_filetype],
+[filetype=
+AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([int i;], [int j;])],
+ [filetype=`${AWK} -f $srcdir/filetype.awk conftest.$ac_objext`],
+ [AC_MSG_FAILURE([compiler failed])])
+libbacktrace_cv_sys_filetype=$filetype])
+
+# Match the file type to decide what files to compile.
+FORMAT_FILE=
+case "$libbacktrace_cv_sys_filetype" in
+elf*) FORMAT_FILE="elf.lo" ;;
+*) AC_MSG_WARN([could not determine output file type])
+ FORMAT_FILE="unknown.lo"
+ backtrace_supported=no
+ ;;
+esac
+AC_SUBST(FORMAT_FILE)
+
+# ELF defines.
+elfsize=
+case "$libbacktrace_cv_sys_filetype" in
+elf32) elfsize=32 ;;
+elf64) elfsize=64 ;;
+esac
+AC_DEFINE_UNQUOTED([BACKTRACE_ELF_SIZE], [$elfsize], [ELF size: 32 or 64])
+
+BACKTRACE_SUPPORTED=0
+if test "$backtrace_supported" = "yes"; then
+ BACKTRACE_SUPPORTED=1
+fi
+AC_SUBST(BACKTRACE_SUPPORTED)
+
+AC_CHECK_HEADERS(sys/mman.h)
+if test "$ac_cv_header_sys_mman_h" = "no"; then
+ have_mmap=no
+else
+ if test -n "${with_target_subdir}"; then
+ # When built as a GCC target library, we can't do a link test. We
+ # simply assume that if we have mman.h, we have mmap.
+ have_mmap=yes
+ else
+ AC_CHECK_FUNC(mmap, [have_mmap=yes], [have_mmap=no])
+ fi
+fi
+if test "$have_mmap" = "no"; then
+ VIEW_FILE=read.lo
+ ALLOC_FILE=alloc.lo
+else
+ VIEW_FILE=mmapio.lo
+ AC_PREPROC_IFELSE([
+#include <sys/mman.h>
+#if !defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
+ #error no MAP_ANONYMOUS
+#endif
+], [ALLOC_FILE=mmap.lo], [ALLOC_FILE=alloc.lo])
+fi
+AC_SUBST(VIEW_FILE)
+AC_SUBST(ALLOC_FILE)
+
+BACKTRACE_USES_MALLOC=0
+if test "$ALLOC_FILE" = "alloc.lo"; then
+ BACKTRACE_USES_MALLOC=1
+fi
+AC_SUBST(BACKTRACE_USES_MALLOC)
+
+AC_CACHE_CHECK([whether tests can run],
+ [libbacktrace_cv_sys_native],
+ [AC_RUN_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
+ [libbacktrace_cv_sys_native=yes],
+ [libbacktrace_cv_sys_native=no],
+ [libbacktrace_cv_sys_native=no])])
+AM_CONDITIONAL(NATIVE, test "$libbacktrace_cv_sys_native" = "yes")
+
+if test "${multilib}" = "yes"; then
+ multilib_arg="--enable-multilib"
+else
+ multilib_arg=
+fi
+
+AC_CONFIG_FILES(Makefile backtrace-supported.h)
+
+# We need multilib support, but only if configuring for the target.
+AC_CONFIG_COMMANDS([default],
+[if test -n "$CONFIG_FILES"; then
+ if test -n "${with_target_subdir}"; then
+ # Multilibs need MULTISUBDIR defined correctly in certain makefiles so
+ # that multilib installs will end up installed in the correct place.
+ # The testsuite needs it for multilib-aware ABI baseline files.
+ # To work around this not being passed down from config-ml.in ->
+ # srcdir/Makefile.am -> srcdir/{src,libsupc++,...}/Makefile.am, manually
+ # append it here. Only modify Makefiles that have just been created.
+ #
+ # Also, get rid of this simulated-VPATH thing that automake does.
+ cat > vpsed << \_EOF
+ s!`test -f '$<' || echo '$(srcdir)/'`!!
+_EOF
+ for i in $SUBDIRS; do
+ case $CONFIG_FILES in
+ *${i}/Makefile*)
+ #echo "Adding MULTISUBDIR to $i/Makefile"
+ sed -f vpsed $i/Makefile > tmp
+ grep '^MULTISUBDIR =' Makefile >> tmp
+ mv tmp $i/Makefile
+ ;;
+ esac
+ done
+ rm vpsed
+ fi
+ fi
+],
+[
+# Variables needed in config.status (file generation) which aren't already
+# passed by autoconf.
+SUBDIRS="$SUBDIRS"
+])
+
+AC_OUTPUT