llvm.org GIT mirror llvm / a84b567
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 Tobias Grosser 8 years ago
3 changed file(s) with 123 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
194194 LLVMCC1 := @LLVMCC1@
195195 LLVMCC1PLUS := @LLVMCC1PLUS@
196196 LLVMGCC_LANGS := @LLVMGCC_LANGS@
197 LLVMGCC_DRAGONEGG := @LLVMGCC_DRAGONEGG@
198 LLVMGCC_DISABLEOPT_FLAGS := @LLVMGCC_DISABLEOPT_FLAGS@
197199
198200 # Information on Clang, if configured.
199201 CLANGPATH := @CLANGPATH@
202204
203205 # The LLVM capable compiler to use.
204206 LLVMCC_OPTION := @LLVMCC_OPTION@
207
208 # The flag used to emit LLVM IR.
209 LLVMCC_EMITIR_FLAG = @LLVMCC_EMITIR_FLAG@
205210
206211 # Path to directory where object files should be stored during a build.
207212 # Set OBJ_ROOT to "." if you do not want to use a separate place for
14131413 dnl Check, whether __dso_handle is present
14141414 AC_CHECK_FUNCS([__dso_handle])
14151415
1416 dnl Check wether llvm-gcc is based on dragonegg
1417 AC_CACHE_CHECK([whether llvm-gcc is dragonegg],[llvm_cv_llvmgcc_dragonegg],
1418 [llvm_cv_llvmgcc_dragonegg="no"
1419 if test -x "$LLVMGCC" ; then
1420 cp /dev/null conftest.c
1421 "$LLVMGCC" -fplugin-arg-dragonegg-emit-ir -S -o - conftest.c | \
1422 grep 'target datalayout =' > /dev/null 2>&1
1423 if test $? -eq 0 ; then
1424 llvm_cv_llvmgcc_dragonegg="yes"
1425 fi
1426 rm conftest.c
1427 fi])
1428
1429 dnl Set the flags needed to emit LLVM IR and to disable optimizations
1430 dnl in llvmgcc
1431 if test "$llvm_cv_llvmgcc_dragonegg" = "yes" ; then
1432 LLVMCC_EMITIR_FLAG="-fplugin-arg-dragonegg-emit-ir"
1433 LLVMGCC_DISABLEOPT_FLAGS="-fplugin-arg-dragonegg-disable-llvm-optzns"
1434 else
1435 LLVMCC_EMITIR_FLAG="-emit-llvm"
1436 LLVMGCC_DISABLEOPT_FLAGS="-mllvm -disable-llvm-optzns"
1437 fi
1438
1439 AC_SUBST(LLVMCC_EMITIR_FLAG)
1440
14161441 dnl See if the llvm-gcc executable can compile to LLVM assembly
14171442 AC_CACHE_CHECK([whether llvm-gcc is sane],[llvm_cv_llvmgcc_sanity],
14181443 [llvm_cv_llvmgcc_sanity="no"
14191444 if test -x "$LLVMGCC" ; then
14201445 cp /dev/null conftest.c
1421 "$LLVMGCC" -emit-llvm -S -o - conftest.c | \
1446 "$LLVMGCC" "$LLVMCC_EMITIR_FLAG" -S -o - conftest.c | \
14221447 grep 'target datalayout =' > /dev/null 2>&1
14231448 if test $? -eq 0 ; then
14241449 llvm_cv_llvmgcc_sanity="yes"
14271452 fi])
14281453
14291454 dnl Since we have a sane llvm-gcc, identify it and its sub-tools
1455 dnl Furthermore, add some information about the tools
14301456 if test "$llvm_cv_llvmgcc_sanity" = "yes" ; then
14311457 AC_MSG_CHECKING([llvm-gcc component support])
14321458 llvmcc1path=`"$LLVMGCC" --print-prog-name=cc1`
14371463 AC_SUBST(LLVMGCCDIR,$llvmgccdir)
14381464 llvmgcclangs=[`"$LLVMGCC" -v --help 2>&1 | grep '^Configured with:' | sed 's/^.*--enable-languages=\([^ ]*\).*/\1/'`]
14391465 AC_SUBST(LLVMGCC_LANGS,$llvmgcclangs)
1466 AC_SUBST(LLVMGCC_DRAGONEGG,$llvm_cv_llvmgcc_dragonegg)
1467 AC_SUBST(LLVMGCC_DISABLEOPT_FLAGS)
14401468 AC_MSG_RESULT([ok])
14411469 fi
14421470
770770 HAVE_PTHREAD
771771 HUGE_VAL_SANITY
772772 MMAP_FILE
773 LLVMCC_EMITIR_FLAG
773774 LLVMCC1
774775 LLVMCC1PLUS
775776 LLVMGCCDIR
776777 LLVMGCC_LANGS
778 LLVMGCC_DRAGONEGG
779 LLVMGCC_DISABLEOPT_FLAGS
777780 SHLIBEXT
778781 SHLIBPATH_VAR
779782 LLVM_PREFIX
1149711500 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1149811501 lt_status=$lt_dlunknown
1149911502 cat > conftest.$ac_ext <
11500 #line 11501 "configure"
11503 #line 11504 "configure"
1150111504 #include "confdefs.h"
1150211505
1150311506 #if HAVE_DLFCN_H
2055920562 done
2056020563
2056120564
20565 { echo "$as_me:$LINENO: checking whether llvm-gcc is dragonegg" >&5
20566 echo $ECHO_N "checking whether llvm-gcc is dragonegg... $ECHO_C" >&6; }
20567 if test "${llvm_cv_llvmgcc_dragonegg+set}" = set; then
20568 echo $ECHO_N "(cached) $ECHO_C" >&6
20569 else
20570 llvm_cv_llvmgcc_dragonegg="no"
20571 if test -x "$LLVMGCC" ; then
20572 cp /dev/null conftest.c
20573 "$LLVMGCC" -fplugin-arg-dragonegg-emit-ir -S -o - conftest.c | \
20574 grep 'target datalayout =' > /dev/null 2>&1
20575 if test $? -eq 0 ; then
20576 llvm_cv_llvmgcc_dragonegg="yes"
20577 fi
20578 rm conftest.c
20579 fi
20580 fi
20581 { echo "$as_me:$LINENO: result: $llvm_cv_llvmgcc_dragonegg" >&5
20582 echo "${ECHO_T}$llvm_cv_llvmgcc_dragonegg" >&6; }
20583
20584 if test "$llvm_cv_llvmgcc_dragonegg" = "yes" ; then
20585 LLVMCC_EMITIR_FLAG="-fplugin-arg-dragonegg-emit-ir"
20586 LLVMGCC_DISABLEOPT_FLAGS="-fplugin-arg-dragonegg-disable-llvm-optzns"
20587 else
20588 LLVMCC_EMITIR_FLAG="-emit-llvm"
20589 LLVMGCC_DISABLEOPT_FLAGS="-mllvm -disable-llvm-optzns"
20590 fi
20591
20592
20593
2056220594 { echo "$as_me:$LINENO: checking whether llvm-gcc is sane" >&5
2056320595 echo $ECHO_N "checking whether llvm-gcc is sane... $ECHO_C" >&6; }
2056420596 if test "${llvm_cv_llvmgcc_sanity+set}" = set; then
2056720599 llvm_cv_llvmgcc_sanity="no"
2056820600 if test -x "$LLVMGCC" ; then
2056920601 cp /dev/null conftest.c
20570 "$LLVMGCC" -emit-llvm -S -o - conftest.c | \
20602 "$LLVMGCC" "$LLVMCC_EMITIR_FLAG" -S -o - conftest.c | \
2057120603 grep 'target datalayout =' > /dev/null 2>&1
2057220604 if test $? -eq 0 ; then
2057320605 llvm_cv_llvmgcc_sanity="yes"
2059220624
2059320625 llvmgcclangs=`"$LLVMGCC" -v --help 2>&1 | grep '^Configured with:' | sed 's/^.*--enable-languages=\([^ ]*\).*/\1/'`
2059420626 LLVMGCC_LANGS=$llvmgcclangs
20627
20628 LLVMGCC_DRAGONEGG=$llvm_cv_llvmgcc_dragonegg
20629
2059520630
2059620631 { echo "$as_me:$LINENO: result: ok" >&5
2059720632 echo "${ECHO_T}ok" >&6; }
2178521820 HAVE_PTHREAD!$HAVE_PTHREAD$ac_delim
2178621821 HUGE_VAL_SANITY!$HUGE_VAL_SANITY$ac_delim
2178721822 MMAP_FILE!$MMAP_FILE$ac_delim
21823 LLVMCC_EMITIR_FLAG!$LLVMCC_EMITIR_FLAG$ac_delim
2178821824 LLVMCC1!$LLVMCC1$ac_delim
2178921825 LLVMCC1PLUS!$LLVMCC1PLUS$ac_delim
2179021826 LLVMGCCDIR!$LLVMGCCDIR$ac_delim
2179121827 LLVMGCC_LANGS!$LLVMGCC_LANGS$ac_delim
21828 LLVMGCC_DRAGONEGG!$LLVMGCC_DRAGONEGG$ac_delim
21829 LLVMGCC_DISABLEOPT_FLAGS!$LLVMGCC_DISABLEOPT_FLAGS$ac_delim
2179221830 SHLIBEXT!$SHLIBEXT$ac_delim
2179321831 SHLIBPATH_VAR!$SHLIBPATH_VAR$ac_delim
2179421832 LLVM_PREFIX!$LLVM_PREFIX$ac_delim
2180721845 ENABLE_VISIBILITY_INLINES_HIDDEN!$ENABLE_VISIBILITY_INLINES_HIDDEN$ac_delim
2180821846 RPATH!$RPATH$ac_delim
2180921847 RDYNAMIC!$RDYNAMIC$ac_delim
21810 LIBOBJS!$LIBOBJS$ac_delim
21811 LTLIBOBJS!$LTLIBOBJS$ac_delim
21812 _ACEOF
21813
21814 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 96; then
21848 _ACEOF
21849
21850 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
2181521851 break
2181621852 elif $ac_last_try; then
2181721853 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
2184321879 ' >>$CONFIG_STATUS
2184421880 rm -f conf$$subs.sed
2184521881 cat >>$CONFIG_STATUS <<_ACEOF
21882 CEOF$ac_eof
21883 _ACEOF
21884
21885
21886 ac_delim='%!_!# '
21887 for ac_last_try in false false false false false :; do
21888 cat >conf$$subs.sed <<_ACEOF
21889 LIBOBJS!$LIBOBJS$ac_delim
21890 LTLIBOBJS!$LTLIBOBJS$ac_delim
21891 _ACEOF
21892
21893 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 2; then
21894 break
21895 elif $ac_last_try; then
21896 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
21897 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
21898 { (exit 1); exit 1; }; }
21899 else
21900 ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
21901 fi
21902 done
21903
21904 ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
21905 if test -n "$ac_eof"; then
21906 ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
21907 ac_eof=`expr $ac_eof + 1`
21908 fi
21909
21910 cat >>$CONFIG_STATUS <<_ACEOF
21911 cat >"\$tmp/subs-3.sed" <<\CEOF$ac_eof
21912 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
21913 _ACEOF
21914 sed '
21915 s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
21916 s/^/s,@/; s/!/@,|#_!!_#|/
21917 :n
21918 t n
21919 s/'"$ac_delim"'$/,g/; t
21920 s/$/\\/; p
21921 N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
21922 ' >>$CONFIG_STATUS
21923 rm -f conf$$subs.sed
21924 cat >>$CONFIG_STATUS <<_ACEOF
21925 :end
21926 s/|#_!!_#|//g
2184621927 CEOF$ac_eof
2184721928 _ACEOF
2184821929
2209022171 s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
2209122172 s&@INSTALL@&$ac_INSTALL&;t t
2209222173 $ac_datarootdir_hack
22093 " $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" | sed 's/|#_!!_#|//g' >$tmp/out
22174 " $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" | sed -f "$tmp/subs-3.sed" >$tmp/out
2209422175
2209522176 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
2209622177 { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&