Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pkg-config check for SDL lib and fallback to deprecated sdl2-config #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
28 changes: 16 additions & 12 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,24 @@ if test "$PHP_SDL" != "no"; then
fi
dnl }}}

AC_MSG_CHECKING(for SDL2 library)

if test "$PHP_SDL" == "yes"; then
AC_PATH_PROG(SDL2_CONFIG, sdl2-config, no)
PKG_CHECK_MODULES([SDL2], [sdl2 < 3.0])
PHP_EVAL_INCLINE($SDL2_CFLAGS)
PHP_EVAL_LIBLINE($SDL2_LIBS, SDL_SHARED_LIBADD)
SDL2_VERSION=`$PKG_CONFIG --modversion sdl2`
AC_MSG_RESULT(using SDL2 version $SDL2_VERSION)
else
SDL2_CONFIG="$PHP_SDL"
fi

AC_MSG_CHECKING(for SDL2 library)
if test -x "$SDL2_CONFIG" ; then
SDL2_VERSION=`$SDL2_CONFIG --version`
AC_MSG_RESULT(using SDL2 version $SDL2_VERSION)
PHP_EVAL_INCLINE(`$SDL2_CONFIG --cflags`)
PHP_EVAL_LIBLINE(`$SDL2_CONFIG --libs`, SDL_SHARED_LIBADD)
else
AC_MSG_ERROR(Cannot find sdl2-config)
if test -x "$SDL2_CONFIG" ; then
SDL2_VERSION=`$SDL2_CONFIG --version`
AC_MSG_RESULT(using SDL2 version $SDL2_VERSION)
PHP_EVAL_INCLINE(`$SDL2_CONFIG --cflags`)
PHP_EVAL_LIBLINE(`$SDL2_CONFIG --libs`, SDL_SHARED_LIBADD)
else
AC_MSG_ERROR(Cannot find sdl2-config)
fi
fi

PHP_SUBST(SDL_SHARED_LIBADD)
Expand All @@ -70,7 +74,7 @@ if test "$PHP_SDL" != "no"; then
src/messagebox.c \
src/mouse.c \
src/mutex.c \
src/php_sdl.c \
php_sdl.c \
src/pixels.c \
src/platform.c \
src/power.c \
Expand Down
6 changes: 3 additions & 3 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
<file role="doc" name="CREDITS"/>
<file role="doc" name="LICENSE"/>
<file role="src" name="config.m4"/>
<file role="src" name="php_sdl.c"/>
<file role="src" name="php_sdl.h"/>
<dir name="src">
<file role="src" name="php_sdl.c"/>
<file role="src" name="php_sdl.h"/>
<file role="src" name="blendmode.c"/>
<file role="src" name="blendmode.h"/>
<file role="src" name="cpuinfo.c"/>
Expand Down Expand Up @@ -245,7 +245,7 @@
<license uri="http://www.php.net/license">PHP</license>
<notes>
- Fix undefined symbol (sdl_window_to_zval)
- Tidy up GL context creation
- Tidy up GL context creation
</notes>
</release>
<release>
Expand Down
48 changes: 24 additions & 24 deletions src/php_sdl.c → php_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,30 @@

#include "php_sdl.h"

#include "blendmode.h"
#include "cpuinfo.h"
#include "error.h"
#include "event.h"
#include "filesystem.h"
#include "glcontext.h"
#include "keyboard.h"
#include "messagebox.h"
#include "mouse.h"
#include "mutex.h"
#include "platform.h"
#include "power.h"
#include "pixels.h"
#include "rect.h"
#include "render.h"
#include "rwops.h"
#include "sdl.h"
#include "shape.h"
#include "surface.h"
#include "timer.h"
#include "version.h"
#include "video.h"
#include "window.h"
#include "joystick.h"
#include "src/blendmode.h"
#include "src/cpuinfo.h"
#include "src/error.h"
#include "src/event.h"
#include "src/filesystem.h"
#include "src/glcontext.h"
#include "src/keyboard.h"
#include "src/messagebox.h"
#include "src/mouse.h"
#include "src/mutex.h"
#include "src/platform.h"
#include "src/power.h"
#include "src/pixels.h"
#include "src/rect.h"
#include "src/render.h"
#include "src/rwops.h"
#include "src/sdl.h"
#include "src/shape.h"
#include "src/surface.h"
#include "src/timer.h"
#include "src/version.h"
#include "src/video.h"
#include "src/window.h"
#include "src/joystick.h"

#ifdef COMPILE_DL_SDL
ZEND_GET_MODULE(sdl)
Expand Down
File renamed without changes.