From b2c4184f1148ba1c51011ee6dd8341b9f204f54e Mon Sep 17 00:00:00 2001 From: Andres Noetzli Date: Fri, 9 Jul 2021 11:24:05 -0700 Subject: [PATCH] Use newer config.sub to fix build on Apple M1 (#6854) When building cvc5 on macOS for M1 natively, ANTLR's version of `config.sub` does not recognize `aarch64-apple-darwin20.5.0`. This commit fixes that issue by downloading the latest version of `config.sub` (similar to what we are already doing for `config.guess`). The commit also updates the URLs for `config.guess` and `config.sub` to the URLs recommended in the files themselves. The commit also does some minor cleanup/simplifications of the commands for building ANTLR. --- cmake/FindANTLR3.cmake | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/cmake/FindANTLR3.cmake b/cmake/FindANTLR3.cmake index 3ed3c5376..4e669e4ac 100644 --- a/cmake/FindANTLR3.cmake +++ b/cmake/FindANTLR3.cmake @@ -62,15 +62,32 @@ if(NOT ANTLR3_FOUND_SYSTEM) ExternalProject_Add( ANTLR3-EP-config.guess ${COMMON_EP_CONFIG} - URL "http://git.savannah.gnu.org/gitweb/?p=config.git\\\;a=blob_plain\\\;f=config.guess\\\;hb=HEAD" + URL "https://git.savannah.gnu.org/cgit/config.git/plain/config.guess" DOWNLOAD_NAME config.guess DOWNLOAD_NO_EXTRACT ON CONFIGURE_COMMAND "" BUILD_COMMAND "" - INSTALL_COMMAND ${CMAKE_COMMAND} -E copy /../config.guess /share/config.guess + INSTALL_COMMAND ${CMAKE_COMMAND} -E copy + /config.guess + /share/config.guess BUILD_BYPRODUCTS /share/config.guess ) + # Download config sub + ExternalProject_Add( + ANTLR3-EP-config.sub + ${COMMON_EP_CONFIG} + URL "https://git.savannah.gnu.org/cgit/config.git/plain/config.sub" + DOWNLOAD_NAME config.sub + DOWNLOAD_NO_EXTRACT ON + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND ${CMAKE_COMMAND} -E copy + /config.sub + /share/config.sub + BUILD_BYPRODUCTS /share/config.sub + ) + if(CMAKE_SYSTEM_PROCESSOR MATCHES ".*64$") set(64bit "--enable-64bit") else() @@ -81,15 +98,17 @@ if(NOT ANTLR3_FOUND_SYSTEM) ExternalProject_Add( ANTLR3-EP-runtime ${COMMON_EP_CONFIG} - DEPENDS ANTLR3-EP-config.guess + BUILD_IN_SOURCE ON + DEPENDS ANTLR3-EP-config.guess ANTLR3-EP-config.sub URL https://www.antlr3.org/download/C/libantlr3c-3.4.tar.gz URL_HASH SHA1=faa9ab43ab4d3774f015471c3f011cc247df6a18 - CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy - /../config.guess /config.guess - COMMAND sed -i.orig "s/avr | avr32/avr | aarch64 | avr32/" - /config.sub - COMMAND ${CMAKE_COMMAND} -E copy_directory /include include/ - COMMAND /configure + PATCH_COMMAND ${CMAKE_COMMAND} -E copy + /share/config.guess + /config.guess + COMMAND ${CMAKE_COMMAND} -E copy + /share/config.sub + /config.sub + CONFIGURE_COMMAND /configure --with-pic --disable-antlrdebug --prefix= -- 2.30.2