summaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
authorTill Straumann <strauman@slac.stanford.edu>2009-04-22 22:06:58 +0000
committerTill Straumann <strauman@slac.stanford.edu>2009-04-22 22:06:58 +0000
commita8bf95d0249565f4210ccab5c13232d501ce0c2d (patch)
treee01f2eca98add8dba13eec23a95fa22120638890 /m4
parentThis commit was manufactured by cvs2svn to create branch 'base'. (diff)
downloadlibbsdport-a8bf95d0249565f4210ccab5c13232d501ce0c2d.tar.bz2
- importing updated version from SLAC as of 20090422
Diffstat (limited to 'm4')
-rw-r--r--m4/acinclude.m416
-rw-r--r--m4/multilib-fix.m478
-rw-r--r--m4/multilib-installdir.m421
-rw-r--r--m4/rtems-bsp-postlink.m432
-rw-r--r--m4/rtems-isml.m411
-rw-r--r--m4/rtems-ismultibsp.m423
-rw-r--r--m4/rtems-multilib.m428
7 files changed, 209 insertions, 0 deletions
diff --git a/m4/acinclude.m4 b/m4/acinclude.m4
new file mode 100644
index 0000000..130276e
--- /dev/null
+++ b/m4/acinclude.m4
@@ -0,0 +1,16 @@
+dnl m4_syscmd is executed when aclocal is run
+m4_syscmd([cat - > makefile.top.am <<'EOF_'
+AUTOMAKE_OPTIONS=foreign
+SUBDIRS=@the_subdirs@
+# When making a distribution we only want to
+# recurse into (any) one single BSP subdir.
+DIST_SUBDIRS=@the_distsub@
+
+# The dist-hook then removes this extra
+# directory level again.
+dist-hook:
+ if test "$(PACKAGE_VERSION)" = "untagged" ; then echo "Need tagged version to cut distribution"; exit 1; fi
+ cp -frl $(distdir)/$(DIST_SUBDIRS)/* $(distdir)
+ rm -fr $(distdir)/$(DIST_SUBDIRS)
+EOF_
+])
diff --git a/m4/multilib-fix.m4 b/m4/multilib-fix.m4
new file mode 100644
index 0000000..d822a79
--- /dev/null
+++ b/m4/multilib-fix.m4
@@ -0,0 +1,78 @@
+# Automake-1.10's AM_ENABLE_MULTILIB is buggy - it
+# does not properly preserve quoting when copying
+# ac_configure_args to the 'config.status' it creates.
+# I guess one level of quoting is removed when the
+# copying happens (by means of a 'here'-document in
+# AC_OUTPUT_COMMANDS).
+#
+# Note that we cannot use a different name since
+# automake 'knows' about AM_ENABLE_MULTILIB and
+# behaves differently if we would, e.g., name the
+# modified macro 'MY_ENABLE_MULTILIB'.
+# Hence we hope that we can override automake/aclocal's
+# definition.
+#
+# Below (look at the 'sed' code) we replace all occurrences
+# of '$' by '\$' so that 'config.status' again says '$'.
+#
+# This is important if we want to pass e.g.,
+#
+# --exec-prefix='${prefix}/xxx'
+#
+# correctly to the multisubdir configurations.
+#
+# AM_ENABLE_MULTILIB([MAKEFILE], [REL-TO-TOP-SRCDIR])
+# ---------------------------------------------------
+# Add --enable-multilib to configure.
+AC_DEFUN([AM_ENABLE_MULTILIB],
+[# Default to --enable-multilib
+AC_ARG_ENABLE(multilib,
+[ --enable-multilib build many library versions (default)],
+[case "$enableval" in
+ yes) multilib=yes ;;
+ no) multilib=no ;;
+ *) AC_MSG_ERROR([bad value $enableval for multilib option]) ;;
+ esac],
+ [multilib=yes])
+
+# We may get other options which we leave undocumented:
+# --with-target-subdir, --with-multisrctop, --with-multisubdir
+# See config-ml.in if you want the gory details.
+
+if test "$srcdir" = "."; then
+ if test "$with_target_subdir" != "."; then
+ multi_basedir="$srcdir/$with_multisrctop../$2"
+ else
+ multi_basedir="$srcdir/$with_multisrctop$2"
+ fi
+else
+ multi_basedir="$srcdir/$2"
+fi
+AC_SUBST(multi_basedir)
+
+# Even if the default multilib is not a cross compilation,
+# it may be that some of the other multilibs are.
+if test $cross_compiling = no && test $multilib = yes \
+ && test "x${with_multisubdir}" != x ; then
+ cross_compiling=maybe
+fi
+
+AC_OUTPUT_COMMANDS([
+# Only add multilib support code if we just rebuilt the top-level
+# Makefile.
+case " $CONFIG_FILES " in
+ *" ]m4_default([$1],Makefile)[ "*)
+ ac_file=]m4_default([$1],Makefile)[ . ${multi_basedir}/config-ml.in
+ ;;
+esac],
+ [
+srcdir="$srcdir"
+host="$host"
+target="$target"
+with_multisubdir="$with_multisubdir"
+with_multisrctop="$with_multisrctop"
+with_target_subdir="$with_target_subdir"
+ac_configure_args="${multilib_arg} `echo ${ac_configure_args} | sed -e 's/[$]/\\\\$/g'`"
+multi_basedir="$multi_basedir"
+CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+CC="$CC"])])dnl
diff --git a/m4/multilib-installdir.m4 b/m4/multilib-installdir.m4
new file mode 100644
index 0000000..68ac591
--- /dev/null
+++ b/m4/multilib-installdir.m4
@@ -0,0 +1,21 @@
+# TILLAM_MULTISUB_INSTALLDIR
+#
+# tweak 'libdir' so that libraries are
+# installed in proper multisubdir.
+#
+# For use by 'sub-packages', i.e., from
+# configure.ac in a subdir of a main
+# package. Only the toplevel configure.ac
+# should say AM_ENABLE_MULTILIB
+#
+AC_DEFUN([TILLAM_MULTISUB_INSTALLDIR],
+[# Install multilib into proper multisubdir
+if test "${with_multisubdir+set}" = "set" ; then
+ the_multisubdir="/${with_multisubdir}"
+else
+ the_multisubdir=
+fi
+AC_SUBST(libdir,[${libdir}${the_multisubdir}])])dnl
+
+
+])dnl
diff --git a/m4/rtems-bsp-postlink.m4 b/m4/rtems-bsp-postlink.m4
new file mode 100644
index 0000000..c2007d4
--- /dev/null
+++ b/m4/rtems-bsp-postlink.m4
@@ -0,0 +1,32 @@
+# Define 'postlink' commands based on BSP family
+#
+# NOTE: This is NOT extracted from the RTEMS makefiles but
+# essentially a copy of what rtems-4.9.0 does.
+# It would be too hard to figure this one out ;-(
+#
+AC_DEFUN([TILLAC_RTEMS_BSP_POSTLINK_CMDS],
+ [AC_ARG_VAR([RTEMS_BSP_POSTLINK_CMDS],[Command sequence to convert ELF file into downloadable executable])
+ AC_MSG_NOTICE([Setting RTEMS_BSP_POSTLINK_CMDS based on RTEMS_BSP_FAMILY])
+ case "$RTEMS_BSP_FAMILY" in
+ svgm|beatnik|mvme5500|mvme3100|uC5282|mvme167|mvme162)
+# convert ELF -> pure binary
+ RTEMS_BSP_POSTLINK_CMDS='$(OBJCOPY) -Obinary -R .comment -S $(basename $[@])$(APPEXEEXT) $[@]'
+ ;;
+ motorola_powerpc)
+# convert ELF -> special PREP bootloader
+ RTEMS_BSP_POSTLINK_CMDS=\
+'$(OBJCOPY) -O binary -R .comment -S $(basename $[@])$(APPEXEEXT) rtems ;'\
+'gzip -vf9 rtems ; '\
+'$(LD) -o $(basename $[@])$(DOWNEXT) $(RTEMS_BSP_INSTTOP)/lib/bootloader.o '\
+'--just-symbols=$(basename $[@])$(APPEXEEXT) '\
+'-b binary rtems.gz -T $(RTEMS_BSP_INSTTOP)/lib/ppcboot.lds '\
+'-Map $(basename $[@]).map && chmod 755 $(basename $[@])$(DOWNEXT) ; '\
+'rm -f rtems.gz'
+ ;;
+# default: empty command
+ *)
+ ;;
+ esac
+ AC_MSG_NOTICE([RTEMS_BSP_POSTLINK_CMDS: "$RTEMS_BSP_POSTLINK_CMDS"])
+ AM_CONDITIONAL([HAVE_BSP_POSTLINK_CMDS], [test ! "$RTEMS_BSP_POSTLINK_CMDS"xx = "xx" ])]dnl
+)
diff --git a/m4/rtems-isml.m4 b/m4/rtems-isml.m4
new file mode 100644
index 0000000..1a4f62e
--- /dev/null
+++ b/m4/rtems-isml.m4
@@ -0,0 +1,11 @@
+# Find out if this is a multilibbed RTEMS installation
+#
+# Result is exit status, i.e., this macro can e.g., be used
+# in a 'if MACRO ; then list; fi' statement.
+#
+# TILLAC_RTEMS_CPUKIT_MULTILIB
+AC_DEFUN([TILLAC_RTEMS_CPUKIT_MULTILIB],
+ [AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_REQUIRE([TILLAC_RTEMS_OPTIONS])
+ test -d ${with_rtems_top}/${host_cpu}-${host_os}/include]dnl
+)
diff --git a/m4/rtems-ismultibsp.m4 b/m4/rtems-ismultibsp.m4
new file mode 100644
index 0000000..63e8805
--- /dev/null
+++ b/m4/rtems-ismultibsp.m4
@@ -0,0 +1,23 @@
+#
+# Check if the 'enable_rtemsbsp' variable lists a single
+# or multiple BSPs and set exit status accordingly:
+#
+# Result is exit status, i.e., this macro can e.g., be used
+# in a 'if MACRO ; then list; fi' statement.
+#
+# true - if enable_rtembsp lists more than one BSP
+# false - otherwise
+#
+# if TILLAC_RTEMS_CHECK_MULTI_BSPS ; then list ; fi
+AC_DEFUN([TILLAC_RTEMS_CHECK_MULTI_BSPS],
+ [AC_REQUIRE([TILLAC_RTEMS_CHECK_BSPS])
+ ( _tillac_rtems_multi_bsps=no
+ for _tillac_rtems_bspcand in $enable_rtemsbsp ; do
+ if test "$_tillac_rtems_multi_bsps" = "no" ; then
+ _tillac_rtems_multi_bsps=maybe
+ else
+ _tillac_rtems_multi_bsps=yes
+ fi
+ done
+ test "$_tillac_rtems_multi_bsps" = "yes")]dnl
+)
diff --git a/m4/rtems-multilib.m4 b/m4/rtems-multilib.m4
new file mode 100644
index 0000000..25be9d4
--- /dev/null
+++ b/m4/rtems-multilib.m4
@@ -0,0 +1,28 @@
+#
+# Prepare for a multilibbed build
+# - check for presence of 'config-ml.in'
+# - expand AM_ENABLE_MULTILIB(MAKEFILE, REL-TO-TOP-SRCDIR)
+# - expand TILLAM_MULTISUB_INSTALLDIR (workaround so that
+# multilibs are installed into proper subdir.
+# - make sure 'enable_multilib' is set to 'no' if it was initially
+# unset; yet another little workaround...
+#
+# TILLAC_RTEMS_MULTILIB([MAKEFILE], [REL-TO-TOP-SRCDIR])
+AC_DEFUN([TILLAC_RTEMS_MULTILIB],
+ [if test -f ${srcdir}/config-ml.in || test -f $(srcdir)/../config-ml.in ; then
+ AM_ENABLE_MULTILIB([$1],[$2])
+ # install multilibs into MULTISUBDIR
+ TILLAM_MULTISUB_INSTALLDIR
+dnl AC_SUBST(libdir,[${libdir}'$(MULTISUBDIR)'])
+ # in order to properly build multilibs in sub-libraries it seems we
+ # must pass the --enable-multilibs arg to sub-configures or multilibs
+ # are not built there.
+ # To work around, we simply set the default to 'no' so the user must
+ # say --enable-multilib to get them.
+ if test ! "${enable_multilib+set}" = "set" ; then
+ multilib=no
+ fi
+ else
+ enable_multilib=no
+ fi]dnl
+)