From ece08e37c01ac7ed1d4d600f881fbf90c9338cd3 Mon Sep 17 00:00:00 2001 From: Alexey Sheplyakov Date: Sun, 28 Aug 2011 23:05:31 +0300 Subject: [PATCH] CLN can be built with CMake See INSTALL.CMake for the details --- CMakeLists.txt | 214 +++++ INSTALL.CMake | 62 ++ cln.pc.cmake | 11 + cmake/cln-config.cmake.in | 15 + cmake/modules/AsmNoexecstack.cmake | 36 + cmake/modules/AsmUnderscore.cmake | 24 + cmake/modules/CLNstrutils.cmake | 19 + cmake/modules/CheckTypeAlign.c.in | 45 + cmake/modules/CheckTypeAlign.cmake | 180 ++++ cmake/modules/CheckTypeAlignMap.cmake.in | 1 + cmake/modules/FindGMP.cmake | 48 ++ cmake/modules/GMPLimbSize.cmake | 56 ++ doc/CMakeLists.txt | 46 + examples/CMakeLists.txt | 28 + include/CMakeLists.txt | 80 ++ include/cln/config.h.cmake | 24 + include/cln/host_cpu.h.cmake | 10 + include/cln/intparam.h.cmake | 9 + src/CMakeLists.txt | 1000 ++++++++++++++++++++++ src/base/cl_base_config.h.cmake | 17 + src/base/cl_gmpconfig.h.cmake | 7 + src/base/digitseq/cl_asm.S | 8 +- src/base/digitseq/cl_asm.h | 8 +- src/cl_config.h.cmake | 15 + src/timing/cl_t_config.h.cmake | 6 + tests/CMakeLists.txt | 61 ++ 26 files changed, 2028 insertions(+), 2 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 INSTALL.CMake create mode 100644 cln.pc.cmake create mode 100644 cmake/cln-config.cmake.in create mode 100644 cmake/modules/AsmNoexecstack.cmake create mode 100644 cmake/modules/AsmUnderscore.cmake create mode 100644 cmake/modules/CLNstrutils.cmake create mode 100644 cmake/modules/CheckTypeAlign.c.in create mode 100644 cmake/modules/CheckTypeAlign.cmake create mode 100644 cmake/modules/CheckTypeAlignMap.cmake.in create mode 100644 cmake/modules/FindGMP.cmake create mode 100644 cmake/modules/GMPLimbSize.cmake create mode 100644 doc/CMakeLists.txt create mode 100644 examples/CMakeLists.txt create mode 100644 include/CMakeLists.txt create mode 100644 include/cln/config.h.cmake create mode 100644 include/cln/host_cpu.h.cmake create mode 100644 include/cln/intparam.h.cmake create mode 100644 src/CMakeLists.txt create mode 100644 src/base/cl_base_config.h.cmake create mode 100644 src/base/cl_gmpconfig.h.cmake create mode 100644 src/cl_config.h.cmake create mode 100644 src/timing/cl_t_config.h.cmake create mode 100644 tests/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..9736c77 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,214 @@ +cmake_minimum_required(VERSION 3.10) +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") + +project(CLN) +file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/include/cln/version.h" _cl_vinfo REGEX "^#define[\t ]+CL_VERSION_.*") +string(REGEX REPLACE "^.*CL_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" CL_VERSION_MAJOR "${_cl_vinfo}") +string(REGEX REPLACE "^.*CL_VERSION_MINOR[ \t]+([0-9]+).*" "\\1" CL_VERSION_MINOR "${_cl_vinfo}") +string(REGEX REPLACE "^.*CL_VERSION_PATCHLEVEL[ \t]+([0-9]+).*" "\\1" CL_VERSION_PATCHLEVEL "${_cl_vinfo}") +set(CL_VERSION "${CL_VERSION_MAJOR}.${CL_VERSION_MINOR}.${CL_VERSION_PATCHLEVEL}") + +# Library +file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/include/cln/version.h _cl_vinfo REGEX "^#define[\t ]+CL_LT_.*") +string(REGEX REPLACE "^.*CL_LT_CURRENT[ \t]+([0-9]+).*" "\\1" cl_lt_current "${_cl_vinfo}") +string(REGEX REPLACE "^.*CL_LT_AGE[ \t]+([0-9]+).*" "\\1" cl_lt_age "${_cl_vinfo}") +string(REGEX REPLACE "^.*CL_LT_REVISION[ \t]+([0-9]+).*" "\\1" cl_lt_revision "${_cl_vinfo}") + +# XXX: CMake has no portable library versioning? +math(EXPR libcln_soversion "${cl_lt_current} - ${cl_lt_age}") +set(libcln_version ${libcln_soversion}.${cl_lt_age}.${cl_lt_revision}) +option(CLN_USE_GMP "Use GMP low level routines" ON) + +include(GNUInstallDirs) + +set(cl_config_files + include/cln/config.h + include/cln/host_cpu.h + include/cln/intparam.h + src/cl_config.h + src/base/cl_base_config.h + src/base/cl_gmpconfig.h + src/timing/cl_t_config.h +) +set(cln_generated_headers) + +include(CheckIncludeFile) +include(CheckLibraryExists) +include(CheckTypeSize) +include(TestBigEndian) +include(CheckFunctionExists) +include(CheckCXXSourceCompiles) +include(CheckTypeAlign) + +enable_testing() +if (NOT TARGET check) + add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}) +endif() +if (NOT TARGET test_suite) + add_custom_target(test_suite) +endif() +if (NOT TARGET info) + add_custom_target(info ALL) +endif() +if (NOT TARGET html) + add_custom_target(html) +endif() +if (NOT TARGET pdf) + add_custom_target(pdf) +endif() + +if (NOT DEFINED BUILD_SHARED_LIBS) + if (NOT MSVC) + set(BUILD_SHARED_LIBS true) + else() + set(BUILD_SHARED_LIBS false) + endif() +endif() +if (WIN32) + if (NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) + endif() +endif() + +if (CLN_USE_GMP) +find_package(GMP REQUIRED) +endif() + +if (GMP_FOUND) + set(CL_USE_GMP TRUE) +endif() + +if (GMP_FOUND) + get_filename_component(GMP_LIBDIR ${GMP_LIBRARIES} PATH) + include(GMPLimbSize) +endif(GMP_FOUND) + + +check_type_size("long long" LONGLONG) +if (HAVE_LONGLONG) + set(SIZEOF_LONGLONG ${LONGLONG}) +endif() +check_type_size("short" SIZEOF_SHORT) +check_type_size("int" SIZEOF_INT) +check_type_size("long" SIZEOF_LONG) +check_type_size("void *" SIZEOF_VOIDP) +check_type_align("void *" ALIGNOF_VOIDP) + +# not guaranteed by the C standard, but holds in practice +set(cl_char_bitsize 8) +math(EXPR x "${SIZEOF_SHORT} * ${cl_char_bitsize}") +set(cl_short_bitsize ${x} CACHE INTERNAL "short_bitsize") +math(EXPR cl_int_bitsize "${SIZEOF_INT} * ${cl_char_bitsize}") +math(EXPR cl_long_bitsize "${SIZEOF_LONG} * ${cl_char_bitsize}") +math(EXPR cl_pointer_bitsize "${SIZEOF_VOIDP} * ${cl_char_bitsize}") +if (HAVE_LONGLONG) + math(EXPR cl_long_long_bitsize "${SIZEOF_LONGLONG} * ${cl_char_bitsize}") +endif() + + +check_include_file("unistd.h" HAVE_UNISTD_H) +check_function_exists(gettimeofday HAVE_GETTIMEOFDAY) + +set(_save_required_includes ${CMAKE_REQUIRED_INCLUDES}) +set(_save_required_libraries ${CMAKE_REQUIRED_LIBRARIES}) +set(_save_required_flags ${CMAKE_REQUIRED_FLAGS}) +set(CMAKE_REQUIRED_FLAGS "-Werror") +set(CMAKE_REQUIRED_INCLUDES "") +set(CMAKE_REQUIRED_LIBRARIES "") +CHECK_CXX_SOURCE_COMPILES(" + void f() __attribute__((flatten)); + int main() { return 0; } + " + CL_HAVE_ATTRIBUTE_FLATTEN +) +set(CMAKE_REQUIRED_FLAGS ${_save_required_flags}) +set(CMAKE_REQUIRED_INCLUDES ${_save_required_includes}) +set(CMAKE_REQUIRED_LIBRARIES ${_save_required_libraries}) + + +test_big_endian(cl_cv_bigendian_p) +if(cl_cv_bigendian_p) + set(cln_cpu_big_endian 1) +else() + set(cln_cpu_big_endian 0) +endif() + +include(AsmUnderscore) +include(AsmNoexecstack) + +set(GMP_LIBDIR_PC) + +set(_cln_rpath_reloc "$ORIGIN/../lib") +set(_wl_rpath "${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}") +set(_wl_rpath_link "${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG}") + +# rpath for the pkg-config meta-data +set(_libcln_rpath "${_cln_rpath_reloc}") +set(_libcln_pc_rpath "${_wl_rpath}${_cln_rpath_reloc}") + +list(FIND CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_FULL_LIBDIR}" isSystemDir) +if ("${isSystemDir}" STREQUAL "-1") + set(_libcln_pc_rpath "${_libcln_pc_rpath} ${_wl_rpath}\${libdir}") + list(APPEND _libcln_rpath ${CMAKE_INSTALL_FULL_LIBDIR}) +endif() + +list(FIND CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "${GMP_LIBDIR}" isSystemDir) +if ("${isSystemDir}" STREQUAL "-1") + list(APPEND _libcln_rpath ${GMP_LIBDIR}) + set(_libcln_pc_rpath "${_libcln_pc_rpath} ${_wl_rpath_link}${GMP_LIBDIR}") + set(GMP_LIBDIR_PC "-L${GMP_LIBDIR}") +endif() +string(REPLACE ";" ":" libcln_rpath "${_libcln_rpath}") + +if (NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_RPATH) + set(CMAKE_INSTALL_RPATH_USE_LINK_RPATH TRUE) +endif() +if (NOT DEFINED CMAKE_INSTALL_RPATH) + set(CMAKE_INSTALL_RPATH ${libcln_rpath}) + if (_wl_rpath) + set(CLN_PC_RPATH ${_libcln_pc_rpath}) + endif() +endif() +if (APPLE AND NOT DEFINED CMAKE_INSTALL_NAME_DIR) + set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_FULL_LIBDIR}) +endif() + +macro(cl_config_file relname) + set(_dst ${CMAKE_CURRENT_BINARY_DIR}/${relname}) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${relname}.cmake ${_dst}) + if ("${relname}" MATCHES "^include") + list(APPEND cln_generated_headers "${_dst}") + endif() +endmacro() + +foreach(_cf ${cl_config_files}) + cl_config_file("${_cf}") +endforeach() +install(FILES ${cln_generated_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/cln") + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cln.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/cln.pc @ONLY) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cln.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/cln-config-version.cmake + VERSION ${CL_VERSION} + COMPATIBILITY AnyNewerVersion +) +configure_package_config_file(${CMAKE_CURRENT_LIST_DIR}/cmake/cln-config.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/cln-config.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cln +) +install(FILES + ${CMAKE_CURRENT_LIST_DIR}/cmake/modules/FindGMP.cmake + ${CMAKE_CURRENT_BINARY_DIR}/cln-config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/cln-config-version.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cln +) + +add_subdirectory(src) +add_subdirectory(tests) +add_subdirectory(include) +add_subdirectory(examples) +add_subdirectory(doc) + diff --git a/INSTALL.CMake b/INSTALL.CMake new file mode 100644 index 0000000..3f4806b --- /dev/null +++ b/INSTALL.CMake @@ -0,0 +1,62 @@ +Prerequisites +============= + +* C++11-compliant C++ compiler. GNU C++ compiler (version >= 5.1) is recommended. + +* [Recommended] GNU multiprecision library (http://gmplib.org), version > 4.0. + +* CMake, version 3.10 or newer. + +* Ninja (https://ninja-build.org), version 1.8 or newer + +* [Optional] To build CLN documentation texinfo and TeX are necessary. + +* If you install CLN from git, you also need git (http://git-scm.com), + version >= 1.8. + +Installation from a source .tar.bz2 distribution +================================================ + +1) Unpack the archive + + $ tar xaf cln-x.y.z-tar.bz2 + +2) Create a build directory + + $ mkdir cln_build + +3) Run CMake to generate build files + + $ cd cln_build + $ cmake -GNinja ../cln-x.y.z + +4) Actually build CLN + + $ cmake --build . + +5) Run the test suite (not mandatory, but strongly recommended) + + $ cmake --build . --target check + +6) Install CLN + + [become root if necessary] + # make install + + +Installation from git +===================== + +The steps are essentially the same as compiling from the tarball, the only +difference is using git to get the code. + +1) Download the code: + + $ git clone git://ginac.de/cln.git cln + + or, if you have already cloned the repository, + + $ git pull + +Subsequent steps are the same as compiling from a source distribution. + diff --git a/cln.pc.cmake b/cln.pc.cmake new file mode 100644 index 0000000..b2cf1ff --- /dev/null +++ b/cln.pc.cmake @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + +Name: cln +Description: Class Library for Numbers +Version: @CL_VERSION@ +Libs: @CLN_PC_RPATH@ -L${libdir} -lcln +Libs.private: @GMP_LIBDIR_PC@ -lgmp +Cflags: -I${includedir} diff --git a/cmake/cln-config.cmake.in b/cmake/cln-config.cmake.in new file mode 100644 index 0000000..2e3fbed --- /dev/null +++ b/cmake/cln-config.cmake.in @@ -0,0 +1,15 @@ +include(CMakeFindDependencyMacro) + +set(CLN_USE_GMP @CLN_USE_GMP@) + +if (CLN_USE_GMP) + list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + find_package(GMP REQUIRED MODULE) + list(REMOVE_AT CMAKE_MODULE_PATH -1) +endif() + +if (NOT TARGET cln::cln) + include("${CMAKE_CURRENT_LIST_DIR}/cln-targets.cmake") +endif() + +set(cln_LIBRARIES cln::cln) diff --git a/cmake/modules/AsmNoexecstack.cmake b/cmake/modules/AsmNoexecstack.cmake new file mode 100644 index 0000000..172d9f9 --- /dev/null +++ b/cmake/modules/AsmNoexecstack.cmake @@ -0,0 +1,36 @@ +# Check whether the stack can be marked nonexecutable by passing +# an option to the C compiler when acting on .s files. +# +# ASM_NOEXECSTACK_FLAG -- compiler option(s) for marking the stack +# nonexecutable + +# CC='ccache gcc' => "${CMAKE_C_COMPILER_ARG1}" == " gcc" +# (notice the leading whitespace). Grrr! +string(STRIP "${CMAKE_C_COMPILER_ARG1}" _c_compiler_arg1) + +set(_conftest_c "${CMAKE_BINARY_DIR}/conftest.c") +set(_conftest_s "${CMAKE_BINARY_DIR}/conftest.s") +set(_conftest_o "${CMAKE_BINARY_DIR}/conftest.o") +set(_need_noexecstack) +set(_cc_ret) + +file(WRITE ${_conftest_c} "void foo() { }") + +execute_process( + COMMAND ${CMAKE_C_COMPILER} ${_c_compiler_arg1} -S ${_conftest_c} + RESULT_VARIABLE _cc_ret +) + +if ("${_cc_ret}" EQUAL "0") + file(STRINGS ${_conftest_s} _need_noexecstack REGEX "\\.note\\.GNU-stack") +endif() + +if (_need_noexecstack) + execute_process(COMMAND ${CMAKE_C_COMPILER} ${_c_compiler_arg1} -Wa,--noexecstack -c ${_conftest_s} + RESULT_VARIABLE _cc_ret) + if ("${_cc_ret}" EQUAL "0") + set(ASM_NOEXECSTACK_FLAG "-Wa,--noexecstack") + endif() +endif() +file(REMOVE ${_conftest_o} ${_conftest_s} ${_conftest_c}) + diff --git a/cmake/modules/AsmUnderscore.cmake b/cmake/modules/AsmUnderscore.cmake new file mode 100644 index 0000000..5f20237 --- /dev/null +++ b/cmake/modules/AsmUnderscore.cmake @@ -0,0 +1,24 @@ +# Check if symbols are prefixed by an underscore in assembly language. +set(ASM_UNDERSCORE) + +set(_conftest_c ${CMAKE_BINARY_DIR}/conftest.c) +set(_conftest_s ${CMAKE_BINARY_DIR}/conftest.s) +set(_cc_ret) + +file(WRITE ${_conftest_c} "int foo() { return 0; }") + +# CC='ccache gcc' => "${CMAKE_C_COMPILER_ARG1}" == " gcc" +# (notice the leading whitespace). Grrr! +string(STRIP "${CMAKE_C_COMPILER_ARG1}" _c_compiler_arg1) +execute_process( + COMMAND ${CMAKE_C_COMPILER} ${_c_compiler_arg1} -S ${_conftest_c} + RESULT_VARIABLE _cc_ret +) +if ("${_cc_ret}" EQUAL "0") + file(STRINGS ${_conftest_s} _asm_underscore REGEX "_foo") + if (_asm_underscore) + set(ASM_UNDERSCORE true) + endif() +endif() +file(REMOVE ${_conftest_s} ${_conftest_c}) + diff --git a/cmake/modules/CLNstrutils.cmake b/cmake/modules/CLNstrutils.cmake new file mode 100644 index 0000000..14a5b96 --- /dev/null +++ b/cmake/modules/CLNstrutils.cmake @@ -0,0 +1,19 @@ +# various string manipulation routines + +if (NOT _cln_strutils_included) + set(_cln_strutils_included 1) + + macro(cl_string_join var strlist delimiter) + set(_ret "") + foreach(_str ${strlist}) + if ("${_ret}" STREQUAL "") + set(_ret "${_str}") + else() + set(_ret "${_ret}${delimiter}${_str}") + endif() + endforeach() + set(${var} "${_ret}") + endmacro() + +endif(NOT _cln_strutils_included) + diff --git a/cmake/modules/CheckTypeAlign.c.in b/cmake/modules/CheckTypeAlign.c.in new file mode 100644 index 0000000..80ab0d5 --- /dev/null +++ b/cmake/modules/CheckTypeAlign.c.in @@ -0,0 +1,45 @@ +@headers@ + +#ifndef HAVE_STDDEF_H +/* + * This definition is definitely not standard compliant, but it works + * surprisingly well. Also, conforming implementations are supposed + * to ship the file. + */ +#define offsetof(st, m) ((int)((char*)&((st*)(0))->m - (char*)0)) +#endif +#undef KEY +#if defined(__i386) +# define KEY '_','_','i','3','8','6' +#elif defined(__x86_64) +# define KEY '_','_','x','8','6','_','6','4' +#elif defined(__ppc__) +# define KEY '_','_','p','p','c','_','_' +#elif defined(__ppc64__) +# define KEY '_','_','p','p','c','6','4','_','_' +#endif + +#define SIZE (offsetof(struct { char c; @type@ x; }, x)) +char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[', + ('0' + ((SIZE / 10000)%10)), + ('0' + ((SIZE / 1000)%10)), + ('0' + ((SIZE / 100)%10)), + ('0' + ((SIZE / 10)%10)), + ('0' + (SIZE % 10)), + ']', +#ifdef KEY + ' ','k','e','y','[', KEY, ']', +#endif + '\0'}; + +#ifdef __CLASSIC_C__ +int main(argc, argv) int argc; char *argv[]; +#else +int main(int argc, char *argv[]) +#endif +{ + int require = 0; + require += info_size[argc]; + (void)argv; + return require; +} diff --git a/cmake/modules/CheckTypeAlign.cmake b/cmake/modules/CheckTypeAlign.cmake new file mode 100644 index 0000000..8e28e14 --- /dev/null +++ b/cmake/modules/CheckTypeAlign.cmake @@ -0,0 +1,180 @@ +# - Check sizeof a type +# CHECK_TYPE_ALIGN(TYPE VARIABLE [BUILTIN_TYPES_ONLY]) +# Check if the type exists and determine its alignment. +# On return, "${VARIABLE}" holds one of the following: +# = type has non-zero align +# "0" = type has arch-dependent alignment (see below) +# "" = type does not exist +# Furthermore, the variable "${VARIABLE}_CODE" holds C preprocessor +# code to define the macro "${VARIABLE}" to the size of the type, or +# leave the macro undefined if the type does not exist. +# +# The variable "${VARIABLE}" may be "0" when CMAKE_OSX_ARCHITECTURES +# has multiple architectures for building OS X universal binaries. +# This indicates that the type align varies across architectures. +# In this case "${VARIABLE}_CODE" contains C preprocessor tests +# mapping from each architecture macro to the corresponding type align. +# The list of architecture macros is stored in "${VARIABLE}_KEYS", and +# the value for each key is stored in "${VARIABLE}-${KEY}". +# +# If the BUILTIN_TYPES_ONLY option is not given, the macro checks for +# headers , , and , and saves results +# in HAVE_SYS_TYPES_H, HAVE_STDINT_H, and HAVE_STDDEF_H. The type +# align check automatically includes the available headers, thus +# supporting checks of types defined in the headers. +# +# The following variables may be set before calling this macro to +# modify the way the check is run: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_EXTRA_INCLUDE_FILES = list of extra headers to include + +# Based upon CheckTypeSize.cmake (distributed with CMake). + + +include(CheckIncludeFile) + +cmake_policy(PUSH) +cmake_minimum_required(VERSION 3.10 FATAL_ERROR) + +get_filename_component(__check_type_align_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) + +#----------------------------------------------------------------------------- +# Helper function. DO NOT CALL DIRECTLY. +function(__check_type_align_impl type var map builtin) + message(STATUS "Check align of ${type}") + + # Include header files. + set(headers) + if(builtin) + if(HAVE_SYS_TYPES_H) + set(headers "${headers}#include \n") + endif() + if(HAVE_STDINT_H) + set(headers "${headers}#include \n") + endif() + if(HAVE_STDDEF_H) + set(headers "${headers}#include \n") + endif() + endif() + foreach(h ${CMAKE_EXTRA_INCLUDE_FILES}) + set(headers "${headers}#include \"${h}\"\n") + endforeach() + + # Perform the check. + set(src ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeAlign/${var}.c) + set(bin ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckTypeAlign/${var}.bin) + configure_file(${__check_type_align_dir}/CheckTypeAlign.c.in ${src} @ONLY) + try_compile(_HAVE_${var} ${CMAKE_BINARY_DIR} ${src} + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + CMAKE_FLAGS + "-DCOMPILE_DEFINITIONS:STRING=${CMAKE_REQUIRED_FLAGS}" + "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}" + "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}" + OUTPUT_VARIABLE output + COPY_FILE ${bin} + ) + + if(_HAVE_${var}) + # The check compiled. Load information from the binary. + file(STRINGS ${bin} strings LIMIT_COUNT 10 REGEX "INFO:size") + + # Parse the information strings. + set(regex_size ".*INFO:size\\[0*([^]]*)\\].*") + set(regex_key " key\\[([^]]*)\\]") + set(keys) + set(code) + set(mismatch) + set(first 1) + foreach(info ${strings}) + if("${info}" MATCHES "${regex_size}") + # Get the type size. + string(REGEX REPLACE "${regex_size}" "\\1" size "${info}") + if(first) + set(${var} ${size}) + elseif(NOT "${size}" STREQUAL "${${var}}") + set(mismatch 1) + endif() + set(first 0) + + # Get the architecture map key. + string(REGEX MATCH "${regex_key}" key "${info}") + string(REGEX REPLACE "${regex_key}" "\\1" key "${key}") + if(key) + set(code "${code}\nset(${var}-${key} \"${size}\")") + list(APPEND keys ${key}) + endif() + endif() + endforeach() + + # Update the architecture-to-size map. + if(mismatch AND keys) + configure_file(${__check_type_align_dir}/CheckTypeAlignMap.cmake.in ${map} @ONLY) + set(${var} 0) + else() + file(REMOVE ${map}) + endif() + + if(mismatch AND NOT keys) + message(SEND_ERROR "CHECK_TYPE_ALIGN found different results, consider setting CMAKE_OSX_ARCHITECTURES or CMAKE_TRY_COMPILE_OSX_ARCHITECTURES to one or no architecture !") + endif() + + message(STATUS "Check align of ${type} - done") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining align of ${type} passed with the following output:\n${output}\n\n") + set(${var} "${${var}}" CACHE INTERNAL "CHECK_TYPE_ALIGN: alignof(${type})") + else(_HAVE_${var}) + # The check failed to compile. + message(STATUS "Check align of ${type} - failed") + file(READ ${src} content) + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining align of ${type} failed with the following output:\n${output}\n${src}:\n${content}\n\n") + set(${var} "" CACHE INTERNAL "CHECK_TYPE_ALIGN: ${type} unknown") + file(REMOVE ${map}) + endif(_HAVE_${var}) +endfunction() + +#----------------------------------------------------------------------------- +macro(CHECK_TYPE_ALIGN TYPE VARIABLE) + # Optionally check for standard headers. + if("${ARGV2}" STREQUAL "BUILTIN_TYPES_ONLY") + set(_builtin 0) + else() + set(_builtin 1) + check_include_file(sys/types.h HAVE_SYS_TYPES_H) + check_include_file(stdint.h HAVE_STDINT_H) + check_include_file(stddef.h HAVE_STDDEF_H) + endif() + + # Compute or load the size or size map. + set(${VARIABLE}_KEYS) + set(_map_file ${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CheckTypeAlign/${VARIABLE}.cmake) + if(NOT DEFINED _HAVE_${VARIABLE}) + __check_type_align_impl(${TYPE} ${VARIABLE} ${_map_file} ${_builtin}) + endif() + include(${_map_file} OPTIONAL) + set(_map_file) + set(_builtin) + + # Create preprocessor code. + if(${VARIABLE}_KEYS) + set(${VARIABLE}_CODE) + set(_if if) + foreach(key ${${VARIABLE}_KEYS}) + set(${VARIABLE}_CODE "${${VARIABLE}_CODE}#${_if} defined(${key})\n# define ${VARIABLE} ${${VARIABLE}-${key}}\n") + set(_if elif) + endforeach() + set(${VARIABLE}_CODE "${${VARIABLE}_CODE}#else\n# error ${VARIABLE} unknown\n#endif") + set(_if) + elseif(${VARIABLE}) + set(${VARIABLE}_CODE "#define ${VARIABLE} ${${VARIABLE}}") + else() + set(${VARIABLE}_CODE "/* #undef ${VARIABLE} */") + endif() +endmacro() + +#----------------------------------------------------------------------------- +cmake_policy(POP) diff --git a/cmake/modules/CheckTypeAlignMap.cmake.in b/cmake/modules/CheckTypeAlignMap.cmake.in new file mode 100644 index 0000000..1e73cff --- /dev/null +++ b/cmake/modules/CheckTypeAlignMap.cmake.in @@ -0,0 +1 @@ +set(@var@_KEYS "@keys@")@code@ diff --git a/cmake/modules/FindGMP.cmake b/cmake/modules/FindGMP.cmake new file mode 100644 index 0000000..4eea985 --- /dev/null +++ b/cmake/modules/FindGMP.cmake @@ -0,0 +1,48 @@ +# Try to find the GMP librairies +# GMP_FOUND - system has GMP lib +# GMP_INCLUDE_DIR - the GMP include directory +# GMP_LIBRARIES - Libraries needed to use GMP + +# Copyright (c) 2006, Laurent Montel, +# Adjusted by Alexei Sheplyakov. +# Redistribution and use is allowed according to the terms of the BSD license. + + +if (GMP_INCLUDE_DIR AND GMP_LIBRARIES) + # Already in cache, be silent + set(GMP_FIND_QUIETLY TRUE) +endif (GMP_INCLUDE_DIR AND GMP_LIBRARIES) + +find_path(GMP_INCLUDE_DIR NAMES gmp.h) +find_library(GMP_LIBRARIES NAMES gmp libgmp) + + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMP DEFAULT_MSG GMP_INCLUDE_DIR GMP_LIBRARIES) + +if (GMP_FOUND AND NOT TARGET gmp::gmp) + set(_found_shared_libgmp FALSE) + get_filename_component(_gmplib_suffix ${GMP_LIBRARIES} EXT) + if (_gmplib_suffix STREQUAL ${CMAKE_STATIC_LIBRARY_SUFFIX}) + # XXX: msvc has the same suffix both for the static and import libs + add_library(gmp::gmp STATIC IMPORTED) + else() + set(_found_shared_libgmp TRUE) + add_library(gmp::gmp SHARED IMPORTED) + endif() + set_target_properties(gmp::gmp PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${GMP_INCLUDE_DIR} + ) + if (WIN32 AND _found_shared_libgmp) + set_target_properties(gmp::gmp PROPERTIES + IMPORTED_IMPLIB ${GMP_LIBRARIES} + ) + else() + set_target_properties(gmp::gmp PROPERTIES + IMPORTED_LOCATION ${GMP_LIBRARIES} + ) + endif() +endif() + +mark_as_advanced(GMP_INCLUDE_DIR GMP_LIBRARIES) + diff --git a/cmake/modules/GMPLimbSize.cmake b/cmake/modules/GMPLimbSize.cmake new file mode 100644 index 0000000..04b2f98 --- /dev/null +++ b/cmake/modules/GMPLimbSize.cmake @@ -0,0 +1,56 @@ + +include(CheckCXXSourceCompiles) + +set(_save_required_libraries ${CMAKE_REQUIRED_LIBRARIES}) +set(_save_required_includes ${CMAKE_REQUIRED_INCLUDES}) +set(CMAKE_REQUIRED_LIBRARIES "${GMP_LIBRARIES} ${CMAKE_REQUIRED_LIBRARIES}") +set(CMAKE_REQUIRED_INCLUDES "${GMP_INCLUDE_DIR} ${CMAKE_REQUIRED_INCLUDES}") + +CHECK_CXX_SOURCE_COMPILES(" + #include + template struct Static_Assert; + template<> struct Static_Assert { }; + #if defined(__GMP_BITS_PER_MP_LIB) + Static_Assert<8*sizeof(mp_limb_t) == __GMP_BITS_PER_MP_LIB> check; + int main() { return 0; } + #endif + " + cl_gmp_has_nails +) +if (${cl_gmp_has_nails}) + message(SEND_ERROR "nails in MP limbs are not supported.") +endif() + +CHECK_CXX_SOURCE_COMPILES(" + #include + template struct Static_Assert; + template<> struct Static_Assert { }; + Static_Assert check; + int main() { return 0; } + " + mp_limb_t_is_long +) + +CHECK_CXX_SOURCE_COMPILES(" + #include + template struct Static_Assert; + template<> struct Static_Assert { }; + Static_Assert check; + int main() { return 0; } + " + mp_limb_t_is_long_long +) +set(CMAKE_REQUIRED_INCLUDES ${_save_required_includes}) +set(CMAKE_REQUIRED_LIBRARIES ${_save_required_libraries}) + +if (mp_limb_t_is_long) + message(STATUS "sizeof(mp_limb_t) == sizeof(long)") + set(GMP_DEMANDS_UINTD_LONG 1 CACHE INTERNAL "sizeof(mp_limb_t) == sizeof(long)") +else (mp_limb_t_is_long) + if (mp_limb_t_is_long_long) + message(STATUS "sizeof(mp_limb_t) == sizeof(long long)") + set(GMP_DEMANDS_UINTD_LONG_LONG 1 CACHE INTERNAL "sizeof(mp_limb_t) == sizeof(long long)") + else() + message(SEND_ERROR "Don't know which C integer type has sizeof(mp_limb_t)") + endif() +endif (mp_limb_t_is_long) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 0000000..7d8adad --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1,46 @@ +find_program(MAKEINFO makeinfo) +find_program(TEXI2DVI texi2dvi) +find_package(LATEX) + +macro(add_info_file thename) + set(${thename}_INFO ${CMAKE_CURRENT_BINARY_DIR}/${thename}.info) + set(${thename}_HTML ${CMAKE_CURRENT_BINARY_DIR}/${thename}.html) + set(${thename}_TEXINFO ${CMAKE_CURRENT_SOURCE_DIR}/${thename}.texi) + add_custom_command( + OUTPUT ${${thename}_INFO} + COMMAND ${MAKEINFO} --no-split -o ${${thename}_INFO} ${${thename}_TEXINFO} + DEPENDS ${${thename}_TEXINFO} + COMMENT "MAKEFINO ${thename}.texi" + VERBATIM) + add_custom_command( + OUTPUT ${${thename}_HTML} + COMMAND ${MAKEINFO} --html --no-split -o ${${thename}_HTML} ${${thename}_TEXINFO} + DEPENDS ${${thename}_TEXINFO} ${${thename}_HTML_EXTRA_DEPS} + COMMENT "MAKEINFOHTML ${thename}.texi" + VERBATIM) + add_custom_target(${thename}_info ALL DEPENDS ${${thename}_INFO}) + add_custom_target(${thename}_html ALL DEPENDS ${${thename}_HTML}) + add_dependencies(info ${thename}_info) + add_dependencies(html ${thename}_html) +endmacro() + +macro(add_doc_format src fmt) + set(_out ${CMAKE_CURRENT_BINARY_DIR}/${src}.${fmt}) + set(_src ${CMAKE_CURRENT_SOURCE_DIR}/${src}.texi) + add_custom_command( + OUTPUT ${_out} + COMMAND ${TEXI2DVI} --${fmt} --batch -o ${_out} ${_src} + DEPENDS ${_src} ${_${src}_tutorial_figures_${fmt}} + COMMENT "TEXI2DVI ${src}.texi => ${src}.${fmt}" + VERBATIM) + add_custom_target(${fmt}_${src}_tutorial DEPENDS ${_out}) + add_dependencies(${fmt} ${fmt}_${src}_tutorial) +endmacro() + +if (MAKEINFO) + add_info_file(cln) + if (PDFLATEX_COMPILER) + add_doc_format(cln pdf) + endif() +endif() + diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000..c856109 --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.10) +project(CLN_examples) + +set(cln_examples + contfrac + e + fibonacci + legendre + lucaslehmer + nextprime + perfnum + pi +) + +if (NOT TARGET cln) + find_package(cln REQUIRED CONFIG) +endif() +macro(cl_add_example srcname) + add_executable(${srcname} ${srcname}.cc) + target_link_libraries(${srcname} cln::cln) +endmacro() + +foreach(_ex ${cln_examples}) + cl_add_example(${_ex}) +endforeach() + +install(TARGETS pi RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt new file mode 100644 index 0000000..714ba56 --- /dev/null +++ b/include/CMakeLists.txt @@ -0,0 +1,80 @@ +set(cln_public_headers + cln/cln.h + cln/complex_class.h + cln/complex.h + cln/complex_io.h + cln/complex_ring.h + cln/condition.h + cln/dfloat_class.h + cln/dfloat.h + cln/dfloat_io.h + cln/exception.h + cln/ffloat_class.h + cln/ffloat.h + cln/ffloat_io.h + cln/float_class.h + cln/floatformat.h + cln/float.h + cln/float_io.h + cln/GV_complex.h + cln/GV.h + cln/GV_integer.h + cln/GV_modinteger.h + cln/GV_number.h + cln/GV_rational.h + cln/GV_real.h + cln/input.h + cln/integer_class.h + cln/integer.h + cln/integer_io.h + cln/integer_ring.h + cln/io.h + cln/lfloat_class.h + cln/lfloat.h + cln/lfloat_io.h + cln/malloc.h + cln/modinteger.h + cln/modules.h + cln/null_ring.h + cln/number.h + cln/number_io.h + cln/numtheory.h + cln/object.h + cln/output.h + cln/proplist.h + cln/random.h + cln/rational_class.h + cln/rational.h + cln/rational_io.h + cln/rational_ring.h + cln/real_class.h + cln/real.h + cln/real_io.h + cln/real_ring.h + cln/ring.h + cln/sfloat_class.h + cln/sfloat.h + cln/sfloat_io.h + cln/string.h + cln/SV_complex.h + cln/SV.h + cln/SV_integer.h + cln/SV_number.h + cln/SV_rational.h + cln/SV_real.h + cln/SV_ringelt.h + cln/symbol.h + cln/timing.h + cln/types.h + cln/univpoly_complex.h + cln/univpoly.h + cln/univpoly_integer.h + cln/univpoly_modint.h + cln/univpoly_rational.h + cln/univpoly_real.h + cln/V.h + cln/version.h +) + +install(FILES ${cln_public_headers} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/cln") + diff --git a/include/cln/config.h.cmake b/include/cln/config.h.cmake new file mode 100644 index 0000000..55662ed --- /dev/null +++ b/include/cln/config.h.cmake @@ -0,0 +1,24 @@ +#ifndef CL_CONFIG_PUBLIC_H +#define CL_CONFIG_PUBLIC_H + +#include "cln/host_cpu.h" +#include "cln/version.h" + +/** + * Alignment of a `void*'. CLN needs it to distinguish between pointers + * and immediate values. + */ +#define cl_word_alignment @ALIGNOF_VOIDP@ + +/* + * Numbers in the heap are stored as "digit" (or "limb" in GMP speak) + * sequences. A digit is an unsigned int with sizeof(void *)*CHAR_BIT bits. + * It should be 8 or 16 or 32 or 64 bits. If CLN is sitting on top of GMP + * it should match mp_limb_t + */ +#cmakedefine GMP_DEMANDS_UINTD_INT +#cmakedefine GMP_DEMANDS_UINTD_LONG +#cmakedefine GMP_DEMANDS_UINTD_LONG_LONG + +#endif /* CL_CONFIG_PUBLIC_H */ + diff --git a/include/cln/host_cpu.h.cmake b/include/cln/host_cpu.h.cmake new file mode 100644 index 0000000..7555fe9 --- /dev/null +++ b/include/cln/host_cpu.h.cmake @@ -0,0 +1,10 @@ +#ifndef CLN_HOST_CPU_CONFIG_H +#define CLN_HOST_CPU_CONFIG_H + +/* CPU */ +#ifndef __${CMAKE_SYSTEM_PROCESSOR}__ +#define __${CMAKE_SYSTEM_PROCESSOR}__ 1 +#endif + +#endif /* CLN_HOST_CPU_CONFIG_H */ + diff --git a/include/cln/intparam.h.cmake b/include/cln/intparam.h.cmake new file mode 100644 index 0000000..7cea90b --- /dev/null +++ b/include/cln/intparam.h.cmake @@ -0,0 +1,9 @@ +#define char_bitsize @cl_char_bitsize@ +#define short_bitsize @cl_short_bitsize@ +#define int_bitsize @cl_int_bitsize@ +#define long_bitsize @cl_long_bitsize@ +// #ifdef HAVE_LONGLONG +#define long_long_bitsize @cl_long_long_bitsize@ +// #endif +#define pointer_bitsize @cl_pointer_bitsize@ +#define stack_grows_down diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..5a7dc90 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,1000 @@ + +set(cln_sources + base/cl_N.h + base/cl_alloca.cc + base/cl_alloca.h + base/cl_as_exception.cc + base/cl_condition.cc + base/cl_d0_exception.cc + base/cl_debug.cc + base/cl_debugout.cc + base/cl_free.cc + base/cl_immclasses.cc + base/cl_inline.h + base/cl_inline2.h + base/cl_iterator.h + base/cl_low.h + base/cl_macros.h + base/cl_malloc.cc + base/cl_maybe_inline.h + base/cl_notreached_exception.cc + base/cl_offsetof.h + base/cl_sysdep.h + base/cl_version.cc + base/cl_xmacros.h + base/digit/cl_2D.h + base/digit/cl_2D_div.cc + base/digit/cl_2D_exptpos.cc + base/digit/cl_D.h + base/digitseq/cl_asm.h + base/digitseq/cl_2DS.h + base/digitseq/cl_2DS_div.cc + base/digitseq/cl_2DS_recip.cc + base/digitseq/cl_DS.h + base/digitseq/cl_DS_div.cc + base/digitseq/cl_DS_endian.h + base/digitseq/cl_DS_mul.cc + base/digitseq/cl_DS_mul_fftc.h + base/digitseq/cl_DS_mul_fftcs.h + base/digitseq/cl_DS_mul_fftm.h + base/digitseq/cl_DS_mul_fftp.h + base/digitseq/cl_DS_mul_fftp3.h + base/digitseq/cl_DS_mul_fftp3m.h + base/digitseq/cl_DS_mul_fftr.h + base/digitseq/cl_DS_mul_kara.h + base/digitseq/cl_DS_mul_kara_sqr.h + base/digitseq/cl_DS_mul_nuss.h + base/digitseq/cl_DS_random.cc + base/digitseq/cl_DS_recip.cc + base/digitseq/cl_DS_recipsqrt.cc + base/digitseq/cl_DS_sqrt.cc + base/digitseq/cl_DS_trandom.cc + base/digitseq/cl_asm.h + base/digitseq/cl_asm.S + base/hash/cl_hash.h + base/hash/cl_hash1.h + base/hash/cl_hash1weak.h + base/hash/cl_hash2.h + base/hash/cl_hash2weak.h + base/hash/cl_hashset.h + base/hash/cl_hashuniq.h + base/hash/cl_hashuniqweak.h + base/hash/cl_rcpointer2_hashweak_rcpointer.cc + base/hash/cl_rcpointer2_hashweak_rcpointer.h + base/hash/cl_rcpointer_hashweak_rcpointer.cc + base/hash/cl_rcpointer_hashweak_rcpointer.h + base/input/cl_read_bad_syntax_exception.cc + base/input/cl_read_eof_exception.cc + base/input/cl_read_junk_exception.cc + base/low/cl_low_div.cc + base/low/cl_low_isqrt.cc + base/low/cl_low_isqrt2.cc + base/low/cl_low_mul.cc + base/output/cl_output_dec.cc + base/output/cl_output_hex.cc + base/output/cl_prin_globals.cc + base/proplist/cl_pl_add.cc + base/proplist/cl_pl_d.cc + base/proplist/cl_pl_get.cc + base/random/cl_UL_random.cc + base/random/cl_random_def.cc + base/random/cl_random_from.cc + base/random/cl_random_impl.h + base/ring/cl_no_ring.cc + base/ring/cl_ring_debug.cc + base/string/cl_spushstring.h + base/string/cl_spushstring_append.cc + base/string/cl_spushstring_push.cc + base/string/cl_sstring.cc + base/string/cl_sstring.h + base/string/cl_st_c2.cc + base/string/cl_st_concat1.cc + base/string/cl_st_concat2.cc + base/string/cl_st_concat3.cc + base/string/cl_st_debug.cc + base/string/cl_st_hashcode.cc + base/string/cl_st_make0.cc + base/string/cl_st_make0.h + base/string/cl_st_make1.cc + base/string/cl_st_make2.cc + base/string/input/cl_st_get1.cc + base/string/input/cl_st_get2.cc + base/string/input/cl_st_getline1.cc + base/string/input/cl_st_getline2.cc + base/string/input/cl_st_gettoken.cc + base/string/misc/cl_st_class.cc + base/string/output/cl_st_print.cc + base/symbol/cl_sy_hashcode.cc + base/symbol/cl_symbol.cc + complex/algebraic/cl_C_abs.cc + complex/algebraic/cl_C_abs_aux.cc + complex/algebraic/cl_C_signum.cc + complex/algebraic/cl_C_sqrt.cc + complex/algebraic/cl_DF_hypot.cc + complex/algebraic/cl_FF_hypot.cc + complex/algebraic/cl_LF_hypot.cc + complex/algebraic/cl_R_hypot.cc + complex/algebraic/cl_SF_hypot.cc + complex/cl_C.h + complex/elem/cl_C_equal.cc + complex/elem/cl_C_from_R_R_complex.cc + complex/elem/cl_C_from_R_R_complex1.cc + complex/elem/cl_C_imagpart.cc + complex/elem/cl_C_minus.cc + complex/elem/cl_C_minus1.cc + complex/elem/cl_C_mul.cc + complex/elem/cl_C_plus.cc + complex/elem/cl_C_plus1.cc + complex/elem/cl_C_realpart.cc + complex/elem/cl_C_square.cc + complex/elem/cl_C_uminus.cc + complex/elem/cl_C_zerop.cc + complex/elem/division/cl_C_DF_recip.cc + complex/elem/division/cl_C_FF_recip.cc + complex/elem/division/cl_C_LF_recip.cc + complex/elem/division/cl_C_SF_recip.cc + complex/elem/division/cl_C_div.cc + complex/elem/division/cl_C_recip.cc + complex/input/cl_N_from_string.cc + complex/input/cl_N_read.cc + complex/input/cl_N_read_stream.cc + complex/misc/cl_C_class.cc + complex/misc/cl_C_conjugate.cc + complex/misc/cl_C_debug.cc + complex/misc/cl_C_eqhashcode.cc + complex/misc/cl_C_expt.cc + complex/misc/cl_C_expt_I.cc + complex/misc/cl_N_as.cc + complex/output/cl_N_aprint.cc + complex/output/cl_N_bprint.cc + complex/ring/cl_C_ring.cc + complex/transcendental/cl_C_acos.cc + complex/transcendental/cl_C_acosh.cc + complex/transcendental/cl_C_asin.cc + complex/transcendental/cl_C_asinh.cc + complex/transcendental/cl_C_asinh_aux.cc + complex/transcendental/cl_C_atan.cc + complex/transcendental/cl_C_atanh.cc + complex/transcendental/cl_C_atanh_aux.cc + complex/transcendental/cl_C_cis.cc + complex/transcendental/cl_C_cos.cc + complex/transcendental/cl_C_cosh.cc + complex/transcendental/cl_C_exp.cc + complex/transcendental/cl_C_expt_C.cc + complex/transcendental/cl_C_log.cc + complex/transcendental/cl_C_log2.cc + complex/transcendental/cl_C_phase.cc + complex/transcendental/cl_C_sin.cc + complex/transcendental/cl_C_sinh.cc + complex/transcendental/cl_C_tan.cc + complex/transcendental/cl_C_tanh.cc + complex/transcendental/cl_R_cis.cc + float/algebraic/cl_F_sqrt.cc + float/base/cl_F_globals.cc + float/base/cl_F_nan_exception.cc + float/base/cl_F_overflow_exception.cc + float/base/cl_F_underflow_exception.cc + float/cl_F.h + float/conv/cl_DF_to_FF.cc + float/conv/cl_DF_to_LF.cc + float/conv/cl_DF_to_SF.cc + float/conv/cl_DF_to_double.cc + float/conv/cl_DF_to_float.cc + float/conv/cl_FF_to_DF.cc + float/conv/cl_FF_to_LF.cc + float/conv/cl_FF_to_SF.cc + float/conv/cl_FF_to_double.cc + float/conv/cl_FF_to_float.cc + float/conv/cl_F_from_F.cc + float/conv/cl_F_from_F_f.cc + float/conv/cl_F_from_I.cc + float/conv/cl_F_from_I_def.cc + float/conv/cl_F_from_I_f.cc + float/conv/cl_F_from_RA.cc + float/conv/cl_F_from_RA_def.cc + float/conv/cl_F_from_RA_f.cc + float/conv/cl_F_to_DF.cc + float/conv/cl_F_to_FF.cc + float/conv/cl_F_to_LF.cc + float/conv/cl_F_to_SF.cc + float/conv/cl_F_to_double.cc + float/conv/cl_F_to_float.cc + float/conv/cl_LF_to_DF.cc + float/conv/cl_LF_to_FF.cc + float/conv/cl_LF_to_SF.cc + float/conv/cl_LF_to_double.cc + float/conv/cl_LF_to_float.cc + float/conv/cl_SF_to_DF.cc + float/conv/cl_SF_to_FF.cc + float/conv/cl_SF_to_LF.cc + float/conv/cl_SF_to_double.cc + float/conv/cl_SF_to_float.cc + float/dfloat/algebraic/cl_DF_sqrt.cc + float/dfloat/cl_DF.h + float/dfloat/conv/cl_DF_from_double.cc + float/dfloat/conv/cl_DF_to_doublej.cc + float/dfloat/conv/cl_I_to_double.cc + float/dfloat/conv/cl_RA_to_double.cc + float/dfloat/division/cl_DF_ceil22.cc + float/dfloat/division/cl_DF_fceil.cc + float/dfloat/division/cl_DF_floor22.cc + float/dfloat/division/cl_DF_recip.cc + float/dfloat/division/cl_DF_round22.cc + float/dfloat/division/cl_DF_trunc22.cc + float/dfloat/elem/cl_DF_compare.cc + float/dfloat/elem/cl_DF_div.cc + float/dfloat/elem/cl_DF_ffloor.cc + float/dfloat/elem/cl_DF_from_I.cc + float/dfloat/elem/cl_DF_from_RA.cc + float/dfloat/elem/cl_DF_fround.cc + float/dfloat/elem/cl_DF_ftrunc.cc + float/dfloat/elem/cl_DF_futrunc.cc + float/dfloat/elem/cl_DF_globals.cc + float/dfloat/elem/cl_DF_minus.cc + float/dfloat/elem/cl_DF_minusp.cc + float/dfloat/elem/cl_DF_mul.cc + float/dfloat/elem/cl_DF_plus.cc + float/dfloat/elem/cl_DF_plusp.cc + float/dfloat/elem/cl_DF_scale.cc + float/dfloat/elem/cl_DF_scale_I.cc + float/dfloat/elem/cl_DF_to_I.cc + float/dfloat/elem/cl_DF_uminus.cc + float/dfloat/elem/cl_DF_zerop.cc + float/dfloat/input/cl_DF_from_string.cc + float/dfloat/misc/cl_DF_abs.cc + float/dfloat/misc/cl_DF_as.cc + float/dfloat/misc/cl_DF_class.cc + float/dfloat/misc/cl_DF_debug.cc + float/dfloat/misc/cl_DF_decode.cc + float/dfloat/misc/cl_DF_digits.cc + float/dfloat/misc/cl_DF_eqhashcode.cc + float/dfloat/misc/cl_DF_exponent.cc + float/dfloat/misc/cl_DF_idecode.cc + float/dfloat/misc/cl_DF_max.cc + float/dfloat/misc/cl_DF_min.cc + float/dfloat/misc/cl_DF_precision.cc + float/dfloat/misc/cl_DF_sign.cc + float/dfloat/misc/cl_DF_signum.cc + float/division/cl_F_ceil1.cc + float/division/cl_F_ceil2.cc + float/division/cl_F_ceil22.cc + float/division/cl_F_fceil1.cc + float/division/cl_F_fceil2.cc + float/division/cl_F_ffloor1.cc + float/division/cl_F_ffloor2.cc + float/division/cl_F_floor1.cc + float/division/cl_F_floor2.cc + float/division/cl_F_floor22.cc + float/division/cl_F_fround1.cc + float/division/cl_F_fround2.cc + float/division/cl_F_ftrunc1.cc + float/division/cl_F_ftrunc2.cc + float/division/cl_F_round1.cc + float/division/cl_F_round2.cc + float/division/cl_F_round22.cc + float/division/cl_F_trunc1.cc + float/division/cl_F_trunc2.cc + float/division/cl_F_trunc22.cc + float/elem/cl_F_I_div.cc + float/elem/cl_F_I_mul.cc + float/elem/cl_F_RA_div.cc + float/elem/cl_F_RA_mul.cc + float/elem/cl_F_compare.cc + float/elem/cl_F_div.cc + float/elem/cl_F_minus.cc + float/elem/cl_F_minusp.cc + float/elem/cl_F_mul.cc + float/elem/cl_F_plus.cc + float/elem/cl_F_plusp.cc + float/elem/cl_F_recip.cc + float/elem/cl_F_scale.cc + float/elem/cl_F_scale_I.cc + float/elem/cl_F_square.cc + float/elem/cl_F_uminus.cc + float/elem/cl_F_zerop.cc + float/elem/cl_I_F_div.cc + float/elem/cl_RA_F_div.cc + float/ffloat/algebraic/cl_FF_sqrt.cc + float/ffloat/cl_FF.h + float/ffloat/conv/cl_FF_from_float.cc + float/ffloat/conv/cl_FF_to_floatj.cc + float/ffloat/conv/cl_I_to_float.cc + float/ffloat/conv/cl_RA_to_float.cc + float/ffloat/division/cl_FF_ceil22.cc + float/ffloat/division/cl_FF_fceil.cc + float/ffloat/division/cl_FF_floor22.cc + float/ffloat/division/cl_FF_recip.cc + float/ffloat/division/cl_FF_round22.cc + float/ffloat/division/cl_FF_trunc22.cc + float/ffloat/elem/cl_FF_compare.cc + float/ffloat/elem/cl_FF_div.cc + float/ffloat/elem/cl_FF_ffloor.cc + float/ffloat/elem/cl_FF_from_I.cc + float/ffloat/elem/cl_FF_from_RA.cc + float/ffloat/elem/cl_FF_fround.cc + float/ffloat/elem/cl_FF_ftrunc.cc + float/ffloat/elem/cl_FF_futrunc.cc + float/ffloat/elem/cl_FF_globals.cc + float/ffloat/elem/cl_FF_minus.cc + float/ffloat/elem/cl_FF_minusp.cc + float/ffloat/elem/cl_FF_mul.cc + float/ffloat/elem/cl_FF_plus.cc + float/ffloat/elem/cl_FF_plusp.cc + float/ffloat/elem/cl_FF_scale.cc + float/ffloat/elem/cl_FF_scale_I.cc + float/ffloat/elem/cl_FF_to_I.cc + float/ffloat/elem/cl_FF_uminus.cc + float/ffloat/elem/cl_FF_zerop.cc + float/ffloat/input/cl_FF_from_string.cc + float/ffloat/misc/cl_FF_abs.cc + float/ffloat/misc/cl_FF_as.cc + float/ffloat/misc/cl_FF_class.cc + float/ffloat/misc/cl_FF_debug.cc + float/ffloat/misc/cl_FF_decode.cc + float/ffloat/misc/cl_FF_digits.cc + float/ffloat/misc/cl_FF_eqhashcode.cc + float/ffloat/misc/cl_FF_exponent.cc + float/ffloat/misc/cl_FF_idecode.cc + float/ffloat/misc/cl_FF_max.cc + float/ffloat/misc/cl_FF_min.cc + float/ffloat/misc/cl_FF_precision.cc + float/ffloat/misc/cl_FF_sign.cc + float/ffloat/misc/cl_FF_signum.cc + float/input/cl_F_from_string.cc + float/input/cl_F_read.cc + float/input/cl_F_read_stream.cc + float/input/cl_F_readparsed.cc + float/lfloat/algebraic/cl_LF_sqrt.cc + float/lfloat/cl_LF.h + float/lfloat/cl_LF_impl.h + float/lfloat/division/cl_LF_ceil22.cc + float/lfloat/division/cl_LF_fceil.cc + float/lfloat/division/cl_LF_floor22.cc + float/lfloat/division/cl_LF_recip.cc + float/lfloat/division/cl_LF_round22.cc + float/lfloat/division/cl_LF_trunc22.cc + float/lfloat/elem/cl_I_LF_div.cc + float/lfloat/elem/cl_LF_1minus.cc + float/lfloat/elem/cl_LF_1plus.cc + float/lfloat/elem/cl_LF_2minus.cc + float/lfloat/elem/cl_LF_2plus.cc + float/lfloat/elem/cl_LF_I_div.cc + float/lfloat/elem/cl_LF_I_mul.cc + float/lfloat/elem/cl_LF_RA_div.cc + float/lfloat/elem/cl_LF_RA_mul.cc + float/lfloat/elem/cl_LF_compare.cc + float/lfloat/elem/cl_LF_div.cc + float/lfloat/elem/cl_LF_ffloor.cc + float/lfloat/elem/cl_LF_from_I.cc + float/lfloat/elem/cl_LF_from_RA.cc + float/lfloat/elem/cl_LF_fround.cc + float/lfloat/elem/cl_LF_ftrunc.cc + float/lfloat/elem/cl_LF_futrunc.cc + float/lfloat/elem/cl_LF_globals.cc + float/lfloat/elem/cl_LF_minus1.cc + float/lfloat/elem/cl_LF_minusp.cc + float/lfloat/elem/cl_LF_mul.cc + float/lfloat/elem/cl_LF_plus1.cc + float/lfloat/elem/cl_LF_plusp.cc + float/lfloat/elem/cl_LF_scale.cc + float/lfloat/elem/cl_LF_scale_I.cc + float/lfloat/elem/cl_LF_square.cc + float/lfloat/elem/cl_LF_to_I.cc + float/lfloat/elem/cl_LF_uminus.cc + float/lfloat/elem/cl_LF_zerop.cc + float/lfloat/elem/cl_RA_LF_div.cc + float/lfloat/input/cl_LF_from_string.cc + float/lfloat/misc/cl_LF_abs.cc + float/lfloat/misc/cl_LF_as.cc + float/lfloat/misc/cl_LF_class.cc + float/lfloat/misc/cl_LF_debug.cc + float/lfloat/misc/cl_LF_decode.cc + float/lfloat/misc/cl_LF_digits.cc + float/lfloat/misc/cl_LF_eqhashcode.cc + float/lfloat/misc/cl_LF_exponent.cc + float/lfloat/misc/cl_LF_extend.cc + float/lfloat/misc/cl_LF_idecode.cc + float/lfloat/misc/cl_LF_leninc.cc + float/lfloat/misc/cl_LF_lenincx.cc + float/lfloat/misc/cl_LF_max.cc + float/lfloat/misc/cl_LF_min.cc + float/lfloat/misc/cl_LF_precision.cc + float/lfloat/misc/cl_LF_shorten.cc + float/lfloat/misc/cl_LF_shortenrel.cc + float/lfloat/misc/cl_LF_shortenwith.cc + float/lfloat/misc/cl_LF_sign.cc + float/lfloat/misc/cl_LF_signum.cc + float/lfloat/misc/cl_LF_to_LF.cc + float/misc/cl_F_abs.cc + float/misc/cl_F_as.cc + float/misc/cl_F_decode.cc + float/misc/cl_F_digits.cc + float/misc/cl_F_epsneg.cc + float/misc/cl_F_epspos.cc + float/misc/cl_F_eqhashcode.cc + float/misc/cl_F_exponent.cc + float/misc/cl_F_extendsqrt.cc + float/misc/cl_F_extendsqrtx.cc + float/misc/cl_F_idecode.cc + float/misc/cl_F_leastneg.cc + float/misc/cl_F_leastpos.cc + float/misc/cl_F_max.cc + float/misc/cl_F_min.cc + float/misc/cl_F_mostneg.cc + float/misc/cl_F_mostpos.cc + float/misc/cl_F_precision.cc + float/misc/cl_F_rational.cc + float/misc/cl_F_shortenrel.cc + float/misc/cl_F_sign.cc + float/misc/cl_F_sign2.cc + float/misc/cl_F_signum.cc + float/misc/cl_float_format.cc + float/output/cl_F_aprint.cc + float/output/cl_F_bprint.cc + float/output/cl_F_cprint.cc + float/output/cl_F_dprint.cc + float/output/cl_F_printb.cc + float/random/cl_F_random.cc + float/sfloat/algebraic/cl_SF_sqrt.cc + float/sfloat/cl_SF.h + float/sfloat/division/cl_SF_ceil22.cc + float/sfloat/division/cl_SF_fceil.cc + float/sfloat/division/cl_SF_ffloor.cc + float/sfloat/division/cl_SF_floor22.cc + float/sfloat/division/cl_SF_recip.cc + float/sfloat/division/cl_SF_round22.cc + float/sfloat/division/cl_SF_trunc22.cc + float/sfloat/elem/cl_SF_compare.cc + float/sfloat/elem/cl_SF_div.cc + float/sfloat/elem/cl_SF_from_I.cc + float/sfloat/elem/cl_SF_from_RA.cc + float/sfloat/elem/cl_SF_fround.cc + float/sfloat/elem/cl_SF_ftrunc.cc + float/sfloat/elem/cl_SF_futrunc.cc + float/sfloat/elem/cl_SF_minus.cc + float/sfloat/elem/cl_SF_minusp.cc + float/sfloat/elem/cl_SF_mul.cc + float/sfloat/elem/cl_SF_plus.cc + float/sfloat/elem/cl_SF_plusp.cc + float/sfloat/elem/cl_SF_scale.cc + float/sfloat/elem/cl_SF_scale_I.cc + float/sfloat/elem/cl_SF_to_I.cc + float/sfloat/elem/cl_SF_uminus.cc + float/sfloat/elem/cl_SF_zerop.cc + float/sfloat/input/cl_SF_from_string.cc + float/sfloat/misc/cl_SF_abs.cc + float/sfloat/misc/cl_SF_as.cc + float/sfloat/misc/cl_SF_class.cc + float/sfloat/misc/cl_SF_debug.cc + float/sfloat/misc/cl_SF_decode.cc + float/sfloat/misc/cl_SF_digits.cc + float/sfloat/misc/cl_SF_eqhashcode.cc + float/sfloat/misc/cl_SF_exponent.cc + float/sfloat/misc/cl_SF_idecode.cc + float/sfloat/misc/cl_SF_max.cc + float/sfloat/misc/cl_SF_min.cc + float/sfloat/misc/cl_SF_precision.cc + float/sfloat/misc/cl_SF_sign.cc + float/sfloat/misc/cl_SF_signum.cc + float/transcendental/Makefile.devel + float/transcendental/cl_F_atanhx.cc + float/transcendental/cl_F_atanx.cc + float/transcendental/cl_F_catalanconst.cc + float/transcendental/cl_F_catalanconst_def.cc + float/transcendental/cl_F_catalanconst_f.cc + float/transcendental/cl_F_catalanconst_var.cc + float/transcendental/cl_F_catalanconst_var.h + float/transcendental/cl_F_cos.cc + float/transcendental/cl_F_cosh.cc + float/transcendental/cl_F_coshsinh.cc + float/transcendental/cl_F_cossin.cc + float/transcendental/cl_F_eulerconst.cc + float/transcendental/cl_F_eulerconst_def.cc + float/transcendental/cl_F_eulerconst_f.cc + float/transcendental/cl_F_eulerconst_var.cc + float/transcendental/cl_F_eulerconst_var.h + float/transcendental/cl_F_exp.cc + float/transcendental/cl_F_exp1.cc + float/transcendental/cl_F_exp1_def.cc + float/transcendental/cl_F_exp1_f.cc + float/transcendental/cl_F_exp1_var.cc + float/transcendental/cl_F_exp1_var.h + float/transcendental/cl_F_expx.cc + float/transcendental/cl_F_ln.cc + float/transcendental/cl_F_ln10.cc + float/transcendental/cl_F_ln10_f.cc + float/transcendental/cl_F_ln10_var.cc + float/transcendental/cl_F_ln10_var.h + float/transcendental/cl_F_ln2.cc + float/transcendental/cl_F_ln2_f.cc + float/transcendental/cl_F_ln2_var.cc + float/transcendental/cl_F_ln2_var.h + float/transcendental/cl_F_lnx.cc + float/transcendental/cl_F_pi.cc + float/transcendental/cl_F_pi_def.cc + float/transcendental/cl_F_pi_f.cc + float/transcendental/cl_F_pi_var.cc + float/transcendental/cl_F_pi_var.h + float/transcendental/cl_F_roundpi.cc + float/transcendental/cl_F_roundpi2.cc + float/transcendental/cl_F_sin.cc + float/transcendental/cl_F_sinh.cc + float/transcendental/cl_F_sinhx.cc + float/transcendental/cl_F_sinx.cc + float/transcendental/cl_F_tan.cc + float/transcendental/cl_F_tanh.cc + float/transcendental/cl_F_tran.h + float/transcendental/cl_F_zeta_int.cc + float/transcendental/cl_F_zeta_int_def.cc + float/transcendental/cl_F_zeta_int_f.cc + float/transcendental/cl_LF_atan_recip.cc + float/transcendental/cl_LF_atanh_recip.cc + float/transcendental/cl_LF_catalanconst.cc + float/transcendental/cl_LF_coshsinh.cc + float/transcendental/cl_LF_coshsinh_aux.cc + float/transcendental/cl_LF_cossin.cc + float/transcendental/cl_LF_cossin_aux.cc + float/transcendental/cl_LF_eulerconst.cc + float/transcendental/cl_LF_exp1.cc + float/transcendental/cl_LF_exp_aux.cc + float/transcendental/cl_LF_ln10.cc + float/transcendental/cl_LF_ln2.cc + float/transcendental/cl_LF_pi.cc + float/transcendental/cl_LF_ratseries_.cc + float/transcendental/cl_LF_ratseries_a.cc + float/transcendental/cl_LF_ratseries_ab.cc + float/transcendental/cl_LF_ratseries_b.cc + float/transcendental/cl_LF_ratseries_p.cc + float/transcendental/cl_LF_ratseries_pa.cc + float/transcendental/cl_LF_ratseries_pab.cc + float/transcendental/cl_LF_ratseries_pb.cc + float/transcendental/cl_LF_ratseries_pq.cc + float/transcendental/cl_LF_ratseries_pqa.cc + float/transcendental/cl_LF_ratseries_pqab.cc + float/transcendental/cl_LF_ratseries_pqb.cc + float/transcendental/cl_LF_ratseries_q.cc + float/transcendental/cl_LF_ratseries_qa.cc + float/transcendental/cl_LF_ratseries_qab.cc + float/transcendental/cl_LF_ratseries_qb.cc + float/transcendental/cl_LF_ratsumseries_pqcd.cc + float/transcendental/cl_LF_ratsumseries_pqcd_aux.cc + float/transcendental/cl_LF_ratsumseries_pqd.cc + float/transcendental/cl_LF_ratsumseries_pqd_aux.cc + float/transcendental/cl_LF_tran.h + float/transcendental/cl_LF_zeta3.cc + float/transcendental/cl_LF_zeta_int.cc + integer/2adic/cl_I_2adic_div.cc + integer/2adic/cl_I_2adic_recip.cc + integer/algebraic/cl_I_rootp.cc + integer/algebraic/cl_I_rootp_I.cc + integer/algebraic/cl_I_rootp_aux.cc + integer/algebraic/cl_I_sqrt.cc + integer/algebraic/cl_I_sqrtp.cc + integer/bitwise/cl_I_ash.cc + integer/bitwise/cl_I_ash_I.cc + integer/bitwise/cl_I_ash_exception.cc + integer/bitwise/cl_I_boole.cc + integer/bitwise/cl_I_byte.h + integer/bitwise/cl_I_dpb.cc + integer/bitwise/cl_I_dpf.cc + integer/bitwise/cl_I_fullbyte.cc + integer/bitwise/cl_I_ilength.cc + integer/bitwise/cl_I_ldb.cc + integer/bitwise/cl_I_ldbtest.cc + integer/bitwise/cl_I_ldbx.cc + integer/bitwise/cl_I_ldbxtest.cc + integer/bitwise/cl_I_log.h + integer/bitwise/cl_I_log_aux.cc + integer/bitwise/cl_I_logand.cc + integer/bitwise/cl_I_logandc2.cc + integer/bitwise/cl_I_logbitp.cc + integer/bitwise/cl_I_logbitp_I.cc + integer/bitwise/cl_I_logcount.cc + integer/bitwise/cl_I_logeqv.cc + integer/bitwise/cl_I_logior.cc + integer/bitwise/cl_I_lognand.cc + integer/bitwise/cl_I_lognor.cc + integer/bitwise/cl_I_lognot.cc + integer/bitwise/cl_I_logorc2.cc + integer/bitwise/cl_I_logtest.cc + integer/bitwise/cl_I_logxor.cc + integer/bitwise/cl_I_mkf.cc + integer/bitwise/cl_I_mkfx.cc + integer/cl_I.h + integer/conv/cl_I_cached_power.cc + integer/conv/cl_I_cached_power.h + integer/conv/cl_I_digits_need.cc + integer/conv/cl_I_from_DS.cc + integer/conv/cl_I_from_L.cc + integer/conv/cl_I_from_L2.cc + integer/conv/cl_I_from_NDS.cc + integer/conv/cl_I_from_NUDS.cc + integer/conv/cl_I_from_Q.cc + integer/conv/cl_I_from_Q2.cc + integer/conv/cl_I_from_UDS.cc + integer/conv/cl_I_from_UL.cc + integer/conv/cl_I_from_UL2.cc + integer/conv/cl_I_from_UQ.cc + integer/conv/cl_I_from_digits.cc + integer/conv/cl_I_mul10plus.cc + integer/conv/cl_I_to_L.cc + integer/conv/cl_I_to_Q.cc + integer/conv/cl_I_to_UL.cc + integer/conv/cl_I_to_UQ.cc + integer/conv/cl_I_to_digits.cc + integer/division/cl_I_ceil1.cc + integer/division/cl_I_ceil2.cc + integer/division/cl_I_exquo.cc + integer/division/cl_I_exquo_exception.cc + integer/division/cl_I_exquopos.cc + integer/division/cl_I_floor1.cc + integer/division/cl_I_floor2.cc + integer/division/cl_I_mod.cc + integer/division/cl_I_rem.cc + integer/division/cl_I_round1.cc + integer/division/cl_I_round2.cc + integer/division/cl_I_trunc1.cc + integer/division/cl_I_trunc2.cc + integer/elem/cl_I_compare.cc + integer/elem/cl_I_div.cc + integer/elem/cl_I_equal.cc + integer/elem/cl_I_minus.cc + integer/elem/cl_I_minus1.cc + integer/elem/cl_I_minusp.cc + integer/elem/cl_I_mul.cc + integer/elem/cl_I_plus.cc + integer/elem/cl_I_plus1.cc + integer/elem/cl_I_plusp.cc + integer/elem/cl_I_square.cc + integer/elem/cl_I_uminus.cc + integer/elem/cl_I_zerop.cc + integer/gcd/cl_I_gcd.cc + integer/gcd/cl_I_gcd_aux.cc + integer/gcd/cl_I_gcd_aux2.cc + integer/gcd/cl_I_lcm.cc + integer/gcd/cl_I_xgcd.cc + integer/gcd/cl_low_gcd.cc + integer/hash/cl_I_hash_gcobject.cc + integer/hash/cl_I_hash_gcobject.h + integer/hash/cl_I_hash_gcpointer.cc + integer/hash/cl_I_hash_gcpointer.h + integer/hash/cl_I_hash_pointer.cc + integer/hash/cl_I_hash_pointer.h + integer/hash/cl_I_hash_rcobject.cc + integer/hash/cl_I_hash_rcobject.h + integer/hash/cl_I_hash_rcpointer.cc + integer/hash/cl_I_hash_rcpointer.h + integer/hash/cl_I_hashcode.cc + integer/hash/cl_I_hashweak_rcpointer.cc + integer/hash/cl_I_hashweak_rcpointer.h + integer/input/cl_I_from_string.cc + integer/input/cl_I_read.cc + integer/input/cl_I_read_stream.cc + integer/input/cl_I_readparsed.cc + integer/misc/cl_BN_class.cc + integer/misc/cl_FN_class.cc + integer/misc/cl_I_abs.cc + integer/misc/cl_I_as.cc + integer/misc/cl_I_debug.cc + integer/misc/cl_I_eqhashcode.cc + integer/misc/cl_I_exptpos.cc + integer/misc/cl_I_exptpos_I.cc + integer/misc/cl_I_max.cc + integer/misc/cl_I_min.cc + integer/misc/cl_I_oddp.cc + integer/misc/cl_I_ord2.cc + integer/misc/cl_I_power2p.cc + integer/misc/cl_I_signum.cc + integer/misc/combin/cl_I_binomial.cc + integer/misc/combin/cl_I_combin.h + integer/misc/combin/cl_I_doublefactorial.cc + integer/misc/combin/cl_I_factorial.cc + integer/misc/combin/cl_I_factorial_aux.cc + integer/output/cl_I_aprint.cc + integer/output/cl_I_bprint.cc + integer/output/cl_I_cprint.cc + integer/output/cl_I_decstring.cc + integer/output/cl_I_dprint.cc + integer/output/cl_I_print.cc + integer/output/cl_I_print_string.cc + integer/random/cl_I_random.cc + integer/random/cl_I_trandom.cc + integer/ring/cl_0_ring.cc + integer/ring/cl_I_ring.cc + modinteger/cl_MI.cc + modinteger/cl_MI.h + modinteger/cl_MI_cond_composite.cc + modinteger/cl_MI_debug.cc + modinteger/cl_MI_err_comp.cc + modinteger/cl_MI_fix16.h + modinteger/cl_MI_fix29.h + modinteger/cl_MI_fix32.h + modinteger/cl_MI_int.h + modinteger/cl_MI_int32.h + modinteger/cl_MI_lshift.cc + modinteger/cl_MI_montgom.h + modinteger/cl_MI_pow2.h + modinteger/cl_MI_pow2m1.h + modinteger/cl_MI_pow2p1.h + modinteger/cl_MI_rshift.cc + modinteger/cl_MI_std.h + numtheory/cl_IF.h + numtheory/cl_IF_millerrabin.cc + numtheory/cl_IF_smallprimes.cc + numtheory/cl_IF_trialdiv.cc + numtheory/cl_IF_trialdiv1.cc + numtheory/cl_IF_trialdiv2.cc + numtheory/cl_nt_cornacchia1.cc + numtheory/cl_nt_cornacchia4.cc + numtheory/cl_nt_isprobprime.cc + numtheory/cl_nt_jacobi.cc + numtheory/cl_nt_jacobi_low.cc + numtheory/cl_nt_nextprobprime.cc + numtheory/cl_nt_sqrtmodp.cc + polynomial/cl_UP.h + polynomial/elem/cl_UP.cc + polynomial/elem/cl_UP_GF2.h + polynomial/elem/cl_UP_MI.h + polynomial/elem/cl_UP_gen.h + polynomial/elem/cl_UP_named.cc + polynomial/elem/cl_UP_no_ring.cc + polynomial/elem/cl_UP_number.h + polynomial/elem/cl_UP_unnamed.cc + polynomial/misc/cl_UP_I_hermite.cc + polynomial/misc/cl_UP_I_laguerre.cc + polynomial/misc/cl_UP_I_tchebychev.cc + polynomial/misc/cl_UP_RA_legendre.cc + polynomial/misc/cl_UP_debug.cc + polynomial/misc/cl_UP_deriv.cc + rational/algebraic/cl_RA_rootp.cc + rational/algebraic/cl_RA_rootp_I.cc + rational/algebraic/cl_RA_sqrtp.cc + rational/cl_RA.h + rational/division/cl_RA_ceil1.cc + rational/division/cl_RA_ceil12.cc + rational/division/cl_RA_ceil2.cc + rational/division/cl_RA_ceil22.cc + rational/division/cl_RA_floor1.cc + rational/division/cl_RA_floor12.cc + rational/division/cl_RA_floor2.cc + rational/division/cl_RA_floor22.cc + rational/division/cl_RA_round1.cc + rational/division/cl_RA_round12.cc + rational/division/cl_RA_round2.cc + rational/division/cl_RA_round22.cc + rational/division/cl_RA_trunc1.cc + rational/division/cl_RA_trunc12.cc + rational/division/cl_RA_trunc2.cc + rational/division/cl_RA_trunc22.cc + rational/elem/cl_RA_compare.cc + rational/elem/cl_RA_denominator.cc + rational/elem/cl_RA_div.cc + rational/elem/cl_RA_equal.cc + rational/elem/cl_RA_from_I_I_div.cc + rational/elem/cl_RA_from_I_posI.cc + rational/elem/cl_RA_from_I_posI1.cc + rational/elem/cl_RA_from_I_posI_div.cc + rational/elem/cl_RA_minus.cc + rational/elem/cl_RA_minus1.cc + rational/elem/cl_RA_minusp.cc + rational/elem/cl_RA_mul.cc + rational/elem/cl_RA_numerator.cc + rational/elem/cl_RA_plus.cc + rational/elem/cl_RA_plus1.cc + rational/elem/cl_RA_plusp.cc + rational/elem/cl_RA_recip.cc + rational/elem/cl_RA_square.cc + rational/elem/cl_RA_uminus.cc + rational/elem/cl_RA_zerop.cc + rational/input/cl_RA_from_string.cc + rational/input/cl_RA_read.cc + rational/input/cl_RA_read_stream.cc + rational/input/cl_RA_readparsed.cc + rational/misc/cl_RA_abs.cc + rational/misc/cl_RA_as.cc + rational/misc/cl_RA_class.cc + rational/misc/cl_RA_debug.cc + rational/misc/cl_RA_eqhashcode.cc + rational/misc/cl_RA_expt.cc + rational/misc/cl_RA_expt_I.cc + rational/misc/cl_RA_exptpos.cc + rational/misc/cl_RA_exptpos_I.cc + rational/misc/cl_RA_max.cc + rational/misc/cl_RA_min.cc + rational/misc/cl_RA_signum.cc + rational/output/cl_RA_aprint.cc + rational/output/cl_RA_bprint.cc + rational/output/cl_RA_cprint.cc + rational/output/cl_RA_dprint.cc + rational/output/cl_RA_print.cc + rational/ring/cl_RA_ring.cc + rational/transcendental/cl_I_logp.cc + rational/transcendental/cl_RA_logp.cc + real/algebraic/cl_RA_sqrt.cc + real/algebraic/cl_R_sqrt.cc + real/cl_R.h + real/conv/cl_F_from_R.cc + real/conv/cl_F_from_R_def.cc + real/conv/cl_F_from_R_f.cc + real/conv/cl_R_to_DF.cc + real/conv/cl_R_to_FF.cc + real/conv/cl_R_to_LF.cc + real/conv/cl_R_to_SF.cc + real/conv/cl_R_to_double.cc + real/conv/cl_R_to_float.cc + real/division/cl_R_ceil1.cc + real/division/cl_R_ceil12.cc + real/division/cl_R_ceil2.cc + real/division/cl_R_ceil22.cc + real/division/cl_R_div_t.h + real/division/cl_R_fceil1.cc + real/division/cl_R_fceil12.cc + real/division/cl_R_fceil2.cc + real/division/cl_R_fceil22.cc + real/division/cl_R_ffloor1.cc + real/division/cl_R_ffloor12.cc + real/division/cl_R_ffloor2.cc + real/division/cl_R_ffloor22.cc + real/division/cl_R_floor1.cc + real/division/cl_R_floor12.cc + real/division/cl_R_floor2.cc + real/division/cl_R_floor22.cc + real/division/cl_R_fround1.cc + real/division/cl_R_fround12.cc + real/division/cl_R_fround2.cc + real/division/cl_R_fround22.cc + real/division/cl_R_ftrunc1.cc + real/division/cl_R_ftrunc12.cc + real/division/cl_R_ftrunc2.cc + real/division/cl_R_ftrunc22.cc + real/division/cl_R_mod.cc + real/division/cl_R_rem.cc + real/division/cl_R_round1.cc + real/division/cl_R_round12.cc + real/division/cl_R_round2.cc + real/division/cl_R_round22.cc + real/division/cl_R_trunc1.cc + real/division/cl_R_trunc12.cc + real/division/cl_R_trunc2.cc + real/division/cl_R_trunc22.cc + real/elem/cl_R_compare.cc + real/elem/cl_R_div.cc + real/elem/cl_R_equal.cc + real/elem/cl_R_minus.cc + real/elem/cl_R_minus1.cc + real/elem/cl_R_minusp.cc + real/elem/cl_R_mul.cc + real/elem/cl_R_plus.cc + real/elem/cl_R_plus1.cc + real/elem/cl_R_plusp.cc + real/elem/cl_R_recip.cc + real/elem/cl_R_square.cc + real/elem/cl_R_uminus.cc + real/elem/cl_R_zerop.cc + real/format-output/TODO-format + real/format-output/cl_fmt_cardinal.cc + real/format-output/cl_fmt_floatstring.cc + real/format-output/cl_fmt_integer.cc + real/format-output/cl_fmt_newroman.cc + real/format-output/cl_fmt_oldroman.cc + real/format-output/cl_fmt_ordinal.cc + real/format-output/cl_fmt_paddedstring.cc + real/format-output/cl_fmt_scaleexp.cc + real/format-output/cl_fmt_tens.cc + real/format-output/cl_format.h + real/input/cl_R_from_string.cc + real/input/cl_R_read.cc + real/input/cl_R_read_stream.cc + real/misc/cl_R_abs.cc + real/misc/cl_R_as.cc + real/misc/cl_R_contagion.cc + real/misc/cl_R_debug.cc + real/misc/cl_R_eqhashcode.cc + real/misc/cl_R_expt.cc + real/misc/cl_R_expt_I.cc + real/misc/cl_R_max.cc + real/misc/cl_R_min.cc + real/misc/cl_R_rational.cc + real/misc/cl_R_rationalize.cc + real/misc/cl_R_signum.cc + real/output/cl_R_aprint.cc + real/output/cl_R_bprint.cc + real/output/cl_R_cprint.cc + real/random/cl_R_random.cc + real/ring/cl_R_ring.cc + real/transcendental/cl_R_atan.cc + real/transcendental/cl_R_atan2.cc + real/transcendental/cl_R_cos.cc + real/transcendental/cl_R_cosh.cc + real/transcendental/cl_R_coshsinh.cc + real/transcendental/cl_R_cossin.cc + real/transcendental/cl_R_exp.cc + real/transcendental/cl_R_ln.cc + real/transcendental/cl_R_log.cc + real/transcendental/cl_R_sin.cc + real/transcendental/cl_R_sinh.cc + real/transcendental/cl_R_tan.cc + real/transcendental/cl_R_tanh.cc + timing/cl_t_c1.cc + timing/cl_t_c2.cc + timing/cl_t_current.cc + timing/cl_t_current2.cc + timing/cl_t_d.cc + timing/cl_t_dec.cc + timing/cl_t_inc.cc + timing/cl_t_minus.cc + timing/cl_t_report.cc + timing/cl_t_td_minus.cc + timing/cl_t_td_plus.cc + vector/cl_GV_I.cc + vector/cl_GV_I_copy.cc + vector/cl_GV_I_debug.cc + vector/cl_GV_io.h + vector/cl_GV_number.cc + vector/cl_GV_number_copy.cc + vector/cl_GV_number_debug.cc + vector/cl_SV_copy.cc + vector/cl_SV_io.h + vector/cl_SV_number.cc + vector/cl_SV_number_debug.cc + vector/cl_SV_ringelt.cc + vector/cl_SV_ringelt_debug.cc + vector/output/cl_GV_number_aprint.cc + vector/output/cl_SV_aprint.cc + vector/output/cl_SV_number_aprint.cc +) + +set(asm_sources base/digitseq/cl_asm.S) +set_source_files_properties(${asm_sources} PROPERTIES + LANGUAGE C + COMPILE_FLAGS "${ASM_NOEXECSTACK_FLAG}") + +add_library(cln ${cln_sources}) +add_library(cln::cln ALIAS cln) +# The incantation below tells CMake to set the correct SONAME and use +# the conventional libcln.so.SONAME.X.Y file name. The variables +# ("target properties") used by CMake are all but confusing: VERSION +# corresponds to SONAME, and SOVERSION corresponds to version, respectively. +set_target_properties(cln PROPERTIES + SOVERSION ${libcln_soversion} + VERSION ${libcln_version}) +if (CLN_USE_GMP) + target_link_libraries(cln PRIVATE gmp::gmp) +endif() + +if (WIN32 AND CMAKE_COMPILER_IS_GNUCXX AND BUILD_SHARED_LIBS) + set_target_properties(cln PROPERTIES LINK_FLAGS "-Wl,--export-all-symbols") +endif() +if (NOT BUILD_SHARED_LIBS) + set_target_properties(cln PROPERTIES OUTPUT_NAME "cln") + # Avoid the static library vs import library conflict (necessary for + # the m$ toolchain). + set_target_properties(cln PROPERTIES PREFIX "lib") +endif() +target_include_directories(cln + PUBLIC + $ + $ + $ + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} +) + +target_compile_definitions(cln + PRIVATE + -DCL_CPU_BIG_ENDIAN_P=${cln_cpu_big_endian} +) + +install(TARGETS cln + EXPORT cln-exports + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" +) + +install(EXPORT cln-exports + FILE cln-targets.cmake + NAMESPACE cln:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cln +) diff --git a/src/base/cl_base_config.h.cmake b/src/base/cl_base_config.h.cmake new file mode 100644 index 0000000..3ce221d --- /dev/null +++ b/src/base/cl_base_config.h.cmake @@ -0,0 +1,17 @@ +#ifndef CL_BASE_CONFIG_H +#define CL_BASE_CONFIG_H + +/* CL_GETTIMEOFDAY */ +/* Define if you have the gettimeofday() function. */ +#cmakedefine HAVE_GETTIMEOFDAY +/* Define if the declaration of gettimeofday() needs dots. */ +#cmakedefine GETTIMEOFDAY_DOTS +/* Define as the type of `tzp' in gettimeofday() declaration. */ +#cmakedefine GETTIMEOFDAY_TZP_T + +/* CL_TIMES_CLOCK */ +/* Define if you have the times() function and it returns the real time, + but don't have the gettimeofday() function. */ +#cmakedefine HAVE_TIMES_CLOCK +#endif /* CL_BASE_CONFIG_H */ + diff --git a/src/base/cl_gmpconfig.h.cmake b/src/base/cl_gmpconfig.h.cmake new file mode 100644 index 0000000..2c1cda5 --- /dev/null +++ b/src/base/cl_gmpconfig.h.cmake @@ -0,0 +1,7 @@ +#ifndef CL_GMPCONFIG_H +#define CL_GMPCONFIG_H + +#cmakedefine CL_USE_GMP 1 + +#endif /* CL_GMPCONFIG_H */ + diff --git a/src/base/digitseq/cl_asm.S b/src/base/digitseq/cl_asm.S index 036d924..7c272e1 100644 --- a/src/base/digitseq/cl_asm.S +++ b/src/base/digitseq/cl_asm.S @@ -3,7 +3,13 @@ #include "cl_config.h" #include "base/digitseq/cl_DS_endian.h" -#ifndef NO_ASM +#ifdef _MSC_VER +/* m$vc does not grok AT&T asm */ +#undef NO_ASM_LOOPS +#define NO_ASM_LOOPS +#endif + +#if !defined(NO_ASM) && !defined(NO_ASM_LOOPS) #if defined(__m68k__) && (intCsize==16) #include "base/digitseq/cl_asm_m68k_.cc" diff --git a/src/base/digitseq/cl_asm.h b/src/base/digitseq/cl_asm.h index 01ab9c5..b3e77df 100644 --- a/src/base/digitseq/cl_asm.h +++ b/src/base/digitseq/cl_asm.h @@ -3,7 +3,13 @@ #include "cl_config.h" #include "base/digitseq/cl_DS_endian.h" -#ifndef NO_ASM +#ifdef _MSC_VER +/* m$vc does not grok AT&T asm */ +#undef NO_ASM_LOOPS +#define NO_ASM_LOOPS +#endif + +#if !defined(NO_ASM) && !defined(NO_ASM_LOOPS) #if defined(__m68k__) && (intCsize==16) #include "cl_asm_m68k.h" diff --git a/src/cl_config.h.cmake b/src/cl_config.h.cmake new file mode 100644 index 0000000..903916a --- /dev/null +++ b/src/cl_config.h.cmake @@ -0,0 +1,15 @@ +#ifndef CL_CONFIG_H +#define CL_CONFIG_H +#include "cln/host_cpu.h" + +#cmakedefine GMP_DEMANDS_UINTD_INT +#cmakedefine GMP_DEMANDS_UINTD_LONG +#cmakedefine GMP_DEMANDS_UINTD_LONG_LONG + +#cmakedefine CL_USE_GMP 1 + +#cmakedefine ASM_UNDERSCORE +#cmakedefine CL_HAVE_ATTRIBUTE_FLATTEN +#cmakedefine HAVE_UNISTD_H + +#endif /* CL_CONFIG_H */ diff --git a/src/timing/cl_t_config.h.cmake b/src/timing/cl_t_config.h.cmake new file mode 100644 index 0000000..7c06dce --- /dev/null +++ b/src/timing/cl_t_config.h.cmake @@ -0,0 +1,6 @@ +#ifndef CL_T_CONFIG_H +#define CL_T_CONFIG_H +#cmakedefine HAVE_GETTIMEOFDAY + +#endif /* CL_T_CONFIG_H */ + diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..03e50dd --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,61 @@ + +set(cln_tests exam tests) + +set(exam_SOURCES + exam.h exam.cc + exam_I.cc exam_I_plus.cc exam_I_minus.cc exam_I_mul.cc + exam_I_div.cc exam_I_floor.cc + exam_RA.cc exam_RA_plus.cc exam_RA_minus.cc exam_RA_mul.cc + exam_RA_div.cc exam_RA_floor.cc + exam_SF.cc exam_SF_plus.cc exam_SF_minus.cc exam_SF_mul.cc + exam_SF_div.cc exam_SF_floor.cc + exam_FF.cc exam_FF_plus.cc exam_FF_minus.cc exam_FF_mul.cc + exam_FF_div.cc exam_FF_floor.cc + exam_DF.cc exam_DF_plus.cc exam_DF_minus.cc exam_DF_mul.cc + exam_DF_div.cc exam_DF_floor.cc + exam_LF.cc exam_LF_plus.cc exam_LF_minus.cc exam_LF_mul.cc + exam_LF_div.cc exam_LF_floor.cc + exam_I_factorial.cc + exam_I_gcd.cc exam_I_sqrtp.cc test_MI.h test.h +) + +set(tests_SOURCES + test.h tests.cc test_I.cc test_I.h test_I_abs.cc test_I_compare.cc + test_I_plus.cc test_I_minus.cc test_I_plus1.cc + test_I_minus1.cc test_I_mul.cc test_I_div.cc + test_I_gcd.cc test_I_xgcd.cc test_I_ash.cc + test_I_evenp.cc test_I_oddp.cc test_I_lognot.cc + test_I_logand.cc test_I_logandc1.cc test_I_logandc2.cc + test_I_logior.cc test_I_logorc1.cc test_I_logorc2.cc + test_I_logxor.cc test_I_lognand.cc test_I_lognor.cc + test_I_logeqv.cc test_I_boole.cc test_I_logbitp.cc + test_I_logtest.cc test_I_ldb.cc test_I_ldbtest.cc + test_I_mkf.cc test_I_dpb.cc test_I_dpf.cc + test_I_logcount.cc test_I_ilength.cc test_I_ord2.cc + test_I_power2p.cc test_I_isqrt.cc test_I_sqrtp.cc + test_I_io.cc test_I_GV.cc + test_MI.h test_MI.cc test_MI_canonhom.cc test_MI_plus.cc + test_MI_minus.cc test_MI_mul.cc test_MI_recip.cc + test_MI_div.cc test_MI_expt.cc + test_nt.h test_nt.cc test_nt_jacobi.cc) + +macro(add_cln_test thename) + if ("${${thename}_SOURCES}" STREQUAL "") + set(${thename}_sources ${thename}.cc ${${thename}_extra_src}) + endif() + add_executable(${thename} EXCLUDE_FROM_ALL ${${thename}_SOURCES}) + target_link_libraries(${thename} cln::cln) + target_include_directories(${thename} + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/../src + ${CMAKE_CURRENT_BINARY_DIR}/../src + ) + add_dependencies(test_suite ${thename}) + add_dependencies(check ${thename}) + add_test(NAME ${thename} COMMAND $) +endmacro() + +foreach(tst ${cln_tests}) + add_cln_test(${tst}) +endforeach() + -- 2.47.0