public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
* Add libunwind-* arch symlinks and use "normal" recursive configure
@ 2007-12-20  8:57 Mark Wielaard
  0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2007-12-20  8:57 UTC (permalink / raw)
  To: frysk

[-- Attachment #1: Type: text/plain, Size: 1713 bytes --]

Hi,

We used to have a some configure hacks to get libunwind configured and
build for the different architectures we support. This patch adds some
different configure magic so we can use "normal" recursive configure.
Which has as advantage that you can just pass top level configure
options (--enable-debug is really handy when hacking on libunwind
stuff). And it makes sure that we use the same options for all target
builds (previously the 'native' target would be build without
UNW_REMOTE_ONLY, but all 'secondary' targets would be build with it.)

It works because git allows symlinks in the repository. So no more
tricks to get the right directories created, .keep_me files.

frysk-imports/ChangeLog
2007-12-20  Mark Wielaard  <mwielaard@redhat.com>

       * .gitignore: Remove libunwind-*.
       * Makefile.am (LIBUNWIND_DIR): Set to either empty or canonical
       libunwind dir.
       (LIBUNWIND_ARCH_DIRS): Define.
       (LIBUNWIND_OTHER_DIRS): Removed.
       (CHECK_SUBDIRS): Include LIBUNWIND_DIR (if defined).
       (SUBDIRS): Include LIBUNWIND_ARCH_DIRS.
       * bootstrap.sh: Don't create libunwind-* dirs.
       * configure.ac: Don't create and configure libunwind-* dirs
       explicitly.
       (AC_CONFIG_SUBDIRS): Add libunwind-* dirs.

frysk-imports/libunwind/ChangeLog
2007-12-20  Mark Wielaard  <mwielaard@redhat.com>

       * configure.in (is_local_frysk_build): New function.
       (frysk_local_target_cpu): New function.
       Define target_cpu, target_alias and UNW_REMOTE_ONLY based on new
       functions.

Tested with several builds on x86_64, x86, with and without
--enable-debug and --enable-check-libunwind and TestRunner -arch 32 on
the 64bit system.

Cheers,

Mark

[-- Attachment #2: unwind-configure.patch --]
[-- Type: text/x-patch, Size: 7714 bytes --]

diff --git a/frysk-imports/.gitignore b/frysk-imports/.gitignore
index aea9805..2655ccd 100644
--- a/frysk-imports/.gitignore
+++ b/frysk-imports/.gitignore
@@ -10,7 +10,3 @@ depcomp
 files.list
 install-sh
 missing
-libunwind-i386
-libunwind-x86_64
-libunwind-ppc32
-libunwind-ppc64
diff --git a/frysk-imports/ChangeLog b/frysk-imports/ChangeLog
index 0cd00e3..41be628 100644
--- a/frysk-imports/ChangeLog
+++ b/frysk-imports/ChangeLog
@@ -1,3 +1,17 @@
+2007-12-20  Mark Wielaard  <mwielaard@redhat.com>
+
+	* .gitignore: Remove libunwind-*.
+	* Makefile.am (LIBUNWIND_DIR): Set to either empty or canonical
+	libunwind dir.
+	(LIBUNWIND_ARCH_DIRS): Define.
+	(LIBUNWIND_OTHER_DIRS): Removed.
+	(CHECK_SUBDIRS): Include LIBUNWIND_DIR (if defined).
+	(SUBDIRS): Include LIBUNWIND_ARCH_DIRS.
+	* bootstrap.sh: Don't create libunwind-* dirs.
+	* configure.ac: Don't create and configure libunwind-* dirs
+	explicitly.
+	(AC_CONFIG_SUBDIRS): Add libunwind-* dirs.
+
 2007-10-13  Mark Wielaard  <mwielaard@redhat.com>
 
 	* .cvsignore: Add libunwind-ppc32.
diff --git a/frysk-imports/Makefile.am b/frysk-imports/Makefile.am
index c6602a4..d241705 100644
--- a/frysk-imports/Makefile.am
+++ b/frysk-imports/Makefile.am
@@ -44,26 +44,11 @@ include Makefile.gen
 # See the comment above CHECK_SUBDIRS, only add libunwind to the tests
 # if explicitly configured to do so.
 if CHECK_LIBUNWIND
-if ARCH_X86
-    LIBUNWIND_ARCH_DIR = libunwind-i386
-    LIBUNWIND_OTHER_DIRS = libunwind-x86_64 libunwind-ppc32 libunwind-ppc64
-endif # ARCH_X86
-if ARCH_X86_64
-    LIBUNWIND_ARCH_DIR = libunwind-x86_64
-    LIBUNWIND_OTHER_DIRS = libunwind-i386 libunwind-ppc32 libunwind-ppc64
-endif # ARCH_X86_64
-if ARCH_PPC32
-    LIBUNWIND_ARCH_DIR = libunwind-ppc32
-    LIBUNWIND_OTHER_DIRS = libunwind-i386 libunwind-x86_64 libunwind-ppc64
-endif # ARCH_PPC32
-if ARCH_PPC64
-    LIBUNWIND_ARCH_DIR = libunwind-ppc64
-    LIBUNWIND_OTHER_DIRS = libunwind-i386 libunwind-x86_64 libunwind-ppc32
-endif # ARCH_PPC64
+  LIBUNWIND_DIR = libunwind
 else
-  LIBUNWIND_ARCH_DIR = 
-  LIBUNWIND_OTHER_DIRS = libunwind-i386 libunwind-x86_64 libunwind-ppc32 libunwind-ppc64
+  LIBUNWIND_DIR = 
 endif # CHECK_LIBUNWIND
+LIBUNWIND_ARCH_DIRS = libunwind-i386 libunwind-x86_64 libunwind-ppc32 libunwind-ppc64
 
 # List of directories that should both be included in the distro and
 # included in a recursive "make check".  Only the native architecture
@@ -77,13 +62,13 @@ CHECK_SUBDIRS = \
 	elfutils \
 	getopt \
 	tests \
-	$(LIBUNWIND_ARCH_DIR)
+	$(LIBUNWIND_DIR)
 
 check-recursive: SUBDIRS = $(CHECK_SUBDIRS)
 
 # List of directories to build.  This does not include "libunwind" but
 # does include the unwind cross libraries.
-SUBDIRS = $(CHECK_SUBDIRS) $(LIBUNWIND_OTHER_DIRS)
+SUBDIRS = $(CHECK_SUBDIRS) $(LIBUNWIND_ARCH_DIRS)
 
 # List of directories to install, put simply, only install frysk
 # stuff.  Will eventually need to change this so that it installs
diff --git a/frysk-imports/bootstrap.sh b/frysk-imports/bootstrap.sh
index d8e1949..5a734c4 100755
--- a/frysk-imports/bootstrap.sh
+++ b/frysk-imports/bootstrap.sh
@@ -69,13 +69,6 @@ FILE_LIST="\
     autoconf -Werror -f
 )
 
-for isa in i386 x86_64 ppc32 ppc64
-do
-    mkdir -p libunwind-$isa
-    # Something to include in EXTRA_DIST that these directories are
-    # included in the distro.
-    touch libunwind-$isa/.keep_me
-done
 (
     cd libunwind
     mkdir -p config
diff --git a/frysk-imports/configure.ac b/frysk-imports/configure.ac
index f9fc51a..5a127f1 100644
--- a/frysk-imports/configure.ac
+++ b/frysk-imports/configure.ac
@@ -58,24 +58,10 @@ AC_CONFIG_FILES([
 	cdtparser/Makefile
 	junit/Makefile])
 
-for isa in i386 x86_64 ppc32 ppc64
-do
-  AC_MSG_NOTICE([configuring libunwind-$isa])
-  mkdir -p libunwind-$isa
-  confdir=`cd "$srcdir";pwd`
-  # FIXME - This is wrong since it discards any configure flags given
-  # except those explicitly passed on...
-  ( cd libunwind-$isa ; $confdir/libunwind/configure \
-	--target=$isa-unknown-linux-gnu \
-	--build=${build} \
-	--host=${host} \
-	--prefix=${prefix} ) || exit $?
-done
-
 # Even though "libunwind" is not built, it is still included in the
 # list of configured subdirectories so that it can be included in
 # "make dist" (or the recursive "make distdir").
 
-AC_CONFIG_SUBDIRS([elfutils libunwind])
+AC_CONFIG_SUBDIRS([elfutils libunwind libunwind-i386 libunwind-x86_64 libunwind-ppc32 libunwind-ppc64])
 
 AC_OUTPUT
diff --git a/frysk-imports/libunwind-i386 b/frysk-imports/libunwind-i386
new file mode 120000
index 0000000..afad516
--- /dev/null
+++ b/frysk-imports/libunwind-i386
@@ -0,0 +1 @@
+libunwind
\ No newline at end of file
diff --git a/frysk-imports/libunwind-ppc32 b/frysk-imports/libunwind-ppc32
new file mode 120000
index 0000000..afad516
--- /dev/null
+++ b/frysk-imports/libunwind-ppc32
@@ -0,0 +1 @@
+libunwind
\ No newline at end of file
diff --git a/frysk-imports/libunwind-ppc64 b/frysk-imports/libunwind-ppc64
new file mode 120000
index 0000000..afad516
--- /dev/null
+++ b/frysk-imports/libunwind-ppc64
@@ -0,0 +1 @@
+libunwind
\ No newline at end of file
diff --git a/frysk-imports/libunwind-x86_64 b/frysk-imports/libunwind-x86_64
new file mode 120000
index 0000000..afad516
--- /dev/null
+++ b/frysk-imports/libunwind-x86_64
@@ -0,0 +1 @@
+libunwind
\ No newline at end of file
diff --git a/frysk-imports/libunwind/ChangeLog b/frysk-imports/libunwind/ChangeLog
index 04d85ee..e09422a 100644
--- a/frysk-imports/libunwind/ChangeLog
+++ b/frysk-imports/libunwind/ChangeLog
@@ -1,3 +1,10 @@
+2007-12-20  Mark Wielaard  <mwielaard@redhat.com>
+
+	* configure.in (is_local_frysk_build): New function.
+	(frysk_local_target_cpu): New function.
+	Define target_cpu, target_alias and UNW_REMOTE_ONLY based on new
+	functions.
+
 2007-12-11  Andrew Cagney  <cagney@redhat.com>
 
 	* src/x86/Gregs.c (linux_scratch_loc): Add XMM registers.
diff --git a/frysk-imports/libunwind/configure.in b/frysk-imports/libunwind/configure.in
index 0cd1376..28ed2b2 100644
--- a/frysk-imports/libunwind/configure.in
+++ b/frysk-imports/libunwind/configure.in
@@ -7,6 +7,30 @@ dnl Process this file with autoconf to produce a configure script.
 AC_INIT(libunwind, mkvers(pkg_major, pkg_minor, pkg_extra), pkg_maintainer)
 AC_CONFIG_SRCDIR(src/mi/backtrace.c)
 AC_CONFIG_AUX_DIR(config)
+
+# Returns "yes" or "no" based on dirname starting with libunwind-.
+is_local_frysk_build() {
+  if (echo $1 | grep ^libunwind- > /dev/null); then
+	echo "yes"
+  else
+	echo "no"
+  fi
+}
+
+# Returns the encoded build cpu in the local frysk build dir name
+frysk_local_target_cpu() {
+  echo $1 | cut -f2 -d-
+}
+
+# We will trick the target to be the same as the name of the dir
+# for frysk local builds.
+fbdir=$(basename `cd "$builddir";pwd`)
+frysk_local=`is_local_frysk_build $fbdir`
+if test x$frysk_local = xyes; then
+	target_cpu=`frysk_local_target_cpu $fbdir`
+	target_alias=${target_cpu}-unknown-linux-gnu
+fi
+
 AC_CANONICAL_SYSTEM
 AM_INIT_AUTOMAKE([1.6 subdir-objects])
 AM_CONFIG_HEADER(include/config.h)
@@ -84,7 +108,7 @@ get_arch() {
 build_arch=`get_arch $build_cpu`
 target_arch=`get_arch $target_cpu`
 
-AM_CONDITIONAL(REMOTE_ONLY, test x$target_arch != x$build_arch)
+AM_CONDITIONAL(REMOTE_ONLY, test x$frysk_local = xyes)
 AM_CONDITIONAL(ARCH_IA64, test x$target_arch = xia64)
 AM_CONDITIONAL(ARCH_HPPA, test x$target_arch = xhppa)
 AM_CONDITIONAL(ARCH_X86, test x$target_arch = xx86)
@@ -100,7 +124,7 @@ if test x$target_arch = xppc64; then
         AC_SUBST([libdir])
 fi
 
-if test x$target_arch != x$build_arch; then
+if test x$frysk_local = xyes; then
   CPPFLAGS="${CPPFLAGS} -DUNW_REMOTE_ONLY"
 fi
 AC_CONFIG_LINKS(include/libunwind.h:include/libunwind-$target_arch.h

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-12-20  8:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-20  8:57 Add libunwind-* arch symlinks and use "normal" recursive configure Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).