Skip to content

Commit d9cf601

Browse files
committed
Auto merge of #39770 - alexcrichton:configure-clean, r=brson
Delete more swaths of the configure script This PR deletes more swaths of the `./configure` script which are either no longer necessary or already available in rustbuild (where an implementation is preferred)
2 parents 744e696 + f8ca805 commit d9cf601

File tree

3 files changed

+27
-352
lines changed

3 files changed

+27
-352
lines changed

configure

+1-340
Original file line numberDiff line numberDiff line change
@@ -384,207 +384,6 @@ need_cmd sed
384384
need_cmd file
385385
need_cmd make
386386

387-
msg "inspecting environment"
388-
389-
CFG_OSTYPE=$(uname -s)
390-
CFG_CPUTYPE=$(uname -m)
391-
392-
if [ $CFG_OSTYPE = Darwin -a $CFG_CPUTYPE = i386 ]
393-
then
394-
# Darwin's `uname -s` lies and always returns i386. We have to use sysctl
395-
# instead.
396-
if sysctl hw.optional.x86_64 | grep -q ': 1'
397-
then
398-
CFG_CPUTYPE=x86_64
399-
fi
400-
fi
401-
402-
# The goal here is to come up with the same triple as LLVM would,
403-
# at least for the subset of platforms we're willing to target.
404-
405-
case $CFG_OSTYPE in
406-
407-
Linux)
408-
CFG_OSTYPE=unknown-linux-gnu
409-
;;
410-
411-
FreeBSD)
412-
CFG_OSTYPE=unknown-freebsd
413-
;;
414-
415-
DragonFly)
416-
CFG_OSTYPE=unknown-dragonfly
417-
;;
418-
419-
Bitrig)
420-
CFG_OSTYPE=unknown-bitrig
421-
;;
422-
423-
OpenBSD)
424-
CFG_OSTYPE=unknown-openbsd
425-
;;
426-
427-
NetBSD)
428-
CFG_OSTYPE=unknown-netbsd
429-
;;
430-
431-
Darwin)
432-
CFG_OSTYPE=apple-darwin
433-
;;
434-
435-
SunOS)
436-
CFG_OSTYPE=sun-solaris
437-
CFG_CPUTYPE=$(isainfo -n)
438-
;;
439-
440-
Haiku)
441-
CFG_OSTYPE=unknown-haiku
442-
;;
443-
444-
MINGW*)
445-
# msys' `uname` does not print gcc configuration, but prints msys
446-
# configuration. so we cannot believe `uname -m`:
447-
# msys1 is always i686 and msys2 is always x86_64.
448-
# instead, msys defines $MSYSTEM which is MINGW32 on i686 and
449-
# MINGW64 on x86_64.
450-
CFG_CPUTYPE=i686
451-
CFG_OSTYPE=pc-windows-gnu
452-
if [ "$MSYSTEM" = MINGW64 ]
453-
then
454-
CFG_CPUTYPE=x86_64
455-
fi
456-
;;
457-
458-
MSYS*)
459-
CFG_OSTYPE=pc-windows-gnu
460-
;;
461-
462-
# Thad's Cygwin identifiers below
463-
464-
# Vista 32 bit
465-
CYGWIN_NT-6.0)
466-
CFG_OSTYPE=pc-windows-gnu
467-
CFG_CPUTYPE=i686
468-
;;
469-
470-
# Vista 64 bit
471-
CYGWIN_NT-6.0-WOW64)
472-
CFG_OSTYPE=pc-windows-gnu
473-
CFG_CPUTYPE=x86_64
474-
;;
475-
476-
# Win 7 32 bit
477-
CYGWIN_NT-6.1)
478-
CFG_OSTYPE=pc-windows-gnu
479-
CFG_CPUTYPE=i686
480-
;;
481-
482-
# Win 7 64 bit
483-
CYGWIN_NT-6.1-WOW64)
484-
CFG_OSTYPE=pc-windows-gnu
485-
CFG_CPUTYPE=x86_64
486-
;;
487-
488-
# Win 8 # uname -s on 64-bit cygwin does not contain WOW64, so simply use uname -m to detect arch (works in my install)
489-
CYGWIN_NT-6.3)
490-
CFG_OSTYPE=pc-windows-gnu
491-
;;
492-
# We do not detect other OS such as XP/2003 using 64 bit using uname.
493-
# If we want to in the future, we will need to use Cygwin - Chuck's csih helper in /usr/lib/csih/winProductName.exe or alternative.
494-
*)
495-
err "unknown OS type: $CFG_OSTYPE"
496-
;;
497-
esac
498-
499-
500-
case $CFG_CPUTYPE in
501-
502-
i386 | i486 | i686 | i786 | x86)
503-
CFG_CPUTYPE=i686
504-
;;
505-
506-
xscale | arm)
507-
CFG_CPUTYPE=arm
508-
;;
509-
510-
armv6l)
511-
CFG_CPUTYPE=arm
512-
CFG_OSTYPE="${CFG_OSTYPE}eabihf"
513-
;;
514-
515-
armv7l | armv8l)
516-
CFG_CPUTYPE=armv7
517-
CFG_OSTYPE="${CFG_OSTYPE}eabihf"
518-
;;
519-
520-
aarch64 | arm64)
521-
CFG_CPUTYPE=aarch64
522-
;;
523-
524-
powerpc | ppc)
525-
CFG_CPUTYPE=powerpc
526-
;;
527-
528-
powerpc64 | ppc64)
529-
CFG_CPUTYPE=powerpc64
530-
;;
531-
532-
powerpc64le | ppc64le)
533-
CFG_CPUTYPE=powerpc64le
534-
;;
535-
536-
s390x)
537-
CFG_CPUTYPE=s390x
538-
;;
539-
540-
x86_64 | x86-64 | x64 | amd64)
541-
CFG_CPUTYPE=x86_64
542-
;;
543-
544-
mips | mips64)
545-
if [ "$CFG_CPUTYPE" = "mips64" ]; then
546-
CFG_OSTYPE="${CFG_OSTYPE}abi64"
547-
fi
548-
ENDIAN=$(printf '\1' | od -dAn)
549-
if [ "$ENDIAN" -eq 1 ]; then
550-
CFG_CPUTYPE="${CFG_CPUTYPE}el"
551-
elif [ "$ENDIAN" -ne 256 ]; then
552-
err "unknown endianness: $ENDIAN (expecting 1 for little or 256 for big)"
553-
fi
554-
;;
555-
556-
BePC)
557-
CFG_CPUTYPE=i686
558-
;;
559-
560-
*)
561-
err "unknown CPU type: $CFG_CPUTYPE"
562-
esac
563-
564-
# Detect 64 bit linux systems with 32 bit userland and force 32 bit compilation
565-
if [ $CFG_OSTYPE = unknown-linux-gnu -a $CFG_CPUTYPE = x86_64 ]
566-
then
567-
# $SHELL does not exist in standard 'sh', so probably only exists
568-
# if configure is running in an interactive bash shell. /usr/bin/env
569-
# exists *everywhere*.
570-
BIN_TO_PROBE="$SHELL"
571-
if [ ! -r "$BIN_TO_PROBE" ]; then
572-
if [ -r "/usr/bin/env" ]; then
573-
BIN_TO_PROBE="/usr/bin/env"
574-
else
575-
warn "Cannot check if the userland is i686 or x86_64"
576-
fi
577-
fi
578-
file -L "$BIN_TO_PROBE" | grep -q "x86[_-]64"
579-
if [ $? != 0 ]; then
580-
msg "i686 userland on x86_64 Linux kernel"
581-
CFG_CPUTYPE=i686
582-
fi
583-
fi
584-
585-
586-
DEFAULT_BUILD="${CFG_CPUTYPE}-${CFG_OSTYPE}"
587-
588387
CFG_SRC_DIR="$(abs_path $(dirname $0))/"
589388
CFG_SRC_DIR_RELATIVE="$(dirname $0)/"
590389
CFG_BUILD_DIR="$(pwd)/"
@@ -673,7 +472,7 @@ valopt infodir "${CFG_PREFIX}/share/info" "install additional info"
673472
valopt llvm-root "" "set LLVM root"
674473
valopt python "" "set path to python"
675474
valopt jemalloc-root "" "set directory where libjemalloc_pic.a is located"
676-
valopt build "${DEFAULT_BUILD}" "GNUs ./configure syntax LLVM build triple"
475+
valopt build "" "GNUs ./configure syntax LLVM build triple"
677476
valopt android-cross-path "" "Android NDK standalone path (deprecated)"
678477
valopt i686-linux-android-ndk "" "i686-linux-android NDK standalone path"
679478
valopt arm-linux-androideabi-ndk "" "arm-linux-androideabi NDK standalone path"
@@ -821,76 +620,6 @@ if [ $(echo $python_version | grep -c '^Python 2\.7') -ne 1 ]; then
821620
err "Found $python_version, but Python 2.7 is required"
822621
fi
823622

824-
# If we have no git directory then we are probably a tarball distribution
825-
# and shouldn't attempt to load submodules
826-
if [ ! -e ${CFG_SRC_DIR}.git ]
827-
then
828-
probe CFG_GIT git
829-
msg "git: no git directory. disabling submodules"
830-
CFG_DISABLE_MANAGE_SUBMODULES=1
831-
else
832-
probe_need CFG_GIT git
833-
fi
834-
835-
# Use `md5sum` on GNU platforms, or `md5 -q` on BSD
836-
probe CFG_MD5 md5
837-
probe CFG_MD5SUM md5sum
838-
if [ -n "$CFG_MD5" ]
839-
then
840-
CFG_HASH_COMMAND="$CFG_MD5 -q | cut -c 1-8"
841-
elif [ -n "$CFG_MD5SUM" ]
842-
then
843-
CFG_HASH_COMMAND="$CFG_MD5SUM | cut -c 1-8"
844-
else
845-
err 'could not find one of: md5 md5sum'
846-
fi
847-
putvar CFG_HASH_COMMAND
848-
849-
probe CFG_CLANG clang++
850-
probe CFG_CCACHE ccache
851-
probe CFG_GCC gcc
852-
probe CFG_LD ld
853-
probe CFG_VALGRIND valgrind
854-
probe CFG_PERF perf
855-
probe CFG_ISCC iscc
856-
probe CFG_ANTLR4 antlr4
857-
probe CFG_GRUN grun
858-
probe CFG_FLEX flex
859-
probe CFG_BISON bison
860-
probe CFG_GDB gdb
861-
probe CFG_LLDB lldb
862-
863-
if [ -n "$CFG_ENABLE_NINJA" ]
864-
then
865-
probe CFG_NINJA ninja
866-
if [ -z "$CFG_NINJA" ]
867-
then
868-
# On Debian and Fedora, the `ninja` binary is an IRC bot, so the build tool was
869-
# renamed. Handle this case.
870-
probe CFG_NINJA ninja-build
871-
fi
872-
fi
873-
874-
# For building LLVM
875-
if [ -z "$CFG_LLVM_ROOT" ]
876-
then
877-
probe_need CFG_CMAKE cmake
878-
fi
879-
880-
# On MacOS X, invoking `javac` pops up a dialog if the JDK is not
881-
# installed. Since `javac` is only used if `antlr4` is available,
882-
# probe for it only in this case.
883-
if [ -n "$CFG_ANTLR4" ]
884-
then
885-
CFG_ANTLR4_JAR="\"$(find /usr/ -name antlr-complete.jar 2>/dev/null | head -n 1)\""
886-
if [ "x" = "x$CFG_ANTLR4_JAR" ]
887-
then
888-
CFG_ANTLR4_JAR="\"$(find ~ -name antlr-complete.jar 2>/dev/null | head -n 1)\""
889-
fi
890-
putvar CFG_ANTLR4_JAR $CFG_ANTLR4_JAR
891-
probe CFG_JAVAC javac
892-
fi
893-
894623
# the valgrind rpass tests will fail if you don't have a valgrind, but they're
895624
# only disabled if you opt out.
896625
if [ -z "$CFG_VALGRIND" ]
@@ -905,41 +634,6 @@ then
905634
fi
906635
fi
907636

908-
if [ -n "$CFG_LLDB" ]
909-
then
910-
# Store LLDB's version
911-
CFG_LLDB_VERSION=$($CFG_LLDB --version 2>/dev/null | head -1)
912-
putvar CFG_LLDB_VERSION
913-
914-
# If CFG_LLDB_PYTHON_DIR is not already set from the outside and valid, try to read it from
915-
# LLDB via the -P commandline options.
916-
if [ -z "$CFG_LLDB_PYTHON_DIR" ] || [ ! -d "$CFG_LLDB_PYTHON_DIR" ]
917-
then
918-
CFG_LLDB_PYTHON_DIR=$($CFG_LLDB -P)
919-
920-
# If CFG_LLDB_PYTHON_DIR is not a valid directory, set it to something more readable
921-
if [ ! -d "$CFG_LLDB_PYTHON_DIR" ]
922-
then
923-
CFG_LLDB_PYTHON_DIR="LLDB_PYTHON_DIRECTORY_NOT_FOUND"
924-
fi
925-
926-
putvar CFG_LLDB_PYTHON_DIR
927-
fi
928-
fi
929-
930-
# LLDB tests on OSX require /usr/bin/python, not something like Homebrew's
931-
# /usr/local/bin/python. We're loading a compiled module for LLDB tests which is
932-
# only compatible with the system.
933-
case $CFG_BUILD in
934-
*-apple-darwin)
935-
CFG_LLDB_PYTHON=/usr/bin/python
936-
;;
937-
*)
938-
CFG_LLDB_PYTHON=$CFG_PYTHON
939-
;;
940-
esac
941-
putvar CFG_LLDB_PYTHON
942-
943637
# Do some sanity checks if running on buildbot
944638
# (these env vars are set by rust-buildbot)
945639
if [ -n "$RUST_DIST_SERVER" -a -n "$ALLOW_NONZERO_RLIMIT_CORE" ]; then
@@ -952,10 +646,6 @@ if [ -n "$RUST_DIST_SERVER" -a -n "$ALLOW_NONZERO_RLIMIT_CORE" ]; then
952646
fi
953647
fi
954648

955-
step_msg "looking for target specific programs"
956-
957-
probe CFG_ADB adb
958-
959649
BIN_SUF=
960650
if [ "$CFG_OSTYPE" = "pc-windows-gnu" ] || [ "$CFG_OSTYPE" = "pc-windows-msvc" ]
961651
then
@@ -1021,10 +711,6 @@ CFG_MANDIR=${CFG_MANDIR%/}
1021711
CFG_DOCDIR=${CFG_DOCDIR%/}
1022712
CFG_HOST="$(echo $CFG_HOST | tr ',' ' ')"
1023713
CFG_TARGET="$(echo $CFG_TARGET | tr ',' ' ')"
1024-
CFG_SUPPORTED_TARGET=""
1025-
for target_file in ${CFG_SRC_DIR}mk/cfg/*.mk; do
1026-
CFG_SUPPORTED_TARGET="${CFG_SUPPORTED_TARGET} $(basename "$target_file" .mk)"
1027-
done
1028714

1029715
# copy build-triples to host-triples so that builds are a subset of hosts
1030716
V_TEMP=""
@@ -1064,31 +750,6 @@ putvar CFG_MANDIR
1064750
putvar CFG_DOCDIR
1065751
putvar CFG_USING_LIBCPP
1066752

1067-
# Avoid spurious warnings from clang by feeding it original source on
1068-
# ccache-miss rather than preprocessed input.
1069-
if [ -n "$CFG_ENABLE_CCACHE" ] && [ -n "$CFG_USING_CLANG" ]
1070-
then
1071-
CFG_CCACHE_CPP2=1
1072-
putvar CFG_CCACHE_CPP2
1073-
fi
1074-
1075-
if [ -n "$CFG_ENABLE_CCACHE" ]
1076-
then
1077-
CFG_CCACHE_BASEDIR=${CFG_SRC_DIR}
1078-
putvar CFG_CCACHE_BASEDIR
1079-
fi
1080-
1081-
1082-
putvar CFG_LLVM_SRC_DIR
1083-
1084-
for t in $CFG_HOST
1085-
do
1086-
CFG_LLVM_BUILD_DIR=$(echo CFG_LLVM_BUILD_DIR_${t} | tr - _)
1087-
CFG_LLVM_INST_DIR=$(echo CFG_LLVM_INST_DIR_${t} | tr - _)
1088-
putvar $CFG_LLVM_BUILD_DIR
1089-
putvar $CFG_LLVM_INST_DIR
1090-
done
1091-
1092753
msg
1093754
copy_if_changed ${CFG_SRC_DIR}src/bootstrap/mk/Makefile.in ./Makefile
1094755
move_if_changed config.tmp config.mk

0 commit comments

Comments
 (0)