Detect if llvm-gcc is built on dragonegg.

Store the flags needed to disable optimizations and to emit LLVM-IR depending on
the version of llvm-gcc used.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118684 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Tobias Grosser 2010-11-10 16:31:34 +00:00
parent 6c43de46ff
commit a84b567713
3 changed files with 121 additions and 7 deletions

View File

@ -195,6 +195,8 @@ LLVMGXX := @LLVMGXX@
LLVMCC1 := @LLVMCC1@
LLVMCC1PLUS := @LLVMCC1PLUS@
LLVMGCC_LANGS := @LLVMGCC_LANGS@
LLVMGCC_DRAGONEGG := @LLVMGCC_DRAGONEGG@
LLVMGCC_DISABLEOPT_FLAGS := @LLVMGCC_DISABLEOPT_FLAGS@
# Information on Clang, if configured.
CLANGPATH := @CLANGPATH@
@ -204,6 +206,9 @@ ENABLE_BUILT_CLANG := @ENABLE_BUILT_CLANG@
# The LLVM capable compiler to use.
LLVMCC_OPTION := @LLVMCC_OPTION@
# The flag used to emit LLVM IR.
LLVMCC_EMITIR_FLAG = @LLVMCC_EMITIR_FLAG@
# Path to directory where object files should be stored during a build.
# Set OBJ_ROOT to "." if you do not want to use a separate place for
# object files.

View File

@ -1414,12 +1414,37 @@ fi
dnl Check, whether __dso_handle is present
AC_CHECK_FUNCS([__dso_handle])
dnl Check wether llvm-gcc is based on dragonegg
AC_CACHE_CHECK([whether llvm-gcc is dragonegg],[llvm_cv_llvmgcc_dragonegg],
[llvm_cv_llvmgcc_dragonegg="no"
if test -x "$LLVMGCC" ; then
cp /dev/null conftest.c
"$LLVMGCC" -fplugin-arg-dragonegg-emit-ir -S -o - conftest.c | \
grep 'target datalayout =' > /dev/null 2>&1
if test $? -eq 0 ; then
llvm_cv_llvmgcc_dragonegg="yes"
fi
rm conftest.c
fi])
dnl Set the flags needed to emit LLVM IR and to disable optimizations
dnl in llvmgcc
if test "$llvm_cv_llvmgcc_dragonegg" = "yes" ; then
LLVMCC_EMITIR_FLAG="-fplugin-arg-dragonegg-emit-ir"
LLVMGCC_DISABLEOPT_FLAGS="-fplugin-arg-dragonegg-disable-llvm-optzns"
else
LLVMCC_EMITIR_FLAG="-emit-llvm"
LLVMGCC_DISABLEOPT_FLAGS="-mllvm -disable-llvm-optzns"
fi
AC_SUBST(LLVMCC_EMITIR_FLAG)
dnl See if the llvm-gcc executable can compile to LLVM assembly
AC_CACHE_CHECK([whether llvm-gcc is sane],[llvm_cv_llvmgcc_sanity],
[llvm_cv_llvmgcc_sanity="no"
if test -x "$LLVMGCC" ; then
cp /dev/null conftest.c
"$LLVMGCC" -emit-llvm -S -o - conftest.c | \
"$LLVMGCC" "$LLVMCC_EMITIR_FLAG" -S -o - conftest.c | \
grep 'target datalayout =' > /dev/null 2>&1
if test $? -eq 0 ; then
llvm_cv_llvmgcc_sanity="yes"
@ -1428,6 +1453,7 @@ if test -x "$LLVMGCC" ; then
fi])
dnl Since we have a sane llvm-gcc, identify it and its sub-tools
dnl Furthermore, add some information about the tools
if test "$llvm_cv_llvmgcc_sanity" = "yes" ; then
AC_MSG_CHECKING([llvm-gcc component support])
llvmcc1path=`"$LLVMGCC" --print-prog-name=cc1`
@ -1438,6 +1464,8 @@ if test "$llvm_cv_llvmgcc_sanity" = "yes" ; then
AC_SUBST(LLVMGCCDIR,$llvmgccdir)
llvmgcclangs=[`"$LLVMGCC" -v --help 2>&1 | grep '^Configured with:' | sed 's/^.*--enable-languages=\([^ ]*\).*/\1/'`]
AC_SUBST(LLVMGCC_LANGS,$llvmgcclangs)
AC_SUBST(LLVMGCC_DRAGONEGG,$llvm_cv_llvmgcc_dragonegg)
AC_SUBST(LLVMGCC_DISABLEOPT_FLAGS)
AC_MSG_RESULT([ok])
fi

93
configure vendored
View File

@ -771,10 +771,13 @@ USE_OPROFILE
HAVE_PTHREAD
HUGE_VAL_SANITY
MMAP_FILE
LLVMCC_EMITIR_FLAG
LLVMCC1
LLVMCC1PLUS
LLVMGCCDIR
LLVMGCC_LANGS
LLVMGCC_DRAGONEGG
LLVMGCC_DISABLEOPT_FLAGS
SHLIBEXT
SHLIBPATH_VAR
LLVM_PREFIX
@ -11498,7 +11501,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 11501 "configure"
#line 11504 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -20560,6 +20563,35 @@ fi
done
{ echo "$as_me:$LINENO: checking whether llvm-gcc is dragonegg" >&5
echo $ECHO_N "checking whether llvm-gcc is dragonegg... $ECHO_C" >&6; }
if test "${llvm_cv_llvmgcc_dragonegg+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
llvm_cv_llvmgcc_dragonegg="no"
if test -x "$LLVMGCC" ; then
cp /dev/null conftest.c
"$LLVMGCC" -fplugin-arg-dragonegg-emit-ir -S -o - conftest.c | \
grep 'target datalayout =' > /dev/null 2>&1
if test $? -eq 0 ; then
llvm_cv_llvmgcc_dragonegg="yes"
fi
rm conftest.c
fi
fi
{ echo "$as_me:$LINENO: result: $llvm_cv_llvmgcc_dragonegg" >&5
echo "${ECHO_T}$llvm_cv_llvmgcc_dragonegg" >&6; }
if test "$llvm_cv_llvmgcc_dragonegg" = "yes" ; then
LLVMCC_EMITIR_FLAG="-fplugin-arg-dragonegg-emit-ir"
LLVMGCC_DISABLEOPT_FLAGS="-fplugin-arg-dragonegg-disable-llvm-optzns"
else
LLVMCC_EMITIR_FLAG="-emit-llvm"
LLVMGCC_DISABLEOPT_FLAGS="-mllvm -disable-llvm-optzns"
fi
{ echo "$as_me:$LINENO: checking whether llvm-gcc is sane" >&5
echo $ECHO_N "checking whether llvm-gcc is sane... $ECHO_C" >&6; }
if test "${llvm_cv_llvmgcc_sanity+set}" = set; then
@ -20568,7 +20600,7 @@ else
llvm_cv_llvmgcc_sanity="no"
if test -x "$LLVMGCC" ; then
cp /dev/null conftest.c
"$LLVMGCC" -emit-llvm -S -o - conftest.c | \
"$LLVMGCC" "$LLVMCC_EMITIR_FLAG" -S -o - conftest.c | \
grep 'target datalayout =' > /dev/null 2>&1
if test $? -eq 0 ; then
llvm_cv_llvmgcc_sanity="yes"
@ -20594,6 +20626,9 @@ echo $ECHO_N "checking llvm-gcc component support... $ECHO_C" >&6; }
llvmgcclangs=`"$LLVMGCC" -v --help 2>&1 | grep '^Configured with:' | sed 's/^.*--enable-languages=\([^ ]*\).*/\1/'`
LLVMGCC_LANGS=$llvmgcclangs
LLVMGCC_DRAGONEGG=$llvm_cv_llvmgcc_dragonegg
{ echo "$as_me:$LINENO: result: ok" >&5
echo "${ECHO_T}ok" >&6; }
fi
@ -21786,10 +21821,13 @@ USE_OPROFILE!$USE_OPROFILE$ac_delim
HAVE_PTHREAD!$HAVE_PTHREAD$ac_delim
HUGE_VAL_SANITY!$HUGE_VAL_SANITY$ac_delim
MMAP_FILE!$MMAP_FILE$ac_delim
LLVMCC_EMITIR_FLAG!$LLVMCC_EMITIR_FLAG$ac_delim
LLVMCC1!$LLVMCC1$ac_delim
LLVMCC1PLUS!$LLVMCC1PLUS$ac_delim
LLVMGCCDIR!$LLVMGCCDIR$ac_delim
LLVMGCC_LANGS!$LLVMGCC_LANGS$ac_delim
LLVMGCC_DRAGONEGG!$LLVMGCC_DRAGONEGG$ac_delim
LLVMGCC_DISABLEOPT_FLAGS!$LLVMGCC_DISABLEOPT_FLAGS$ac_delim
SHLIBEXT!$SHLIBEXT$ac_delim
SHLIBPATH_VAR!$SHLIBPATH_VAR$ac_delim
LLVM_PREFIX!$LLVM_PREFIX$ac_delim
@ -21808,11 +21846,9 @@ OCAML_LIBDIR!$OCAML_LIBDIR$ac_delim
ENABLE_VISIBILITY_INLINES_HIDDEN!$ENABLE_VISIBILITY_INLINES_HIDDEN$ac_delim
RPATH!$RPATH$ac_delim
RDYNAMIC!$RDYNAMIC$ac_delim
LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 96; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
@ -21848,6 +21884,51 @@ CEOF$ac_eof
_ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 2; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
{ (exit 1); exit 1; }; }
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
if test -n "$ac_eof"; then
ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
ac_eof=`expr $ac_eof + 1`
fi
cat >>$CONFIG_STATUS <<_ACEOF
cat >"\$tmp/subs-3.sed" <<\CEOF$ac_eof
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
_ACEOF
sed '
s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
s/^/s,@/; s/!/@,|#_!!_#|/
:n
t n
s/'"$ac_delim"'$/,g/; t
s/$/\\/; p
N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
' >>$CONFIG_STATUS <conf$$subs.sed
rm -f conf$$subs.sed
cat >>$CONFIG_STATUS <<_ACEOF
:end
s/|#_!!_#|//g
CEOF$ac_eof
_ACEOF
# VPATH may cause trouble with some makes, so we remove $(srcdir),
# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
# trailing colons and then remove the whole line if VPATH becomes empty
@ -22091,7 +22172,7 @@ s&@abs_builddir@&$ac_abs_builddir&;t t
s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
s&@INSTALL@&$ac_INSTALL&;t t
$ac_datarootdir_hack
" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" | sed 's/|#_!!_#|//g' >$tmp/out
" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" | sed -f "$tmp/subs-3.sed" >$tmp/out
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
{ ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&