Skip to content

feat: add --enable-apcu option to toggle APCu support#92

Merged
kjdev merged 1 commit into
masterfrom
feat/enable-apcu
Jun 9, 2026
Merged

feat: add --enable-apcu option to toggle APCu support#92
kjdev merged 1 commit into
masterfrom
feat/enable-apcu

Conversation

@kjdev

@kjdev kjdev commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Chores
    • Added --enable-apcu configure option to allow flexible APCu support enablement during build configuration.
    • Improved APCu detection and configuration handling in build setup.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

config.m4 introduces a new --enable-apcu configure option with automatic detection and reformats the existing APCu detection logic that checks for the serializer header and emits the HAVE_APCU_SUPPORT definition.

Changes

APCu Configure Support

Layer / File(s) Summary
APCu configure option and detection
config.m4
New PHP_ARG_ENABLE(apcu, ..., auto, no) configure argument is declared alongside brotli options. APCu detection logic checking for apc_serializer.h, setting apc_inc_path, and emitting AC_DEFINE(HAVE_APCU_SUPPORT, 1, ...) is reformatted without functional changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A bunny hops through build configs with glee,
APCu support now flows wild and free!
Configure options, fresh and so bright,
Detection logic, reformatted right. 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately describes the main change: adding a --enable-apcu configure option to toggle APCu support in config.m4, which matches the file modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/enable-apcu

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@config.m4`:
- Around line 138-147: When APCu was explicitly requested (PHP_APCU == "yes")
the configure script currently prints "not found" and continues; change the
logic in the APCu detection block so that after testing for
"$phpincludedir/ext/apcu/apc_serializer.h" you still set apc_inc_path and
AC_DEFINE(HAVE_APCU_SUPPORT,1,...) when found, but if the header is missing and
PHP_APCU equals "yes" call AC_MSG_ERROR with a clear failure message (e.g.,
"APCu requested but header apc_serializer.h not found in
$phpincludedir/ext/apcu") so configure aborts; if PHP_APCU is "auto" or unset
keep the existing AC_MSG_RESULT([not found]) behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8779871a-1fcb-4be3-893d-110db1c1c3cf

📥 Commits

Reviewing files that changed from the base of the PR and between 5cd25a6 and 3e35f34.

📒 Files selected for processing (1)
  • config.m4

Comment thread config.m4
Comment on lines +138 to 147
if test "$PHP_APCU" != "no"; then
AC_MSG_CHECKING([for APCu includes])
if test -f "$phpincludedir/ext/apcu/apc_serializer.h"; then
apc_inc_path="$phpincludedir"
AC_MSG_RESULT([APCu in $apc_inc_path])
AC_DEFINE(HAVE_APCU_SUPPORT, 1, [Whether to enable APCu support])
else
AC_MSG_RESULT([not found])
fi
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚖️ Poor tradeoff

Error when APCu is explicitly enabled but the header is not found.

When a user explicitly enables APCu with --enable-apcu=yes, but the required header file is not found, the configure script should fail with an error instead of silently continuing. Currently, the script only prints "not found" and proceeds without defining HAVE_APCU_SUPPORT, which violates the user's explicit request.

The standard autoconf pattern distinguishes between:

  • --enable-apcu=auto (or default): Try to detect, continue if not found
  • --enable-apcu=yes (explicit): Require APCu, fail if not found
  • --disable-apcu or --enable-apcu=no: Skip detection
🔧 Proposed fix to error on explicit enable
   if test "$PHP_APCU" != "no"; then
     AC_MSG_CHECKING([for APCu includes])
     if test -f "$phpincludedir/ext/apcu/apc_serializer.h"; then
       apc_inc_path="$phpincludedir"
       AC_MSG_RESULT([APCu in $apc_inc_path])
       AC_DEFINE(HAVE_APCU_SUPPORT, 1, [Whether to enable APCu support])
     else
-      AC_MSG_RESULT([not found])
+      AC_MSG_RESULT([not found])
+      if test "$PHP_APCU" = "yes"; then
+        AC_MSG_ERROR([APCu support explicitly requested but APCu headers not found])
+      fi
     fi
   fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if test "$PHP_APCU" != "no"; then
AC_MSG_CHECKING([for APCu includes])
if test -f "$phpincludedir/ext/apcu/apc_serializer.h"; then
apc_inc_path="$phpincludedir"
AC_MSG_RESULT([APCu in $apc_inc_path])
AC_DEFINE(HAVE_APCU_SUPPORT, 1, [Whether to enable APCu support])
else
AC_MSG_RESULT([not found])
fi
fi
if test "$PHP_APCU" != "no"; then
AC_MSG_CHECKING([for APCu includes])
if test -f "$phpincludedir/ext/apcu/apc_serializer.h"; then
apc_inc_path="$phpincludedir"
AC_MSG_RESULT([APCu in $apc_inc_path])
AC_DEFINE(HAVE_APCU_SUPPORT, 1, [Whether to enable APCu support])
else
AC_MSG_RESULT([not found])
if test "$PHP_APCU" = "yes"; then
AC_MSG_ERROR([APCu support explicitly requested but APCu headers not found])
fi
fi
fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@config.m4` around lines 138 - 147, When APCu was explicitly requested
(PHP_APCU == "yes") the configure script currently prints "not found" and
continues; change the logic in the APCu detection block so that after testing
for "$phpincludedir/ext/apcu/apc_serializer.h" you still set apc_inc_path and
AC_DEFINE(HAVE_APCU_SUPPORT,1,...) when found, but if the header is missing and
PHP_APCU equals "yes" call AC_MSG_ERROR with a clear failure message (e.g.,
"APCu requested but header apc_serializer.h not found in
$phpincludedir/ext/apcu") so configure aborts; if PHP_APCU is "auto" or unset
keep the existing AC_MSG_RESULT([not found]) behavior.

@kjdev kjdev merged commit 3e35f34 into master Jun 9, 2026
121 checks passed
@kjdev kjdev deleted the feat/enable-apcu branch June 9, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant