diff options
author | panne <unknown> | 2005-01-10 19:01:28 +0000 |
---|---|---|
committer | panne <unknown> | 2005-01-10 19:01:28 +0000 |
commit | 7a8bd24665dc2ea63fe1d95ccd52ff506774c21e (patch) | |
tree | d0c465cb56939ccb78c390535289282ac8b2d39d /aclocal.m4 | |
parent | 0aca2f00f9bddce3624c1c99e9d2373a3a10a6c3 (diff) | |
download | haskell-7a8bd24665dc2ea63fe1d95ccd52ff506774c21e.tar.gz |
[project @ 2005-01-10 19:01:27 by panne]
Refactored and cleaned up ld-related tests. Only tested mildly under Linux.
Diffstat (limited to 'aclocal.m4')
-rw-r--r-- | aclocal.m4 | 87 |
1 files changed, 52 insertions, 35 deletions
diff --git a/aclocal.m4 b/aclocal.m4 index 34542f2553..3a8aa2e6e9 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -330,48 +330,65 @@ AC_SUBST(AlexVersion) ]) -dnl -dnl Check whether ld supports -x -dnl -AC_DEFUN(FPTOOLS_LD_X, -[AC_CACHE_CHECK([whether ld understands -x], fptools_cv_ld_x, -[ -echo 'foo() {}' > conftest.c +# FP_PROG_LD +# ---------- +# Sets the output variable LdCmd to the (non-Cygwin version of the) full path +# of ld. Exits if no ld can be found +AC_DEFUN([FP_PROG_LD], +[AC_PATH_PROG([fp_prog_ld_raw], [ld]) +if test -z "$fp_prog_ld_raw"; then + AC_MSG_ERROR([cannot find ld in your PATH, no idea how to link]) +fi +LdCmd=$fp_prog_ld_raw +case $HostPlatform in + *mingw32) if test x${OSTYPE} != xmsys; then + LdCmd="`cygpath -w ${fp_prog_ld_raw} | sed -e 's@\\\\@/@g'`" + AC_MSG_NOTICE([normalized ld command to $LdCmd]) + fi + ;; +esac +AC_SUBST([LdCmd]) +])# FP_PROG_LD + + +# FP_PROG_LD_X +# ------------ +# Sets the output variable LdXFlag to -x if ld supports this flag, otherwise the +# variable's value is empty. +AC_DEFUN([FP_PROG_LD_X], +[AC_REQUIRE([FP_PROG_LD]) +AC_CACHE_CHECK([whether ld understands -x], [fp_cv_ld_x], +[echo 'foo() {}' > conftest.c ${CC-cc} -c conftest.c -if ${LdCmd} -r -x -o foo.o conftest.o; then - fptools_cv_ld_x=yes +if ${LdCmd} -r -x -o conftest2.o conftest.o; then + fp_cv_ld_x=yes else - fptools_cv_ld_x=no + fp_cv_ld_x=no fi -rm -rf conftest.c conftest.o foo.o -]) -if test "$fptools_cv_ld_x" = yes; then - LdXFlag=-x +rm -rf conftest*]) +if test "$fp_cv_ld_x" = yes; then + LdXFlag=-x else - LdXFlag= + LdXFlag= fi -AC_SUBST(LdXFlag) -]) +AC_SUBST([LdXFlag]) +])# FP_PROG_LD_X -dnl -dnl Check for GNU ld -dnl -AC_DEFUN(FPTOOLS_GNU_LD, -[AC_CACHE_CHECK([whether ld is GNU ld], fptools_cv_gnu_ld, -[ -if ${LdCmd} -v | grep GNU 2>&1 >/dev/null; then - fptools_cv_gnu_ld=yes -else - fptools_cv_gnu_ld=no -fi -]) -if test "$fptools_cv_gnu_ld" = yes; then - LdIsGNULd=YES + +# FP_PROG_LD_IS_GNU +# ----------------- +# Sets the output variable LdIsGNULd to YES or NO, depending on whether it is +# GNU ld or not. +AC_DEFUN([FP_PROG_LD_IS_GNU], +[AC_REQUIRE([FP_PROG_LD]) +AC_CACHE_CHECK([whether ld is GNU ld], [fp_cv_gnu_ld], +[if ${LdCmd} --version 2> /dev/null | grep "GNU" > /dev/null 2>&1; then + fp_cv_gnu_ld=yes else - LdIsGNULd=NO -fi -AC_SUBST(LdIsGNULd) -]) + fp_cv_gnu_ld=no +fi]) +AC_SUBST([LdIsGNULd], [`echo $fp_cv_gnu_ld | sed 'y/yesno/YESNO/'`]) +])# FP_PROG_LD_IS_GNU # FP_PROG_AR |