Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,19 +242,33 @@ jobs:
maint/RunSymbolTest install-dir/usr/local/lib/ maint/

passenger:
# Tests with: Autoconf on oldest RHEL (in extended support).
# That's the absolute limit to how old a Linux version I'll tolerate regular testing on.
name: GCC, very old Autotools
# Tests on the oldest RHEL release in extended support with the minimum
# supported Autoconf version.
name: GCC, RHEL 8, minimum Autoconf
runs-on: ubuntu-latest
container: redhat/ubi8:8.6
if: github.event_name != 'workflow_dispatch' || (inputs.job_id == 'all' || inputs.job_id == 'passenger')
steps:
- name: Setup
run: |
yum -q makecache
yum -q install -y gcc git make automake autoconf libtool diffutils file glibc-langpack-en
yum -q install -y gcc git make automake libtool diffutils file glibc-langpack-en m4 perl curl xz
yum -q update -y glibc-common

- name: Install Autoconf 2.71
run: |
curl --fail --location --retry 3 --output "$RUNNER_TEMP/autoconf-2.71.tar.xz" \
https://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.xz
printf '%s %s\n' \
f14c83cfebcc9427f2c3cea7258bd90df972d92eb26752da4ddad81c87a0faa4 \
"$RUNNER_TEMP/autoconf-2.71.tar.xz" | sha256sum --check --status
tar -C "$RUNNER_TEMP" -xf "$RUNNER_TEMP/autoconf-2.71.tar.xz"
pushd "$RUNNER_TEMP/autoconf-2.71"
./configure --prefix="$RUNNER_TEMP/autoconf-prefix"
make -j"$(nproc)" install
popd
echo "$RUNNER_TEMP/autoconf-prefix/bin" >> "$GITHUB_PATH"

- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand Down
2 changes: 1 addition & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ LOCAL_DEFINES = [
"SUPPORT_UNICODE",
] + select({
"@platforms//os:windows": [],
"//conditions:default": ["HAVE_UNISTD_H"],
"//conditions:default": ["HAVE_UNISTD_H", "HAVE_STDATOMIC_H"],
})

# Workaround for a Bazel quirk. It is extremely strict about the #include path
Expand Down
25 changes: 23 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,13 @@ 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)
if("c_std_11" IN_LIST CMAKE_C_COMPILE_FEATURES)
set(CMAKE_C_STANDARD 11)
elseif("c_std_99" IN_LIST CMAKE_C_COMPILE_FEATURES)
set(CMAKE_C_STANDARD 99)
else()
message(FATAL_ERROR "C compiler must support at least C99.")
endif()
set(CMAKE_C_STANDARD_REQUIRED TRUE)
set(CMAKE_C_VISIBILITY_PRESET hidden)

Expand Down Expand Up @@ -190,11 +196,26 @@ check_symbol_exists(secure_getenv "stdlib.h" HAVE_SECURE_GETENV) # glibc 2.17
check_symbol_exists(setrlimit "sys/resource.h" HAVE_SETRLIMIT)
cmake_pop_check_state()

check_c_source_compiles(
[=[
#ifdef __STDC_NO_ATOMICS__
#error "C compiler does not support standard C atomics"
#endif
#include <stdatomic.h>
int main(void) {
atomic_int value;
atomic_init(&value, 0);
return atomic_load(&value);
}
]=]
HAVE_STDATOMIC_H
)

check_c_source_compiles(
[=[
#include <stdlib.h>
#include <limits.h>
int main(int c, char *v[]) { char buf[PATH_MAX]; realpath(v[c], buf); return 0; }
int main(int c, char *v[]) { char buf[PATH_MAX]; return realpath(v[c], buf) == NULL; }
]=]
HAVE_REALPATH
)
Expand Down
8 changes: 7 additions & 1 deletion build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,14 @@ pub fn build(b: *std.Build) !void {
const is_glibc = rt.isGnuLibC();
const is_freebsd = rt.isFreeBSDLibC();

const cflags = &.{
const common_cflags: []const []const u8 = &.{
"-std=c11",
"-fvisibility=hidden",
};
const cflags: []const []const u8 = if (rt.os.tag == .linux)
try std.mem.concat(b.allocator, []const u8, &.{ common_cflags, &.{"-D_GNU_SOURCE"} })
else
common_cflags;

const config_h = b.addConfigHeader(
.{
Expand All @@ -82,6 +87,7 @@ pub fn build(b: *std.Build) !void {
.HAVE_SYS_TYPES_H = true,
.HAVE_UNISTD_H = is_unix or is_mingw,
.HAVE_WINDOWS_H = rt.os.tag == .windows,
.HAVE_STDATOMIC_H = true,

.HAVE_MEMFD_CREATE = is_musl or is_glibc or is_freebsd,
.HAVE_SECURE_GETENV = is_musl or is_glibc or is_freebsd,
Expand Down
Loading
Loading