1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-16 18:50:23 +02:00
guile/build-aux/lightning.m4
Paolo Bonzini 66aef1c644 detect 32-/64-bit variant of i386 back-end at include time (not configure time)
2008-06-11  Paolo Bonzini  <bonzini@gnu.org>

	* build-aux/lightning.m4: Adjust LIGHTNING_BACKENDS, don't
	use suffix support to distinguish i386/x86_64.
	* lightning/i386/Makefile.frag: Use LIGHTNING_TARGET_FILES
	to distribute *-32.h and *-64.h files now.
	* lightning/i386/asm-i386: Moved to...
	* lightning/i386/asm.h: Include the appropriate subtarget file.
	* lightning/i386/core-i386: Moved to...
	* lightning/i386/core.h: Include the appropriate subtarget file.
	* lightning/i386/fp.h: New, include the appropriate subtarget file.
	* lightning/i386/asm-32: Do not include asm-i386.h.
	* lightning/i386/asm-64.h: Likewise.
	* lightning/i386/core-32: Do not include core-i386.h.
	* lightning/i386/core-64.h: Likewise.
	* lightning/Makefile.am: Adjust for renamed files.

	* configure.ac: Define LIGHTNING_TARGET here.
	* opcode/disass.c: Change list of valid LIGHTNING_TARGET values.

	* lightningize.in: Robustify against missing subtarget files.
2008-06-11 19:00:37 -07:00

77 lines
2.2 KiB
Text

dnl I'd like this to be edited in -*- Autoconf -*- mode...
dnl
# serial 2 LIGHTNING_CONFIGURE_IF_NOT_FOUND
m4_define([LIGHTNING_BACKENDS], [i386 i386:-32 i386:-64 sparc ppc])
AC_DEFUN([LIGHTNING_CONFIGURE_LINKS], [
suffix=
case "$target_cpu" in
i?86) cpu=i386 ;;
x86_64) cpu=i386 ;;
sparc*) cpu=sparc ;;
powerpc) cpu=ppc ;;
*) ;;
esac
if test -n "$cpu" && test -d "$srcdir/lightning/$cpu"; then
$1
lightning_frag=`cd $srcdir && pwd`/lightning/$cpu/Makefile.frag
test -f $lightning_frag || lightning_frag=/dev/null
asm_src=lightning/$cpu/asm.h
test -f $srcdir/lightning/$cpu/asm$suffix.h && asm_src=lightning/$cpu/asm$suffix.h
AC_CONFIG_LINKS(lightning/asm.h:$asm_src, [], [asm_src=$asm_src])
fp_src=lightning/$cpu/fp.h
test -f $srcdir/lightning/$cpu/fp$suffix.h && fp_src=lightning/$cpu/fp$suffix.h
AC_CONFIG_LINKS(lightning/fp.h:$fp_src, [], [fp_src=$fp_src])
core_src=lightning/$cpu/core.h
test -f $srcdir/lightning/$cpu/core$suffix.h && core_src=lightning/$cpu/core$suffix.h
AC_CONFIG_LINKS(lightning/core.h:$core_src, [], [core_src=$core_src])
funcs_src=lightning/$cpu/funcs.h
test -f $srcdir/lightning/$cpu/funcs$suffix.h && funcs_src=lightning/$cpu/funcs$suffix.h
AC_CONFIG_LINKS(lightning/funcs.h:$funcs_src, [], [funcs_src=$funcs_src])
else
$2
lightning_frag=/dev/null
fi
AC_SUBST_FILE(lightning_frag)
])
AC_DEFUN([LIGHTNING_CONFIGURE_IF_NOT_FOUND], [
AC_REQUIRE([AC_PROG_LN_S])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_ARG_WITH(lightning-prefix,
AS_HELP_STRING([--with-lightning-prefix=PFX], [Prefix where GNU lightning is installed]),
[], [with_lightning_prefix=])
saveCFLAGS="$CFLAGS"
if test "x$with_lightning_prefix" != x; then
INCLIGHTNING="-I${with_lightning_prefix}/include"
CFLAGS="$CFLAGS $INCLIGHTNING"
else
INCLIGHTNING=
fi
AC_CHECK_HEADER(lightning.h)
CFLAGS="$saveCFLAGS"
AM_CONDITIONAL(LIGHTNING_MAIN, (exit 1))
AM_CONDITIONAL(HAVE_INSTALLED_LIGHTNING, test "$ac_cv_header_lightning_h" = yes)
lightning=
if test "$ac_cv_header_lightning_h" = yes; then
lightning=yes
else
LIGHTNING_CONFIGURE_LINKS(lightning=yes, lightning=no)
fi
AS_IF([test "$lightning" = yes], [
AC_DEFINE(HAVE_LIGHTNING, 1, [Define if GNU lightning can be used])
$1
], [$2])
unset lightning
])dnl