public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
* Libunwind autoconfigury
@ 2007-04-16 19:29 Stepan Kasal
  0 siblings, 0 replies; only message in thread
From: Stepan Kasal @ 2007-04-16 19:29 UTC (permalink / raw)
  To: frysk

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

Hello,
  I tried to improve the autoconfigury in frysk-imports, which calls
libunwind/configure several times.
  I decided to stick with documented interface of autoconf, so I
worked hard to avoid using the ac_configure_args variable in
frysk-imports/configure.ac.  I decided to use wrapper scripts around
libunwind/configure.
  But the result does not look as nice as I expected.
  In any case, I was not able to finish it so far.  The current
version of the patch is attached below, in case you are interested.

Sorry,
	Stepan

[-- Attachment #2: frysk-libunwind-config2.patch --]
[-- Type: text/plain, Size: 6443 bytes --]

Index: Makefile.am
===================================================================
RCS file: /cvs/frysk/frysk-imports/Makefile.am,v
retrieving revision 1.83
diff -u -r1.83 Makefile.am
--- Makefile.am	16 Apr 2007 18:46:23 -0000	1.83
+++ Makefile.am	16 Apr 2007 19:16:24 -0000
@@ -49,12 +49,11 @@
 	junit \
 	elfutils \
 	getopt
-# Leave out the libunwind-$arch subdirectories from dist:
-DIST_SUBDIRS = $(CHECK_SUBDIRS) libunwind
-SUBDIRS = $(DIST_SUBDIRS) libunwind-i386
+SUBDIRS = $(CHECK_SUBDIRS) libunwind $(LIBUNWIND_ARCH_SUBDIRS)
 check-recursive: SUBDIRS = $(CHECK_SUBDIRS)
 
 EXTRA_DIST += \
+	$(LIBUNWIND_ARCH_CONFIGURES) \
 	frysk/ChangeLog \
 	frysk/junit/ChangeLog \
 	inua/ChangeLog \
Index: bootstrap.sh
===================================================================
RCS file: /cvs/frysk/frysk-imports/bootstrap.sh,v
retrieving revision 1.22
diff -u -r1.22 bootstrap.sh
--- bootstrap.sh	4 Apr 2007 14:47:36 -0000	1.22
+++ bootstrap.sh	16 Apr 2007 19:16:24 -0000
@@ -95,3 +95,23 @@
 echo "Running autoconf ... for libunwind"
 autoconf -f
 cd ..
+
+# Create subdirs for more libunind cross-builds
+libunwind_archs="i386"
+for arch in $libunwind_archs; do
+	test -d libunwind-$arch || mkdir libunwind-$arch
+	cat > libunwind-$arch/configure <<-\EOF
+		#!/bin/sh
+		case $0 in
+		*/libunwind-*)
+			wrapperdir=`expr "X$0" : 'X\(.*\)/libunwind-[^/]*/configure$'` ;;
+		./configure)
+			wrapperdir=.. ;;
+		*)
+			echo "Error: this wrapper cannot handle this case" >&2
+			exit 1 ;;
+		esac
+		. "$wrapperdir"/config.wrapper
+	EOF
+	chmod +x libunwind-$arch/configure
+done
Index: config.wrapper
===================================================================
RCS file: config.wrapper
diff -N config.wrapper
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ config.wrapper	16 Apr 2007 19:16:25 -0000
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+# This file is part of the program FRYSK.
+#
+# Copyright 2005, 2006, 2007, Red Hat Inc.
+#
+# FRYSK is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# FRYSK is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with FRYSK; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+# 
+# In addition, as a special exception, Red Hat, Inc. gives You the
+# additional right to link the code of FRYSK with code not covered
+# under the GNU General Public License ("Non-GPL Code") and to
+# distribute linked combinations including the two, subject to the
+# limitations in this paragraph. Non-GPL Code permitted under this
+# exception must only link to the code of FRYSK through those well
+# defined interfaces identified in the file named EXCEPTION found in
+# the source code files (the "Approved Interfaces"). The files of
+# Non-GPL Code may instantiate templates or use macros or inline
+# functions from the Approved Interfaces without causing the
+# resulting work to be covered by the GNU General Public
+# License. Only Red Hat, Inc. may make changes or additions to the
+# list of Approved Interfaces. You must obey the GNU General Public
+# License in all respects for all of the FRYSK code and other code
+# used in conjunction with FRYSK except the Non-GPL Code covered by
+# this exception. If you modify this file, you may extend this
+# exception to your version of the file, but you are not obligated to
+# do so. If you do not wish to provide this exception without
+# modification, you must delete this exception statement from your
+# version and license this file solely under the GPL without
+# exception.
+
+# A wrapper which calls the libunwind configure with the additional
+# parameters from config-extra-args.
+# It relies on the fact that the sub-configures are always called with
+# --srcdir=...
+
+if test -f config-extra-args; then
+	. ./config-extra-args
+else
+	echo "Error: config-extra-params not found." >&2
+	exit 1
+fi
+
+for arg
+do
+  case $arg in
+  --srcdir=*)
+    srcdir=`expr "x$arg" : 'x[^=]*=\(.*\)'`
+    ;;
+  *)
+    case $arg in
+    *\'*) arg=`echo "$arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    configure_args="$configure_args '$arg'"
+  esac
+done
+
+case $srcdir in
+"")
+  echo "No --srcdir=* option given." >&2
+  exit 1 ;;
+*)
+  eval exec "\"\$srcdir/../libunwind/configure\" $configure_args $extra_args"
+  ;;
+esac
Index: configure.ac
===================================================================
RCS file: /cvs/frysk/frysk-imports/configure.ac,v
retrieving revision 1.68
diff -u -r1.68 configure.ac
--- configure.ac	16 Apr 2007 15:45:35 -0000	1.68
+++ configure.ac	16 Apr 2007 19:16:25 -0000
@@ -58,20 +58,31 @@
 	cdtparser/Makefile
 	junit/Makefile])
 
+AC_CONFIG_SUBDIRS([elfutils])
 
-test -d libunwind-i386 || mkdir libunwind-i386
-(
-  confdir=`(cd "$srcdir";pwd)`
-  cd libunwind-i386
-  # Make sure the inplace build does not break with "already configured"
-  # message; the file is going to regenerated, anyway.
-  # FIXME - This is wrong since it discards any configure flags given
-  # except those explicitly passed on...
-  rm -f $confdir/libunwind/config.status
-  $confdir/libunwind/configure --target=i386-unknown-linux-gnu \
-	--build=${build} --host=${host} --prefix=${prefix}
-)
+######################
+# Configure libunwind for cross builds, too:
 
-AC_CONFIG_SUBDIRS([elfutils libunwind-i386 libunwind])
+AC_CONFIG_SUBDIRS([libunwind-i386])
+# To enable in-place builds, we have to put the native libunwind last,
+# and the previous config.status has to be rebuilt.
+AC_CONFIG_SUBDIRS([libunwind])
+if test "$no_recursion" != yes; then
+  rm -f $srcdir/libunwind/config.status
+fi
+
+libunwind_archs="i386"
+
+if test "$target_vendor" = "" || test "$target_os" = ""; then
+  AC_MSG_ERROR([Canonical target not set.])
+fi
+
+for arch in $libunwind_archs; do
+	LIBUNWIND_ARCH_SUBDIRS="$LIBUNWIND_ARCH_SUBDIRS libunwind-$arch"
+	LIBUNWIND_ARCH_CONFIGURES="$LIBUNWIND_ARCH_SUBDIRS libunwind-$arch/configure"
+	mkdir libunwind-$arch
+	echo "extra_args='--target=$arch-$target_vendor-$target_os'" \
+		>libunwind-$arch/config-extra-args
+done
 
 AC_OUTPUT

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

only message in thread, other threads:[~2007-04-16 19:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-16 19:29 Libunwind autoconfigury Stepan Kasal

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).