mirror of
https://github.com/PCRE2Project/pcre2.git
synced 2025-10-17 07:04:13 +08:00
Move the linker script detection code out into its own CMake module
This commit is contained in:
127
CMakeLists.txt
127
CMakeLists.txt
@@ -114,12 +114,13 @@
|
||||
# -- ./CMakeLists.txt ./cmake/*.cmake ./cmake/*.cmake.in
|
||||
################################################################################
|
||||
|
||||
message(STATUS "Using CMake version ${CMAKE_VERSION} (${CMAKE_COMMAND})")
|
||||
|
||||
# Increased minimum to 3.15 to allow use of string(REPEAT).
|
||||
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
|
||||
project(PCRE2 C)
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_C_STANDARD_REQUIRED TRUE)
|
||||
|
||||
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
||||
|
||||
# Solaris-specific fix for "CMAKE_C_VISIBILITY_PRESET": this feature was only
|
||||
@@ -141,12 +142,10 @@ endif()
|
||||
# cmake_policy(SET CMP0026 OLD)
|
||||
# cmake_policy(SET CMP0074 NEW)
|
||||
|
||||
# For FindReadline.cmake. This uses list(APPEND) rather than set() to allow
|
||||
# For our modules in cmake/. This uses list(APPEND) rather than set() to allow
|
||||
# setting CMAKE_MODULE_PATH on the command line.
|
||||
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
||||
|
||||
include_directories(${PROJECT_BINARY_DIR}/interface ${PROJECT_BINARY_DIR}/src ${PROJECT_SOURCE_DIR}/src)
|
||||
|
||||
# external packages
|
||||
find_package(BZip2)
|
||||
find_package(ZLIB)
|
||||
@@ -163,7 +162,7 @@ include(CheckTypeSize)
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(CMakePushCheckState)
|
||||
include(GNUInstallDirs) # for CMAKE_INSTALL_LIBDIR
|
||||
include(PCRE2CheckLinkerFlag)
|
||||
include(PCRE2CheckVscript)
|
||||
include(PCRE2UseSystemExtensions)
|
||||
include(PCRE2WarningAsError)
|
||||
|
||||
@@ -270,29 +269,7 @@ check_c_source_compiles(
|
||||
|
||||
# Detect support for linker scripts.
|
||||
|
||||
file(WRITE ${PROJECT_BINARY_DIR}/test-map-file.sym "PCRE2_10.00 { global: main; };")
|
||||
file(WRITE ${PROJECT_BINARY_DIR}/test-map-file-broken.sym "PCRE2_10.00 { global: main; }; {")
|
||||
if(NOT MSVC)
|
||||
pcre2_check_linker_flag(C -Wl,--version-script,${PROJECT_BINARY_DIR}/test-map-file.sym HAVE_VSCRIPT_GNU)
|
||||
pcre2_check_linker_flag(C -Wl,-M,${PROJECT_BINARY_DIR}/test-map-file.sym HAVE_VSCRIPT_SUN)
|
||||
endif()
|
||||
if(HAVE_VSCRIPT_GNU)
|
||||
set(VSCRIPT_FLAG --version-script)
|
||||
set(HAVE_VSCRIPT TRUE)
|
||||
elseif(HAVE_VSCRIPT_SUN)
|
||||
set(VSCRIPT_FLAG -M)
|
||||
set(HAVE_VSCRIPT TRUE)
|
||||
endif()
|
||||
if(HAVE_VSCRIPT)
|
||||
# Perform the same logic as ax_check_vscript.m4, to test whether the linker
|
||||
# silently ignores (and overwrites) linker scripts it doesn't understand.
|
||||
pcre2_check_linker_flag(C -Wl,${VSCRIPT_FLAG},${PROJECT_BINARY_DIR}/test-map-file-broken.sym HAVE_VSCRIPT_BROKEN)
|
||||
if(HAVE_VSCRIPT_BROKEN)
|
||||
set(HAVE_VSCRIPT FALSE)
|
||||
endif()
|
||||
endif()
|
||||
file(REMOVE ${PROJECT_BINARY_DIR}/test-map-file.sym)
|
||||
file(REMOVE ${PROJECT_BINARY_DIR}/test-map-file-broken.sym)
|
||||
pcre2_check_vscript(HAVE_VSCRIPT VSCRIPT_FLAG)
|
||||
|
||||
# Check whether Intel CET is enabled, and if so, adjust compiler flags. This
|
||||
# code was written by PH, trying to imitate the logic from the autotools
|
||||
@@ -472,68 +449,26 @@ endif()
|
||||
if(BZIP2_FOUND)
|
||||
option(PCRE2_SUPPORT_LIBBZ2 "Enable support for linking pcre2grep with libbz2." ON)
|
||||
endif()
|
||||
if(PCRE2_SUPPORT_LIBBZ2)
|
||||
if(BZIP2_FOUND)
|
||||
include_directories(${BZIP2_INCLUDE_DIR})
|
||||
else()
|
||||
message(
|
||||
FATAL_ERROR
|
||||
" libbz2 not found. Set BZIP2_INCLUDE_DIR to a compatible header\n"
|
||||
" or set BZip2_ROOT to a full bzip2 installed tree, as needed."
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# zlib
|
||||
if(ZLIB_FOUND)
|
||||
option(PCRE2_SUPPORT_LIBZ "Enable support for linking pcre2grep with libz." ON)
|
||||
endif()
|
||||
if(PCRE2_SUPPORT_LIBZ)
|
||||
if(ZLIB_FOUND)
|
||||
include_directories(${ZLIB_INCLUDE_DIR})
|
||||
else()
|
||||
message(
|
||||
FATAL_ERROR
|
||||
" zlib not found. Set ZLIB_INCLUDE_DIR to a compatible header\n"
|
||||
" or set ZLIB_ROOT to a full zlib installed tree, as needed."
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# editline lib
|
||||
if(EDITLINE_FOUND)
|
||||
option(PCRE2_SUPPORT_LIBEDIT "Enable support for linking pcre2test with libedit." OFF)
|
||||
endif()
|
||||
if(PCRE2_SUPPORT_LIBEDIT)
|
||||
if(EDITLINE_FOUND)
|
||||
include_directories(${EDITLINE_INCLUDE_DIR})
|
||||
else()
|
||||
message(
|
||||
FATAL_ERROR
|
||||
" libedit not found. Set EDITLINE_INCLUDE_DIR to a compatible header\n"
|
||||
" or set Editline_ROOT to a full libedit installed tree, as needed."
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# readline lib
|
||||
if(READLINE_FOUND)
|
||||
option(PCRE2_SUPPORT_LIBREADLINE "Enable support for linking pcre2test with libreadline." ON)
|
||||
endif()
|
||||
if(PCRE2_SUPPORT_LIBREADLINE)
|
||||
if(READLINE_FOUND)
|
||||
include_directories(${READLINE_INCLUDE_DIR})
|
||||
else()
|
||||
message(
|
||||
FATAL_ERROR
|
||||
" libreadline not found. Set READLINE_INCLUDE_DIR to a compatible header\n"
|
||||
" or set Readline_ROOT to a full libreadline installed tree, as needed."
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Prepare build configuration
|
||||
|
||||
include_directories(${PROJECT_BINARY_DIR}/interface ${PROJECT_BINARY_DIR}/src ${PROJECT_SOURCE_DIR}/src)
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS)
|
||||
message(FATAL_ERROR "At least one of BUILD_SHARED_LIBS or BUILD_STATIC_LIBS must be enabled.")
|
||||
endif()
|
||||
@@ -562,6 +497,54 @@ if(PCRE2_BUILD_PCRE2GREP AND NOT PCRE2_BUILD_PCRE2_8)
|
||||
set(PCRE2_BUILD_PCRE2GREP OFF)
|
||||
endif()
|
||||
|
||||
if(PCRE2_SUPPORT_LIBBZ2)
|
||||
if(BZIP2_FOUND)
|
||||
include_directories(${BZIP2_INCLUDE_DIR})
|
||||
else()
|
||||
message(
|
||||
FATAL_ERROR
|
||||
" libbz2 not found. Set BZIP2_INCLUDE_DIR to a compatible header\n"
|
||||
" or set BZip2_ROOT to a full bzip2 installed tree, as needed."
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(PCRE2_SUPPORT_LIBZ)
|
||||
if(ZLIB_FOUND)
|
||||
include_directories(${ZLIB_INCLUDE_DIR})
|
||||
else()
|
||||
message(
|
||||
FATAL_ERROR
|
||||
" zlib not found. Set ZLIB_INCLUDE_DIR to a compatible header\n"
|
||||
" or set ZLIB_ROOT to a full zlib installed tree, as needed."
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(PCRE2_SUPPORT_LIBEDIT)
|
||||
if(EDITLINE_FOUND)
|
||||
include_directories(${EDITLINE_INCLUDE_DIR})
|
||||
else()
|
||||
message(
|
||||
FATAL_ERROR
|
||||
" libedit not found. Set EDITLINE_INCLUDE_DIR to a compatible header\n"
|
||||
" or set Editline_ROOT to a full libedit installed tree, as needed."
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(PCRE2_SUPPORT_LIBREADLINE)
|
||||
if(READLINE_FOUND)
|
||||
include_directories(${READLINE_INCLUDE_DIR})
|
||||
else()
|
||||
message(
|
||||
FATAL_ERROR
|
||||
" libreadline not found. Set READLINE_INCLUDE_DIR to a compatible header\n"
|
||||
" or set Readline_ROOT to a full libreadline installed tree, as needed."
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(PCRE2_SUPPORT_LIBREADLINE AND PCRE2_SUPPORT_LIBEDIT)
|
||||
if(READLINE_FOUND)
|
||||
message(
|
||||
|
@@ -1013,7 +1013,7 @@ EXTRA_DIST += \
|
||||
cmake/FindEditline.cmake \
|
||||
cmake/FindReadline.cmake \
|
||||
cmake/pcre2-config.cmake.in \
|
||||
cmake/PCRE2CheckLinkerFlag.cmake \
|
||||
cmake/PCRE2CheckVscript.cmake \
|
||||
cmake/PCRE2UseSystemExtensions.cmake \
|
||||
cmake/PCRE2WarningAsError.cmake \
|
||||
src/config-cmake.h.in \
|
||||
|
@@ -429,8 +429,14 @@ applications can be supported through UNIX System Services.
|
||||
The PCRE2 codebase compiles and runs with native EBCDIC support on modern z/OS
|
||||
systems, using the pre-installed tools (/bin/sh, ./configure, and the XLC or
|
||||
IBM-Clang compilers). PCRE2 supports z/OS using both Autoconf (./configure) and
|
||||
CMake (which IBM distributes via "zopen install cmake"). Any EBCDIC codepage
|
||||
should work (PCRE2 does not assume or require IBM-1047).
|
||||
CMake (which IBM distributes via "zopen install cmake").
|
||||
|
||||
Note that as of the time of writing, IBM's port of CMake to z/OS has only
|
||||
partial support for EBCDIC. It is recommended to build PCRE2 using the
|
||||
./configure script, if you require an EBCDIC build.
|
||||
|
||||
Any EBCDIC codepage should work (PCRE2 does not assume or require IBM-1047), or
|
||||
PCRE2 can compiled for ASCII/Latin-1/Unicode.
|
||||
|
||||
After unpacking the PCRE2 tarball, you must subsequently tag the files as ASCII
|
||||
in order for the z/OS shell and compiler to interpret them correctly:
|
||||
|
2
README
2
README
@@ -973,7 +973,7 @@ The distribution should contain the files listed below.
|
||||
cmake/FindEditline.cmake
|
||||
cmake/FindReadline.cmake
|
||||
cmake/pcre2-config.cmake.in
|
||||
cmake/PCRE2CheckLinkerFlag.cmake
|
||||
cmake/PCRE2CheckVscript.cmake
|
||||
cmake/PCRE2UseSystemExtensions.cmake
|
||||
cmake/PCRE2WarningAsError.cmake
|
||||
src/config-cmake.h.in
|
||||
|
@@ -1,26 +0,0 @@
|
||||
# This file can be removed once the minimum CMake version is increased to 3.18
|
||||
# or higher. Calls to pcre2_check_linker_flag can be changed to the built in
|
||||
# check_linker_flag.
|
||||
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.18)
|
||||
include(CheckLinkerFlag)
|
||||
|
||||
function(pcre2_check_linker_flag lang flag out_var)
|
||||
check_linker_flag("${lang}" "${flag}" "${out_var}")
|
||||
endfunction()
|
||||
else()
|
||||
# Fallback for versions of CMake older than 3.18.
|
||||
|
||||
include(CheckCCompilerFlag)
|
||||
include(CMakePushCheckState)
|
||||
|
||||
function(pcre2_check_linker_flag lang flag out_var)
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0056 NEW)
|
||||
cmake_push_check_state(RESET)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${flag}")
|
||||
check_c_compiler_flag("" ${out_var})
|
||||
cmake_pop_check_state()
|
||||
cmake_policy(POP)
|
||||
endfunction()
|
||||
endif()
|
112
cmake/PCRE2CheckVscript.cmake
Normal file
112
cmake/PCRE2CheckVscript.cmake
Normal file
@@ -0,0 +1,112 @@
|
||||
# Similarly to Autoconf's ax_check_vscript.m4, check whether the linker supports
|
||||
# version scripts (GNU ld) or map files (Sun linker).
|
||||
# Sets the "have_var" to TRUE or FALSE depending on the detected support; and if
|
||||
# support is detected then sets "flag_var" to the appropriate flag to pass to
|
||||
# the linker (namely, --version-script or -M).
|
||||
|
||||
function(pcre2_check_vscript have_var flag_var)
|
||||
set(${have_var} FALSE PARENT_SCOPE)
|
||||
set(${flag_var} "" PARENT_SCOPE)
|
||||
|
||||
if(MSVC)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(first_run FALSE)
|
||||
if(NOT DEFINED HAVE_VSCRIPT_GNU)
|
||||
set(first_run TRUE)
|
||||
message(STATUS "Detecting linker version script support")
|
||||
endif()
|
||||
|
||||
include(CheckCSourceCompiles)
|
||||
include(CMakePushCheckState)
|
||||
|
||||
# The BSD file here is a workaround for the fact that check_c_source_compiles
|
||||
# very unfortunately only supports linking executables
|
||||
# with an entrypoint (or a static library), and yet the symbol visibility
|
||||
# requirements for executables are understandably different on some platforms
|
||||
# as compared to linking a shared library. On FreeBSD, linking fails if you
|
||||
# use the linker script to hide various global symbols from /usr/lib/crt1.o.
|
||||
# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=269370
|
||||
# Basically, everyone using --version-script is actually going to be creating
|
||||
# a shared library. It's a frustrating mismatch.
|
||||
file(WRITE ${PROJECT_BINARY_DIR}/test-map-file.sym "PCRE2_10.00 { global: exposethis; local: *; };")
|
||||
file(WRITE ${PROJECT_BINARY_DIR}/test-map-file-bsd.sym "PCRE2_10.00 { global: exposethis; environ; __progname; local: *; };")
|
||||
file(WRITE ${PROJECT_BINARY_DIR}/test-map-file-broken.sym "PCRE2_10.00 { global: exposethis; local: *; }; {")
|
||||
|
||||
set(HAVE_VSCRIPT FALSE)
|
||||
|
||||
# Using an executable to check for version-script support is rather delicate,
|
||||
# because linking in an entrypoint (main) adds extra symbols into the mix.
|
||||
# If CMake ever added a SHARED_LIBRARY option to check_c_source_compiles, we'd
|
||||
# use it here.
|
||||
set(
|
||||
test_source
|
||||
[=[
|
||||
int exposethis = 0, hidethis = 0;
|
||||
int main(void) {
|
||||
return exposethis + hidethis;
|
||||
}
|
||||
]=]
|
||||
)
|
||||
|
||||
cmake_push_check_state(RESET)
|
||||
set(CMAKE_REQUIRED_QUIET TRUE)
|
||||
|
||||
set(CMAKE_REQUIRED_LINK_OPTIONS "-Wl,--version-script,${PROJECT_BINARY_DIR}/test-map-file.sym")
|
||||
check_c_source_compiles("${test_source}" HAVE_VSCRIPT_GNU)
|
||||
|
||||
if(HAVE_VSCRIPT_GNU)
|
||||
set(VSCRIPT_FLAG --version-script)
|
||||
set(HAVE_VSCRIPT TRUE)
|
||||
else()
|
||||
set(CMAKE_REQUIRED_LINK_OPTIONS "-Wl,--version-script,${PROJECT_BINARY_DIR}/test-map-file-bsd.sym")
|
||||
check_c_source_compiles("${test_source}" HAVE_VSCRIPT_BSD)
|
||||
|
||||
if(HAVE_VSCRIPT_BSD)
|
||||
set(VSCRIPT_FLAG --version-script)
|
||||
set(HAVE_VSCRIPT TRUE)
|
||||
else()
|
||||
set(CMAKE_REQUIRED_LINK_OPTIONS "-Wl,-M,${PROJECT_BINARY_DIR}/test-map-file.sym")
|
||||
check_c_source_compiles("${test_source}" HAVE_VSCRIPT_SUN)
|
||||
|
||||
if(HAVE_VSCRIPT_SUN)
|
||||
set(VSCRIPT_FLAG -M)
|
||||
set(HAVE_VSCRIPT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(HAVE_VSCRIPT)
|
||||
# Perform the same logic as ax_check_vscript.m4, to test whether the linker
|
||||
# silently ignores (and overwrites) linker scripts it doesn't understand.
|
||||
set(CMAKE_REQUIRED_LINK_OPTIONS "-Wl,${VSCRIPT_FLAG},${PROJECT_BINARY_DIR}/test-map-file-broken.sym")
|
||||
check_c_source_compiles("${test_source}" HAVE_VSCRIPT_BROKEN)
|
||||
|
||||
if(HAVE_VSCRIPT_BROKEN)
|
||||
set(HAVE_VSCRIPT FALSE)
|
||||
if(first_run)
|
||||
message(STATUS "Detecting linker version script support - no (linker overwrites unknown scripts)")
|
||||
endif()
|
||||
else()
|
||||
if(first_run)
|
||||
message(STATUS "Detecting linker version script support - yes (${VSCRIPT_FLAG})")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
if(first_run)
|
||||
message(STATUS "Detecting linker version script support - none detected")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
cmake_pop_check_state()
|
||||
|
||||
file(REMOVE ${PROJECT_BINARY_DIR}/test-map-file.sym)
|
||||
file(REMOVE ${PROJECT_BINARY_DIR}/test-map-file-bsd.sym)
|
||||
file(REMOVE ${PROJECT_BINARY_DIR}/test-map-file-broken.sym)
|
||||
|
||||
if(HAVE_VSCRIPT)
|
||||
set(${have_var} TRUE PARENT_SCOPE)
|
||||
set(${flag_var} "${VSCRIPT_FLAG}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
@@ -21,6 +21,13 @@ function(pcre2_use_system_extensions)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(first_run FALSE)
|
||||
set(found_macro FALSE)
|
||||
if(NOT DEFINED HAVE_GETRLIMIT_NAKED)
|
||||
set(first_run TRUE)
|
||||
message(STATUS "Detecting platform feature test macros")
|
||||
endif()
|
||||
|
||||
include(CheckSymbolExists)
|
||||
include(CheckCSourceCompiles)
|
||||
include(CMakePushCheckState)
|
||||
@@ -40,43 +47,43 @@ function(pcre2_use_system_extensions)
|
||||
]=]
|
||||
)
|
||||
set(CMAKE_REQUIRED_QUIET TRUE)
|
||||
check_c_source_compiles("${_pcre2_test_src}" _HAVE_GETRLIMIT_NAKED)
|
||||
check_c_source_compiles("${_pcre2_test_src}" HAVE_GETRLIMIT_NAKED)
|
||||
|
||||
if(NOT _HAVE_GETRLIMIT_NAKED)
|
||||
if(NOT HAVE_GETRLIMIT_NAKED)
|
||||
# Try again with _ALL_SOURCE
|
||||
if(NOT _HAVE_GETRLIMIT_ALLSOURCE)
|
||||
set(_allsource_first_run TRUE)
|
||||
endif()
|
||||
set(CMAKE_REQUIRED_DEFINITIONS "-D_ALL_SOURCE")
|
||||
check_c_source_compiles("${_pcre2_test_src}" _HAVE_GETRLIMIT_ALLSOURCE)
|
||||
check_c_source_compiles("${_pcre2_test_src}" HAVE_GETRLIMIT_ALLSOURCE)
|
||||
unset(CMAKE_REQUIRED_DEFINITIONS)
|
||||
|
||||
if(_HAVE_GETRLIMIT_ALLSOURCE)
|
||||
if(HAVE_GETRLIMIT_ALLSOURCE)
|
||||
add_compile_definitions(_ALL_SOURCE)
|
||||
if(_allsource_first_run)
|
||||
message(STATUS "Detected platform feature gate _ALL_SOURCE")
|
||||
set(found_macro TRUE)
|
||||
if(first_run)
|
||||
message(STATUS "Detecting platform feature test macros - _ALL_SOURCE")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
check_symbol_exists(mkostemp stdlib.h _HAVE_MKOSTEMP_NAKED)
|
||||
check_symbol_exists(mkostemp stdlib.h HAVE_MKOSTEMP_NAKED)
|
||||
|
||||
if(NOT _HAVE_MKOSTEMP_NAKED)
|
||||
if(NOT HAVE_MKOSTEMP_NAKED)
|
||||
# Try again with _GNU_SOURCE
|
||||
if(NOT _HAVE_MKOSTEMP_GNUSOURCE)
|
||||
set(_gnusource_first_run TRUE)
|
||||
endif()
|
||||
set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
|
||||
check_symbol_exists(mkostemp stdlib.h _HAVE_MKOSTEMP_GNUSOURCE)
|
||||
check_symbol_exists(mkostemp stdlib.h HAVE_MKOSTEMP_GNUSOURCE)
|
||||
unset(CMAKE_REQUIRED_DEFINITIONS)
|
||||
|
||||
if(_HAVE_MKOSTEMP_GNUSOURCE)
|
||||
if(HAVE_MKOSTEMP_GNUSOURCE)
|
||||
add_compile_definitions(_GNU_SOURCE)
|
||||
if(_gnusource_first_run)
|
||||
message(STATUS "Detected platform feature gate _GNU_SOURCE")
|
||||
set(found_macro TRUE)
|
||||
if(first_run)
|
||||
message(STATUS "Detecting platform feature test macros - _GNU_SOURCE")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(first_run AND NOT found_macro)
|
||||
message(STATUS "Detecting platform feature test macros - none")
|
||||
endif()
|
||||
|
||||
cmake_pop_check_state()
|
||||
endfunction()
|
||||
|
@@ -429,8 +429,14 @@ applications can be supported through UNIX System Services.
|
||||
The PCRE2 codebase compiles and runs with native EBCDIC support on modern z/OS
|
||||
systems, using the pre-installed tools (/bin/sh, ./configure, and the XLC or
|
||||
IBM-Clang compilers). PCRE2 supports z/OS using both Autoconf (./configure) and
|
||||
CMake (which IBM distributes via "zopen install cmake"). Any EBCDIC codepage
|
||||
should work (PCRE2 does not assume or require IBM-1047).
|
||||
CMake (which IBM distributes via "zopen install cmake").
|
||||
|
||||
Note that as of the time of writing, IBM's port of CMake to z/OS has only
|
||||
partial support for EBCDIC. It is recommended to build PCRE2 using the
|
||||
./configure script, if you require an EBCDIC build.
|
||||
|
||||
Any EBCDIC codepage should work (PCRE2 does not assume or require IBM-1047), or
|
||||
PCRE2 can compiled for ASCII/Latin-1/Unicode.
|
||||
|
||||
After unpacking the PCRE2 tarball, you must subsequently tag the files as ASCII
|
||||
in order for the z/OS shell and compiler to interpret them correctly:
|
||||
|
@@ -973,7 +973,7 @@ The distribution should contain the files listed below.
|
||||
cmake/FindEditline.cmake
|
||||
cmake/FindReadline.cmake
|
||||
cmake/pcre2-config.cmake.in
|
||||
cmake/PCRE2CheckLinkerFlag.cmake
|
||||
cmake/PCRE2CheckVscript.cmake
|
||||
cmake/PCRE2UseSystemExtensions.cmake
|
||||
cmake/PCRE2WarningAsError.cmake
|
||||
src/config-cmake.h.in
|
||||
|
@@ -57,7 +57,7 @@
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 2
|
||||
#serial 2.99 PCRE2
|
||||
|
||||
# _AX_CHECK_VSCRIPT(flag, global-sym, action-if-link-succeeds, [junk-file=no])
|
||||
AC_DEFUN([_AX_CHECK_VSCRIPT], [
|
||||
@@ -92,6 +92,17 @@ AC_DEFUN([AX_CHECK_VSCRIPT], [
|
||||
_AX_CHECK_VSCRIPT([--version-script], [show], [
|
||||
ax_cv_check_vscript_flag=--version-script
|
||||
])
|
||||
AS_IF([test x$ax_cv_check_vscript_flag = xunsupported], [
|
||||
# PCRE2: Support for FreeBSD. Rather annoyingly, AC_LINK_IFELSE will
|
||||
# only test linking executables, and in turn, on FreeBSD the main
|
||||
# entrypoint will fail to link if you use "local: *" to hide the
|
||||
# visibility of various shared symbols injected from /usr/lib/crt1.o.
|
||||
# It's not at all pretty to hardcode those symbol names here, but I
|
||||
# can't think of an obvious way to improve on this.
|
||||
_AX_CHECK_VSCRIPT([--version-script], [show;environ;__progname], [
|
||||
ax_cv_check_vscript_flag=--version-script
|
||||
])
|
||||
])
|
||||
AS_IF([test x$ax_cv_check_vscript_flag = xunsupported], [
|
||||
_AX_CHECK_VSCRIPT([-M], [show], [ax_cv_check_vscript_flag=-M])
|
||||
])
|
||||
|
@@ -30,8 +30,34 @@ fi
|
||||
nm="nm -B -D"
|
||||
if [ "`uname -s`" = "Linux" ]; then
|
||||
nm="$nm --with-symbol-versions"
|
||||
elif [ "`uname -s`" = "FreeBSD" ]; then
|
||||
# Use llvm-nm to get symbol version information
|
||||
nm="llvm-nm -B -D"
|
||||
elif [ "`uname -s`" = "SunOS" ]; then
|
||||
nm="nm -p -h -D -g"
|
||||
# Highly annoyingly, Solaris' nm doesn't show symbol versions, so here is a
|
||||
# laborious way to reformat the output of elfdump to be as we require.
|
||||
#nm="nm -p -h -D -g"
|
||||
nm=emulated_nm
|
||||
emulated_nm()
|
||||
{
|
||||
# Grab the versions from the version table, and convert into a sed script.
|
||||
VERSUB=`elfdump -v "$1" | \
|
||||
$grep -E '^\s*\[[0-9]+\]' | \
|
||||
$sed -E -e 's/\s+/,/g' | \
|
||||
tr -d '\[\]' | \
|
||||
cut -d',' -f 2,3 | \
|
||||
$sed -E -e 's/([0-9]+),(.*)/s\/@@\1\/@@\2\/;/'`
|
||||
|
||||
# Then grab the symbols and heavily reformat the output to match nm.
|
||||
elfdump -T SHT_DYNSYM "$1" | \
|
||||
$grep -E '^\s*\[[0-9]+\]' | \
|
||||
$sed -E -e 's/\s+/ /g' | \
|
||||
cut -d' ' -f 3,8,9,10 | \
|
||||
$sed -E -e 's/^0x//;s/([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*)/\1 \3 \4@@\2/;' | \
|
||||
$sed -E -e 's/^([^ ]*) .text /\1 T /' | \
|
||||
$sed -E -e 's/^([^ ]*) ([UA])(NDEF|BS) /\1 \2 /' | \
|
||||
$sed -E -e "$VERSUB"
|
||||
}
|
||||
elif [ "`uname -s`" = "Darwin" ]; then
|
||||
nm="nm -B -g"
|
||||
fi
|
||||
@@ -39,13 +65,6 @@ fi
|
||||
supports_versions=1
|
||||
if [ "`uname -s`" = "Darwin" ]; then
|
||||
supports_versions=0
|
||||
elif [ "`uname -s`" = "FreeBSD" ]; then
|
||||
# Highly annoyingly, FreeBSD's nm doesn't show symbol versions, so we just
|
||||
# skip checking it.
|
||||
supports_versions=0
|
||||
elif [ "`uname -s`" = "SunOS" ]; then
|
||||
# Similarly for Solaris.
|
||||
supports_versions=0
|
||||
fi
|
||||
|
||||
so_ext=so
|
||||
@@ -67,8 +86,8 @@ for so_name in "libpcre2-8" "libpcre2-16" "libpcre2-32" "libpcre2-posix"; do
|
||||
$sed -E -e 's/^[0-9a-fA-F]* *//g' | \
|
||||
$grep -E -v '^[Uw] ' | \
|
||||
$grep -E -v '^A PCRE2_' | \
|
||||
$grep -E -v ' (_init|_fini)$' | \
|
||||
$grep -E -v ' (_end|_DYNAMIC|_GLOBAL_OFFSET_TABLE_|_PROCEDURE_LINKAGE_TABLE_|_edata|_etext)$' | \
|
||||
$grep -E -v ' (_init|_fini)($|@)' | \
|
||||
$grep -E -v ' (_end|_DYNAMIC|_GLOBAL_OFFSET_TABLE_|_PROCEDURE_LINKAGE_TABLE_|_edata|_etext)($|@)' | \
|
||||
so_mangling | \
|
||||
sort \
|
||||
> "$base.actual"
|
||||
|
@@ -26,7 +26,7 @@ drwxr-xr-x tarball-dir/pcre2-SNAPSHOT/cmake
|
||||
-rw-r--r-- tarball-dir/pcre2-SNAPSHOT/cmake/COPYING-CMAKE-SCRIPTS
|
||||
-rw-r--r-- tarball-dir/pcre2-SNAPSHOT/cmake/FindEditline.cmake
|
||||
-rw-r--r-- tarball-dir/pcre2-SNAPSHOT/cmake/FindReadline.cmake
|
||||
-rw-r--r-- tarball-dir/pcre2-SNAPSHOT/cmake/PCRE2CheckLinkerFlag.cmake
|
||||
-rw-r--r-- tarball-dir/pcre2-SNAPSHOT/cmake/PCRE2CheckVscript.cmake
|
||||
-rw-r--r-- tarball-dir/pcre2-SNAPSHOT/cmake/PCRE2UseSystemExtensions.cmake
|
||||
-rw-r--r-- tarball-dir/pcre2-SNAPSHOT/cmake/PCRE2WarningAsError.cmake
|
||||
-rw-r--r-- tarball-dir/pcre2-SNAPSHOT/cmake/pcre2-config.cmake.in
|
||||
|
Reference in New Issue
Block a user