[PATCH] D109837: cmake: Deprecate config.guess

Tom Stellard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 15 13:23:18 PDT 2021


tstellar updated this revision to Diff 372785.
tstellar added a comment.

Use -dumpmachine instead of -v.
Pass CXX_FLAGS to compiler along with -dumpmachine.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109837/new/

https://reviews.llvm.org/D109837

Files:
  llvm/CMakeLists.txt
  llvm/cmake/modules/GetHostTriple.cmake


Index: llvm/cmake/modules/GetHostTriple.cmake
===================================================================
--- llvm/cmake/modules/GetHostTriple.cmake
+++ llvm/cmake/modules/GetHostTriple.cmake
@@ -44,7 +44,7 @@
   else( MSVC )
     if(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows AND NOT MSYS)
       message(WARNING "unable to determine host target triple")
-    else()
+    elseif(LLVM_USE_CONFIG_GUESS)
       set(config_guess ${LLVM_MAIN_SRC_DIR}/cmake/config.guess)
       execute_process(COMMAND sh ${config_guess}
         RESULT_VARIABLE TT_RV
@@ -54,6 +54,17 @@
         message(FATAL_ERROR "Failed to execute ${config_guess}")
       endif( NOT TT_RV EQUAL 0 )
       set( value ${TT_OUT} )
+    elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+      execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpmachine ${CMAKE_CXX_COMPILER_ARG1} ${CMAKE_CXX_FLAGS}
+        RESULT_VARIABLE TT_RV
+        OUTPUT_VARIABLE value
+        OUTPUT_STRIP_TRAILING_WHITESPACE)
+      if( NOT TT_RV EQUAL 0 )
+        message(WARNING "Failed to execute ${CMAKE_CXX_COMPILER} for triple detection."
+                        "Use DLLVM_HOST_TRIPLE= to specify the host triple.  If you are "
+                        "unsure of the host triple, you can run the llvm/cmake/config.guess "
+                        "script to find out, but be aware that config.guess is sometimes wrong.")
+      endif( NOT TT_RV EQUAL 0 )
     endif()
   endif( MSVC )
   set( ${var} ${value} PARENT_SCOPE )
Index: llvm/CMakeLists.txt
===================================================================
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -475,6 +475,9 @@
 set(LLVM_CODESIGNING_IDENTITY "" CACHE STRING
   "Sign executables and dylibs with the given identity or skip if empty (Darwin Only)")
 
+option(LLVM_USE_CONFIG_GUESS
+   "(deprecated) Use config.guess to determine host architecture.  This option will be removed in the future." OFF)
+
 # If enabled, verify we are on a platform that supports oprofile.
 if( LLVM_USE_OPROFILE )
   if( NOT CMAKE_SYSTEM_NAME MATCHES "Linux" )


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109837.372785.patch
Type: text/x-patch
Size: 2109 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210915/c48c16f2/attachment.bin>


More information about the llvm-commits mailing list