@@ -690,6 +690,7 @@ extra_host_zlib_configure_flags
690
690
extra_host_libiberty_configure_flags
691
691
stage1_languages
692
692
host_libs_picflag
693
+ CRAB1_LIBS
693
694
PICFLAG
694
695
host_shared
695
696
gcc_host_pie
@@ -8826,6 +8827,139 @@ fi
8826
8827
8827
8828
8828
8829
8830
+ # Rust requires -ldl and -lpthread if you are using an old glibc that does not include them by
8831
+ # default, so we check for them here
8832
+
8833
+ missing_rust_dynlibs=none
8834
+
8835
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5
8836
+ $as_echo_n "checking for library containing dlopen... " >&6; }
8837
+ if ${ac_cv_search_dlopen+:} false; then :
8838
+ $as_echo_n "(cached) " >&6
8839
+ else
8840
+ ac_func_search_save_LIBS=$LIBS
8841
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
8842
+ /* end confdefs.h. */
8843
+
8844
+ /* Override any GCC internal prototype to avoid an error.
8845
+ Use char because int might match the return type of a GCC
8846
+ builtin and then its argument prototype would still apply. */
8847
+ #ifdef __cplusplus
8848
+ extern "C"
8849
+ #endif
8850
+ char dlopen ();
8851
+ int
8852
+ main ()
8853
+ {
8854
+ return dlopen ();
8855
+ ;
8856
+ return 0;
8857
+ }
8858
+ _ACEOF
8859
+ for ac_lib in '' dl; do
8860
+ if test -z "$ac_lib"; then
8861
+ ac_res="none required"
8862
+ else
8863
+ ac_res=-l$ac_lib
8864
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
8865
+ fi
8866
+ if ac_fn_c_try_link "$LINENO"; then :
8867
+ ac_cv_search_dlopen=$ac_res
8868
+ fi
8869
+ rm -f core conftest.err conftest.$ac_objext \
8870
+ conftest$ac_exeext
8871
+ if ${ac_cv_search_dlopen+:} false; then :
8872
+ break
8873
+ fi
8874
+ done
8875
+ if ${ac_cv_search_dlopen+:} false; then :
8876
+
8877
+ else
8878
+ ac_cv_search_dlopen=no
8879
+ fi
8880
+ rm conftest.$ac_ext
8881
+ LIBS=$ac_func_search_save_LIBS
8882
+ fi
8883
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5
8884
+ $as_echo "$ac_cv_search_dlopen" >&6; }
8885
+ ac_res=$ac_cv_search_dlopen
8886
+ if test "$ac_res" != no; then :
8887
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
8888
+
8889
+ fi
8890
+
8891
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_create" >&5
8892
+ $as_echo_n "checking for library containing pthread_create... " >&6; }
8893
+ if ${ac_cv_search_pthread_create+:} false; then :
8894
+ $as_echo_n "(cached) " >&6
8895
+ else
8896
+ ac_func_search_save_LIBS=$LIBS
8897
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
8898
+ /* end confdefs.h. */
8899
+
8900
+ /* Override any GCC internal prototype to avoid an error.
8901
+ Use char because int might match the return type of a GCC
8902
+ builtin and then its argument prototype would still apply. */
8903
+ #ifdef __cplusplus
8904
+ extern "C"
8905
+ #endif
8906
+ char pthread_create ();
8907
+ int
8908
+ main ()
8909
+ {
8910
+ return pthread_create ();
8911
+ ;
8912
+ return 0;
8913
+ }
8914
+ _ACEOF
8915
+ for ac_lib in '' pthread; do
8916
+ if test -z "$ac_lib"; then
8917
+ ac_res="none required"
8918
+ else
8919
+ ac_res=-l$ac_lib
8920
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
8921
+ fi
8922
+ if ac_fn_c_try_link "$LINENO"; then :
8923
+ ac_cv_search_pthread_create=$ac_res
8924
+ fi
8925
+ rm -f core conftest.err conftest.$ac_objext \
8926
+ conftest$ac_exeext
8927
+ if ${ac_cv_search_pthread_create+:} false; then :
8928
+ break
8929
+ fi
8930
+ done
8931
+ if ${ac_cv_search_pthread_create+:} false; then :
8932
+
8933
+ else
8934
+ ac_cv_search_pthread_create=no
8935
+ fi
8936
+ rm conftest.$ac_ext
8937
+ LIBS=$ac_func_search_save_LIBS
8938
+ fi
8939
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pthread_create" >&5
8940
+ $as_echo "$ac_cv_search_pthread_create" >&6; }
8941
+ ac_res=$ac_cv_search_pthread_create
8942
+ if test "$ac_res" != no; then :
8943
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
8944
+
8945
+ fi
8946
+
8947
+
8948
+ if test $ac_cv_search_dlopen = -ldl; then
8949
+ CRAB1_LIBS="$CRAB1_LIBS -ldl"
8950
+ elif test $ac_cv_search_dlopen = no; then
8951
+ missing_rust_dynlibs="libdl"
8952
+ fi
8953
+
8954
+ if test $ac_cv_search_pthread_create = -lpthread; then
8955
+ CRAB1_LIBS="$CRAB1_LIBS -lpthread"
8956
+ elif test $ac_cv_search_pthread_crate = no; then
8957
+ missing_rust_dynlibs="$missing_rust_dynlibs, libpthread"
8958
+ fi
8959
+
8960
+ CRAB1_LIBS="$CRAB1_LIBS"
8961
+
8962
+
8829
8963
# If we are building PIC/PIE host executables, and we are building dependent
8830
8964
# libs (e.g. GMP) in-tree those libs need to be configured to generate PIC
8831
8965
# code.
@@ -9066,6 +9200,26 @@ $as_echo "$as_me: WARNING: GDC is required to build $language" >&2;}
9066
9200
;;
9067
9201
esac
9068
9202
9203
+ # Disable Rust if we are missing some required C libraries for the Rust runtime.
9204
+ case ${add_this_lang}:${language}:${missing_rust_dynlibs} in
9205
+ *:rust:none)
9206
+ # Nothing to do - we're not missing any C libraries
9207
+ ;;
9208
+ yes:rust:*)
9209
+ as_fn_error $? "some C libraries are required to build $language: $missing_rust_dynlibs" "$LINENO" 5
9210
+ add_this_lang=unsupported
9211
+ ;;
9212
+ all:rust:*)
9213
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: some C libraries are required to build $language: $missing_rust_dynlibs" >&5
9214
+ $as_echo "$as_me: WARNING: some C libraries are required to build $language: $missing_rust_dynlibs" >&2;}
9215
+ add_this_lang=unsupported
9216
+ ;;
9217
+ *:rust:*)
9218
+ # Silently disable.
9219
+ add_this_lang=unsupported
9220
+ ;;
9221
+ esac
9222
+
9069
9223
# Disable jit if -enable-host-shared not specified
9070
9224
# but not if building for Mingw. All code in Windows
9071
9225
# is position independent code (PIC).
0 commit comments