diff options
-rwxr-xr-x | configure | 37 |
1 files changed, 22 insertions, 15 deletions
@@ -157,10 +157,10 @@ target=${target#[a-zA-Z0-9]*-} # Per-target configuration -clinker_needs_no_pie=true asm_supports_cfi="" casm_options="" casmruntime="" +clinker_needs_no_pie=true clinker_options="" cprepro_options="" struct_passing="" @@ -378,6 +378,7 @@ if test "$arch" = "x86" -a "$bitsize" = "64"; then esac fi + # # RISC-V Target Configuration # @@ -401,12 +402,31 @@ if test "$arch" = "riscV"; then system="linux" fi + # # Finalize Target Configuration # if test -z "$casmruntime"; then casmruntime="$casm $casm_options"; fi +# Invoke a C compiler, e.g. to check for availability of command-line options +testcompiler () { + tmpsrc="${TMPDIR:-/tmp}/compcert-configure-$$.c" + rm -f "$tmpsrc" + tmpout="${TMPDIR:-/tmp}/compcert-configure-$$.out" + rm -f "$tmpout" + cat >> "$tmpsrc" <<EOF +int main (void) +{ + return 0; +} +EOF + "$@" -o "$tmpout" "$tmpsrc" >/dev/null 2>/dev/null + retcode=$? + rm -f "$tmpsrc" "$tmpout" + return $retcode +} + # # Test Assembler Support for CFI Directives # @@ -435,23 +455,10 @@ fi # if ($clinker_needs_no_pie) then echo "Testing linker support for '-no-pie' option... " | tr -d '\n' - fx=/tmp/compcert-configure-$$.elf - rm -f $fx - f=/tmp/compcert-configure-$$.c - rm -f $f - cat >> $f <<EOF -int main (void) -{ - return 0; -} -EOF - $cc -no-pie -o $fx $f >/dev/null 2>&1 - status=$? - if [ $status -eq 0 ] + if testcompiler ${cc} -no-pie; then echo "yes"; clinker_options="${clinker_options} -no-pie" else echo "no"; clinker_needs_no_pie=false fi - rm -f $f $fx fi |