diff --git a/Makefile.config.in b/Makefile.config.in index d34a2d51a933..2c4f1119e3f8 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -117,6 +117,11 @@ HOST_OS=@HOST_OS@ # Target operating system for which LLVM will compile for. TARGET_OS=@TARGET_OS@ +ifeq ($(TARGET_OS),Bitrig) +PROJ_docsdir := $(PROJ_prefix)/share/docs/llvm +PROJ_mandir := $(PROJ_prefix)/man +endif + # Host hardware architecture HOST_ARCH=@HOST_ARCH@ # Target hardware architecture diff --git a/autoconf/config.sub b/autoconf/config.sub index 673d62bfbf5b..612bff3de8f3 100755 --- a/autoconf/config.sub +++ b/autoconf/config.sub @@ -1354,7 +1354,7 @@ case $os in | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -bitrig*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) diff --git a/configure b/configure index ba5ecbef334f..ec9ff0f34781 100755 --- a/configure +++ b/configure @@ -3966,6 +3966,11 @@ else llvm_cv_no_link_all_option="-Wl,--no-whole-archive" llvm_cv_os_type="DragonFly" llvm_cv_platform_type="Unix" ;; + *-*-bitrig*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="DragonFly" + llvm_cv_platform_type="Unix" ;; *-*-hpux*) llvm_cv_link_all_option="-Wl,--whole-archive" llvm_cv_no_link_all_option="-Wl,--no-whole-archive" @@ -4052,6 +4057,8 @@ else llvm_cv_target_os_type="NetBSD" ;; *-*-dragonfly*) llvm_cv_target_os_type="DragonFly" ;; + *-*-bitrig*) + llvm_cv_target_os_type="Bitrig" ;; *-*-hpux*) llvm_cv_target_os_type="HP-UX" ;; *-*-interix*) @@ -9204,13 +9211,22 @@ fi if test "$LLVM_ENABLE_THREADS" -eq 1 && test "$ENABLE_PTHREADS" -eq 1 ; then +if test "$llvm_cv_os_type" = "Bitrig" ; then +{ echo "$as_me:$LINENO: checking for pthread_mutex_init in -pthread" >&5 +echo $ECHO_N "checking for pthread_mutex_init in -pthread... $ECHO_C" >&6; } +else { echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthread" >&5 echo $ECHO_N "checking for pthread_mutex_init in -lpthread... $ECHO_C" >&6; } +fi if test "${ac_cv_lib_pthread_pthread_mutex_init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" +if test "$llvm_cv_os_type" = "Bitrig" ; then + LIBS="-pthread $LIBS" +else + LIBS="-lpthread $LIBS" +fi cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -9286,7 +9302,11 @@ if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then #define HAVE_LIBPTHREAD 1 _ACEOF +if test "$llvm_cv_os_type" = "Bitrig" ; then + LIBS="-pthread $LIBS" +else LIBS="-lpthread $LIBS" +fi fi diff --git a/lib/Target/X86/X86Subtarget.h b/lib/Target/X86/X86Subtarget.h index 754b5b924717..b0155cb2bcc6 100644 --- a/lib/Target/X86/X86Subtarget.h +++ b/lib/Target/X86/X86Subtarget.h @@ -406,6 +406,7 @@ class X86Subtarget final : public X86GenSubtargetInfo { bool isTargetFreeBSD() const { return TargetTriple.isOSFreeBSD(); } bool isTargetDragonFly() const { return TargetTriple.isOSDragonFly(); } bool isTargetSolaris() const { return TargetTriple.isOSSolaris(); } + bool isTargetBitrig() const { return TargetTriple.isOSBitrig(); } bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); } bool isTargetCOFF() const { return TargetTriple.isOSBinFormatCOFF(); } diff --git a/tools/llvm-config/CMakeLists.txt b/tools/llvm-config/CMakeLists.txt index 50c84e6c3d08..f10d01bd13f4 100644 --- a/tools/llvm-config/CMakeLists.txt +++ b/tools/llvm-config/CMakeLists.txt @@ -5,9 +5,15 @@ set(BUILDVARIABLES_OBJPATH ${CMAKE_CURRENT_BINARY_DIR}/BuildVariables.inc) # Compute the substitution values for various items. get_property(LLVM_SYSTEM_LIBS_LIST TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS) -foreach(l ${LLVM_SYSTEM_LIBS_LIST}) - set(SYSTEM_LIBS ${SYSTEM_LIBS} "-l${l}") -endforeach() +if (${CMAKE_SYSTEM_NAME} MATCHES "Bitrig") + foreach(l ${LLVM_SYSTEM_LIBS_LIST}) + set(SYSTEM_LIBS ${SYSTEM_LIBS} "-${l}") + endforeach() +else() + foreach(l ${LLVM_SYSTEM_LIBS_LIST}) + set(SYSTEM_LIBS ${SYSTEM_LIBS} "-l${l}") + endforeach() +endif() string(REPLACE ";" " " SYSTEM_LIBS "${SYSTEM_LIBS}") # Use configure_file to create BuildVariables.inc.