[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: config.h changes comitted -- ./autogen.sh run required.
From: |
Kevin Ryde |
Subject: |
Re: config.h changes comitted -- ./autogen.sh run required. |
Date: |
Sat, 29 Mar 2003 08:59:25 +1000 |
User-agent: |
Gnus/5.090017 (Oort Gnus v0.17) Emacs/21.2 (gnu/linux) |
I think libguile/Makefile.am ends up using plain $(CC) to link
gen-scmconfig, rather than $(CC_FOR_BUILD). And $(OBJEXT) in the rule
for gen-scmconfig.$(OBJEXT) will be the cross-compiler's objext I
think.
As a suggestion, it might be easier to make a rule for a combined
compile and link, to keep right away from the $(CC) setups,
gen-scmconfig$(EXEEXT_FOR_BUILD): gen-scmconfig.c ...
$(CC_FOR_BUILD) `test -f 'gen-scmconfig.c' || echo
'$(srcdir)/'\`gen-scmconfig.c -o gen-scmconfig$(EXEEXT_FOR_BUILD)
If you're not planning to build on djgpp or mingw then
$(EXEEXT_FOR_BUILD) can be dispensed with.
I hit my head against some of this for gmp recently (in the next
release it'll run some stuff on the build system). The couple of
macros below might be of use for inspiration or consideration.
(The CC_FOR_BUILD search below assumes that nothing particular in the
way of types or sizes is needed from the build compiler, just a
compiler that will create a working executable.)
AC_ARG_VAR on CC_FOR_BUILD is a good idea, if nothing else. It shows
the variable in configure --help, and preserves the value across
re-configures.
dnl GMP_PROG_CC_FOR_BUILD
dnl ---------------------
dnl Establish CC_FOR_BUILD, a C compiler for the build system.
dnl
dnl If CC_FOR_BUILD is set, it's used without testing, likewise the old
dnl style HOST_CC, otherwise some likely candidates are tried, as per
dnl configfsf.guess.
AC_DEFUN(GMP_PROG_CC_FOR_BUILD,
[AC_REQUIRE([AC_PROG_CC])
if test -n "$CC_FOR_BUILD"; then
GMP_PROG_CC_FOR_BUILD_WORKS($CC_FOR_BUILD,,
[AC_MSG_ERROR([Specified CC_FOR_BUILD doesn't seem to work])])
elif test -n "$HOST_CC"; then
GMP_PROG_CC_FOR_BUILD_WORKS($HOST_CC,
[CC_FOR_BUILD=$HOST_CC],
[AC_MSG_ERROR([Specified HOST_CC doesn't seem to work])])
else
for i in "$CC" "$CC $CFLAGS $CPPFLAGS" cc gcc c89 c99; do
GMP_PROG_CC_FOR_BUILD_WORKS($i,
[CC_FOR_BUILD=$i
break])
done
if test -z "$CC_FOR_BUILD"; then
AC_MSG_ERROR([Cannot find a build system compiler])
fi
fi
AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
AC_SUBST(CC_FOR_BUILD)
])
dnl GMP_PROG_CC_FOR_BUILD_WORKS(cc/cflags[,[action-if-good][,action-if-bad]])
dnl -------------------------------------------------------------------------
dnl See if the given cc/cflags works on the build system.
dnl
dnl It seems easiest to just use the default compiler output, rather than
dnl figuring out the .exe or whatever at this stage.
AC_DEFUN(GMP_PROG_CC_FOR_BUILD_WORKS,
[AC_MSG_CHECKING([build system compiler $1])
rm -f conftest* a.out b.out a.exe a_out.exe
cat >conftest.c <<EOF
int
main ()
{
exit(0);
}
EOF
gmp_compile="$1 conftest.c"
cc_for_build_works=no
if AC_TRY_EVAL(gmp_compile); then
if (./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest) >&AC_FD_CC
2>&1; then
cc_for_build_works=yes
fi
fi
rm -f conftest* a.out b.out a.exe a_out.exe
AC_MSG_RESULT($cc_for_build_works)
if test "$cc_for_build_works" = yes; then
ifelse([$2],,:,[$2])
else
ifelse([$3],,:,[$3])
fi
])
dnl GMP_PROG_EXEEXT_FOR_BUILD
dnl -------------------------
dnl Determine EXEEXT_FOR_BUILD, the build system executable suffix.
dnl
dnl The idea is to find what "-o conftest$foo" will make it possible to run
dnl the program with ./conftest. On Unix-like systems this is of course
dnl nothing, for DOS it's ".exe", or for a strange RISC OS foreign file
dnl system cross compile it can be ",ff8" apparently. Not sure if the
dnl latter actually applies to a build-system executable, maybe it doesn't,
dnl but it won't hurt to try.
AC_DEFUN(GMP_PROG_EXEEXT_FOR_BUILD,
[AC_REQUIRE([GMP_PROG_CC_FOR_BUILD])
AC_CACHE_CHECK([for build system executable suffix],
gmp_cv_prog_exeext_for_build,
[cat >conftest.c <<EOF
int
main ()
{
exit (0);
}
EOF
for i in .exe ,ff8 ""; do
gmp_compile="$CC_FOR_BUILD conftest.c -o conftest$i"
if AC_TRY_EVAL(gmp_compile); then
if (./conftest) 2>&AC_FD_CC; then
gmp_cv_prog_exeext_for_build=$i
break
fi
fi
done
rm -f conftest*
if test "${gmp_cv_prog_exeext_for_build+set}" != set; then
AC_MSG_ERROR([Cannot determine executable suffix])
fi
])
AC_SUBST(EXEEXT_FOR_BUILD,$gmp_cv_prog_exeext_for_build)
])