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
36 changes: 36 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,42 @@ extension GCC accepts. A C99 feature may be used only under
in `include/ap_config.h`, with a C89 fallback in the `#else` branch; see
`include/http_log.h`.

## APR and APR-util versions

httpd builds against APR 1.x plus APR-util 1.x, and against APR 2.x
(APR trunk), which has APR-util merged into it. Code conditional on an
APR-util feature must come out right for both.

Include `apu_version.h` unconditionally before testing
`APU_MAJOR_VERSION` or `APU_MINOR_VERSION`. APR 2.x ships that header
too, defining the `APU_*_VERSION` macros to the `APR_*_VERSION` ones, so
one test covers both:

```c
#include "apu_version.h"

#if APU_MAJOR_VERSION > 1 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 7)
/* APR-util 1.7 API */
#else
/* fallback */
#endif
```

Do not wrap the include in `#if !APR_VERSION_AT_LEAST(2,0,0)` or
`#if APR_MAJOR_VERSION < 2`, as some existing code does. Without the
header an undefined `APU_MAJOR_VERSION` evaluates to 0 in `#if`, so
under APR 2.x the test is silently false and the fallback is compiled.

Mind the minimum versions too. `configure` on trunk requires APR 1.6
and APR-util 1.6; on 2.4.x it requires only APR 1.4 and APR-util 1.3.
Trunk code which is a candidate for backport must therefore either keep
to the APIs of those older versions, or put anything newer under a
version test with a fallback, or the backport will need rewriting.

Either branch may never have been compiled locally, so build against
both an APR-util older than the version tested for and APR trunk when
touching such code, or say which was not built.

## Building

A git checkout has no `configure` script; generate it with `buildconf`,
Expand Down
6 changes: 3 additions & 3 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -423,12 +423,12 @@ AC_USE_SYSTEM_EXTENSIONS
# Ensure that satisfactory versions of apr and apr-util are
# found if external copies are configured.
if test "${apr_found}" = "yes"; then
# Require at least APR 1.3.x otherwise fail
APACHE_CHECK_APxVER([apr], 1, 3)
# Require at least APR 1.6.x otherwise fail
APACHE_CHECK_APxVER([apr], 1, 6)
fi

if test "${apu_found}" = "yes"; then
# Require at least APR-util 1.3.x otherwise fail
# Require at least APR-util 1.6.x otherwise fail
if test "${apr_found}" = "yes"; then
# we need to add the APR includes to CPPFLAGS
apu_ckver_CPPFLAGS="$CPPFLAGS"
Expand Down
3 changes: 0 additions & 3 deletions modules/aaa/mod_authn_dbm.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@

#include "mod_auth.h"

#include "apr_version.h"
#if !APR_VERSION_AT_LEAST(2,0,0)
#include "apu_version.h"
#endif

static APR_OPTIONAL_FN_TYPE(ap_authn_cache_store) *authn_cache_store = NULL;
#define AUTHN_CACHE_STORE(r,user,realm,data) \
Expand Down
3 changes: 0 additions & 3 deletions modules/aaa/mod_authz_dbm.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
#include "apr_dbm.h"
#include "apr_md5.h"

#include "apr_version.h"
#if !APR_VERSION_AT_LEAST(2,0,0)
#include "apu_version.h"
#endif

#include "httpd.h"
#include "http_config.h"
Expand Down
3 changes: 0 additions & 3 deletions modules/cache/mod_socache_dbm.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@
#define APR_WANT_STRFUNC
#include "apr_want.h"
#include "apr_dbm.h"
#include "apr_version.h"
#if !APR_VERSION_AT_LEAST(2,0,0)
#include "apu_version.h"
#endif

#if APR_HAVE_UNISTD_H
#include <unistd.h>
Expand Down
3 changes: 0 additions & 3 deletions modules/mappers/mod_rewrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@
#include "apr_dbm.h"
#include "apr_dbd.h"

#include "apr_version.h"
#if !APR_VERSION_AT_LEAST(2,0,0)
#include "apu_version.h"
#endif

#include "mod_dbd.h"

Expand Down
3 changes: 0 additions & 3 deletions modules/proxy/mod_proxy_express.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@

module AP_MODULE_DECLARE_DATA proxy_express_module;

#include "apr_version.h"
#if !APR_VERSION_AT_LEAST(2,0,0)
#include "apu_version.h"
#endif

static int proxy_available = 0;

Expand Down
Loading