diff options
author | Alexander Lanin <alex@lanin.de> | 2020-06-14 09:59:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-14 09:59:00 +0200 |
commit | f2341b2ba3369d5641a53deb3f6b1d513a8924e2 (patch) | |
tree | 229095217e949396920dbe3b77712bef25587775 | |
parent | b1fcfbca224b2af5b6499794edd8615dbc3dc7b5 (diff) | |
download | ccache-f2341b2ba3369d5641a53deb3f6b1d513a8924e2.tar.gz |
Switch to CMake (#573)
Co-authored-by: Cristian Adam <cristian.adam@gmail.com>
Co-authored-by: Joel Rosdahl <joel@rosdahl.net>
54 files changed, 1440 insertions, 6138 deletions
diff --git a/.cmake-format b/.cmake-format new file mode 100644 index 00000000..e0ce1c8d --- /dev/null +++ b/.cmake-format @@ -0,0 +1,21 @@ +# This is for cmake-format. +# See https://github.com/cheshirekow/cmake_format +# for GUI integration and more details. + +# Installation: pip3 install cmake-format + +# cmake-format +# Execution: cmake-format CMakeLists.txt cmake/*.cmake src/CMakeLists.txt unittest/CMakeLists.txt -i +bullet_char: '*' +dangle_parens: false +enum_char: . +line_ending: unix +line_width: 80 +separate_ctrl_name_with_space: false +separate_fn_name_with_space: false +tab_size: 2 +max_subgroups_hwrap: 3 # default is 2 which prevents trivial set(key value PARENT_SCOPE) + +# cmake-lint +# Execution: cmake-lint CMakeLists.txt cmake/*.cmake src/CMakeLists.txt unittest/CMakeLists.txt +max_statement_spacing: 2 @@ -7,36 +7,18 @@ *~ .DS_Store .deps -Makefile -autom4te.cache -ccache ccache-*.tar.* -compile_commands.json -config.cache -config.h -config.h.in -config.log -config.status -configure -dev.mk -dev_mode_disabled -doc/ccache.1 -libb2-*.tar.gz perfdir.* -src/third_party/libb2 -src/third_party/zstd -src/version.cpp testdir.* -unittest/run -zstd-*.tar.gz # Version is generated into src, because it should be included into src packages /src/Version.cpp # Typical build directories -/build/ -/build-* -/build_* +/build* + +# Unignore buildenv directory matched by the pattern above +!/buildenv/ # Visual Studio /.vs/ diff --git a/.travis.sh b/.travis.sh deleted file mode 100755 index 8bed7e97..00000000 --- a/.travis.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -ex - -make clean -make travis CC=gcc CXX=g++ -make travis CC=clang CXX=clang++ -make travis CC=gcc CFLAGS="-m32 -g -O2" CXX=g++ CXXFLAGS="-m32 -g -O2" LDFLAGS="-m32" CONFIGURE="--host=i386-linux-gnu --with-libzstd-from-internet --with-libb2-from-internet" -make travis CC=i686-w64-mingw32-gcc-posix CXX=i686-w64-mingw32-g++-posix CONFIGURE="--host=i686-w64-mingw32 --with-libzstd-from-internet --with-libb2-from-internet" TEST="unittest/run.exe" -make travis CC=clang CXX=clang++ CFLAGS="-fsanitize=undefined" LDFLAGS="-fsanitize=undefined" ASAN_OPTIONS="detect_leaks=0" -make travis CC=clang CXX=clang++ CFLAGS="-fsanitize=address -g" LDFLAGS="-fsanitize=address" ASAN_OPTIONS="detect_leaks=0" -make travis CC=/usr/bin/clang CXX=/usr/bin/clang++ TEST=analyze -make travis CC=/usr/bin/clang CXX=/usr/bin/clang++ TEST=tidy -make travis CC=/usr/bin/clang CXX=/usr/bin/clang++ TEST=check_format diff --git a/.travis.yml b/.travis.yml index af0cbb24..f7119d60 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,15 @@ language: cpp dist: bionic -script: - - ./autogen.sh - - test -z $BUILD_DIR || { mkdir -p $BUILD_DIR; cd $BUILD_DIR; } - - ${SRC_DIR:-.}/configure $CONFIGURE - - test "$NO_COMPILE" || make - - make ${TEST:-test} - -matrix: +script: ci/build.sh + +jobs: include: - # Job 1: Build (in separate build directory) on Linux with native GCC + # Job 1: Build (in source directory) on Linux with native GCC - os: linux compiler: gcc - env: T="Linux GCC, separate build directory" V=1 ENABLE_CACHE_CLEANUP_TESTS=1 BUILD_DIR=build SRC_DIR=.. + env: T="Linux GCC" VERBOSE=1 ENABLE_CACHE_CLEANUP_TESTS=1 BUILDDIR=. CCACHE_LOC=. addons: apt: packages: @@ -25,7 +20,7 @@ matrix: # Job 2: Build on Linux with native 32-bit GCC - os: linux compiler: gcc - env: T="Linux GCC 32-bit" V=1 CFLAGS="-m32 -g -O2" CXXFLAGS="-m32 -g -O2" LDFLAGS="-m32" CONFIGURE="--host=i386-linux-gnu --with-libzstd-from-internet --with-libb2-from-internet" ENABLE_CACHE_CLEANUP_TESTS=1 + env: T="Linux GCC 32-bit" VERBOSE=1 CFLAGS="-m32 -g -O2" CXXFLAGS="-m32 -g -O2" LDFLAGS="-m32" CMAKE_PARAMS="-DUSE_LIBZSTD_FROM_INTERNET=ON -DUSE_LIBB2_FROM_INTERNET=ON" ENABLE_CACHE_CLEANUP_TESTS=1 addons: apt: packages: @@ -36,7 +31,7 @@ matrix: # Job 3: Build on Linux with native Clang - os: linux compiler: clang - env: T="Linux Clang" V=1 ENABLE_CACHE_CLEANUP_TESTS=1 + env: T="Linux Clang" VERBOSE=1 ENABLE_CACHE_CLEANUP_TESTS=1 addons: apt: packages: @@ -47,8 +42,7 @@ matrix: # Job 4: Build on Linux with native GCC and CUDA compiler - os: linux compiler: gcc - env: T="Linux GCC CUDA" V=1 CUDA=10.1.243-1 ENABLE_CACHE_CLEANUP_TESTS=1 - sudo: required + env: T="Linux GCC CUDA" VERBOSE=1 CUDA=10.1.243-1 ENABLE_CACHE_CLEANUP_TESTS=1 addons: apt: packages: @@ -61,7 +55,7 @@ matrix: # Job 5: Build on Linux with 32-bit MinGW cross-compiler - os: linux compiler: i686-w64-mingw32-g++-posix - env: T="Linux MinGW 32-bit" V=1 CC=i686-w64-mingw32-gcc-posix CXX=i686-w64-mingw32-g++-posix CONFIGURE="--host=i686-w64-mingw32 --with-libzstd-from-internet --with-libb2-from-internet" TEST="unittest/run.exe" ENABLE_CACHE_CLEANUP_TESTS=1 + env: T="Linux MinGW 32-bit" VERBOSE=1 CC=i686-w64-mingw32-gcc-posix CXX=i686-w64-mingw32-g++-posix CMAKE_PARAMS="-DCMAKE_SYSTEM_NAME=Windows -DUSE_LIBZSTD_FROM_INTERNET=ON -DUSE_LIBB2_FROM_INTERNET=ON" RUN_TESTS=0 ENABLE_CACHE_CLEANUP_TESTS=1 addons: apt: packages: @@ -70,7 +64,7 @@ matrix: # Job 6: Build on Linux with 64-bit MinGW cross-compiler - os: linux compiler: x86_64-w64-mingw32-g++ - env: T="Linux MinGW 64-bit" V=1 CC=x86_64-w64-mingw32-gcc-posix CXX=x86_64-w64-mingw32-g++-posix CONFIGURE="--host=x86_64-w64-mingw32 --with-libzstd-from-internet --with-libb2-from-internet" TEST="unittest/run.exe" ENABLE_CACHE_CLEANUP_TESTS=1 + env: T="Linux MinGW 64-bit" VERBOSE=1 CC=x86_64-w64-mingw32-gcc-posix CXX=x86_64-w64-mingw32-g++-posix CMAKE_PARAMS="-DCMAKE_SYSTEM_NAME=Windows -DUSE_LIBZSTD_FROM_INTERNET=ON -DUSE_LIBB2_FROM_INTERNET=ON" RUN_TESTS=0 ENABLE_CACHE_CLEANUP_TESTS=1 addons: apt: packages: @@ -79,12 +73,12 @@ matrix: # Job 7: Build on MacOS with native Clang - os: osx compiler: clang - env: T="MacOS Clang" V=1 CONFIGURE="--with-libzstd-from-internet --with-libb2-from-internet" ENABLE_CACHE_CLEANUP_TESTS=1 + env: T="MacOS Clang" VERBOSE=1 CMAKE_PARAMS="-DUSE_LIBZSTD_FROM_INTERNET=ON -DUSE_LIBB2_FROM_INTERNET=ON" ENABLE_CACHE_CLEANUP_TESTS=1 # Job 8: Run Clang's undefined behavior sanitizer - os: linux compiler: clang - env: T="Clang UB sanitizer" V=1 CFLAGS="-fsanitize=undefined" CXXFLAGS="-fsanitize=undefined" LDFLAGS="-fsanitize=undefined" ASAN_OPTIONS="detect_leaks=0" + env: T="Clang UB sanitizer" VERBOSE=1 CMAKE_PARAMS="-DENABLE_SANITIZER_UNDEFINED_BEHAVIOR=ON" ASAN_OPTIONS="detect_leaks=0" addons: apt: packages: @@ -95,7 +89,7 @@ matrix: # Job 9: Run Clang's address sanitizer - os: linux compiler: clang - env: T="Clang address sanitizer" V=1 CFLAGS="-fsanitize=address -g" CXXFLAGS="-fsanitize=address -g" LDFLAGS="-fsanitize=address" ASAN_OPTIONS="detect_leaks=0" + env: T="Clang address sanitizer" VERBOSE=1 CMAKE_PARAMS="-DENABLE_SANITIZER_ADDRESS=ON" ASAN_OPTIONS="detect_leaks=0" addons: apt: packages: @@ -106,7 +100,7 @@ matrix: # Job 10: Run Clang's static analyzer - os: linux compiler: clang - env: T="Clang static analyzer" V=1 PATH="/usr/bin:$PATH" SCAN_BUILD=scan-build-7 TEST=analyze + env: T="Clang static analyzer" VERBOSE=1 PATH="/usr/bin:$PATH" CMAKE_PREFIX=scan-build RUN_TESTS=0 addons: apt: packages: @@ -115,19 +109,29 @@ matrix: # Job 11: Run Clang-Tidy - os: linux - env: T="Clang-Tidy" TEST=tidy V=1 PATH="/usr/bin:$PATH" NO_COMPILE=1 + compiler: clang + env: T="Clang-Tidy" VERBOSE=1 CMAKE_PARAMS="-DENABLE_CLANG_TIDY=ON" RUN_TESTS=0 + addons: + apt: + packages: + - libzstd1-dev + - libb2-dev + + # Job 12: Run Clang-Format amd CMake-Format check mode + - os: linux + compiler: clang + env: T="Clang-Format" VERBOSE=1 BUILDEXTRAFLAGS="--target check_format" RUN_TESTS=0 addons: apt: packages: - - elfutils - libzstd1-dev - libb2-dev before_install: - - pip install --user compiledb + - pip install --user cmake_format - # Job 12: Run Clang-Format + # Job 13: Build binary package, extract it out of source, run tests. - os: linux - env: T="Clang-Format" V=1 PATH="/usr/bin:$PATH" NO_COMPILE=1 TEST=check_format + env: T="Build binary and verify" VERBOSE=1 SPECIAL=build_and_verify_package addons: apt: packages: @@ -135,27 +139,60 @@ matrix: - libzstd1-dev - libb2-dev - # New jobs go here until they are established for some weeks - allow_failures: + # Job 14: Build source package, extract it out of source, run tests. + - os: linux + env: T="Build source package and verify" VERBOSE=1 SPECIAL=build_and_verify_package_source + addons: + apt: + packages: + - elfutils + - libzstd1-dev + - libb2-dev - # Job 11: Clang-Tidy + # Job 15: Build documentation - os: linux - env: T="Clang-Tidy" V=1 PATH="/usr/bin:$PATH" NO_COMPILE=1 TEST=tidy + env: T="Build documentation" VERBOSE=1 BUILDEXTRAFLAGS="--target documentation" RUN_TESTS=0 addons: apt: packages: - elfutils - libzstd1-dev - libb2-dev - before_install: - - pip install --user compiledb + - asciidoc - # Job 12: Clang-Format + # Job 16: Build manpage - os: linux - env: T="Clang-Format" V=1 PATH="/usr/bin:$PATH" NO_COMPILE=1 TEST=check_format + env: T="Build manpage" VERBOSE=1 BUILDEXTRAFLAGS="--target manpage" RUN_TESTS=0 addons: apt: packages: - elfutils - libzstd1-dev - libb2-dev + - asciidoc + - xsltproc + + # New jobs go here until they are established for some weeks + allow_failures: + + # Job 11: Run Clang-Tidy + - os: linux + compiler: clang + env: T="Clang-Tidy" VERBOSE=1 CMAKE_PARAMS="-DENABLE_CLANG_TIDY=ON" RUN_TESTS=0 + addons: + apt: + packages: + - libzstd1-dev + - libb2-dev + + # Job 12: Run Clang-Format amd CMake-Format check mode + - os: linux + compiler: clang + env: T="Clang-Format" VERBOSE=1 BUILDEXTRAFLAGS="--target check_format" RUN_TESTS=0 + addons: + apt: + packages: + - libzstd1-dev + - libb2-dev + before_install: + - pip install --user cmake_format diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..c124fd4a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,141 @@ +# Building upon same version as llvm. Let's assume they did their homework and +# it's a good version. Compare: +# ~~~ +# https://repology.org/badge/vertical-allrepos/cmake.svg?minversion=3.4.3 +# ~~~ +cmake_minimum_required(VERSION 3.4.3) + +project(ccache LANGUAGES C CXX) +set(CMAKE_PROJECT_DESCRIPTION "a fast C/C++ compiler cache") + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED YES) +set(CMAKE_CXX_EXTENSIONS NO) + +set(CMAKE_C_STANDARD 99) +set(CMAKE_C_STANDARD_REQUIRED YES) +set(CMAKE_C_EXTENSIONS NO) + +# Always export compile_commands.json as it's useful for so many tools. +set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + +# +# Settings +# +include(StandardSettings) +include(StandardWarnings) +include(DefaultBuildType) + +# +# Configuration +# +include(GenerateConfigurationFile) +include(GenerateVersionFile) + +# +# 3rd party +# +option(USE_LIBZSTD_FROM_INTERNET "Download and use libzstd from the Internet" + OFF) +find_package(zstd 1.1.2 REQUIRED) + +option(USE_LIBB2_FROM_INTERNET "Download and use libb2 from the Internet" OFF) +find_package(libb2 0.98 REQUIRED) + +# +# special flags +# +# Note: cppcheck will scan everything after this point. Zstd and libb2 are above +# so they don't get scanned. +# +include(CodeAnalysis) +option(ENABLE_TRACING "Enable possibility to use internal ccache tracing" OFF) + +# +# ccache_lib +# +add_subdirectory(src) + +# +# ccache +# +add_executable(ccache src/main.cpp) +target_link_libraries(ccache PRIVATE standard_settings standard_warnings + ccache_lib) + +add_subdirectory(doc) + +# +# installation +# +include(GNUInstallDirs) +install(TARGETS ccache DESTINATION ${CMAKE_INSTALL_BINDIR}) + +# before adding documentation to package run misc/update_authors.sh +# +# install(TARGETS documentation DESTINATION ${CMAKE_INSTALL_DOCDIR}) + +# +# packaging +# +include(CCachePackConfig) + +# +# test and unittest +# +option(ENABLE_TESTING "Enable Tests" ON) +if(ENABLE_TESTING) + enable_testing() + add_subdirectory(unittest) + add_subdirectory(test) + + # Note: VERSION_GREATER_EQUAL requires cmake 3.17 + if(NOT ${CMAKE_VERSION} VERSION_LESS "3.17") + list(APPEND CMAKE_CTEST_ARGUMENTS "--output-on-failure") + endif() + + # Add 'check' target which will compile & run tests + if(CMAKE_CONFIGURATION_TYPES) + add_custom_target( + check + COMMAND ${CMAKE_CTEST_COMMAND} --force-new-ctest-process + --output-on-failure --build-config "$<CONFIGURATION>" + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + DEPENDS ccache unittest) + else() + add_custom_target( + check + COMMAND ${CMAKE_CTEST_COMMAND} --force-new-ctest-process + --output-on-failure + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + DEPENDS ccache unittest) + endif() +endif() + +# +# Special formatting targets. You can also run the scripts without cmake/make! +# + +find_program(CLANG_FORMAT_EXE NAMES "clang-format" + DOC "Path to clang-format executable") +mark_as_advanced(CLANG_FORMAT_EXE) # don't show in ccmake + +if(NOT CLANG_FORMAT_EXE) + message(WARNING "clang-format not found.") +else() + add_custom_target( + format + COMMAND misc/format.sh + COMMENT "Formatting code" + USES_TERMINAL + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + + add_custom_target( + check_format + COMMAND misc/check_format.sh + COMMENT "Checking correctly formatted code" + USES_TERMINAL + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) +endif() diff --git a/Makefile.in b/Makefile.in deleted file mode 100644 index 2b2bb9e4..00000000 --- a/Makefile.in +++ /dev/null @@ -1,219 +0,0 @@ -srcdir = @srcdir@ -builddir = @builddir@ -VPATH = @srcdir@ - -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -mandir = @mandir@ -datarootdir = @datarootdir@ -sysconfdir = @sysconfdir@ -installcmd = @INSTALL@ - -BASH = @BASH@ -CC = @CC@ -CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXFLAGS = @CXXFLAGS@ -EXEEXT = @EXEEXT@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ - -all_cflags = $(CFLAGS) -all_cxxflags = $(CXXFLAGS) -all_cppflags = @DEFS@ -DSYSCONFDIR=$(sysconfdir) -I. -I$(srcdir)/src -I$(builddir)/unittest $(CPPFLAGS) -extra_libs = @extra_libs@ - -v_at_0 = yes -v_at_ = $(v_at_0) -quiet := $(v_at_$(V)) -Q=$(if $(quiet),@) - -non_third_party_sources = \ - src/Args.cpp \ - src/AtomicFile.cpp \ - src/CacheEntryReader.cpp \ - src/CacheEntryWriter.cpp \ - src/CacheFile.cpp \ - src/Compression.cpp \ - src/Compressor.cpp \ - src/Config.cpp \ - src/Context.cpp \ - src/Counters.cpp \ - src/Decompressor.cpp \ - src/InodeCache.cpp \ - src/Lockfile.cpp \ - src/MiniTrace.cpp \ - src/NullCompressor.cpp \ - src/NullDecompressor.cpp \ - src/ProgressBar.cpp \ - src/SignalHandler.cpp \ - src/Stat.cpp \ - src/ThreadPool.cpp \ - src/Util.cpp \ - src/ZstdCompressor.cpp \ - src/ZstdDecompressor.cpp \ - src/argprocessing.cpp \ - src/ccache.cpp \ - src/cleanup.cpp \ - src/compopt.cpp \ - src/compress.cpp \ - src/execute.cpp \ - src/hash.cpp \ - src/hashutil.cpp \ - src/language.cpp \ - src/legacy_util.cpp \ - src/logging.cpp \ - src/manifest.cpp \ - src/result.cpp \ - src/stats.cpp \ - src/win32compat.cpp -generated_sources = \ - src/version.cpp -third_party_sources = \ - src/third_party/format.cpp \ - src/third_party/getopt_long.c \ - src/third_party/xxhash.c -extra_sources = @extra_sources@ -base_sources = $(non_third_party_sources) $(generated_sources) $(third_party_sources) $(extra_sources) -base_objs = $(patsubst %.c, %.o, $(patsubst %.cpp, %.o, $(base_sources))) - -non_third_party_objs = $(patsubst %.c, %.o, $(patsubst %.cpp, %.o, $(non_third_party_sources))) - -ccache_sources = src/main.cpp $(base_sources) -ccache_objs = $(patsubst %.c, %.o, $(patsubst %.cpp, %.o, $(ccache_sources))) - -test_suites += unittest/test_Args.cpp -test_suites += unittest/test_AtomicFile.cpp -test_suites += unittest/test_Checksum.cpp -test_suites += unittest/test_Compression.cpp -test_suites += unittest/test_Config.cpp -test_suites += unittest/test_FormatNonstdStringView.cpp -test_suites += unittest/test_InodeCache.cpp -test_suites += unittest/test_Lockfile.cpp -test_suites += unittest/test_NullCompression.cpp -test_suites += unittest/test_Stat.cpp -test_suites += unittest/test_Util.cpp -test_suites += unittest/test_ZstdCompression.cpp -test_suites += unittest/test_argprocessing.cpp -test_suites += unittest/test_compopt.cpp -test_suites += unittest/test_hash.cpp -test_suites += unittest/test_hashutil.cpp -test_suites += unittest/test_legacy_util.cpp - -test_sources += unittest/TestUtil.cpp -test_sources += unittest/catch2_tests.cpp -test_sources += unittest/main.cpp -test_sources += $(test_suites) -test_objs = $(test_sources:.cpp=.o) - -all_sources = $(ccache_sources) $(test_sources) -all_objs = $(ccache_objs) $(test_objs) - -files_to_clean = \ - $(all_objs) \ - ccache$(EXEEXT) \ - src/*~ \ - testdir.* \ - unittest/run$(EXEEXT) \ - *~ - -files_to_distclean = Makefile config.h config.log config.status - -.PHONY: all -all: ccache$(EXEEXT) - -ccache$(EXEEXT): $(ccache_objs) $(extra_libs) - $(if $(quiet),@echo " LD $@") - $(Q)$(CXX) -o $@ $(ccache_objs) $(LDFLAGS) $(extra_libs) $(LIBS) - -ccache.1: doc/ccache.1 - $(if $(quiet),@echo " CP $@") - $(Q)cp $< $@ - -.PHONY: install -install: ccache$(EXEEXT) @disable_man@ccache.1 - $(if $(quiet),@echo " INSTALL ccache$(EXEEXT)") - $(Q)$(installcmd) -d $(DESTDIR)$(bindir) - $(Q)$(installcmd) -m 755 ccache$(EXEEXT) $(DESTDIR)$(bindir) -@disable_man@ $(if $(quiet),@echo " INSTALL ccache.1") -@disable_man@ $(Q)$(installcmd) -d $(DESTDIR)$(mandir)/man1 -@disable_man@ $(Q)-$(installcmd) -m 644 ccache.1 $(DESTDIR)$(mandir)/man1/ - -.PHONY: clean -clean: - rm -rf $(files_to_clean) - [ ! -f src/third_party/zstd/Makefile ] || $(MAKE) -C src/third_party/zstd/lib clean - [ ! -f src/third_party/libb2/Makefile ] || $(MAKE) -C src/third_party/libb2 clean - -$(non_third_party_objs) $(test_objs): CFLAGS += @extra_warnings@ -$(non_third_party_objs) $(test_objs): CXXFLAGS += @extra_warnings@ - -libzstd_options = \ - ZSTD_LEGACY_SUPPORT=0 \ - ZSTD_LIB_DEPRECATED=0 \ - ZSTD_LIB_DICTBUILDER=0 - -src/third_party/zstd/lib/libzstd.a: - $(MAKE) -C src/third_party/zstd/lib libzstd.a $(libzstd_options) CC="$(CC)" - -libb2_options = \ - --disable-shared \ - --enable-static - -@disable_cross@# cross compilation -@disable_cross@libb2_options += \ -@disable_cross@ --build=@build_alias@ \ -@disable_cross@ --host=@host_alias@ \ -@disable_cross@ --target=@target_alias@ \ -@disable_cross@ --disable-openmp \ -@disable_cross@ --disable-fat \ -@disable_cross@ --disable-native - -src/third_party/libb2/src/.libs/libb2.a: - cd src/third_party/libb2 && ./configure ${libb2_options} CC="$(CC)" - $(MAKE) -C src/third_party/libb2 CC="$(CC)" \ -@disable_cross@ CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" - -.PHONY: performance -performance: ccache$(EXEEXT) - $(srcdir)/misc/performance --ccache ccache$(EXEEXT) $(CXX) $(all_cppflags) $(all_cxxflags) $(srcdir)/src/ccache.cpp - -.PHONY: test -test: ccache$(EXEEXT) unittest/run$(EXEEXT) - $(if $(quiet),@echo " TEST unittest/run$(EXEEXT)") - $(Q)unittest/run$(EXEEXT) - $(if $(quiet),@echo " TEST $(srcdir)/test/run") - $(Q)CC='$(CC)' $(BASH) $(srcdir)/test/run - -.PHONY: unittest -unittest: unittest/run$(EXEEXT) - $(if $(quiet),@echo " TEST $@") - $(Q)unittest/run$(EXEEXT) - -unittest/run$(EXEEXT): $(base_objs) $(test_objs) $(extra_libs) - $(if $(quiet),@echo " LD $@") - $(Q)$(CXX) -o $@ $(base_objs) $(test_objs) $(LDFLAGS) $(extra_libs) $(LIBS) - -.PHONY: check -check: test - -.PHONY: distclean -distclean: clean - rm -rf $(files_to_distclean) - -.PHONY: installcheck -installcheck: ccache$(EXEEXT) unittest/run$(EXEEXT) - unittest/run$(EXEEXT) - CCACHE=$(bindir)/ccache CC='$(CC)' $(BASH) $(srcdir)/test/run - -.c.o: - $(if $(quiet),@echo " CC $@") - $(Q)$(CC) $(all_cppflags) $(all_cflags) -c -o $@ $< - -.cpp.o: - $(if $(quiet),@echo " CXX $@") - $(Q)$(CXX) $(all_cppflags) $(all_cxxflags) -c -o $@ $< - -@include_dev_mk@ diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index da120f94..00000000 --- a/autogen.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -set -e - -if [ -f dev_mode_disabled ]; then - cat <<EOF >&2 -Error: It looks like you are building ccache from a release archive. If so, -there is no need to run autogen.sh. See INSTALL.md for further instructions. - -If you do want to the enable the development mode, delete the file -dev_mode_disabled first, but it's probably a better idea to work with the -proper ccache Git repository directly as described on -<https://ccache.dev/repo.html>. -EOF - exit 1 -fi - -autoheader -f -autoconf -f -echo "Now run ./configure and make" diff --git a/buildenv/debian-10-buster/Dockerfile b/buildenv/debian-10-buster/Dockerfile index ed108260..01656620 100644 --- a/buildenv/debian-10-buster/Dockerfile +++ b/buildenv/debian-10-buster/Dockerfile @@ -1,9 +1,15 @@ FROM debian:10 +# Seperate layer because this is required no matter what +RUN apt-get update && apt-get install -y --no-install-recommends build-essential \ + && rm -rf /var/lib/apt/lists/* + +# All the rest RUN apt-get update && apt-get install -y --no-install-recommends \ asciidoc \ bash \ build-essential \ + ccache \ clang \ cmake \ elfutils \ @@ -12,3 +18,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libzstd-dev \ xsltproc \ && rm -rf /var/lib/apt/lists/* + +# redirect all compilers to ccache +RUN for t in gcc g++ cc c++ clang clang++; do ln -vs /usr/bin/ccache /usr/local/bin/$t; done diff --git a/buildenv/debian-9-stretch/Dockerfile b/buildenv/debian-9-stretch/Dockerfile index 4cbb043e..495770f7 100644 --- a/buildenv/debian-9-stretch/Dockerfile +++ b/buildenv/debian-9-stretch/Dockerfile @@ -1,9 +1,15 @@ FROM debian:9 +# Seperate layer because this is required no matter what +RUN apt-get update && apt-get install -y --no-install-recommends build-essential \ + && rm -rf /var/lib/apt/lists/* + +# All the rest RUN apt-get update && apt-get install -y --no-install-recommends \ asciidoc \ bash \ build-essential \ + ccache \ clang \ cmake \ elfutils \ @@ -12,3 +18,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libzstd-dev \ xsltproc \ && rm -rf /var/lib/apt/lists/* + +# redirect all compilers to ccache +RUN for t in gcc g++ cc c++ clang clang++; do ln -vs /usr/bin/ccache /usr/local/bin/$t; done diff --git a/buildenv/ubuntu-14-trusty/Dockerfile b/buildenv/ubuntu-14-trusty/Dockerfile new file mode 100644 index 00000000..7e7edf03 --- /dev/null +++ b/buildenv/ubuntu-14-trusty/Dockerfile @@ -0,0 +1,25 @@ +FROM ubuntu:trusty + +# Seperate layer because this is required no matter what +RUN apt-get update && apt-get install -y --no-install-recommends build-essential \ + && rm -rf /var/lib/apt/lists/* + +RUN apt-get update && apt-get install -y --no-install-recommends \ + asciidoc \ + bash \ + ccache \ + clang \ + curl \ + elfutils \ + gcc-multilib \ + wget \ + xsltproc \ + && rm -rf /var/lib/apt/lists/* + +# redirect all compilers to ccache +RUN for t in gcc g++ cc c++ clang clang++; do ln -vs /usr/bin/ccache /usr/local/bin/$t; done + +# Preinstalled cmake it too old (2.8.12.2) +RUN curl -sSL https://cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz | sudo tar -xzC /opt +RUN cp -a /opt/cmake-3.5.2-Linux-x86_64/bin /usr/local +RUN cp -a /opt/cmake-3.5.2-Linux-x86_64/share /usr/local diff --git a/buildenv/ubuntu-16-xenial/Dockerfile b/buildenv/ubuntu-16-xenial/Dockerfile index 1a3f5f03..a892c495 100644 --- a/buildenv/ubuntu-16-xenial/Dockerfile +++ b/buildenv/ubuntu-16-xenial/Dockerfile @@ -1,9 +1,13 @@ FROM ubuntu:xenial +# Seperate layer because this is required no matter what +RUN apt-get update && apt-get install -y --no-install-recommends build-essential \ + && rm -rf /var/lib/apt/lists/* + RUN apt-get update && apt-get install -y --no-install-recommends \ asciidoc \ bash \ - build-essential \ + ccache \ clang \ cmake \ elfutils \ @@ -12,3 +16,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libzstd1-dev \ xsltproc \ && rm -rf /var/lib/apt/lists/* + +# redirect all compilers to ccache +RUN for t in gcc g++ cc c++ clang clang++; do ln -vs /usr/bin/ccache /usr/local/bin/$t; done diff --git a/buildenv/ubuntu-20-focal/Dockerfile b/buildenv/ubuntu-20-focal/Dockerfile new file mode 100644 index 00000000..96383cc2 --- /dev/null +++ b/buildenv/ubuntu-20-focal/Dockerfile @@ -0,0 +1,22 @@ +FROM ubuntu:focal + +# Seperate layer because this is required no matter what +RUN apt-get update && apt-get install -y --no-install-recommends build-essential \ + && rm -rf /var/lib/apt/lists/* + +# noninteractive: do not set up timezone settings. +RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \ + asciidoc \ + bash \ + ccache \ + clang \ + cmake \ + elfutils \ + gcc-multilib \ + libb2-dev \ + #libzstd1-dev \ not available?! + xsltproc \ + && rm -rf /var/lib/apt/lists/* + +# redirect all compilers to ccache +RUN for t in gcc g++ cc c++ clang clang++; do ln -vs /usr/bin/ccache /usr/local/bin/$t; done diff --git a/ci/build.sh b/ci/build.sh new file mode 100755 index 00000000..1d334e7d --- /dev/null +++ b/ci/build.sh @@ -0,0 +1,15 @@ +#!/bin/sh -ex +# This script is used by travis.yml and docker.sh + +if [ -n "${SPECIAL}" ]; then + sh ci/${SPECIAL}.sh +else + mkdir -p ${BUILDDIR:-build} + cd ${BUILDDIR:-build} + ${CMAKE_PREFIX:-} cmake ${CCACHE_LOC:-..} ${CMAKE_PARAMS:-} + # 4 threads seems a reasonable default for Travis + ${CMAKE_PREFIX:-} cmake --build . ${BUILDEXTRAFLAGS:-} -- -j4 + # Warning: Rare random failures when running with j4. + test "${RUN_TESTS:-1}" -eq "1" && ctest --output-on-failure -j1 +fi +exit 0 diff --git a/ci/build_and_verify_package.sh b/ci/build_and_verify_package.sh new file mode 100755 index 00000000..bdf6acd8 --- /dev/null +++ b/ci/build_and_verify_package.sh @@ -0,0 +1,20 @@ +#!/bin/sh -ex + +echo "Warning: Binary package support is rather experimental\n" + +mkdir -p build_package_dir_test +cd build_package_dir_test +rm -rf * +cmake .. +cmake --build . --target package + +# get out of git directory just to be sure +tmp_dir=$(mktemp -d) + +tar -xzf ccache-binary.tar.gz -C $tmp_dir + +CCACHE=$tmp_dir/ccache-binary/bin/ccache ../test/run + +rm -rf $tmp_dir + +echo "\n\nbinary package is fine and can be used!\n\n" diff --git a/ci/build_and_verify_package_source.sh b/ci/build_and_verify_package_source.sh new file mode 100755 index 00000000..221f813d --- /dev/null +++ b/ci/build_and_verify_package_source.sh @@ -0,0 +1,26 @@ +#!/bin/sh -ex + +echo "Warning: Source package support is rather experimental\n" + +mkdir -p build_package_source_dir_test +cd build_package_source_dir_test +rm -rf * +cmake .. +cmake --build . --target package_source + +# get out of git directory +# Unfortunately this random name will prevent ccache from caching results... +# ToDo: use '../../temp' instead? +tmp_dir=$(mktemp -d) + +tar -xzf ccache-src.tar.gz -C $tmp_dir +cd $tmp_dir + +cmake . +cmake --build . -- -j4 +ctest --output-on-failure -j4 + +rm -rf $tmp_dir + +echo "\n\nsource package is fine and can be used!\n\n" + diff --git a/cmake/CCachePackConfig.cmake b/cmake/CCachePackConfig.cmake new file mode 100644 index 00000000..9a69eecc --- /dev/null +++ b/cmake/CCachePackConfig.cmake @@ -0,0 +1,41 @@ +# Note: this is part of CMakeLists.txt file, not to be confused with +# CPackConfig.cmake + +find_program(NINJA_EXE NAMES "ninja" DOC "Path to ninja executable") +mark_as_advanced(NINJA_EXE) # don't show in ccmake +if(NINJA_EXE) + set(CPACK_CMAKE_GENERATOR "Ninja") +else() + set(CPACK_CMAKE_GENERATOR "Unix Makefiles") +endif() + +# make obvious which version is used +set(CMAKE_DEBUG_POSTFIX "-d") + +if(${CMAKE_VERSION} VERSION_LESS "3.9") + set(CPACK_PACKAGE_DESCRIPTION "${CMAKE_PROJECT_DESCRIPTION}") +endif() + +# from GenerateVersionFile.cmake +set(CPACK_PACKAGE_VERSION ${VERSION}) + +set(CPACK_VERBATIM_VARIABLES ON) + +if(WIN32) + set(CPACK_GENERATOR "ZIP") +else() + set(CPACK_GENERATOR "TGZ") +endif() + +set(CPACK_SOURCE_GENERATOR "TGZ") + +# Default includes build directory, so improve it: Include buildenv, but exclude +# other build directories like /build/, /build-* and /build_* +list(APPEND CPACK_SOURCE_IGNORE_FILES "^${CMAKE_SOURCE_DIR}/\\.git") +list(APPEND CPACK_SOURCE_IGNORE_FILES "^${CMAKE_SOURCE_DIR}/build[\\-_/]") +list(APPEND CPACK_SOURCE_IGNORE_FILES "^${CMAKE_BINARY_DIR}") + +set(CPACK_PACKAGE_FILE_NAME "ccache-binary") +set(CPACK_SOURCE_PACKAGE_FILE_NAME "ccache-src") + +include(CPack) diff --git a/cmake/CodeAnalysis.cmake b/cmake/CodeAnalysis.cmake new file mode 100644 index 00000000..17eedf51 --- /dev/null +++ b/cmake/CodeAnalysis.cmake @@ -0,0 +1,40 @@ +option(ENABLE_CPPCHECK "Enable static analysis with cppcheck" OFF) +if(ENABLE_CPPCHECK) + if(${CMAKE_VERSION} VERSION_LESS "3.10") + message(WARNING "CppCheck requires cmake 3.10") + else() + find_program(CPPCHECK_EXE cppcheck) + mark_as_advanced(CPPCHECK_EXE) # don't show in ccmake + if(CPPCHECK_EXE) + # cmake-format: off + set(CMAKE_CXX_CPPCHECK + ${CPPCHECK_EXE} + --suppressions-list=${CMAKE_SOURCE_DIR}/misc/cppcheck-suppressions.txt + --inline-suppr + -q + --enable=all + --force + --std=c++11 + -I ${CMAKE_SOURCE_DIR} + --template="cppcheck: warning: {id}:{file}:{line}: {message}" + -i src/third_party) + # cmake-format: on + else() + message(WARNING "cppcheck requested but executable not found") + endif() + endif() +endif() + +option(ENABLE_CLANG_TIDY "Enable static analysis with clang-tidy" OFF) +if(ENABLE_CLANG_TIDY) + if(${CMAKE_VERSION} VERSION_LESS "3.6") + message(WARNING "clang-tidy requires cmake 3.6") + else() + find_program(CLANGTIDY clang-tidy) + if(CLANGTIDY) + set(CMAKE_CXX_CLANG_TIDY ${CLANGTIDY}) + else() + message(SEND_ERROR "clang-tidy requested but executable not found") + endif() + endif() +endif() diff --git a/cmake/DefaultBuildType.cmake b/cmake/DefaultBuildType.cmake new file mode 100644 index 00000000..fb7a387a --- /dev/null +++ b/cmake/DefaultBuildType.cmake @@ -0,0 +1,19 @@ +# Set a default build type if none was specified + +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + # Default to Release for zip builds and Debug for git builds + if(EXISTS "${CMAKE_SOURCE_DIR}/.git") + set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build." FORCE) + else() + set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." + FORCE) + endif() + message( + STATUS + "Setting CMAKE_BUILD_TYPE to '${CMAKE_BUILD_TYPE}' as none was specified." + ) + + # Set the possible values of build type for ccmake + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" + "MinSizeRel" "RelWithDebInfo") +endif() diff --git a/cmake/Findlibb2.cmake b/cmake/Findlibb2.cmake new file mode 100644 index 00000000..62861644 --- /dev/null +++ b/cmake/Findlibb2.cmake @@ -0,0 +1,105 @@ +if(libb2_FOUND) + return() +endif() + +if(USE_LIBB2_FROM_INTERNET) + set(libb2_version ${libb2_FIND_VERSION}) + set(libb2_url + https://github.com/BLAKE2/libb2/releases/download/v${libb2_version}/libb2-${libb2_version}.tar.gz + ) + + set(libb2_dir ${CMAKE_BINARY_DIR}/libb2-${libb2_version}) + set(libb2_build ${CMAKE_BINARY_DIR}/libb2-build) + + if(NOT EXISTS "${libb2_dir}.tar.gz") + file(DOWNLOAD "${libb2_url}" "${libb2_dir}.tar.gz") + endif() + execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${libb2_dir}.tar.gz" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}") + + file( + WRITE "${libb2_dir}/src/config.h.cmake.in" + [=[ + /* Define if you have the `explicit_bzero' function. */ + #cmakedefine HAVE_EXPLICIT_BZERO + /* Define if you have the `explicit_memset' function. */ + #cmakedefine HAVE_EXPLICIT_MEMSET + /* Define if you have the `memset' function. */ + #cmakedefine HAVE_MEMSET + /* Define if you have the `memset_s' function. */ + #cmakedefine HAVE_MEMSET_S + ]=]) + + file( + WRITE "${libb2_dir}/src/CMakeLists.txt" + [=[ + project(libb2 C) + + include(CheckFunctionExists) + foreach(func IN ITEMS + explicit_bzero + explicit_memset + memset + memset_s + ) + string(TOUPPER ${func} func_var) + set(func_var HAVE_${func_var}) + check_function_exists(${func} ${func_var}) + endforeach() + + configure_file(config.h.cmake.in config.h) + set(CMAKE_INCLUDE_CURRENT_DIR ON) + + add_library(libblake2b_ref STATIC blake2b-ref.c blake2s-ref.c) + target_compile_definitions(libblake2b_ref PRIVATE SUFFIX=_ref) + + function(add_libblake2b name suffix) + add_library(${name} STATIC blake2b.c blake2s.c) + target_compile_definitions(${name} PRIVATE ${suffix}) + target_compile_options(${name} PRIVATE ${ARGN}) + endfunction() + + add_libblake2b(libblake2b_sse2 SUFFIX=_sse2 -msse2) + add_libblake2b(libblake2b_ssse3 SUFFIX=_ssse3 -msse2 -mssse3) + add_libblake2b(libblake2b_sse41 SUFFIX=_sse41 -msse2 -mssse3 -msse4.1) + add_libblake2b(libblake2s_avx SUFFIX=_avx -msse2 -mssse3 -msse4.1 -mavx) + add_libblake2b(libblake2b_xop SUFFIX=_xop -msse2 -mssse3 -msse4.1 -mavx -mxop) + + add_library(libb2 STATIC blake2-dispatch.c) + target_link_libraries(libb2 + PUBLIC + libblake2b_ref libblake2b_sse2 libblake2b_ssse3 + libblake2b_sse41 libblake2s_avx libblake2b_xop + ) + ]=]) + add_subdirectory("${libb2_dir}/src" "${libb2_build}" EXCLUDE_FROM_ALL) + + add_library(libb2::libb2 ALIAS libb2) + set_target_properties(libb2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${libb2_dir}/src") + + set(libb2_FOUND TRUE) +else() + find_library(LIBB2_LIBRARY NAMES b2 libb2) + find_path(LIBB2_INCLUDE_DIR blake2.h) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args( + libb2 "please install libb2 or use -DUSE_LIBB2_FROM_INTERNET=ON" + LIBB2_INCLUDE_DIR LIBB2_LIBRARY) + mark_as_advanced(LIBB2_INCLUDE_DIR LIBB2_LIBRARY) + + add_library(libb2::libb2 UNKNOWN IMPORTED) + set_target_properties( + libb2::libb2 + PROPERTIES IMPORTED_LOCATION "${LIBB2_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${LIBB2_INCLUDE_DIR}") +endif() + +include(FeatureSummary) +# cmake-format: off +# (behaviour change in cmake-format 0.6.10) +set_package_properties( + libb2 PROPERTIES URL "http://blake2.net/" + DESCRIPTION "C library providing BLAKE2b, BLAKE2s, BLAKE2bp, BLAKE2sp") +# cmake-format: on diff --git a/cmake/Findzstd.cmake b/cmake/Findzstd.cmake new file mode 100644 index 00000000..a0095090 --- /dev/null +++ b/cmake/Findzstd.cmake @@ -0,0 +1,52 @@ +if(zstd_FOUND) + return() +endif() + +if(USE_LIBZSTD_FROM_INTERNET) + # Although ${zstd_FIND_VERSION} was requested, let's download a newer version. + # Note: structure has changed in 1.3.0, download supports only 1.3.0 and + # newer. + set(zstd_version "1.4.4") + set(zstd_url https://github.com/facebook/zstd/archive/v${zstd_version}.tar.gz) + + set(zstd_dir ${CMAKE_BINARY_DIR}/zstd-${zstd_version}) + set(zstd_build ${CMAKE_BINARY_DIR}/zstd-build) + + if(NOT EXISTS "${zstd_dir}.tar.gz") + file(DOWNLOAD "${zstd_url}" "${zstd_dir}.tar.gz") + endif() + + execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${zstd_dir}.tar.gz" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}") + + set(ZSTD_BUILD_SHARED OFF) + add_subdirectory("${zstd_dir}/build/cmake" "${zstd_build}" EXCLUDE_FROM_ALL) + + add_library(ZSTD::ZSTD ALIAS libzstd_static) + set_target_properties(libzstd_static PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${zstd_dir}/lib") + + set(zstd_FOUND TRUE) +else() + find_library(ZSTD_LIBRARY zstd) + find_path(ZSTD_INCLUDE_DIR zstd.h) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args( + zstd "please install libzstd or use -DUSE_LIBZSTD_FROM_INTERNET=ON" + ZSTD_INCLUDE_DIR ZSTD_LIBRARY) + mark_as_advanced(ZSTD_INCLUDE_DIR ZSTD_LIBRARY) + + add_library(ZSTD::ZSTD UNKNOWN IMPORTED) + set_target_properties( + ZSTD::ZSTD PROPERTIES IMPORTED_LOCATION "${ZSTD_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${ZSTD_INCLUDE_DIR}") +endif() + +include(FeatureSummary) +# cmake-format: off +# (behaviour change in cmake-format 0.6.10) +set_package_properties( + zstd PROPERTIES URL "https://facebook.github.io/zstd" + DESCRIPTION "Zstandard - Fast real-time compression algorithm") +# cmake-format: on diff --git a/cmake/GenerateConfigurationFile.cmake b/cmake/GenerateConfigurationFile.cmake new file mode 100644 index 00000000..b698c4fc --- /dev/null +++ b/cmake/GenerateConfigurationFile.cmake @@ -0,0 +1,71 @@ +include(CheckIncludeFile) +set(include_files + linux/fs.h + pwd.h + sys/clonefile.h + sys/ioctl.h + sys/mman.h + sys/time.h + sys/wait.h + syslog.h + termios.h) +foreach(include_file IN ITEMS ${include_files}) + string(TOUPPER ${include_file} include_var) + string(REGEX REPLACE "[/.]" "_" include_var ${include_var}) + set(include_var HAVE_${include_var}) + check_include_file(${include_file} ${include_var}) +endforeach() + +include(CheckFunctionExists) +set(functions + asctime_r + geteuid + GetFinalPathNameByHandleW + getopt_long + getpwuid + gettimeofday + localtime_r + mkstemp + posix_fallocate + realpath + setenv + strndup + syslog + unsetenv + utimes) +foreach(func IN ITEMS ${functions}) + string(TOUPPER ${func} func_var) + set(func_var HAVE_${func_var}) + check_function_exists(${func} ${func_var}) +endforeach() + +include(CheckStructHasMember) +check_struct_has_member("struct stat" st_ctim sys/stat.h + HAVE_STRUCT_STAT_ST_CTIM) +check_struct_has_member("struct stat" st_mtim sys/stat.h + HAVE_STRUCT_STAT_ST_MTIM) +check_struct_has_member("struct statfs" f_fstypename sys/mount.h + HAVE_STRUCT_STATFS_F_FSTYPENAME) + +include(CheckCXXCompilerFlag) +check_cxx_compiler_flag(-mavx2 HAVE_AVX2) + +list(APPEND CMAKE_REQUIRED_LIBRARIES ws2_32) +list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES ws2_32) + +include(CheckTypeSize) +check_type_size("long long" HAVE_LONG_LONG) + +if(WIN32) + set(_WIN32_WINNT 0x0600) +endif() + +if(CMAKE_SYSTEM MATCHES "Darwin") + set(_DARWIN_C_SOURCE 1) +endif() + +# alias +set(MTR_ENABLED "${ENABLE_TRACING}") + +configure_file(${CMAKE_SOURCE_DIR}/cmake/config.h.in + ${CMAKE_BINARY_DIR}/config.h @ONLY) diff --git a/cmake/GenerateVersionFile.cmake b/cmake/GenerateVersionFile.cmake new file mode 100644 index 00000000..29d4e3b4 --- /dev/null +++ b/cmake/GenerateVersionFile.cmake @@ -0,0 +1,56 @@ +# Determines VERSION from git. See also VERSION_ERROR and VERSION_DIRTY. +function(get_version_from_git) + find_package(Git) + if(NOT GIT_FOUND) + message(STATUS "Git not found") + set(VERSION_ERROR TRUE PARENT_SCOPE) + set(VERSION_DIRTY TRUE PARENT_SCOPE) + set(VERSION "unknown" PARENT_SCOPE) + return() + endif() + + execute_process( + COMMAND git describe --exact-match + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE git_tag + ERROR_VARIABLE git_tag + RESULT_VARIABLE cmd_result + OUTPUT_STRIP_TRAILING_WHITESPACE) + + if(cmd_result EQUAL 0) + set(VERSION_ERROR FALSE PARENT_SCOPE) + set(VERSION_DIRTY FALSE PARENT_SCOPE) + set(VERSION ${git_tag} PARENT_SCOPE) + else() + execute_process( + COMMAND git rev-parse --abbrev-ref HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE git_branch OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE cmd_branch_result) + + execute_process( + COMMAND git rev-parse --short=8 HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE git_hash OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE cmd_hash_result) + + if(cmd_branch_result EQUAL 0 AND cmd_hash_result EQUAL 0) + set(VERSION_ERROR FALSE PARENT_SCOPE) + set(VERSION_DIRTY TRUE PARENT_SCOPE) + set(VERSION "${git_branch}.${git_hash}" PARENT_SCOPE) + else() + message(WARNING "Running git failed") + set(VERSION_ERROR TRUE PARENT_SCOPE) + set(VERSION_DIRTY TRUE PARENT_SCOPE) + set(VERSION "unknown" PARENT_SCOPE) + endif() + endif() +endfunction() + +get_version_from_git() +if(VERSION_ERROR) + message(STATUS "Not within git repository") +else() + configure_file(${CMAKE_SOURCE_DIR}/cmake/Version.cpp.in + ${CMAKE_SOURCE_DIR}/src/Version.cpp @ONLY) +endif() diff --git a/cmake/StandardSettings.cmake b/cmake/StandardSettings.cmake new file mode 100644 index 00000000..c28bd718 --- /dev/null +++ b/cmake/StandardSettings.cmake @@ -0,0 +1,47 @@ +# This file provides a special target 'standard_settings' which shall be linked +# privately by all other targets. + +add_library(standard_settings INTERFACE) + +# Not supported in cmake 3.4: target_compile_features(project_options INTERFACE +# c_std_11 cxx_std_11) + +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL + "Clang") + option(ENABLE_COVERAGE "Enable coverage reporting for gcc/clang" FALSE) + if(ENABLE_COVERAGE) + target_compile_options(standard_settings INTERFACE --coverage -O0 -g) + target_link_libraries(standard_settings INTERFACE --coverage) + endif() + + set(SANITIZERS "") + + option(ENABLE_SANITIZER_ADDRESS "Enable address sanitizer" FALSE) + if(ENABLE_SANITIZER_ADDRESS) + list(APPEND SANITIZERS "address") + endif() + + option(ENABLE_SANITIZER_MEMORY "Enable memory sanitizer" FALSE) + if(ENABLE_SANITIZER_MEMORY) + list(APPEND SANITIZERS "memory") + endif() + + option(ENABLE_SANITIZER_UNDEFINED_BEHAVIOR + "Enable undefined behavior sanitizer" FALSE) + if(ENABLE_SANITIZER_UNDEFINED_BEHAVIOR) + list(APPEND SANITIZERS "undefined") + endif() + + option(ENABLE_SANITIZER_THREAD "Enable thread sanitizer" FALSE) + if(ENABLE_SANITIZER_THREAD) + list(APPEND SANITIZERS "thread") + endif() + + if(SANITIZERS) + string(REPLACE ";" " " LIST_OF_SANITIZERS "${SANITIZERS}") + target_compile_options(standard_settings + INTERFACE -fsanitize=${LIST_OF_SANITIZERS}) + target_link_libraries(standard_settings + INTERFACE -fsanitize=${LIST_OF_SANITIZERS}) + endif() +endif() diff --git a/cmake/StandardWarnings.cmake b/cmake/StandardWarnings.cmake new file mode 100644 index 00000000..a2ac735f --- /dev/null +++ b/cmake/StandardWarnings.cmake @@ -0,0 +1,141 @@ +# This file provides a special target 'standard_warnings' which shall be linked +# privately by all product and test code, but not by third_party code. +add_library(standard_warnings INTERFACE) + +if(IS_DIRECTORY "${CMAKE_SOURCE_DIR}/.git" OR DEFINED ENV{"CI"}) + # Enabled by default for builds based on git as this will prevent bad pull + # requests to ccache repository. Also enabled in case of Travis builds + # (Environment var CI is set). + option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" TRUE) +else() + # Disabled by default so compilation doesn't fail with new compilers, just + # because they produce a new warning. + option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" FALSE) +endif() + +include(CheckCXXCompilerFlag) + +# check_cxx_compiler_flag caches the result, so a unique variable name is +# required for every flag to be checked. +# +# * flag [in], e.g. XXX +# * variable_name_of_variable_name [in], e.g. "TEMP". This is the variable that +# "HAS_XXX" will be written to. +function(generate_unique_has_flag_variable_name flag + variable_name_of_variable_name) + string(REGEX REPLACE "[=-]" "_" variable_name "${flag}") + string(TOUPPER "${variable_name}" variable_name) + set(${variable_name_of_variable_name} "HAS_${variable_name}" PARENT_SCOPE) +endfunction() + +function(add_target_compile_flag_if_supported_ex target flag alternative_flag) + # has_flag will contain "HAS_$flag" so each flag gets a unique HAS variable. + generate_unique_has_flag_variable_name("${flag}" "has_flag") + + # Instead of passing "has_flag" this is passing the content of has_flag. + check_cxx_compiler_flag("${flag}" "${has_flag}") + + # If the variable named in has_flag is true, compiler supports the cxx flag. + if(${${has_flag}}) + target_compile_options(${target} INTERFACE "${flag}") + elseif("${alternative_flag}") + add_target_compile_flag_if_supported_ex(${target} ${alternative_flag} "") + endif() +endfunction() + +# ToDo: Is there a better way to private an optional third argument? +macro(add_target_compile_flag_if_supported target flag) + add_target_compile_flag_if_supported_ex("${target}" "${flag}" "") +endmacro() + +# Several standard warnings disabled for now so no code change is required as +# part of CMake-Switch commit. +set(CLANG_GCC_WARNINGS + -Wall + -Wextra + -Wnon-virtual-dtor + -Wcast-align + -Wunused + -Woverloaded-virtual + -Wpedantic + # To be enabled in the future: + # + # * -Wshadow + # * -Wold-style-cast + # * -Wconversion + # * -Wsign-conversion + # * -Wnull-dereference + # * -Wformat=2 +) +# Tested seperatly as this is not supported by clang 3.4 +add_target_compile_flag_if_supported(standard_warnings "-Wdouble-promotion") + +if(WARNINGS_AS_ERRORS) + set(CLANG_GCC_WARNINGS ${CLANG_GCC_WARNINGS} -Werror) +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + # Exact version or reason unknown, discovered in Ubuntu 14 docker test with clang 3.4 + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) + # reserved-id-macro issued by clang 3.6 - 3.9 for libb2 blake2.h + set(CLANG_GCC_WARNINGS ${CLANG_GCC_WARNINGS} -Qunused-arguments -Wno-error=unreachable-code -Wno-error=reserved-id-macro) + endif() + + target_compile_options( + standard_warnings + INTERFACE ${CLANG_GCC_WARNINGS} + -Weverything + -Wno-c++98-compat-pedantic + -Wno-c++98-compat + -Wno-constexpr-not-const + -Wno-conversion + -Wno-disabled-macro-expansion + -Wno-documentation-unknown-command + -Wno-exit-time-destructors + -Wno-format-nonliteral + -Wno-global-constructors + -Wno-implicit-fallthrough + -Wno-padded + -Wno-shorten-64-to-32 + -Wno-sign-conversion + -Wno-weak-vtables + -Wno-old-style-cast) + + # If compiler supports shadow-field-in-constructor, disable only that. + # Otherwise disable shadow. + add_target_compile_flag_if_supported_ex( + standard_warnings "-Wno-shadow-field-in-constructor" "-Wno-shadow") + + # Disable C++20 compatibility for now. + add_target_compile_flag_if_supported(standard_warnings "-Wno-c++2a-compat") + + # If compiler supports these warnings, they have to be disabled for now. + add_target_compile_flag_if_supported(standard_warnings + "-Wno-zero-as-null-pointer-constant") + add_target_compile_flag_if_supported(standard_warnings + "-Wno-undefined-func-template") + add_target_compile_flag_if_supported(standard_warnings + "-Wno-return-std-move-in-c++11") +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + target_compile_options( + standard_warnings + INTERFACE ${CLANG_GCC_WARNINGS} + + -Wlogical-op # warn about logical operations being used where bitwise were probably wanted. + + # + # To be enabled in the future: + # + # * -Wmisleading- indentation # warn if identation implies blocks where + # blocks do not exist + # * -Wduplicated-cond # warn if if / else chain has duplicated conditions + # * -Wduplicated-branches # warn if if / else branches have duplicated code + # * -Wuseless-cast # warn if you perform a cast to the same type + ) + + # Exact version or reason unknown, discovered in Ubuntu 14 docker test with gcc 4.8.4 + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8.5) + add_target_compile_flag_if_supported(standard_warnings "-Wno-missing-field-initializers") + add_target_compile_flag_if_supported(standard_warnings "-Wno-unused-variable") + endif() +endif() diff --git a/cmake/Version.cpp.in b/cmake/Version.cpp.in new file mode 100644 index 00000000..291f0496 --- /dev/null +++ b/cmake/Version.cpp.in @@ -0,0 +1,2 @@ +extern const char CCACHE_VERSION[]; +const char CCACHE_VERSION[] = "@VERSION@"; diff --git a/cmake/config.h.in b/cmake/config.h.in new file mode 100644 index 00000000..b60aee8c --- /dev/null +++ b/cmake/config.h.in @@ -0,0 +1,142 @@ +#pragma once +#ifdef __clang__ +# pragma clang diagnostic push +# if __has_warning("-Wreserved-id-macro") +# pragma clang diagnostic ignored "-Wreserved-id-macro" +# endif +#endif + +// For example for vasprintf under i686-w64-mingw32-g++-posix. +// The later defininition of _XOPEN_SOURCE disables certain features +// on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone). +#define _GNU_SOURCE 1 + +// The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables +// certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable +// them. +#define _NETBSD_SOURCE 1 + +// The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables +// certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable +// them. +#define __BSD_VISIBLE 1 + +// The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables +// u_int on Irix 5.3. Defining _BSD_TYPES brings it back. +#define _BSD_TYPES 1 + +// The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables +// certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable +// them. +#cmakedefine _DARWIN_C_SOURCE + +// Define to activate features from IEEE Stds 1003.1-2001. +#define _POSIX_C_SOURCE 200809L + +#if defined(__SunOS_5_8) || defined(__SunOS_5_9) || defined(__SunOS_5_10) + #define _XOPEN_SOURCE 500 +#elif !defined(__SunOS_5_11) && !defined(__APPLE__) + #define _XOPEN_SOURCE +#endif + +#if defined(__SunOS_5_10) || defined(__SunOS_5_11) + #define __EXTENSIONS__ 1 +#else + #define _XOPEN_SOURCE_EXTENDED +#endif + + +#cmakedefine _WIN32_WINNT @_WIN32_WINNT@ + +#ifdef __clang__ +# pragma clang diagnostic pop +#endif + +#cmakedefine MTR_ENABLED + +/* Define to 1 if you have the `asctime_r' function. */ +#cmakedefine HAVE_ASCTIME_R + +/* Define to 1 if your compiler supports AVX2. */ +#cmakedefine HAVE_AVX2 + +/* Define to 1 if you have the `geteuid' function. */ +#cmakedefine HAVE_GETEUID + +/* Define to 1 if you have the `GetFinalPathNameByHandleW' function. */ +#cmakedefine HAVE_GETFINALPATHNAMEBYHANDLEW + +/* Define to 1 if you have the `getopt_long' function. */ +#cmakedefine HAVE_GETOPT_LONG + +/* Define to 1 if you have the `getpwuid' function. */ +#cmakedefine HAVE_GETPWUID + +/* Define to 1 if you have the `gettimeofday' function. */ +#cmakedefine HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the <linux/fs.h> header file. */ +#cmakedefine HAVE_LINUX_FS_H + +/* Define to 1 if you have the `localtime_r' function. */ +#cmakedefine HAVE_LOCALTIME_R + +/* Define to 1 if the system has the type `long long'. */ +#cmakedefine HAVE_LONG_LONG + +/* Define to 1 if you have the `mkstemp' function. */ +#cmakedefine HAVE_MKSTEMP + +/* Define to 1 if you have the `posix_fallocate. */ +#cmakedefine HAVE_POSIX_FALLOCATE + +/* Define to 1 if you have the <pwd.h> header file. */ +#cmakedefine HAVE_PWD_H + +/* Define to 1 if you have the `realpath' function. */ +#cmakedefine HAVE_REALPATH + +/* Define to 1 if you have the `setenv' function. */ +#cmakedefine HAVE_SETENV + +/* Define to 1 if you have the `strndup' function. */ +#cmakedefine HAVE_STRNDUP + +/* Define to 1 if `f_fstypename' is a member of `struct statfs'. */ +#cmakedefine HAVE_STRUCT_STATFS_F_FSTYPENAME + +/* Define to 1 if `st_ctim' is a member of `struct stat'. */ +#cmakedefine HAVE_STRUCT_STAT_ST_CTIM + +/* Define to 1 if `st_mtim' is a member of `struct stat'. */ +#cmakedefine HAVE_STRUCT_STAT_ST_MTIM + +/* Define to 1 if you have the `syslog' function. */ +#cmakedefine HAVE_SYSLOG + +/* Define to 1 if you have the <syslog.h> header file. */ +#cmakedefine HAVE_SYSLOG_H + +/* Define to 1 if you have the <sys/clonefile.h> header file. */ +#cmakedefine HAVE_SYS_CLONEFILE_H + +/* Define to 1 if you have the <sys/ioctl.h> header file. */ +#cmakedefine HAVE_SYS_IOCTL_H + +/* Define to 1 if you have the <sys/mman.h> header file. */ +#cmakedefine HAVE_SYS_MMAN_H + +/* Define to 1 if you have the <sys/time.h> header file. */ +#cmakedefine HAVE_SYS_TIME_H + +/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */ +#cmakedefine HAVE_SYS_WAIT_H + +/* Define to 1 if you have the <termios.h> header file. */ +#cmakedefine HAVE_TERMIOS_H + +/* Define to 1 if you have the `unsetenv' function. */ +#cmakedefine HAVE_UNSETENV + +/* Define to 1 if you have the `utimes' function. */ +#cmakedefine HAVE_UTIMES diff --git a/config.guess b/config.guess deleted file mode 100644 index 9baaa270..00000000 --- a/config.guess +++ /dev/null @@ -1,1476 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright 1992-2018 Free Software Foundation, Inc. - -timestamp='2018-01-26' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see <https://www.gnu.org/licenses/>. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). -# -# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. -# -# You can get the latest version of this script from: -# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess -# -# Please send patches to <config-patches@gnu.org>. - - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Options: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to <config-patches@gnu.org>." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright 1992-2018 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > "$dummy.c" ; - for c in cc gcc c89 c99 ; do - if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -case "$UNAME_SYSTEM" in -Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu - - eval "$set_cc_for_build" - cat <<-EOF > "$dummy.c" - #include <features.h> - #if defined(__UCLIBC__) - LIBC=uclibc - #elif defined(__dietlibc__) - LIBC=dietlibc - #else - LIBC=gnu - #endif - EOF - eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" - - # If ldd exists, use it to detect musl libc. - if command -v ldd >/dev/null && \ - ldd --version 2>&1 | grep -q ^musl - then - LIBC=musl - fi - ;; -esac - -# Note: order is significant - the case branches are not exclusive. - -case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ - "/sbin/$sysctl" 2>/dev/null || \ - "/usr/sbin/$sysctl" 2>/dev/null || \ - echo unknown)` - case "$UNAME_MACHINE_ARCH" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - sh5el) machine=sh5le-unknown ;; - earmv*) - arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` - endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` - machine="${arch}${endian}"-unknown - ;; - *) machine="$UNAME_MACHINE_ARCH"-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently (or will in the future) and ABI. - case "$UNAME_MACHINE_ARCH" in - earm*) - os=netbsdelf - ;; - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval "$set_cc_for_build" - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ELF__ - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # Determine ABI tags. - case "$UNAME_MACHINE_ARCH" in - earm*) - expr='s/^earmv[0-9]/-eabi/;s/eb$//' - abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "$UNAME_VERSION" in - Debian*) - release='-gnu' - ;; - *) - release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "$machine-${os}${release}${abi}" - exit ;; - *:Bitrig:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" - exit ;; - *:LibertyBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" - exit ;; - *:MidnightBSD:*:*) - echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" - exit ;; - *:ekkoBSD:*:*) - echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" - exit ;; - *:SolidBSD:*:*) - echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" - exit ;; - macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd"$UNAME_RELEASE" - exit ;; - *:MirBSD:*:*) - echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" - exit ;; - *:Sortix:*:*) - echo "$UNAME_MACHINE"-unknown-sortix - exit ;; - *:Redox:*:*) - echo "$UNAME_MACHINE"-unknown-redox - exit ;; - mips:OSF1:*.*) - echo mips-dec-osf1 - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE=alpha ;; - "EV4.5 (21064)") - UNAME_MACHINE=alpha ;; - "LCA4 (21066/21068)") - UNAME_MACHINE=alpha ;; - "EV5 (21164)") - UNAME_MACHINE=alphaev5 ;; - "EV5.6 (21164A)") - UNAME_MACHINE=alphaev56 ;; - "EV5.6 (21164PC)") - UNAME_MACHINE=alphapca56 ;; - "EV5.7 (21164PC)") - UNAME_MACHINE=alphapca57 ;; - "EV6 (21264)") - UNAME_MACHINE=alphaev6 ;; - "EV6.7 (21264A)") - UNAME_MACHINE=alphaev67 ;; - "EV6.8CB (21264C)") - UNAME_MACHINE=alphaev68 ;; - "EV6.8AL (21264B)") - UNAME_MACHINE=alphaev68 ;; - "EV6.8CX (21264D)") - UNAME_MACHINE=alphaev68 ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE=alphaev69 ;; - "EV7 (21364)") - UNAME_MACHINE=alphaev7 ;; - "EV7.9 (21364A)") - UNAME_MACHINE=alphaev79 ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo "$UNAME_MACHINE"-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo "$UNAME_MACHINE"-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix"$UNAME_RELEASE" - exit ;; - arm*:riscos:*:*|arm*:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - s390x:SunOS:*:*) - echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" - exit ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" - exit ;; - i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux"$UNAME_RELEASE" - exit ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval "$set_cc_for_build" - SUN_ARCH=i386 - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH=x86_64 - fi - fi - echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos"$UNAME_RELEASE" - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos"$UNAME_RELEASE" - ;; - sun4) - echo sparc-sun-sunos"$UNAME_RELEASE" - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos"$UNAME_RELEASE" - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint"$UNAME_RELEASE" - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint"$UNAME_RELEASE" - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint"$UNAME_RELEASE" - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten"$UNAME_RELEASE" - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten"$UNAME_RELEASE" - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix"$UNAME_RELEASE" - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix"$UNAME_RELEASE" - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix"$UNAME_RELEASE" - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval "$set_cc_for_build" - sed 's/^ //' << EOF > "$dummy.c" -#ifdef __cplusplus -#include <stdio.h> /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o "$dummy" "$dummy.c" && - dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`"$dummy" "$dummyarg"` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos"$UNAME_RELEASE" - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] - then - if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ - [ "$TARGET_BINARY_INTERFACE"x = x ] - then - echo m88k-dg-dgux"$UNAME_RELEASE" - else - echo m88k-dg-dguxbcs"$UNAME_RELEASE" - fi - else - echo i586-dg-dgux"$UNAME_RELEASE" - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" - fi - echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval "$set_cc_for_build" - sed 's/^ //' << EOF > "$dummy.c" - #include <sys/systemcfg.h> - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[4567]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/lslpp ] ; then - IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | - awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` - else - IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" - fi - echo "$IBM_ARCH"-ibm-aix"$IBM_REV" - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` - case "$UNAME_MACHINE" in - 9000/31?) HP_ARCH=m68000 ;; - 9000/[34]??) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "$sc_cpu_version" in - 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 - 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "$sc_kernel_bits" in - 32) HP_ARCH=hppa2.0n ;; - 64) HP_ARCH=hppa2.0w ;; - '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "$HP_ARCH" = "" ]; then - eval "$set_cc_for_build" - sed 's/^ //' << EOF > "$dummy.c" - - #define _HPUX_SOURCE - #include <stdlib.h> - #include <unistd.h> - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ "$HP_ARCH" = hppa2.0w ] - then - eval "$set_cc_for_build" - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | - grep -q __LP64__ - then - HP_ARCH=hppa2.0w - else - HP_ARCH=hppa64 - fi - fi - echo "$HP_ARCH"-hp-hpux"$HPUX_REV" - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux"$HPUX_REV" - exit ;; - 3050*:HI-UX:*:*) - eval "$set_cc_for_build" - sed 's/^ //' << EOF > "$dummy.c" - #include <unistd.h> - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo "$UNAME_MACHINE"-unknown-osf1mk - else - echo "$UNAME_MACHINE"-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` - FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` - FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` - FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi"$UNAME_RELEASE" - exit ;; - *:BSD/OS:*:*) - echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" - exit ;; - *:FreeBSD:*:*) - UNAME_PROCESSOR=`/usr/bin/uname -p` - case "$UNAME_PROCESSOR" in - amd64) - UNAME_PROCESSOR=x86_64 ;; - i386) - UNAME_PROCESSOR=i586 ;; - esac - echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" - exit ;; - i*:CYGWIN*:*) - echo "$UNAME_MACHINE"-pc-cygwin - exit ;; - *:MINGW64*:*) - echo "$UNAME_MACHINE"-pc-mingw64 - exit ;; - *:MINGW*:*) - echo "$UNAME_MACHINE"-pc-mingw32 - exit ;; - *:MSYS*:*) - echo "$UNAME_MACHINE"-pc-msys - exit ;; - i*:PW*:*) - echo "$UNAME_MACHINE"-pc-pw32 - exit ;; - *:Interix*:*) - case "$UNAME_MACHINE" in - x86) - echo i586-pc-interix"$UNAME_RELEASE" - exit ;; - authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix"$UNAME_RELEASE" - exit ;; - IA64) - echo ia64-unknown-interix"$UNAME_RELEASE" - exit ;; - esac ;; - i*:UWIN*:*) - echo "$UNAME_MACHINE"-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" - exit ;; - *:GNU:*:*) - # the GNU system - echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" - exit ;; - i*86:Minix:*:*) - echo "$UNAME_MACHINE"-pc-minix - exit ;; - aarch64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - aarch64_be:Linux:*:*) - UNAME_MACHINE=aarch64_be - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC=gnulibc1 ; fi - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - arc:Linux:*:* | arceb:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - arm*:Linux:*:*) - eval "$set_cc_for_build" - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_EABI__ - then - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - else - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi - else - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf - fi - fi - exit ;; - avr32*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - cris:Linux:*:*) - echo "$UNAME_MACHINE"-axis-linux-"$LIBC" - exit ;; - crisv32:Linux:*:*) - echo "$UNAME_MACHINE"-axis-linux-"$LIBC" - exit ;; - e2k:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - frv:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - hexagon:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - i*86:Linux:*:*) - echo "$UNAME_MACHINE"-pc-linux-"$LIBC" - exit ;; - ia64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - k1om:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - m32r*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - m68*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - mips:Linux:*:* | mips64:Linux:*:*) - eval "$set_cc_for_build" - sed 's/^ //' << EOF > "$dummy.c" - #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" - test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } - ;; - mips64el:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - openrisc*:Linux:*:*) - echo or1k-unknown-linux-"$LIBC" - exit ;; - or32:Linux:*:* | or1k*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - padre:Linux:*:*) - echo sparc-unknown-linux-"$LIBC" - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-"$LIBC" - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; - PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; - *) echo hppa-unknown-linux-"$LIBC" ;; - esac - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-"$LIBC" - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-"$LIBC" - exit ;; - ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-"$LIBC" - exit ;; - ppcle:Linux:*:*) - echo powerpcle-unknown-linux-"$LIBC" - exit ;; - riscv32:Linux:*:* | riscv64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" - exit ;; - sh64*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - sh*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - tile*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - vax:Linux:*:*) - echo "$UNAME_MACHINE"-dec-linux-"$LIBC" - exit ;; - x86_64:Linux:*:*) - echo "$UNAME_MACHINE"-pc-linux-"$LIBC" - exit ;; - xtensa*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo "$UNAME_MACHINE"-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo "$UNAME_MACHINE"-unknown-stop - exit ;; - i*86:atheos:*:*) - echo "$UNAME_MACHINE"-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo "$UNAME_MACHINE"-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos"$UNAME_RELEASE" - exit ;; - i*86:*DOS:*:*) - echo "$UNAME_MACHINE"-pc-msdosdjgpp - exit ;; - i*86:*:4.*:*) - UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" - else - echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` - echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL" - elif /bin/uname -X 2>/dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" - else - echo "$UNAME_MACHINE"-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. - # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configure will decide that - # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } - /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos"$UNAME_RELEASE" - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos"$UNAME_RELEASE" - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos"$UNAME_RELEASE" - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos"$UNAME_RELEASE" - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv"$UNAME_RELEASE" - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo "$UNAME_MACHINE"-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says <Richard.M.Bartel@ccMail.Census.GOV> - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes <hewes@openmarket.com>. - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo "$UNAME_MACHINE"-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux"$UNAME_RELEASE" - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv"$UNAME_RELEASE" - else - echo mips-unknown-sysv"$UNAME_RELEASE" - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - x86_64:Haiku:*:*) - echo x86_64-unknown-haiku - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux"$UNAME_RELEASE" - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux"$UNAME_RELEASE" - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux"$UNAME_RELEASE" - exit ;; - SX-7:SUPER-UX:*:*) - echo sx7-nec-superux"$UNAME_RELEASE" - exit ;; - SX-8:SUPER-UX:*:*) - echo sx8-nec-superux"$UNAME_RELEASE" - exit ;; - SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux"$UNAME_RELEASE" - exit ;; - SX-ACE:SUPER-UX:*:*) - echo sxace-nec-superux"$UNAME_RELEASE" - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody"$UNAME_RELEASE" - exit ;; - *:Rhapsody:*:*) - echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - eval "$set_cc_for_build" - if test "$UNAME_PROCESSOR" = unknown ; then - UNAME_PROCESSOR=powerpc - fi - if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac - fi - # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc - if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_PPC >/dev/null - then - UNAME_PROCESSOR=powerpc - fi - fi - elif test "$UNAME_PROCESSOR" = i386 ; then - # Avoid executing cc on OS X 10.9, as it ships with a stub - # that puts up a graphical alert prompting to install - # developer tools. Any system running Mac OS X 10.7 or - # later (Darwin 11 and later) is required to have a 64-bit - # processor. This is not true of the ARM version of Darwin - # that Apple uses in portable devices. - UNAME_PROCESSOR=x86_64 - fi - echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = x86; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NEO-*:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk"$UNAME_RELEASE" - exit ;; - NSE-*:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk"$UNAME_RELEASE" - exit ;; - NSR-*:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk"$UNAME_RELEASE" - exit ;; - NSV-*:NONSTOP_KERNEL:*:*) - echo nsv-tandem-nsk"$UNAME_RELEASE" - exit ;; - NSX-*:NONSTOP_KERNEL:*:*) - echo nsx-tandem-nsk"$UNAME_RELEASE" - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = 386; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo "$UNAME_MACHINE"-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux"$UNAME_RELEASE" - exit ;; - *:DragonFly:*:*) - echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "$UNAME_MACHINE" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" - exit ;; - i*86:rdos:*:*) - echo "$UNAME_MACHINE"-pc-rdos - exit ;; - i*86:AROS:*:*) - echo "$UNAME_MACHINE"-pc-aros - exit ;; - x86_64:VMkernel:*:*) - echo "$UNAME_MACHINE"-unknown-esx - exit ;; - amd64:Isilon\ OneFS:*:*) - echo x86_64-unknown-onefs - exit ;; -esac - -echo "$0: unable to guess system type" >&2 - -case "$UNAME_MACHINE:$UNAME_SYSTEM" in - mips:Linux | mips64:Linux) - # If we got here on MIPS GNU/Linux, output extra information. - cat >&2 <<EOF - -NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize -the system type. Please install a C compiler and try again. -EOF - ;; -esac - -cat >&2 <<EOF - -This script (version $timestamp), has failed to recognize the -operating system you are using. If your script is old, overwrite *all* -copies of config.guess and config.sub with the latest versions from: - - https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess -and - https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub - -If $0 has already been updated, send the following data and any -information you think might be pertinent to config-patches@gnu.org to -provide the necessary information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = "$UNAME_MACHINE" -UNAME_RELEASE = "$UNAME_RELEASE" -UNAME_SYSTEM = "$UNAME_SYSTEM" -UNAME_VERSION = "$UNAME_VERSION" -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-functions 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/config.sub b/config.sub deleted file mode 100644 index 818892c1..00000000 --- a/config.sub +++ /dev/null @@ -1,1800 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright 1992-2018 Free Software Foundation, Inc. - -timestamp='2018-01-15' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see <https://www.gnu.org/licenses/>. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). - - -# Please send patches to <config-patches@gnu.org>. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# You can get the latest version of this script from: -# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS - -Canonicalize a configuration name. - -Options: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to <config-patches@gnu.org>." - -version="\ -GNU config.sub ($timestamp) - -Copyright 1992-2018 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo "$1" - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ - kopensolaris*-gnu* | cloudabi*-eabi* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - android-linux) - os=-linux-android - basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown - ;; - *) - basic_machine=`echo "$1" | sed 's/-[^-]*$//'` - if [ "$basic_machine" != "$1" ] - then os=`echo "$1" | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze*) - os= - basic_machine=$1 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*178) - os=-lynxos178 - ;; - -lynx*5) - os=-lynxos5 - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | aarch64 | aarch64_be \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arceb \ - | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ - | avr | avr32 \ - | ba \ - | be32 | be64 \ - | bfin \ - | c4x | c8051 | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | e2k | epiphany \ - | fido | fr30 | frv | ft32 \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | hexagon \ - | i370 | i860 | i960 | ia16 | ia64 \ - | ip2k | iq2000 \ - | k1om \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa32r6 | mipsisa32r6el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64r6 | mipsisa64r6el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipsr5900 | mipsr5900el \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 | nios2eb | nios2el \ - | ns16k | ns32k \ - | open8 | or1k | or1knd | or32 \ - | pdp10 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pru \ - | pyramid \ - | riscv32 | riscv64 \ - | rl78 | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ - | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | visium \ - | wasm32 \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; - leon|leon[3-9]) - basic_machine=sparc-$basic_machine - ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) - ;; - ms1) - basic_machine=mt-unknown - ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown - ;; - xgate) - basic_machine=$basic_machine-unknown - os=-none - ;; - xscaleeb) - basic_machine=armeb-unknown - ;; - - xscaleel) - basic_machine=armel-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | aarch64-* | aarch64_be-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | ba-* \ - | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | c8051-* | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | e2k-* | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | hexagon-* \ - | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ - | ip2k-* | iq2000-* \ - | k1om-* \ - | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | microblaze-* | microblazeel-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa32r6-* | mipsisa32r6el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64r6-* | mipsisa64r6el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipsr5900-* | mipsr5900el-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* | nios2eb-* | nios2el-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | or1k*-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pru-* \ - | pyramid-* \ - | riscv32-* | riscv64-* \ - | rl78-* | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ - | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile*-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ - | vax-* \ - | visium-* \ - | wasm32-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-pc - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - asmjs) - basic_machine=asmjs-unknown - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=-linux - ;; - bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c54x-*) - basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16 | cr16-*) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2*) - basic_machine=m68k-bull - os=-sysv3 - ;; - e500v[12]) - basic_machine=powerpc-unknown - os=$os"spe" - ;; - e500v[12]-*) - basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=$os"spe" - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; - i*86v32) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - leon-*|leon[3-9]-*) - basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=-linux - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze*) - basic_machine=microblaze-xilinx - ;; - mingw64) - basic_machine=x86_64-pc - os=-mingw64 - ;; - mingw32) - basic_machine=i686-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - moxiebox) - basic_machine=moxie-unknown - os=-moxiebox - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` - ;; - msys) - basic_machine=i686-pc - os=-msys - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - nacl) - basic_machine=le32-unknown - os=-nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - nsv-tandem) - basic_machine=nsv-tandem - ;; - nsx-tandem) - basic_machine=nsx-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=-linux - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc | ppcbe) basic_machine=powerpc-unknown - ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos | rdos64) - basic_machine=x86_64-pc - os=-rdos - ;; - rdos32) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - strongarm-* | thumb-*) - basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tile*) - basic_machine=$basic_machine-unknown - os=-linux-gnu - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - x64) - basic_machine=x86_64-pc - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - xscale-* | xscalee[bl]-*) - basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases that might get confused - # with valid system types. - # -solaris* is a basic system type, with this one exception. - -auroraux) - os=-auroraux - ;; - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # es1800 is here to avoid being matched by es* (a different OS) - -es1800*) - os=-ose - ;; - # Now accept the basic system types. - # The portable systems comes first. - # Each alternative MUST end in a * to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* | -plan9* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* | -cloudabi* | -sortix* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ - | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ - | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -xray | -os68k* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo "$os" | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo "$os" | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo "$os" | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4*) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -zvmoe) - os=-zvmoe - ;; - -dicos*) - os=-dicos - ;; - -pikeos*) - # Until real need of OS specific support for - # particular features comes up, bare metal - # configurations are quite functional. - case $basic_machine in - arm*) - os=-eabi - ;; - *) - os=-elf - ;; - esac - ;; - -nacl*) - ;; - -ios) - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - c8051-*) - os=-elf - ;; - hexagon-*) - os=-elf - ;; - tic54x-*) - os=-coff - ;; - tic55x-*) - os=-coff - ;; - tic6x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - ;; - m68*-cisco) - os=-aout - ;; - mep-*) - os=-elf - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - pru-*) - os=-elf - ;; - *-be) - os=-beos - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -cnk*|-aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` - ;; -esac - -echo "$basic_machine$os" -exit - -# Local variables: -# eval: (add-hook 'write-file-functions 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 33f6c7d2..00000000 --- a/configure.ac +++ /dev/null @@ -1,303 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. - -AC_INIT() -AC_PREREQ(2.52) - -AC_MSG_NOTICE([configuring ccache]) - -dnl Enable developer mode if dev.mk.in exists. -if test ! -f $srcdir/dev_mode_disabled; then - dev_mode=yes - AC_MSG_NOTICE(developer mode enabled) - AC_CONFIG_FILES([dev.mk]) - include_dev_mk='include dev.mk' - version=`(git --git-dir=$srcdir/.git describe --dirty 2>/dev/null || echo vunknown) | sed -e 's/v//' -e 's/-/+/' -e 's/-/_/g'` - mkdir -p src - echo "extern const char CCACHE_VERSION@<:@@:>@; const char CCACHE_VERSION@<:@@:>@ = \"$version\";" >src/version.cpp -else - dev_mode=no - AC_MSG_NOTICE(developer mode disabled) -fi - -AC_CONFIG_HEADER(config.h) - -AC_CANONICAL_HOST - -case $host in - *mingw32* | *mingw64* | *cygwin* | *wince* | *mingwce*) - windows_os=yes - AC_DEFINE(_WIN32_WINNT,0x0600, Windows Vista or newer is required) - ;; - *os400* | *aix*) - AR="ar -X64" - ;; -esac - -AC_SUBST(disable_cross) -AC_SUBST(disable_man) -AC_SUBST(extra_libs) -AC_SUBST(extra_sources) -AC_SUBST(extra_warnings) -AC_SUBST(include_dev_mk) - -m4_include(m4/feature_macros.m4) -m4_include(m4/ax_cxx_compile_stdcxx.m4) -m4_include(m4/ax_check_compile_flag.m4) -m4_include(m4/ax_pthread.m4) -m4_include(m4/clang.m4) - -mkdir -p .deps src/third_party unittest - -dnl Checks for programs. -AC_PROG_CC -AX_CXX_COMPILE_STDCXX(11, noext, mandatory) -_AC_LANG_COMPILER_CLANG -AC_PROG_INSTALL - -AX_CHECK_COMPILE_FLAG([-mavx2], [AC_DEFINE(HAVE_AVX2, 1, Define to 1 if your compiler supports AVX2)]) - -AX_PTHREAD -LIBS="$PTHREAD_LIBS $LIBS" -CFLAGS="$CFLAGS $PTHREAD_CFLAGS" -CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" -LDFLAGS="$LDFLAGS $PTHREAD_CFLAGS" - -# Prefer bash, needed for test.sh -AC_PATH_TOOL(BASH, bash, "/bin/bash") - -# If GCC (or clang), turn on warnings. -if test "$ac_compiler_gnu" = yes; then - CFLAGS="$CFLAGS -Wall -W" - CXXFLAGS="$CXXFLAGS -Wall -W" -else - CFLAGS="$CXXFLAGS -O" - CXXFLAGS="$CXXFLAGS -O" -fi - -AC_ARG_ENABLE(more_warnings, - [AS_HELP_STRING([--enable-more-warnings], - [enable more compiler warnings])]) -if test "$dev_mode" = yes -o "$enable_more_warnings" = yes; then - extra_warnings="-Wextra -Wpedantic" - if test "$ac_compiler_clang" = yes; then - extra_warnings="$extra_warnings -Weverything" - AX_CHECK_COMPILE_FLAG([-Wno-c++2a-compat], [extra_warnings="$extra_warnings -Wno-c++2a-compat"],, [-Werror]) - AX_CHECK_COMPILE_FLAG([-Wno-c++98-compat-pedantic], [extra_warnings="$extra_warnings -Wno-c++98-compat-pedantic"],, [-Werror]) - AX_CHECK_COMPILE_FLAG([-Wno-c++98-compat], [extra_warnings="$extra_warnings -Wno-c++98-compat"],, [-Werror]) - AX_CHECK_COMPILE_FLAG([-Wno-constexpr-not-const], [extra_warnings="$extra_warnings -Wno-constexpr-not-const"],, [-Werror]) - AX_CHECK_COMPILE_FLAG([-Wno-conversion], [extra_warnings="$extra_warnings -Wno-conversion"],, [-Werror]) - AX_CHECK_COMPILE_FLAG([-Wno-disabled-macro-expansion], [extra_warnings="$extra_warnings -Wno-disabled-macro-expansion"],, [-Werror]) - AX_CHECK_COMPILE_FLAG([-Wno-documentation-unknown-command], [extra_warnings="$extra_warnings -Wno-documentation-unknown-command"],, [-Werror]) - AX_CHECK_COMPILE_FLAG([-Wno-exit-time-destructors], [extra_warnings="$extra_warnings -Wno-exit-time-destructors"],, [-Werror]) - AX_CHECK_COMPILE_FLAG([-Wno-format-nonliteral], [extra_warnings="$extra_warnings -Wno-format-nonliteral"],, [-Werror]) - AX_CHECK_COMPILE_FLAG([-Wno-global-constructors], [extra_warnings="$extra_warnings -Wno-global-constructors"],, [-Werror]) - AX_CHECK_COMPILE_FLAG([-Wno-implicit-fallthrough], [extra_warnings="$extra_warnings -Wno-implicit-fallthrough"],, [-Werror]) - AX_CHECK_COMPILE_FLAG([-Wno-padded], [extra_warnings="$extra_warnings -Wno-padded"],, [-Werror]) - AX_CHECK_COMPILE_FLAG([-Wno-return-std-move-in-c++11], [extra_warnings="$extra_warnings -Wno-return-std-move-in-c++11"],, [-Werror]) - AX_CHECK_COMPILE_FLAG([-Wno-shadow-field-in-constructor], [extra_warnings="$extra_warnings -Wno-shadow-field-in-constructor"],, [-Werror]) - AX_CHECK_COMPILE_FLAG([-Wno-shorten-64-to-32], [extra_warnings="$extra_warnings -Wno-shorten-64-to-32"],, [-Werror]) - AX_CHECK_COMPILE_FLAG([-Wno-sign-conversion], [extra_warnings="$extra_warnings -Wno-sign-conversion"],, [-Werror]) - AX_CHECK_COMPILE_FLAG([-Wno-undefined-func-template], [extra_warnings="$extra_warnings -Wno-undefined-func-template"],, [-Werror]) - AX_CHECK_COMPILE_FLAG([-Wno-weak-vtables], [extra_warnings="$extra_warnings -Wno-weak-vtables"],, [-Werror]) - - # TODO: Enable these in the future: - AX_CHECK_COMPILE_FLAG([-Wno-old-style-cast], [extra_warnings="$extra_warnings -Wno-old-style-cast"],, [-Werror]) - AX_CHECK_COMPILE_FLAG([-Wno-zero-as-null-pointer-constant], [extra_warnings="$extra_warnings -Wno-zero-as-null-pointer-constant"],, [-Werror]) - fi -fi - -AC_HEADER_DIRENT -AC_HEADER_TIME -AC_HEADER_SYS_WAIT - -AC_CHECK_TYPES(long long) - -AC_CHECK_HEADERS(ctype.h pwd.h stdlib.h string.h strings.h sys/time.h sys/mman.h) -AC_CHECK_HEADERS(syslog.h) -AC_CHECK_HEADERS(termios.h) -AC_CHECK_HEADERS(sys/ioctl.h) -AC_CHECK_HEADERS(linux/fs.h) -AC_CHECK_HEADERS(sys/clonefile.h) - -AC_CHECK_FUNCS(asctime_r) -AC_CHECK_FUNCS(geteuid) -AC_CHECK_FUNCS(getopt_long) -AC_CHECK_FUNCS(getpwuid) -AC_CHECK_FUNCS(gettimeofday) -AC_CHECK_FUNCS(localtime_r) -AC_CHECK_FUNCS(mkstemp) -AC_CHECK_FUNCS(posix_fallocate) -AC_CHECK_FUNCS(realpath) -AC_CHECK_FUNCS(setenv) -AC_CHECK_FUNCS(strndup) -AC_CHECK_FUNCS(syslog) -AC_CHECK_FUNCS(unsetenv) -AC_CHECK_FUNCS(utimes) - -AC_CHECK_MEMBERS([struct stat.st_ctim, struct stat.st_mtim]) -AC_CHECK_MEMBERS([struct statfs.f_fstypename], [], [], [#include <sys/mount.h>]) - -dnl Check if -lm is needed. -AC_SEARCH_LIBS(cos, m) - -dnl Check for libzstd -zstd_version=1.4.4 -zstd_url=https://github.com/facebook/zstd/releases/download/v${zstd_version}/zstd-${zstd_version}.tar.gz - -AC_ARG_WITH(libzstd-from-internet, - [AS_HELP_STRING([--with-libzstd-from-internet], - [download and use libzstd from the Internet instead of using the system's default libzstd])]) -if test x${with_libzstd_from_internet} = x; then - AC_CHECK_LIB(zstd, ZSTD_versionNumber, [found_libzstd=yes]) - if test x${found_libzstd} = x; then - AC_MSG_ERROR(please install libzstd or use --with-libzstd-from-internet) - fi - LIBS="$LIBS -lzstd" -else - zstd_archive=`basename ${zstd_url}` - if ! test -f ${zstd_archive}; then - AC_CHECK_TOOL(WGET, wget) - if test -n "$WGET"; then - AC_MSG_NOTICE(downloading libzstd from $zstd_url) - wget -q ${zstd_url} - else - AC_CHECK_TOOL(CURL, curl) - if test -n "$CURL"; then - AC_MSG_NOTICE(downloading libzstd from $zstd_url) - curl -sLOJ ${zstd_url} - else - AC_MSG_ERROR(please install wget or curl) - fi - fi - fi - if ! test -f $zstd_archive; then - AC_MSG_ERROR(failed to download $zstd_url) - fi - (cd src/third_party && tar -xzf ../../${zstd_archive}) - rm -rf src/third_party/zstd - mv src/third_party/zstd-${zstd_version} src/third_party/zstd - CPPFLAGS="$CPPFLAGS -I$PWD/src/third_party/zstd/lib" - extra_libs="src/third_party/zstd/lib/libzstd.a" -fi - -dnl Check for libb2 -libb2_version=0.98.1 -libb2_url=https://github.com/BLAKE2/libb2/releases/download/v${libb2_version}/libb2-${libb2_version}.tar.gz - -AC_ARG_WITH(libb2-from-internet, - [AS_HELP_STRING([--with-libb2-from-internet], - [download and use libb2 from the Internet instead of using the system's default libb2])]) -if test x${with_libb2_from_internet} = x; then - AC_CHECK_LIB([b2],[blake2b], [found_libb2=yes]) - if test x${found_libb2} = x; then - AC_MSG_ERROR(please install libb2 or use --with-libb2-from-internet) - fi - LIBS="$LIBS -lb2" -else - libb2_archive=`basename ${libb2_url}` - if ! test -f ${libb2_archive}; then - AC_CHECK_TOOL(WGET, wget) - if test -n "$WGET"; then - AC_MSG_NOTICE(downloading libb2 from $libb2_url) - wget -q ${libb2_url} - else - AC_CHECK_TOOL(CURL, curl) - if test -n "$CURL"; then - AC_MSG_NOTICE(downloading libb2 from $libb2_url) - curl -sLOJ ${libb2_url} - else - AC_MSG_ERROR(please install wget or curl) - fi - fi - fi - if ! test -f $libb2_archive; then - AC_MSG_ERROR(failed to download $libb2_url) - fi - (cd src/third_party && tar -xzf ../../${libb2_archive}) - rm -rf src/third_party/libb2 - mv src/third_party/libb2-${libb2_version} src/third_party/libb2 - # try to make clang happy by changing the header guard macros - sed -i -e 's/__BLAKE2_H__/BLAKE2_H/' src/third_party/libb2/src/blake2.h - CPPFLAGS="$CPPFLAGS -I$PWD/src/third_party/libb2/src" - extra_libs="$extra_libs src/third_party/libb2/src/.libs/libb2.a" -fi - -if test "$cross_compiling" != no -o "$host_cpu" != 'x86_64'; then - disable_cross='' -else - disable_cross='#' -fi - -AC_ARG_ENABLE(man, - [AS_HELP_STRING([--disable-man], - [disable installing man pages])]) -if test x${enable_man} = xno; then - disable_man='#' -fi - -AC_ARG_ENABLE(tracing, - [AS_HELP_STRING([--enable-tracing], - [enable possibility to use internal ccache tracing])]) -if test x${enable_tracing} = xyes; then - CPPFLAGS="$CPPFLAGS -DMTR_ENABLED" - extra_sources="src/third_party/minitrace.c" -fi - -dnl Linking on Windows needs ws2_32 -if test x${windows_os} = xyes; then - LDFLAGS="$LDFLAGS -static" - LIBS="$LIBS -lws2_32" - AC_CHECK_FUNCS(GetFinalPathNameByHandleW,[],[LIBS="$LIBS -lpsapi"]) -fi - -AC_C_BIGENDIAN - -AC_C_INLINE - -dnl Check for "extern inline". -AC_CACHE_CHECK( - for extern inline, - ac_cv_c_extern_inline, - [ - ac_cv_c_extern_inline=no - AC_TRY_COMPILE( - [ - extern $ac_cv_c_inline double foo(double x); - extern $ac_cv_c_inline double foo(double x) { return x+1.0; }; - double foo (double x) { return x + 1.0; }; - ], - [foo(1.0)], - [ac_cv_c_extern_inline="yes"])]) -if test "$ac_cv_c_extern_inline" != no ; then - AC_DEFINE(HAVE_EXTERN_INLINE, 1, - Define to 1 if your compiler supports extern inline) -fi - -if test ! -f $srcdir/src/version.cpp -a ! -f src/version.cpp ; then - AC_MSG_WARN(unable to determine ccache version) - echo "extern const char CCACHE_VERSION@<:@@:>@; const char CCACHE_VERSION@<:@@:>@ = \"unknown\";" >src/version.cpp -fi - -AC_CONFIG_FILES([Makefile]) -AC_OUTPUT - -cat <<EOF >config.h.tmp -#pragma once -#ifdef __clang__ -# pragma clang diagnostic push -# if __has_warning("-Wreserved-id-macro") -# pragma clang diagnostic ignored "-Wreserved-id-macro" -# endif -#endif - -EOF -cat config.h >>config.h.tmp -cat <<EOF >>config.h.tmp - -#ifdef __clang__ -# pragma clang diagnostic pop -#endif -EOF -mv config.h.tmp config.h - -AC_MSG_NOTICE(now build ccache by running make) diff --git a/dev.mk.in b/dev.mk.in deleted file mode 100644 index 2ad6eb43..00000000 --- a/dev.mk.in +++ /dev/null @@ -1,242 +0,0 @@ -# GNU make syntax reigns in this file. - -all_cflags += -Werror -all_cppflags += -MD -MP -MF .deps/$(subst .._,,$(subst /,_,$(subst $(srcdir)/,,$<))).d -MQ $@ -all_cxxflags += -Werror - -A2X = a2x -ASCIIDOC = asciidoc -CLANG_FORMAT = clang-format -CLANG_TIDY = clang-tidy -COMPILEDB = compiledb -CPPCHECK = cppcheck -CPPCHECK_SUPPRESSIONS = misc/cppcheck-suppressions.txt -DOCKER = docker -SCAN_BUILD = scan-build -SHELLCHECK = shellcheck -SHELLCHECK_EXCLUDES = misc/shellcheck-excludes.txt -TEST = test - -git := git --git-dir=$(srcdir)/.git -version := \ - $(shell ($(git) describe --exact-match \ - || echo "$$($(git) rev-parse --abbrev-ref HEAD).$$($(git) rev-parse HEAD | cut -c1-8)") 2>/dev/null \ - | sed -re 's/^v([0-9].+)/\1/') - -dist_dir = ccache-$(version) -dist_archives = \ - ccache-$(version).tar.gz \ - ccache-$(version).tar.xz - -generated_docs = \ - LICENSE.html \ - doc/AUTHORS.html \ - doc/MANUAL.html \ - doc/NEWS.html \ - doc/ccache.1 -built_dist_files = $(generated_sources) $(generated_docs) - -non_third_party_headers_without_cpp = \ - src/ArgsInfo.hpp \ - src/Checksum.hpp \ - src/File.hpp \ - src/FormatNonstdStringView.hpp \ - src/NonCopyable.hpp \ - src/NullCompressor.hpp \ - src/NullDecompressor.hpp \ - src/ProgressBar.hpp \ - src/Stat.hpp \ - src/StdMakeUnique.hpp \ - src/ThreadPool.hpp \ - src/exceptions.hpp \ - src/macroskip.hpp \ - src/system.hpp - -non_third_party_headers = \ - $(subst .cpp,.hpp,$(non_third_party_sources)) \ - $(non_third_party_headers_without_cpp) - -third_party_headers = \ - src/third_party/catch.hpp \ - src/third_party/fmt/core.h \ - src/third_party/fmt/format-inl.h \ - src/third_party/fmt/format.h \ - src/third_party/getopt_long.h \ - src/third_party/minitrace.h \ - src/third_party/nonstd/optional.hpp \ - src/third_party/nonstd/string_view.hpp \ - src/third_party/xxhash.h -headers = $(non_third_party_headers) $(third_party_headers) - -files_to_clean += *.tar.gz *.tar.xz *.xml doc/*.xml .deps/* perfdir.* -files_to_clean += compile_commands.json -files_to_distclean += $(built_dist_files) src/version.cpp -files_to_distclean += .deps dev.mk - -source_dist_files = \ - $(non_third_party_sources) \ - $(third_party_sources) \ - $(headers) \ - $(test_sources) \ - CONTRIBUTING.md \ - GPL-3.0.txt \ - LICENSE.adoc \ - Makefile.in \ - README.md \ - autogen.sh \ - config.guess \ - config.h.in \ - config.sub \ - configure \ - configure.ac \ - dev.mk.in \ - doc/AUTHORS.adoc \ - doc/MANUAL.adoc \ - doc/NEWS.adoc \ - install-sh \ - m4 \ - src/main.cpp \ - src/third_party/minitrace.c \ - test/run \ - test/suites/*.bash \ - unittest/catch2_tests.cpp \ - unittest/catch2_tests.hpp - -dist_files = \ - $(addprefix $(srcdir)/, $(source_dist_files)) \ - $(built_dist_files) - -ifneq ($(shell sed -n 's/.*"\(.*\)".*/\1/p' src/version.cpp 2>/dev/null),$(version)) - $(shell echo 'extern const char CCACHE_VERSION[];' >src/version.cpp) - $(shell echo 'const char CCACHE_VERSION[] = "$(version)";' >>src/version.cpp) -endif -src/version.o: src/version.cpp - -.PHONY: dist -dist: $(dist_archives) - -$(dist_archives): $(dist_files) - tmpdir=$$(mktemp -d /tmp/tmp-ccache-dist.XXXXXX) && \ - dir=$$tmpdir/$(dist_dir) && \ - mkdir $$dir && \ - (cd $(srcdir) && \ - rsync -r --relative $(source_dist_files) $$dir) && \ - cp $(srcdir)/doc/INSTALL-from-release-archive.md $$dir/INSTALL.md && \ - (cd $(builddir) && \ - rsync -r --relative $(built_dist_files) $$dir) && \ - echo "Remove this file to enable developer mode." >$$dir/dev_mode_disabled && \ - (cd $$tmpdir && \ - tarcompression= && \ - case $@ in \ - *.gz) tarcompression=-z ;; \ - *.xz) tarcompression=-J ;; \ - esac && \ - tar -c $$tarcompression -f $(CURDIR)/$@ $(dist_dir)) && \ - rm -rf $$tmpdir - -# $(1): extra configure options -define do_distcheck - tmpdir=$$(mktemp -d /tmp/tmp-ccache-distcheck.XXXXXX) && \ - (cd $$tmpdir && \ - tar xf $(CURDIR)/$< && \ - mkdir -p $(dist_dir)/build && \ - chmod -R a-w $(dist_dir) && \ - chmod u+w $(dist_dir)/build && \ - cd $(dist_dir)/build && \ - ../configure --enable-more-warnings --prefix=$$tmpdir/root --sysconfdir=/etc $(1) && \ - $(MAKE) install V=1 && \ - $(MAKE) installcheck V=1) && \ - chmod -R u+w $$tmpdir/$(dist_dir) && \ - rm -rf $$tmpdir -endef - -.PHONY: distcheck -distcheck: $(firstword $(dist_archives)) - $(call do_distcheck, CFLAGS=-Werror CXXFLAGS=-Werror) - $(call do_distcheck, --with-libzstd-from-internet --with-libb2-from-internet) - $(call do_distcheck, CC=clang CXX=clang++) - -.PHONY: docs -docs: $(generated_docs) - -%.html: %.adoc - @mkdir -p $(@D) - $(if $(quiet),@echo " ASCIIDOC $@") - $(Q)$(ASCIIDOC) -o $@ -a revnumber=$(version) -a toc -b xhtml11 $< - -%.xml: %.adoc - @mkdir -p $(@D) -# Make literals stand out as bold in the man page: - $(if $(quiet),@echo " ASCIIDOC $@") - $(Q)$(ASCIIDOC) -a revnumber=$(version) -d manpage -b docbook -o - $< | \ - perl -pe 's!<literal>(.*?)</literal>!<emphasis role="strong">\1</emphasis>!g' >$@ - -doc/ccache.1: doc/MANUAL.xml - $(if $(quiet),@echo " A2X $@") - $(Q)$(A2X) --doctype manpage --format manpage $< - -.PHONY: update-authors -update-authors: - git log --pretty=format:"%H %aN%n%(trailers:only)" \ - | grep -Ev 'd7c5056beda5483fcd5c098165fffd9be86fe98d|http|Conflicts:' \ - | grep '^[^ ]' \ - | sed -r -e 's/[^ ]+/*/' -e 's/<.*//' -e 's/ *$$//' \ - | sort -u \ - | perl -00 -p -i -e 's/^\*.*/<STDIN> . "\n"/es' doc/AUTHORS.adoc - -.PHONY: check-syntax -check-syntax: - $(CC) $(all_cppflags) -I. $(filter-out -g% -O%,$(all_cxxflags)) -S -o /dev/null $(CHK_SOURCES) - -.PHONY: cppcheck -cppcheck: - cd $(srcdir) && $(CPPCHECK) --suppressions-list=$(CPPCHECK_SUPPRESSIONS) \ - --inline-suppr -q --enable=all --force -I $(CURDIR) \ - --template='cppcheck: warning: {id}:{file}:{line}: {message}' \ - $(non_third_party_sources) src/main.cpp $(test_sources) - -.PHONY: shellcheck -shellcheck: test/suites/*.bash - $(SHELLCHECK) --shell=bash --exclude=$(shell sed -e 's/:.*//' <$(SHELLCHECK_EXCLUDES) | grep -v '#' | tr '\n' ',' | sed -e 's/,$$//') $^ - -.PHONY: format -format: - @cd $(srcdir) && misc/format.sh - -# Not using parallel execution because target is most likely being run on non-interactive CI system, -# so no user is waiting for immediate results, and it avoids possibly interleaved output. -.PHONY: check_format -check_format: - @[ -t 1 ] && export cf_diff_color="--color=always"; \ - cd $(srcdir) && misc/check_format.sh || \ - { echo; echo "Error: Sources are not formatted with clang-format."; \ - echo 'Run "make format" or apply the above diff.'; echo; exit 1; } 1>&2 - -# pip install compiledb -compile_commands.json: - $(COMPILEDB) -n $(MAKE) all unittest - -.PHONY: tidy -tidy: compile_commands.json - $(CLANG_TIDY) $(all_sources) - -.PHONY: analyze -analyze: - $(SCAN_BUILD) --use-cc="$(CC)" --use-c++="$(CXX)" $(srcdir)/configure - $(SCAN_BUILD) --use-cc="$(CC)" --use-c++="$(CXX)" --status-bugs $(MAKE) -B - -BUILDENV = ubuntu -DOCKER_IMAGE_TAG = ccache/build:$(BUILDENV) - -.PHONY: docker -docker: buildenv/$(BUILDENV)/Dockerfile - $(DOCKER) inspect $(DOCKER_IMAGE_TAG) >/dev/null || $(DOCKER) build -t $(DOCKER_IMAGE_TAG) buildenv/$(BUILDENV) - $(DOCKER) run --rm -v $(PWD):/build -w /build $(DOCKER_IMAGE_TAG) misc/build.sh $(TEST) - -.PHONY: travis -travis: .travis/Dockerfile - $(DOCKER) inspect travis-build >/dev/null || $(DOCKER) build -t travis-build .travis - $(DOCKER) run --rm --volume $(PWD):/src --tmpfs /dst:rw,exec --env ASAN_OPTIONS='$(ASAN_OPTIONS)' travis-build \ - sh -c "cd /src && ./autogen.sh && cd /dst && CC=$(CC) CFLAGS='$(CFLAGS)' CXX=$(CXX) CXXFLAGS='$(CXXFLAGS)' LDFLAGS='$(LDFLAGS)' /src/configure $(CONFIGURE) && CC=$(CC) CFLAGS='$(CFLAGS)' make V=$(V) && CC=$(CC) make V=$(V) $(TEST)" - --include .deps/*.d diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 00000000..3ecef50b --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1,57 @@ + +find_program (ASCIIDOC_EXE asciidoc) +mark_as_advanced(ASCIIDOC_EXE) # don't show in ccmake +if (NOT ASCIIDOC_EXE) + message (WARNING "Could not find asciidoc: documentation & manpage will not be generated") +else() + # + # documentation + # + add_custom_target(documentation) + + function(generate_html in out) + add_custom_command ( + TARGET documentation + COMMAND ${ASCIIDOC_EXE} -o "${CMAKE_BINARY_DIR}/${out}" -a revnumber="${VERSION}" -a toc -b xhtml11 "${CMAKE_SOURCE_DIR}/${in}" + BYPRODUCTS "${out}" + ) + endfunction() + + add_custom_command ( + TARGET documentation + COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/doc" + COMMAND misc/update_authors.sh + BYPRODUCTS "doc" + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) + + generate_html(LICENSE.adoc LICENSE.html) + generate_html(doc/AUTHORS.adoc doc/AUTHORS.html) + generate_html(doc/MANUAL.adoc doc/MANUAL.html) + generate_html(doc/NEWS.adoc doc/NEWS.html) + + # + # manpage + # + + find_program (A2X_EXE a2x) + mark_as_advanced(A2X_EXE) # don't show in ccmake + if (NOT A2X_EXE) + message (WARNING "Could not find a2x: manpage will not be generated") + else() + add_custom_target(manpage) + + # MANUAL.adoc -> MANUAL.xml -> MANUAL manpage + add_custom_command ( + TARGET manpage + COMMAND ${ASCIIDOC_EXE} -o - -a revnumber=${VERSION} -d manpage -b docbook "${CMAKE_SOURCE_DIR}/doc/MANUAL.adoc" | perl -pe 's!<literal>\(.*?\)</literal>!<emphasis role="strong">\\1</emphasis>!g' > "${CMAKE_BINARY_DIR}/MANUAL.xml" + BYPRODUCTS "${CMAKE_BINARY_DIR}/MANUAL.xml" + ) + + add_custom_command ( + TARGET manpage + COMMAND a2x --doctype manpage --format manpage "${CMAKE_BINARY_DIR}/MANUAL.xml" + BYPRODUCTS ccache.1 + ) + endif() +endif() diff --git a/doc/DEVELOPER.md b/doc/DEVELOPER.md index c856f1fb..e211c9ff 100644 --- a/doc/DEVELOPER.md +++ b/doc/DEVELOPER.md @@ -7,7 +7,7 @@ Tracing In order to see what ccache is doing, it is possible to enable internal tracing: -* Build ccache with the `--enable-tracing` configure option. +* Build ccache with the `-DENABLE_TRACING=1` cmake option. * Set the environment variable `CCACHE_INTERNAL_TRACE` to instruct ccache to create trace files at runtime. diff --git a/doc/INSTALL-from-release-archive.md b/doc/INSTALL-from-release-archive.md deleted file mode 100644 index 0a54b384..00000000 --- a/doc/INSTALL-from-release-archive.md +++ /dev/null @@ -1,58 +0,0 @@ -ccache installation from release archive -======================================== - -Prerequisites -------------- - -To build ccache from a -[release archive](https://ccache.dev/download.html), you need: - -- A C++11 compiler. -- A C89 compiler. -- [libb2](https://github.com/BLAKE2/libb2). If you don't have libb2 installed - and can't or don't want to install it on your system, you can pass - `--with-libb2-from-internet` to the configure script, which will make the - script download libb2 from the Internet and unpack it in the local source - tree. ccache will then be linked statically to the locally built libb2. -- [libzstd](https://www.zstd.net). If you don't have libzstd installed and - can't or don't want to install it on your system, you can pass - `--with-libzstd-from-internet` to the configure script, which will make the - script download libzstd from the Internet and unpack it in the local source - tree. ccache will then be linked statically to the locally built libzstd. - - -Installation ------------- - -To compile and install ccache, run these commands: - - ./configure - make - make install - -You may set the installation directory and other parameters by options to -`./configure`. To see them, run `./configure --help`. - -There are two ways to use ccache. You can either prefix your compilation -commands with `ccache` or you can create a symbolic link (named as your -compiler) to ccache. The first method is most convenient if you just want to -try out ccache or wish to use it for some specific projects. The second method -is most useful for when you wish to use ccache for all your compilations. - -To install for usage by the first method just copy ccache to somewhere in your -path. - -To install for the second method, do something like this: - - cp ccache /usr/local/bin/ - ln -s ccache /usr/local/bin/gcc - ln -s ccache /usr/local/bin/g++ - ln -s ccache /usr/local/bin/cc - ln -s ccache /usr/local/bin/c++ - -And so forth. This will work as long as `/usr/local/bin` comes before the path -to the compiler (which is usually in `/usr/bin`). After installing you may wish -to run `which gcc` to make sure that the correct link is being used. - -NOTE: Do not use a hard link, use a symbolic link. A hard link will cause -"interesting" problems. diff --git a/doc/INSTALL.md b/doc/INSTALL.md index 6599645f..c4961a41 100644 --- a/doc/INSTALL.md +++ b/doc/INSTALL.md @@ -4,7 +4,8 @@ ccache installation from source repository Prerequisites ------------- -To build ccache from a source repository, you need: +To build ccache from a source repository or from a +[release archive](https://ccache.dev/download.html), you need: - A C++11 compiler. - A C99 compiler. @@ -16,14 +17,14 @@ To build ccache from a source repository, you need: script and related files. - [libb2](https://github.com/BLAKE2/libb2). If you don't have libb2 installed and can't or don't want to install it on your system, you can pass - `--with-libb2-from-internet` to the configure script, which will make the - script download libb2 from the Internet and unpack it in the local source - tree. ccache will then be linked statically to the locally built libb2. + `-DUSE_LIBB2_FROM_INTERNET=ON` to cmake, which will download libb2 from the + Internet and unpack it in the local binary tree. + ccache will then be linked statically to the locally built libb2. - [libzstd](https://www.zstd.net). If you don't have libzstd installed and can't or don't want to install it on your system, you can pass - `--with-libzstd-from-internet` to the configure script, which will make the - script download libzstd from the Internet and unpack it in the local source - tree. ccache will then be linked statically to the locally built libzstd. + `-DUSE_LIBZSTD_FROM_INTERNET=ON` to cmake, which will download libzstd from + the Internet and unpack it in the local binary tree. + ccache will then be linked statically to the locally built libzstd. To debug and run the performance test suite you'll also need: @@ -35,13 +36,13 @@ Installation To compile and install ccache, run these commands: - ./autogen.sh - ./configure + mkdir build && cd build + cmake .. make make install -You may set the installation directory and other parameters by options to -`./configure`. To see them, run `./configure --help`. +You may set the installation directory to e.g. /usr by replacing above cmake +call with with `cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ..`. There are two ways to use ccache. You can either prefix your compilation commands with `ccache` or you can create a symbolic link (named as your diff --git a/doc/NEWS.adoc b/doc/NEWS.adoc index 53600cd8..ea83ca7e 100644 --- a/doc/NEWS.adoc +++ b/doc/NEWS.adoc @@ -25,6 +25,8 @@ High-level summary of changes (work in progress) - A C++11 compiler is now required to build ccache. +- Build tooling switched from automake to cmake. + - Added a `-x/--show-compression` option which shows some statistics about cache compression. diff --git a/docker.sh b/docker.sh new file mode 100755 index 00000000..88159178 --- /dev/null +++ b/docker.sh @@ -0,0 +1,48 @@ +#!/bin/sh -xe + +# This script will run misc/build.sh within a docker image. +# ToDo: use ccache within docker and preserve the cache. + +# Parameter: +# First parameter directory name within buildenv, defaults to travis +# Other parameters will be passed to misc/build.sh + +echo "Warning: Docker support is rather experimental\n" + +BUILDENV=${1:-travis} + +# expose remaining parameters as $* +shift $(( $# > 0 ? 1 : 0 )) + +# Pulling the docker image is actually slower than just creating it locally! +# (comparison on same machine: ~90 sec for pulling but only ~50secs for building locally) +DOCKER_IMAGE_TAG=alexanderlanin/ccache:${BUILDENV}-1 + +# Build (if not exists): +docker build -t ${DOCKER_IMAGE_TAG} buildenv/${BUILDENV} + +# Cache compilation across docker sessions +# ToDo: separate cache for each docker image or is it fine like that? +mkdir -p build +mkdir -p build/docker-ccache + +docker run --rm \ + --volume ${PWD}:/source \ + --volume ${PWD}/build/docker-ccache:/ccache \ + --tmpfs /builddir:rw,exec \ + --workdir /builddir \ + --env CC="${CC:-}" \ + --env CFLAGS="${CFLAGS:-}" \ + --env CXX="${CXX:-}" \ + --env CXXFLAGS="${CXXFLAGS:-}" \ + --env LDFLAGS="${LDFLAGS:-}" \ + --env ASAN_OPTIONS="${ASAN_OPTIONS:-}" \ + --env CCACHE_LOC="/source" \ + --env SPECIAL="${SPECIAL:-}" \ + --env SCAN_BUILD="${SCAN_BUILD:-}" \ + --env CMAKE_PARAMS="${CMAKE_PARAMS:-}" \ + --env BUILDEXTRAFLAGS="${BUILDEXTRAFLAGS:-}" \ + --env NO_TEST="${NO_TEST:-}" \ + --env CCACHE_DIR=/ccache \ + ${DOCKER_IMAGE_TAG} \ + /source/ci/build.sh $* diff --git a/install-sh b/install-sh deleted file mode 100755 index ba5e22ad..00000000 --- a/install-sh +++ /dev/null @@ -1,238 +0,0 @@ -#! /bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. -# - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4 deleted file mode 100644 index bd753b34..00000000 --- a/m4/ax_check_compile_flag.m4 +++ /dev/null @@ -1,53 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) -# -# DESCRIPTION -# -# Check whether the given FLAG works with the current language's compiler -# or gives an error. (Warnings, however, are ignored) -# -# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on -# success/failure. -# -# If EXTRA-FLAGS is defined, it is added to the current language's default -# flags (e.g. CFLAGS) when the check is done. The check is thus made with -# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to -# force the compiler to issue an error when a bad flag is given. -# -# INPUT gives an alternative input source to AC_COMPILE_IFELSE. -# -# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this -# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. -# -# LICENSE -# -# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> -# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com> -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 6 - -AC_DEFUN([AX_CHECK_COMPILE_FLAG], -[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF -AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl -AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ - ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS - _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" - AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], - [AS_VAR_SET(CACHEVAR,[yes])], - [AS_VAR_SET(CACHEVAR,[no])]) - _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) -AS_VAR_IF(CACHEVAR,yes, - [m4_default([$2], :)], - [m4_default([$3], :)]) -AS_VAR_POPDEF([CACHEVAR])dnl -])dnl AX_CHECK_COMPILE_FLAGS diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4 deleted file mode 100644 index 43087b2e..00000000 --- a/m4/ax_cxx_compile_stdcxx.m4 +++ /dev/null @@ -1,951 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) -# -# DESCRIPTION -# -# Check for baseline language coverage in the compiler for the specified -# version of the C++ standard. If necessary, add switches to CXX and -# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard) -# or '14' (for the C++14 standard). -# -# The second argument, if specified, indicates whether you insist on an -# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. -# -std=c++11). If neither is specified, you get whatever works, with -# preference for an extended mode. -# -# The third argument, if specified 'mandatory' or if left unspecified, -# indicates that baseline support for the specified C++ standard is -# required and that the macro should error out if no mode with that -# support is found. If specified 'optional', then configuration proceeds -# regardless, after defining HAVE_CXX${VERSION} if and only if a -# supporting mode is found. -# -# LICENSE -# -# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com> -# Copyright (c) 2012 Zack Weinberg <zackw@panix.com> -# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu> -# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com> -# Copyright (c) 2015 Paul Norman <penorman@mac.com> -# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu> -# Copyright (c) 2016, 2018 Krzesimir Nowak <qdlacz@gmail.com> -# Copyright (c) 2019 Enji Cooper <yaneurabeya@gmail.com> -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 11 - -dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro -dnl (serial version number 13). - -AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl - m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"], - [$1], [14], [ax_cxx_compile_alternatives="14 1y"], - [$1], [17], [ax_cxx_compile_alternatives="17 1z"], - [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl - m4_if([$2], [], [], - [$2], [ext], [], - [$2], [noext], [], - [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl - m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], - [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], - [$3], [optional], [ax_cxx_compile_cxx$1_required=false], - [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) - AC_LANG_PUSH([C++])dnl - ac_success=no - - m4_if([$2], [noext], [], [dnl - if test x$ac_success = xno; then - for alternative in ${ax_cxx_compile_alternatives}; do - switch="-std=gnu++${alternative}" - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, - $cachevar, - [ac_save_CXX="$CXX" - CXX="$CXX $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXX="$ac_save_CXX"]) - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - fi]) - - m4_if([$2], [ext], [], [dnl - if test x$ac_success = xno; then - dnl HP's aCC needs +std=c++11 according to: - dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf - dnl Cray's crayCC needs "-h std=c++11" - for alternative in ${ax_cxx_compile_alternatives}; do - for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, - $cachevar, - [ac_save_CXX="$CXX" - CXX="$CXX $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXX="$ac_save_CXX"]) - if eval test x\$$cachevar = xyes; then - CXX="$CXX $switch" - if test -n "$CXXCPP" ; then - CXXCPP="$CXXCPP $switch" - fi - ac_success=yes - break - fi - done - if test x$ac_success = xyes; then - break - fi - done - fi]) - AC_LANG_POP([C++]) - if test x$ax_cxx_compile_cxx$1_required = xtrue; then - if test x$ac_success = xno; then - AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) - fi - fi - if test x$ac_success = xno; then - HAVE_CXX$1=0 - AC_MSG_NOTICE([No compiler with C++$1 support was found]) - else - HAVE_CXX$1=1 - AC_DEFINE(HAVE_CXX$1,1, - [define if the compiler supports basic C++$1 syntax]) - fi - AC_SUBST(HAVE_CXX$1) -]) - - -dnl Test body for checking C++11 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 -) - - -dnl Test body for checking C++14 support - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 -) - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17], - _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 - _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 -) - -dnl Tests for new features in C++11 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ - -// If the compiler admits that it is not ready for C++11, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201103L - -#error "This is not a C++11 compiler" - -#else - -namespace cxx11 -{ - - namespace test_static_assert - { - - template <typename T> - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - } - - namespace test_final_override - { - - struct Base - { - virtual ~Base() {} - virtual void f() {} - }; - - struct Derived : public Base - { - virtual ~Derived() override {} - virtual void f() override {} - }; - - } - - namespace test_double_right_angle_brackets - { - - template < typename T > - struct check {}; - - typedef check<void> single_type; - typedef check<check<void>> double_type; - typedef check<check<check<void>>> triple_type; - typedef check<check<check<check<void>>>> quadruple_type; - - } - - namespace test_decltype - { - - int - f() - { - int a = 1; - decltype(a) b = 2; - return a + b; - } - - } - - namespace test_type_deduction - { - - template < typename T1, typename T2 > - struct is_same - { - static const bool value = false; - }; - - template < typename T > - struct is_same<T, T> - { - static const bool value = true; - }; - - template < typename T1, typename T2 > - auto - add(T1 a1, T2 a2) -> decltype(a1 + a2) - { - return a1 + a2; - } - - int - test(const int c, volatile int v) - { - static_assert(is_same<int, decltype(0)>::value == true, ""); - static_assert(is_same<int, decltype(c)>::value == false, ""); - static_assert(is_same<int, decltype(v)>::value == false, ""); - auto ac = c; - auto av = v; - auto sumi = ac + av + 'x'; - auto sumf = ac + av + 1.0; - static_assert(is_same<int, decltype(ac)>::value == true, ""); - static_assert(is_same<int, decltype(av)>::value == true, ""); - static_assert(is_same<int, decltype(sumi)>::value == true, ""); - static_assert(is_same<int, decltype(sumf)>::value == false, ""); - static_assert(is_same<int, decltype(add(c, v))>::value == true, ""); - return (sumf > 0.0) ? sumi : add(c, v); - } - - } - - namespace test_noexcept - { - - int f() { return 0; } - int g() noexcept { return 0; } - - static_assert(noexcept(f()) == false, ""); - static_assert(noexcept(g()) == true, ""); - - } - - namespace test_constexpr - { - - template < typename CharT > - unsigned long constexpr - strlen_c_r(const CharT *const s, const unsigned long acc) noexcept - { - return *s ? strlen_c_r(s + 1, acc + 1) : acc; - } - - template < typename CharT > - unsigned long constexpr - strlen_c(const CharT *const s) noexcept - { - return strlen_c_r(s, 0UL); - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("1") == 1UL, ""); - static_assert(strlen_c("example") == 7UL, ""); - static_assert(strlen_c("another\0example") == 7UL, ""); - - } - - namespace test_rvalue_references - { - - template < int N > - struct answer - { - static constexpr int value = N; - }; - - answer<1> f(int&) { return answer<1>(); } - answer<2> f(const int&) { return answer<2>(); } - answer<3> f(int&&) { return answer<3>(); } - - void - test() - { - int i = 0; - const int c = 0; - static_assert(decltype(f(i))::value == 1, ""); - static_assert(decltype(f(c))::value == 2, ""); - static_assert(decltype(f(0))::value == 3, ""); - } - - } - - namespace test_uniform_initialization - { - - struct test - { - static const int zero {}; - static const int one {1}; - }; - - static_assert(test::zero == 0, ""); - static_assert(test::one == 1, ""); - - } - - namespace test_lambdas - { - - void - test1() - { - auto lambda1 = [](){}; - auto lambda2 = lambda1; - lambda1(); - lambda2(); - } - - int - test2() - { - auto a = [](int i, int j){ return i + j; }(1, 2); - auto b = []() -> int { return '0'; }(); - auto c = [=](){ return a + b; }(); - auto d = [&](){ return c; }(); - auto e = [a, &b](int x) mutable { - const auto identity = [](int y){ return y; }; - for (auto i = 0; i < a; ++i) - a += b--; - return x + identity(a + b); - }(0); - return a + b + c + d + e; - } - - int - test3() - { - const auto nullary = [](){ return 0; }; - const auto unary = [](int x){ return x; }; - using nullary_t = decltype(nullary); - using unary_t = decltype(unary); - const auto higher1st = [](nullary_t f){ return f(); }; - const auto higher2nd = [unary](nullary_t f1){ - return [unary, f1](unary_t f2){ return f2(unary(f1())); }; - }; - return higher1st(nullary) + higher2nd(nullary)(unary); - } - - } - - namespace test_variadic_templates - { - - template <int...> - struct sum; - - template <int N0, int... N1toN> - struct sum<N0, N1toN...> - { - static constexpr auto value = N0 + sum<N1toN...>::value; - }; - - template <> - struct sum<> - { - static constexpr auto value = 0; - }; - - static_assert(sum<>::value == 0, ""); - static_assert(sum<1>::value == 1, ""); - static_assert(sum<23>::value == 23, ""); - static_assert(sum<1, 2>::value == 3, ""); - static_assert(sum<5, 5, 11>::value == 21, ""); - static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); - - } - - // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae - // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function - // because of this. - namespace test_template_alias_sfinae - { - - struct foo {}; - - template<typename T> - using member = typename T::member_type; - - template<typename T> - void func(...) {} - - template<typename T> - void func(member<T>*) {} - - void test(); - - void test() { func<foo>(0); } - - } - -} // namespace cxx11 - -#endif // __cplusplus >= 201103L - -]]) - - -dnl Tests for new features in C++14 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ - -// If the compiler admits that it is not ready for C++14, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201402L - -#error "This is not a C++14 compiler" - -#else - -namespace cxx14 -{ - - namespace test_polymorphic_lambdas - { - - int - test() - { - const auto lambda = [](auto&&... args){ - const auto istiny = [](auto x){ - return (sizeof(x) == 1UL) ? 1 : 0; - }; - const int aretiny[] = { istiny(args)... }; - return aretiny[0]; - }; - return lambda(1, 1L, 1.0f, '1'); - } - - } - - namespace test_binary_literals - { - - constexpr auto ivii = 0b0000000000101010; - static_assert(ivii == 42, "wrong value"); - - } - - namespace test_generalized_constexpr - { - - template < typename CharT > - constexpr unsigned long - strlen_c(const CharT *const s) noexcept - { - auto length = 0UL; - for (auto p = s; *p; ++p) - ++length; - return length; - } - - static_assert(strlen_c("") == 0UL, ""); - static_assert(strlen_c("x") == 1UL, ""); - static_assert(strlen_c("test") == 4UL, ""); - static_assert(strlen_c("another\0test") == 7UL, ""); - - } - - namespace test_lambda_init_capture - { - - int - test() - { - auto x = 0; - const auto lambda1 = [a = x](int b){ return a + b; }; - const auto lambda2 = [a = lambda1(x)](){ return a; }; - return lambda2(); - } - - } - - namespace test_digit_separators - { - - constexpr auto ten_million = 100'000'000; - static_assert(ten_million == 100000000, ""); - - } - - namespace test_return_type_deduction - { - - auto f(int& x) { return x; } - decltype(auto) g(int& x) { return x; } - - template < typename T1, typename T2 > - struct is_same - { - static constexpr auto value = false; - }; - - template < typename T > - struct is_same<T, T> - { - static constexpr auto value = true; - }; - - int - test() - { - auto x = 0; - static_assert(is_same<int, decltype(f(x))>::value, ""); - static_assert(is_same<int&, decltype(g(x))>::value, ""); - return x; - } - - } - -} // namespace cxx14 - -#endif // __cplusplus >= 201402L - -]]) - - -dnl Tests for new features in C++17 - -m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[ - -// If the compiler admits that it is not ready for C++17, why torture it? -// Hopefully, this will speed up the test. - -#ifndef __cplusplus - -#error "This is not a C++ compiler" - -#elif __cplusplus < 201703L - -#error "This is not a C++17 compiler" - -#else - -#include <initializer_list> -#include <utility> -#include <type_traits> - -namespace cxx17 -{ - - namespace test_constexpr_lambdas - { - - constexpr int foo = [](){return 42;}(); - - } - - namespace test::nested_namespace::definitions - { - - } - - namespace test_fold_expression - { - - template<typename... Args> - int multiply(Args... args) - { - return (args * ... * 1); - } - - template<typename... Args> - bool all(Args... args) - { - return (args && ...); - } - - } - - namespace test_extended_static_assert - { - - static_assert (true); - - } - - namespace test_auto_brace_init_list - { - - auto foo = {5}; - auto bar {5}; - - static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value); - static_assert(std::is_same<int, decltype(bar)>::value); - } - - namespace test_typename_in_template_template_parameter - { - - template<template<typename> typename X> struct D; - - } - - namespace test_fallthrough_nodiscard_maybe_unused_attributes - { - - int f1() - { - return 42; - } - - [[nodiscard]] int f2() - { - [[maybe_unused]] auto unused = f1(); - - switch (f1()) - { - case 17: - f1(); - [[fallthrough]]; - case 42: - f1(); - } - return f1(); - } - - } - - namespace test_extended_aggregate_initialization - { - - struct base1 - { - int b1, b2 = 42; - }; - - struct base2 - { - base2() { - b3 = 42; - } - int b3; - }; - - struct derived : base1, base2 - { - int d; - }; - - derived d1 {{1, 2}, {}, 4}; // full initialization - derived d2 {{}, {}, 4}; // value-initialized bases - - } - - namespace test_general_range_based_for_loop - { - - struct iter - { - int i; - - int& operator* () - { - return i; - } - - const int& operator* () const - { - return i; - } - - iter& operator++() - { - ++i; - return *this; - } - }; - - struct sentinel - { - int i; - }; - - bool operator== (const iter& i, const sentinel& s) - { - return i.i == s.i; - } - - bool operator!= (const iter& i, const sentinel& s) - { - return !(i == s); - } - - struct range - { - iter begin() const - { - return {0}; - } - - sentinel end() const - { - return {5}; - } - }; - - void f() - { - range r {}; - - for (auto i : r) - { - [[maybe_unused]] auto v = i; - } - } - - } - - namespace test_lambda_capture_asterisk_this_by_value - { - - struct t - { - int i; - int foo() - { - return [*this]() - { - return i; - }(); - } - }; - - } - - namespace test_enum_class_construction - { - - enum class byte : unsigned char - {}; - - byte foo {42}; - - } - - namespace test_constexpr_if - { - - template <bool cond> - int f () - { - if constexpr(cond) - { - return 13; - } - else - { - return 42; - } - } - - } - - namespace test_selection_statement_with_initializer - { - - int f() - { - return 13; - } - - int f2() - { - if (auto i = f(); i > 0) - { - return 3; - } - - switch (auto i = f(); i + 4) - { - case 17: - return 2; - - default: - return 1; - } - } - - } - - namespace test_template_argument_deduction_for_class_templates - { - - template <typename T1, typename T2> - struct pair - { - pair (T1 p1, T2 p2) - : m1 {p1}, - m2 {p2} - {} - - T1 m1; - T2 m2; - }; - - void f() - { - [[maybe_unused]] auto p = pair{13, 42u}; - } - - } - - namespace test_non_type_auto_template_parameters - { - - template <auto n> - struct B - {}; - - B<5> b1; - B<'a'> b2; - - } - - namespace test_structured_bindings - { - - int arr[2] = { 1, 2 }; - std::pair<int, int> pr = { 1, 2 }; - - auto f1() -> int(&)[2] - { - return arr; - } - - auto f2() -> std::pair<int, int>& - { - return pr; - } - - struct S - { - int x1 : 2; - volatile double y1; - }; - - S f3() - { - return {}; - } - - auto [ x1, y1 ] = f1(); - auto& [ xr1, yr1 ] = f1(); - auto [ x2, y2 ] = f2(); - auto& [ xr2, yr2 ] = f2(); - const auto [ x3, y3 ] = f3(); - - } - - namespace test_exception_spec_type_system - { - - struct Good {}; - struct Bad {}; - - void g1() noexcept; - void g2(); - - template<typename T> - Bad - f(T*, T*); - - template<typename T1, typename T2> - Good - f(T1*, T2*); - - static_assert (std::is_same_v<Good, decltype(f(g1, g2))>); - - } - - namespace test_inline_variables - { - - template<class T> void f(T) - {} - - template<class T> inline T g(T) - { - return T{}; - } - - template<> inline void f<>(int) - {} - - template<> int g<>(int) - { - return 5; - } - - } - -} // namespace cxx17 - -#endif // __cplusplus < 201703L - -]]) diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4 deleted file mode 100644 index 4920e073..00000000 --- a/m4/ax_pthread.m4 +++ /dev/null @@ -1,486 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_pthread.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -# -# DESCRIPTION -# -# This macro figures out how to build C programs using POSIX threads. It -# sets the PTHREAD_LIBS output variable to the threads library and linker -# flags, and the PTHREAD_CFLAGS output variable to any special C compiler -# flags that are needed. (The user can also force certain compiler -# flags/libs to be tested by setting these environment variables.) -# -# Also sets PTHREAD_CC to any special C compiler that is needed for -# multi-threaded programs (defaults to the value of CC otherwise). (This -# is necessary on AIX to use the special cc_r compiler alias.) -# -# NOTE: You are assumed to not only compile your program with these flags, -# but also to link with them as well. For example, you might link with -# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS -# -# If you are only building threaded programs, you may wish to use these -# variables in your default LIBS, CFLAGS, and CC: -# -# LIBS="$PTHREAD_LIBS $LIBS" -# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" -# CC="$PTHREAD_CC" -# -# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant -# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to -# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). -# -# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the -# PTHREAD_PRIO_INHERIT symbol is defined when compiling with -# PTHREAD_CFLAGS. -# -# ACTION-IF-FOUND is a list of shell commands to run if a threads library -# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it -# is not found. If ACTION-IF-FOUND is not specified, the default action -# will define HAVE_PTHREAD. -# -# Please let the authors know if this macro fails on any platform, or if -# you have any other suggestions or comments. This macro was based on work -# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help -# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by -# Alejandro Forero Cuervo to the autoconf macro repository. We are also -# grateful for the helpful feedback of numerous users. -# -# Updated for Autoconf 2.68 by Daniel Richard G. -# -# LICENSE -# -# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu> -# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG> -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see <https://www.gnu.org/licenses/>. -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 25 - -AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) -AC_DEFUN([AX_PTHREAD], [ -AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_CC]) -AC_REQUIRE([AC_PROG_SED]) -AC_LANG_PUSH([C]) -ax_pthread_ok=no - -# We used to check for pthread.h first, but this fails if pthread.h -# requires special compiler flags (e.g. on Tru64 or Sequent). -# It gets checked for in the link test anyway. - -# First of all, check if the user has set any of the PTHREAD_LIBS, -# etcetera environment variables, and if threads linking works using -# them: -if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then - ax_pthread_save_CC="$CC" - ax_pthread_save_CFLAGS="$CFLAGS" - ax_pthread_save_LIBS="$LIBS" - AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"]) - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS]) - AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes]) - AC_MSG_RESULT([$ax_pthread_ok]) - if test "x$ax_pthread_ok" = "xno"; then - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" - fi - CC="$ax_pthread_save_CC" - CFLAGS="$ax_pthread_save_CFLAGS" - LIBS="$ax_pthread_save_LIBS" -fi - -# We must check for the threads library under a number of different -# names; the ordering is very important because some systems -# (e.g. DEC) have both -lpthread and -lpthreads, where one of the -# libraries is broken (non-POSIX). - -# Create a list of thread flags to try. Items starting with a "-" are -# C compiler flags, and other items are library names, except for "none" -# which indicates that we try without any flags at all, and "pthread-config" -# which is a program returning the flags for the Pth emulation library. - -ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" - -# The ordering *is* (sometimes) important. Some notes on the -# individual items follow: - -# pthreads: AIX (must check this before -lpthread) -# none: in case threads are in libc; should be tried before -Kthread and -# other compiler flags to prevent continual compiler warnings -# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) -# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 -# (Note: HP C rejects this with "bad form for `-t' option") -# -pthreads: Solaris/gcc (Note: HP C also rejects) -# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it -# doesn't hurt to check since this sometimes defines pthreads and -# -D_REENTRANT too), HP C (must be checked before -lpthread, which -# is present but should not be used directly; and before -mthreads, -# because the compiler interprets this as "-mt" + "-hreads") -# -mthreads: Mingw32/gcc, Lynx/gcc -# pthread: Linux, etcetera -# --thread-safe: KAI C++ -# pthread-config: use pthread-config program (for GNU Pth library) - -case $host_os in - - freebsd*) - - # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) - # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) - - ax_pthread_flags="-kthread lthread $ax_pthread_flags" - ;; - - hpux*) - - # From the cc(1) man page: "[-mt] Sets various -D flags to enable - # multi-threading and also sets -lpthread." - - ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" - ;; - - openedition*) - - # IBM z/OS requires a feature-test macro to be defined in order to - # enable POSIX threads at all, so give the user a hint if this is - # not set. (We don't define these ourselves, as they can affect - # other portions of the system API in unpredictable ways.) - - AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING], - [ -# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) - AX_PTHREAD_ZOS_MISSING -# endif - ], - [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])]) - ;; - - solaris*) - - # On Solaris (at least, for some versions), libc contains stubbed - # (non-functional) versions of the pthreads routines, so link-based - # tests will erroneously succeed. (N.B.: The stubs are missing - # pthread_cleanup_push, or rather a function called by this macro, - # so we could check for that, but who knows whether they'll stub - # that too in a future libc.) So we'll check first for the - # standard Solaris way of linking pthreads (-mt -lpthread). - - ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags" - ;; -esac - -# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) - -AS_IF([test "x$GCC" = "xyes"], - [ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"]) - -# The presence of a feature test macro requesting re-entrant function -# definitions is, on some systems, a strong hint that pthreads support is -# correctly enabled - -case $host_os in - darwin* | hpux* | linux* | osf* | solaris*) - ax_pthread_check_macro="_REENTRANT" - ;; - - aix*) - ax_pthread_check_macro="_THREAD_SAFE" - ;; - - *) - ax_pthread_check_macro="--" - ;; -esac -AS_IF([test "x$ax_pthread_check_macro" = "x--"], - [ax_pthread_check_cond=0], - [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"]) - -# Are we compiling with Clang? - -AC_CACHE_CHECK([whether $CC is Clang], - [ax_cv_PTHREAD_CLANG], - [ax_cv_PTHREAD_CLANG=no - # Note that Autoconf sets GCC=yes for Clang as well as GCC - if test "x$GCC" = "xyes"; then - AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG], - [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ -# if defined(__clang__) && defined(__llvm__) - AX_PTHREAD_CC_IS_CLANG -# endif - ], - [ax_cv_PTHREAD_CLANG=yes]) - fi - ]) -ax_pthread_clang="$ax_cv_PTHREAD_CLANG" - -ax_pthread_clang_warning=no - -# Clang needs special handling, because older versions handle the -pthread -# option in a rather... idiosyncratic way - -if test "x$ax_pthread_clang" = "xyes"; then - - # Clang takes -pthread; it has never supported any other flag - - # (Note 1: This will need to be revisited if a system that Clang - # supports has POSIX threads in a separate library. This tends not - # to be the way of modern systems, but it's conceivable.) - - # (Note 2: On some systems, notably Darwin, -pthread is not needed - # to get POSIX threads support; the API is always present and - # active. We could reasonably leave PTHREAD_CFLAGS empty. But - # -pthread does define _REENTRANT, and while the Darwin headers - # ignore this macro, third-party headers might not.) - - PTHREAD_CFLAGS="-pthread" - PTHREAD_LIBS= - - ax_pthread_ok=yes - - # However, older versions of Clang make a point of warning the user - # that, in an invocation where only linking and no compilation is - # taking place, the -pthread option has no effect ("argument unused - # during compilation"). They expect -pthread to be passed in only - # when source code is being compiled. - # - # Problem is, this is at odds with the way Automake and most other - # C build frameworks function, which is that the same flags used in - # compilation (CFLAGS) are also used in linking. Many systems - # supported by AX_PTHREAD require exactly this for POSIX threads - # support, and in fact it is often not straightforward to specify a - # flag that is used only in the compilation phase and not in - # linking. Such a scenario is extremely rare in practice. - # - # Even though use of the -pthread flag in linking would only print - # a warning, this can be a nuisance for well-run software projects - # that build with -Werror. So if the active version of Clang has - # this misfeature, we search for an option to squash it. - - AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread], - [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG], - [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown - # Create an alternate version of $ac_link that compiles and - # links in two steps (.c -> .o, .o -> exe) instead of one - # (.c -> exe), because the warning occurs only in the second - # step - ax_pthread_save_ac_link="$ac_link" - ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' - ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"` - ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" - ax_pthread_save_CFLAGS="$CFLAGS" - for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do - AS_IF([test "x$ax_pthread_try" = "xunknown"], [break]) - CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" - ac_link="$ax_pthread_save_ac_link" - AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], - [ac_link="$ax_pthread_2step_ac_link" - AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], - [break]) - ]) - done - ac_link="$ax_pthread_save_ac_link" - CFLAGS="$ax_pthread_save_CFLAGS" - AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no]) - ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" - ]) - - case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in - no | unknown) ;; - *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; - esac - -fi # $ax_pthread_clang = yes - -if test "x$ax_pthread_ok" = "xno"; then -for ax_pthread_try_flag in $ax_pthread_flags; do - - case $ax_pthread_try_flag in - none) - AC_MSG_CHECKING([whether pthreads work without any flags]) - ;; - - -mt,pthread) - AC_MSG_CHECKING([whether pthreads work with -mt -lpthread]) - PTHREAD_CFLAGS="-mt" - PTHREAD_LIBS="-lpthread" - ;; - - -*) - AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) - PTHREAD_CFLAGS="$ax_pthread_try_flag" - ;; - - pthread-config) - AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) - AS_IF([test "x$ax_pthread_config" = "xno"], [continue]) - PTHREAD_CFLAGS="`pthread-config --cflags`" - PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" - ;; - - *) - AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag]) - PTHREAD_LIBS="-l$ax_pthread_try_flag" - ;; - esac - - ax_pthread_save_CFLAGS="$CFLAGS" - ax_pthread_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - - # Check for various functions. We must include pthread.h, - # since some functions may be macros. (On the Sequent, we - # need a special flag -Kthread to make this header compile.) - # We check for pthread_join because it is in -lpthread on IRIX - # while pthread_create is in libc. We check for pthread_attr_init - # due to DEC craziness with -lpthreads. We check for - # pthread_cleanup_push because it is one of the few pthread - # functions on Solaris that doesn't have a non-functional libc stub. - # We try pthread_create on general principles. - - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h> -# if $ax_pthread_check_cond -# error "$ax_pthread_check_macro must be defined" -# endif - static void routine(void *a) { a = 0; } - static void *start_routine(void *a) { return a; }], - [pthread_t th; pthread_attr_t attr; - pthread_create(&th, 0, start_routine, 0); - pthread_join(th, 0); - pthread_attr_init(&attr); - pthread_cleanup_push(routine, 0); - pthread_cleanup_pop(0) /* ; */])], - [ax_pthread_ok=yes], - []) - - CFLAGS="$ax_pthread_save_CFLAGS" - LIBS="$ax_pthread_save_LIBS" - - AC_MSG_RESULT([$ax_pthread_ok]) - AS_IF([test "x$ax_pthread_ok" = "xyes"], [break]) - - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" -done -fi - -# Various other checks: -if test "x$ax_pthread_ok" = "xyes"; then - ax_pthread_save_CFLAGS="$CFLAGS" - ax_pthread_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - - # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. - AC_CACHE_CHECK([for joinable pthread attribute], - [ax_cv_PTHREAD_JOINABLE_ATTR], - [ax_cv_PTHREAD_JOINABLE_ATTR=unknown - for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>], - [int attr = $ax_pthread_attr; return attr /* ; */])], - [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break], - []) - done - ]) - AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ - test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ - test "x$ax_pthread_joinable_attr_defined" != "xyes"], - [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], - [$ax_cv_PTHREAD_JOINABLE_ATTR], - [Define to necessary symbol if this constant - uses a non-standard name on your system.]) - ax_pthread_joinable_attr_defined=yes - ]) - - AC_CACHE_CHECK([whether more special flags are required for pthreads], - [ax_cv_PTHREAD_SPECIAL_FLAGS], - [ax_cv_PTHREAD_SPECIAL_FLAGS=no - case $host_os in - solaris*) - ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" - ;; - esac - ]) - AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ - test "x$ax_pthread_special_flags_added" != "xyes"], - [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" - ax_pthread_special_flags_added=yes]) - - AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], - [ax_cv_PTHREAD_PRIO_INHERIT], - [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], - [[int i = PTHREAD_PRIO_INHERIT; - return i;]])], - [ax_cv_PTHREAD_PRIO_INHERIT=yes], - [ax_cv_PTHREAD_PRIO_INHERIT=no]) - ]) - AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ - test "x$ax_pthread_prio_inherit_defined" != "xyes"], - [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.]) - ax_pthread_prio_inherit_defined=yes - ]) - - CFLAGS="$ax_pthread_save_CFLAGS" - LIBS="$ax_pthread_save_LIBS" - - # More AIX lossage: compile with *_r variant - if test "x$GCC" != "xyes"; then - case $host_os in - aix*) - AS_CASE(["x/$CC"], - [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], - [#handle absolute path differently from PATH based program lookup - AS_CASE(["x$CC"], - [x/*], - [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], - [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) - ;; - esac - fi -fi - -test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" - -AC_SUBST([PTHREAD_LIBS]) -AC_SUBST([PTHREAD_CFLAGS]) -AC_SUBST([PTHREAD_CC]) - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test "x$ax_pthread_ok" = "xyes"; then - ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) - : -else - ax_pthread_ok=no - $2 -fi -AC_LANG_POP -])dnl AX_PTHREAD diff --git a/m4/clang.m4 b/m4/clang.m4 deleted file mode 100644 index 11911ce2..00000000 --- a/m4/clang.m4 +++ /dev/null @@ -1,19 +0,0 @@ -# _AC_LANG_COMPILER_CLANG -# --------------------- -# Check whether the compiler for the current language is clang. -# Adapted from standard autoconf function: _AC_LANG_COMPILER_GNU -# -# Note: clang also identifies itself as a GNU compiler (gcc 4.2.1) -# for compatibility reasons, so that cannot be used to determine -m4_define([_AC_LANG_COMPILER_CLANG], -[AC_CACHE_CHECK([whether we are using the clang _AC_LANG compiler], - [ac_cv_[]_AC_LANG_ABBREV[]_compiler_clang], -[_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#ifndef __clang__ - choke me -#endif -]])], - [ac_compiler_clang=yes], - [ac_compiler_clang=no]) -ac_cv_[]_AC_LANG_ABBREV[]_compiler_clang=$ac_compiler_clang -])])# _AC_LANG_COMPILER_CLANG - diff --git a/m4/feature_macros.m4 b/m4/feature_macros.m4 deleted file mode 100644 index e51adc1a..00000000 --- a/m4/feature_macros.m4 +++ /dev/null @@ -1,149 +0,0 @@ -dnl =========================================================================== -dnl Feature macro stuff borrowed from Python's configure.in -dnl -dnl For license information, see -dnl <http://www.python.org/download/releases/2.6.2/license/>. -dnl =========================================================================== - -# The later defininition of _XOPEN_SOURCE disables certain features -# on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone). -AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features]) - -# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables -# certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable -# them. -AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features]) - -# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables -# certain features on FreeBSD, so we need __BSD_VISIBLE to re-enable -# them. -AC_DEFINE(__BSD_VISIBLE, 1, [Define on FreeBSD to activate all library features]) - -# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables -# u_int on Irix 5.3. Defining _BSD_TYPES brings it back. -AC_DEFINE(_BSD_TYPES, 1, [Define on Irix to enable u_int]) - -# The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables -# certain features on Mac OS X, so we need _DARWIN_C_SOURCE to re-enable -# them. -AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features]) - -define_xopen_source=yes - -ac_sys_system=`uname -s` -if test "$ac_sys_system" = "AIX" -o "$ac_sys_system" = "Monterey64" \ - -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then - ac_sys_release=`uname -v` -else - ac_sys_release=`uname -r` -fi - -# Some systems cannot stand _XOPEN_SOURCE being defined at all; they -# disable features if it is defined, without any means to access these -# features as extensions. For these systems, we skip the definition of -# _XOPEN_SOURCE. Before adding a system to the list to gain access to -# some feature, make sure there is no alternative way to access this -# feature. Also, when using wildcards, make sure you have verified the -# need for not defining _XOPEN_SOURCE on all systems matching the -# wildcard, and that the wildcard does not include future systems -# (which may remove their limitations). -dnl quadrigraphs "@<:@" and "@:>@" produce "[" and "]" in the output -case $ac_sys_system/$ac_sys_release in - # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined, - # even though select is a POSIX function. Reported by J. Ribbens. - # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish. - OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@ | OpenBSD/4.@<:@0123@:>@) - define_xopen_source=no - # OpenBSD undoes our definition of __BSD_VISIBLE if _XOPEN_SOURCE is - # also defined. This can be overridden by defining _BSD_SOURCE - # As this has a different meaning on Linux, only define it on OpenBSD - AC_DEFINE(_BSD_SOURCE, 1, [Define on OpenBSD to activate all library features]) - ;; - # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of - # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by - # Marc Recht - NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@) - define_xopen_source=no;; - # On Solaris 2.6, sys/wait.h is inconsistent in the usage - # of union __?sigval. Reported by Stuart Bishop. - SunOS/5.6) - define_xopen_source=no;; - # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE, - # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice. - # Reconfirmed for 7.1.4 by Martin v. Loewis. - OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-4@:>@) - define_xopen_source=no;; - # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE, - # but used in struct sockaddr.sa_family. Reported by Tim Rice. - SCO_SV/3.2) - define_xopen_source=no;; - # On FreeBSD 4, the math functions C89 does not cover are never defined - # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them. - FreeBSD/4.*) - define_xopen_source=no;; - # On MacOS X 10.2, a bug in ncurses.h means that it craps out if - # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which - # identifies itself as Darwin/7.* - # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE - # disables platform specific features beyond repair. - # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE - # has no effect, don't bother defining them - Darwin/@<:@6789@:>@.*) - define_xopen_source=no;; - # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but - # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined - # or has another value. By not (re)defining it, the defaults come in place. - AIX/4) - define_xopen_source=no;; - AIX/5|AIX/7) - if test `uname -r` -eq 1; then - define_xopen_source=no - fi - ;; - # On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from - # defining NI_NUMERICHOST. - QNX/6.3.2) - define_xopen_source=no - ;; - -esac - -if test $define_xopen_source = yes -then - # On Solaris w/ g++ it appears that _XOPEN_SOURCE has to be - # defined precisely as g++ defines it - # Furthermore, on Solaris 10, XPG6 requires the use of a C99 - # compiler - case $ac_sys_system/$ac_sys_release in - SunOS/5.8|SunOS/5.9|SunOS/5.10) - AC_DEFINE(_XOPEN_SOURCE, 500, - Define to the level of X/Open that your system supports) - ;; - SunOS/5.11) - ;; - *) - AC_DEFINE(_XOPEN_SOURCE, 700, - Define to the level of X/Open that your system supports) - ;; - esac - - # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires - # definition of _XOPEN_SOURCE_EXTENDED and _POSIX_C_SOURCE, or else - # several APIs are not declared. Since this is also needed in some - # cases for HP-UX, we define it globally. - # except for Solaris 10, where it must not be defined, - # as it implies XPG4.2 - case $ac_sys_system/$ac_sys_release in - SunOS/5.10|SunOS/5.11) - AC_DEFINE(__EXTENSIONS__, 1, - Define to activate Unix95-and-earlier features) - ;; - *) - AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, - Define to activate Unix95-and-earlier features) - ;; - esac - - AC_DEFINE(_POSIX_C_SOURCE, 200809L, Define to activate features from IEEE Stds 1003.1-2001) - -fi diff --git a/misc/build.sh b/misc/build.sh deleted file mode 100755 index f46c6994..00000000 --- a/misc/build.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -ex -# doc/INSTALL.md -./autogen.sh -./configure -make -make ${*:-test} diff --git a/misc/check_format.sh b/misc/check_format.sh index 56ee3db2..dff3d94d 100755 --- a/misc/check_format.sh +++ b/misc/check_format.sh @@ -1,4 +1,24 @@ -#!/bin/sh -ex +#!/bin/sh -e + +if [ -n "${VERBOSE}" ]; then + set -x +fi # xarg returns 1 if any run-clang-format call returns 1. +clang-format --version find src unittest -path src/third_party -prune -o -regex ".*\.[ch]p?p?" -print0 | xargs -0 -n1 misc/run-clang-format --check + +# Top level CMakeLists.txt + subidrectories. +# This avoids running the check on any build directories. +if hash cmake-format 2>/dev/null; then + printf "cmake-format version " + cmake-format --version + CLANG_FORMAT=cmake-format misc/run-clang-format --check CMakeLists.txt + find cmake -name "*.cmake" -print0 | CLANG_FORMAT=cmake-format xargs -0 -n1 misc/run-clang-format --check + find src unittest -name "CMakeLists.txt" -print0 | CLANG_FORMAT=cmake-format xargs -0 -n1 misc/run-clang-format --check +else + echo "Note: cmake-format not installed. CMake files will not be checked for correct formatting." + echo "You can install it via pip3 install cmake-format" +fi + +echo "Format is ok" diff --git a/misc/format.sh b/misc/format.sh index a53acc5e..30892bf5 100755 --- a/misc/format.sh +++ b/misc/format.sh @@ -1,2 +1,20 @@ -#!/bin/sh -ex +#!/bin/sh -e + +if [ -n "${VERBOSE}" ]; then + set -x +fi + find src unittest -path src/third_party -prune -o -regex ".*\.[ch]p?p?" -exec misc/run-clang-format {} \; + +if hash cmake-format 2>/dev/null; then + # Top level CMakeLists.txt + subidrectories. + # This avoids running the check on any build directories. + cmake-format -i CMakeLists.txt + find cmake -name "*.cmake" -exec cmake-format -i {} \; + find src unittest -name "CMakeLists.txt" -exec cmake-format -i {} \; +else + echo "Note: cmake-format not installed. CMake files will not be formatted." + echo "You can install it via pip3 install cmake-format" +fi + +echo "Formating complete" diff --git a/misc/freebsd/README b/misc/freebsd/README deleted file mode 100644 index 2faebe6c..00000000 --- a/misc/freebsd/README +++ /dev/null @@ -1,12 +0,0 @@ -How to use Vagrant to test ccache on FreeBSD -============================================ - -vagrant up -vagrant ssh - -vagrant@freebsd:~ % git clone https://github.com/ccache/ccache.git -vagrant@freebsd:~ % cd ccache -vagrant@freebsd:~/ccache % ./autogen.sh -vagrant@freebsd:~/ccache % ./configure -vagrant@freebsd:~/ccache % gmake -vagrant@freebsd:~/ccache % gmake test diff --git a/misc/freebsd/Vagrantfile b/misc/freebsd/Vagrantfile deleted file mode 100644 index da126cdc..00000000 --- a/misc/freebsd/Vagrantfile +++ /dev/null @@ -1,23 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -Vagrant.configure("2") do |config| - config.vm.guest = :freebsd - config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", disabled: true - config.vm.box = "freebsd/FreeBSD-12.0-CURRENT" - config.ssh.shell = "sh" - config.vm.base_mac = "080027D14C66" - - config.vm.provider :virtualbox do |vb| - vb.customize ["modifyvm", :id, "--memory", "1024"] - vb.customize ["modifyvm", :id, "--cpus", "1"] - vb.customize ["modifyvm", :id, "--hwvirtex", "on"] - vb.customize ["modifyvm", :id, "--audio", "none"] - vb.customize ["modifyvm", :id, "--nictype1", "virtio"] - vb.customize ["modifyvm", :id, "--nictype2", "virtio"] - end - - config.vm.provision "shell", inline: <<-SHELL - pkg install -y git gmake bash autoconf - SHELL -end diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 00000000..dc1ac78b --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,62 @@ +add_library( + ccache_lib STATIC + Args.cpp + AtomicFile.cpp + CacheEntryReader.cpp + CacheEntryWriter.cpp + CacheFile.cpp + Compression.cpp + Compressor.cpp + Config.cpp + Context.cpp + Counters.cpp + Decompressor.cpp + InodeCache.cpp + Lockfile.cpp + MiniTrace.cpp + NullCompressor.cpp + NullDecompressor.cpp + ProgressBar.cpp + SignalHandler.cpp + Stat.cpp + ThreadPool.cpp + Util.cpp + ZstdCompressor.cpp + ZstdDecompressor.cpp + argprocessing.cpp + ccache.cpp + cleanup.cpp + compopt.cpp + compress.cpp + execute.cpp + hash.cpp + hashutil.cpp + language.cpp + legacy_util.cpp + logging.cpp + manifest.cpp + result.cpp + stats.cpp + win32compat.cpp + Version.cpp) + +if(WIN32) + target_link_libraries(ccache_lib PRIVATE ws2_32 "psapi") + + if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + target_link_libraries(ccache_lib PRIVATE -static gcc stdc++ winpthread + -dynamic) + else() + target_link_libraries(ccache_lib PRIVATE -static c++ -dynamic) + endif() +endif() + +find_package(Threads REQUIRED) +target_link_libraries( + ccache_lib PRIVATE standard_settings standard_warnings ZSTD::ZSTD + libb2::libb2 Threads::Threads third_party_lib) + +# There is currently no separate interface directory. +target_include_directories(ccache_lib PRIVATE ${CMAKE_BINARY_DIR} .) + +add_subdirectory(third_party) diff --git a/src/Util.cpp b/src/Util.cpp index fa5b13da..b1ed2648 100644 --- a/src/Util.cpp +++ b/src/Util.cpp @@ -651,7 +651,7 @@ real_path(const std::string& path, bool return_empty_on_error) char* buffer = managed_buffer.get(); char* resolved = nullptr; -#if HAVE_REALPATH +#ifdef HAVE_REALPATH resolved = realpath(c_path, buffer); #elif defined(_WIN32) if (c_path[0] == '/') { diff --git a/src/third_party/CMakeLists.txt b/src/third_party/CMakeLists.txt new file mode 100644 index 00000000..b6beab91 --- /dev/null +++ b/src/third_party/CMakeLists.txt @@ -0,0 +1,30 @@ +add_library(third_party_lib STATIC format.cpp getopt_long.c xxhash.c) +if(ENABLE_TRACING) + target_sources(third_party_lib PRIVATE minitrace.c) +endif() + +# Treat third party headers as system files. (No warning from those headers) +target_include_directories(third_party_lib PRIVATE ${CMAKE_BINARY_DIR} . SYSTEM + INTERFACE .) + +target_link_libraries(third_party_lib PRIVATE standard_settings) + +# third_party (for now) has way fewer compiler warnings enabled than the rest of +# the code. + +# These warnings are enabled by default even without e.g. -Wall. But (for now) +# we don't want even them in third_party. +target_compile_options( + third_party_lib + PRIVATE $<$<COMPILE_LANGUAGE:C>:-Wno-implicit-function-declaration + -Wno-int-conversion>) +if(CMAKE_C_COMPILER_ID STREQUAL "GNU") + target_compile_options(third_party_lib + PRIVATE $<$<COMPILE_LANGUAGE:C>:-Wno-attributes>) +endif() + +# The headers are included from the rest of the project, so turn off warnings as +# requried (for now). +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + target_compile_options(third_party_lib INTERFACE -Wno-shadow) +endif() diff --git a/test-all-systems.sh b/test-all-systems.sh new file mode 100755 index 00000000..45f23443 --- /dev/null +++ b/test-all-systems.sh @@ -0,0 +1,31 @@ +#!/bin/sh -ex + +# While it's obviously quite impossible to support and test every single distribution, +# this script enables easy checking of the most common standard distributions at least. + +# Runtime is roughly 1 minute per line (depending on system). +# First run takes about 1 additional minute per docker image (depending on internet connection). + +# TODO: store docker images in (public) repository. +# TODO: use ccache within docker and preserve the cache. +# That would make this script really fast and usable for small iterations! + +echo "Warning: Docker support is rather experimental\n" + +#CC=gcc CXX=g++ ./docker.sh debian-9-stretch +#CC=clang CXX=clang++ ./docker.sh debian-9-stretch + +CC=gcc CXX=g++ ./docker.sh debian-10-buster +CC=clang CXX=clang++ ./docker.sh debian-10-buster + +# zstd and libb2 not available for Ubuntu 14. +CC=gcc CXX=g++ CMAKE_PARAMS="-DUSE_LIBZSTD_FROM_INTERNET=ON -DUSE_LIBB2_FROM_INTERNET=ON" ./docker.sh ubuntu-14-trusty + +# See https://github.com/ccache/ccache/issues/601 +#CC=clang CXX=clang++ CMAKE_PARAMS="-DUSE_LIBZSTD_FROM_INTERNET=ON -DUSE_LIBB2_FROM_INTERNET=ON" ./docker.sh ubuntu-14-tusty + +CC=gcc CXX=g++ ./docker.sh ubuntu-16-xenial +CC=clang CXX=clang++ ./docker.sh ubuntu-16-xenial + +CC=gcc CXX=g++ CMAKE_PARAMS="-DUSE_LIBZSTD_FROM_INTERNET=ON" ./docker.sh ubuntu-20-focal +CC=clang CXX=clang++ CMAKE_PARAMS="-DUSE_LIBZSTD_FROM_INTERNET=ON" ./docker.sh ubuntu-20-focal diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 00000000..eba49117 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,39 @@ +function(addtest name) + add_test(NAME "producttest.${name}" + COMMAND test/run ${name} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + set_tests_properties("producttest.${name}" PROPERTIES ENVIRONMENT CCACHE=${CMAKE_BINARY_DIR}/ccache) +endfunction() + +addtest(base) +addtest(nocpp2) +addtest(cpp1) +addtest(multi_arch) +addtest(serialize_diagnostics) +addtest(color_diagnostics) +addtest(sanitize_blacklist) +addtest(debug_prefix_map) +addtest(profiling) +addtest(profiling_gcc) +addtest(profiling_clang) +addtest(split_dwarf) +addtest(masquerading) +addtest(hardlink) +addtest(fileclone) +addtest(direct) +addtest(direct_gcc) +addtest(depend) +addtest(basedir) +addtest(no_compression) +addtest(readonly) +addtest(readonly_direct) +addtest(cleanup) +addtest(pch) +addtest(modules) +addtest(upgrade) +addtest(input_charset) +addtest(nvcc) +addtest(nvcc_direct) +addtest(nvcc_ldir) +addtest(nvcc_nocpp2) +addtest(inode_cache) @@ -442,6 +442,7 @@ fi # --------------------------------------- +# Note: this list is currently duplicated within CMakeLists.txt until further cleanup. Keep them in sync! all_suites=" base nocpp2 diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt new file mode 100644 index 00000000..d1873310 --- /dev/null +++ b/unittest/CMakeLists.txt @@ -0,0 +1,30 @@ +add_executable( + unittest + TestUtil.cpp + catch2_tests.cpp + main.cpp + test_Args.cpp + test_AtomicFile.cpp + test_Checksum.cpp + test_Compression.cpp + test_Config.cpp + test_FormatNonstdStringView.cpp + test_InodeCache.cpp + test_Lockfile.cpp + test_NullCompression.cpp + test_Stat.cpp + test_Util.cpp + test_ZstdCompression.cpp + test_argprocessing.cpp + test_compopt.cpp + test_hash.cpp + test_hashutil.cpp + test_legacy_util.cpp) + +target_link_libraries(unittest PRIVATE standard_settings standard_warnings + ccache_lib) + +target_include_directories(unittest PRIVATE ${CMAKE_BINARY_DIR} . ../src) + +# add to ctest +add_test(NAME unittest COMMAND unittest) |