Skip to content

Commit 0b7cefc

Browse files
committed
Add pkg-config check for SDL lib and fallback to deprecated sdl-config
1 parent 655e403 commit 0b7cefc

File tree

4 files changed

+44
-40
lines changed

4 files changed

+44
-40
lines changed

config.m4

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,24 @@ if test "$PHP_SDL" != "no"; then
3636
fi
3737
dnl }}}
3838

39+
AC_MSG_CHECKING(for SDL2 library)
40+
3941
if test "$PHP_SDL" == "yes"; then
40-
AC_PATH_PROG(SDL2_CONFIG, sdl2-config, no)
42+
PKG_CHECK_MODULES([SDL2], [sdl2 < 3.0])
43+
PHP_EVAL_INCLINE($SDL2_CFLAGS)
44+
PHP_EVAL_LIBLINE($SDL2_LIBS, SDL_SHARED_LIBADD)
45+
SDL2_VERSION=`$PKG_CONFIG --modversion sdl2`
46+
AC_MSG_RESULT(using SDL2 version $SDL2_VERSION)
4147
else
4248
SDL2_CONFIG="$PHP_SDL"
43-
fi
44-
45-
AC_MSG_CHECKING(for SDL2 library)
46-
if test -x "$SDL2_CONFIG" ; then
47-
SDL2_VERSION=`$SDL2_CONFIG --version`
48-
AC_MSG_RESULT(using SDL2 version $SDL2_VERSION)
49-
PHP_EVAL_INCLINE(`$SDL2_CONFIG --cflags`)
50-
PHP_EVAL_LIBLINE(`$SDL2_CONFIG --libs`, SDL_SHARED_LIBADD)
51-
else
52-
AC_MSG_ERROR(Cannot find sdl2-config)
49+
if test -x "$SDL2_CONFIG" ; then
50+
SDL2_VERSION=`$SDL2_CONFIG --version`
51+
AC_MSG_RESULT(using SDL2 version $SDL2_VERSION)
52+
PHP_EVAL_INCLINE(`$SDL2_CONFIG --cflags`)
53+
PHP_EVAL_LIBLINE(`$SDL2_CONFIG --libs`, SDL_SHARED_LIBADD)
54+
else
55+
AC_MSG_ERROR(Cannot find sdl2-config)
56+
fi
5357
fi
5458

5559
PHP_SUBST(SDL_SHARED_LIBADD)
@@ -70,7 +74,7 @@ if test "$PHP_SDL" != "no"; then
7074
src/messagebox.c \
7175
src/mouse.c \
7276
src/mutex.c \
73-
src/php_sdl.c \
77+
php_sdl.c \
7478
src/pixels.c \
7579
src/platform.c \
7680
src/power.c \

package.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<active>yes</active>
2020
</lead>
2121
<!-- Current version -->
22-
<date>2022-07-22</date>
22+
<date>2023-06-01</date>
2323
<time>12:00:00</time>
2424
<version>
2525
<release>2.7.0</release>
@@ -39,9 +39,9 @@
3939
<file role="doc" name="CREDITS"/>
4040
<file role="doc" name="LICENSE"/>
4141
<file role="src" name="config.m4"/>
42+
<file role="src" name="php_sdl.c"/>
43+
<file role="src" name="php_sdl.h"/>
4244
<dir name="src">
43-
<file role="src" name="php_sdl.c"/>
44-
<file role="src" name="php_sdl.h"/>
4545
<file role="src" name="blendmode.c"/>
4646
<file role="src" name="blendmode.h"/>
4747
<file role="src" name="cpuinfo.c"/>
@@ -245,7 +245,7 @@
245245
<license uri="http://www.php.net/license">PHP</license>
246246
<notes>
247247
- Fix undefined symbol (sdl_window_to_zval)
248-
- Tidy up GL context creation
248+
- Tidy up GL context creation
249249
</notes>
250250
</release>
251251
<release>

src/php_sdl.c renamed to php_sdl.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,30 @@
1717

1818
#include "php_sdl.h"
1919

20-
#include "blendmode.h"
21-
#include "cpuinfo.h"
22-
#include "error.h"
23-
#include "event.h"
24-
#include "filesystem.h"
25-
#include "glcontext.h"
26-
#include "keyboard.h"
27-
#include "messagebox.h"
28-
#include "mouse.h"
29-
#include "mutex.h"
30-
#include "platform.h"
31-
#include "power.h"
32-
#include "pixels.h"
33-
#include "rect.h"
34-
#include "render.h"
35-
#include "rwops.h"
36-
#include "sdl.h"
37-
#include "shape.h"
38-
#include "surface.h"
39-
#include "timer.h"
40-
#include "version.h"
41-
#include "video.h"
42-
#include "window.h"
43-
#include "joystick.h"
20+
#include "src/blendmode.h"
21+
#include "src/cpuinfo.h"
22+
#include "src/error.h"
23+
#include "src/event.h"
24+
#include "src/filesystem.h"
25+
#include "src/glcontext.h"
26+
#include "src/keyboard.h"
27+
#include "src/messagebox.h"
28+
#include "src/mouse.h"
29+
#include "src/mutex.h"
30+
#include "src/platform.h"
31+
#include "src/power.h"
32+
#include "src/pixels.h"
33+
#include "src/rect.h"
34+
#include "src/render.h"
35+
#include "src/rwops.h"
36+
#include "src/sdl.h"
37+
#include "src/shape.h"
38+
#include "src/surface.h"
39+
#include "src/timer.h"
40+
#include "src/version.h"
41+
#include "src/video.h"
42+
#include "src/window.h"
43+
#include "src/joystick.h"
4444

4545
#ifdef COMPILE_DL_SDL
4646
ZEND_GET_MODULE(sdl)

src/php_sdl.h renamed to php_sdl.h

File renamed without changes.

0 commit comments

Comments
 (0)