Skip to content

Commit

Permalink
Autotools: Refactor rt library check
Browse files Browse the repository at this point in the history
This appends the -lrt only as needed to the LIBS (if apcu is built as
static) or to the APCU_SHARED_LIBADD variable (when APCu is built as
shared). Modern *nix systems have shared memory operations located in
default libraries and explicit linking with -lrt is redundant.
  • Loading branch information
petk committed Sep 2, 2024
1 parent 4c43268 commit 5d07d25
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,12 @@ if test "$PHP_APCU" != "no"; then
apc_iterator.c \
apc_persist.c"

PHP_CHECK_LIBRARY(rt, shm_open, [PHP_ADD_LIBRARY(rt,,APCU_SHARED_LIBADD)])
LIBS_SAVED=$LIBS; LIBS=
AC_SEARCH_LIBS([shm_open], [rt])
LIBS=$LIBS_SAVED
AS_VAR_IF([ac_cv_search_shm_open], ["none required"], [],
[PHP_ADD_LIBRARY([rt], [], [APCU_SHARED_LIBADD])])

PHP_NEW_EXTENSION([apcu], [$apc_sources], [$ext_shared],, [$APCU_CFLAGS])
PHP_SUBST(APCU_SHARED_LIBADD)
PHP_SUBST(PHP_LDFLAGS)
Expand Down

0 comments on commit 5d07d25

Please sign in to comment.