aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--auto.def10
-rw-r--r--autosetup/local.tcl49
-rw-r--r--jim-sdl.c4
3 files changed, 44 insertions, 19 deletions
diff --git a/auto.def b/auto.def
index 624d6a3..e82d5be 100644
--- a/auto.def
+++ b/auto.def
@@ -4,7 +4,7 @@
define JIM_VERSION 76
# Note: modules which support options *must* be included before 'options'
-use cc cc-shared cc-db cc-lib
+use cc cc-shared cc-db cc-lib pkg-config
use local
options {
@@ -280,15 +280,15 @@ dict set extdb info {
namespace { dep nshelper }
posix { check {[have-feature waitpid]} }
readdir { check {[have-feature opendir]} }
- readline { check {[cc-check-function-in-lib readline readline]} libdep lib_readline}
+ readline { pkg-config readline check {[cc-check-function-in-lib readline readline]} libdep lib_readline}
rlprompt { dep readline }
tree { dep oo }
- sdl { check {[cc-check-function-in-lib SDL_SetVideoMode SDL] && [cc-check-function-in-lib rectangleRGBA SDL_gfx]}
+ sdl { pkg-config SDL_gfx check {[cc-check-function-in-lib SDL_SetVideoMode SDL] && [cc-check-function-in-lib rectangleRGBA SDL_gfx]}
libdep {lib_SDL_SetVideoMode lib_rectangleRGBA}
}
signal { check {[have-feature sigaction] && [have-feature vfork]} }
- sqlite3 { check {[cc-check-function-in-lib sqlite3_prepare_v2 sqlite3]} libdep lib_sqlite3_prepare_v2 }
- zlib { check {[cc-check-function-in-lib deflate z]} libdep lib_deflate }
+ sqlite3 { pkg-config sqlite3 check {[cc-check-function-in-lib sqlite3_prepare_v2 sqlite3]} libdep lib_sqlite3_prepare_v2 }
+ zlib { pkg-config zlib check {[cc-check-function-in-lib deflate z]} libdep lib_deflate }
syslog { check {[have-feature syslog]} }
tree { dep oo }
win32 { check {[have-feature windows]} }
diff --git a/autosetup/local.tcl b/autosetup/local.tcl
index a5da8b0..bf86c5c 100644
--- a/autosetup/local.tcl
+++ b/autosetup/local.tcl
@@ -1,5 +1,3 @@
-# The complex extension checking is done here.
-
global withinfo
global extdb
@@ -58,12 +56,27 @@ proc check-extension-status {ext required} {
# Stash the current value of LIBS
set LIBS [get-define LIBS]
- # Check direct dependencies
- if [ext-get $ext check 1] {
- # "check" conditions are met
- } else {
- # not met
- incr depinfo(n)
+ set use_pkgconfig 0
+ set pkgconfig [ext-get $ext pkg-config]
+ if {$pkgconfig ne ""} {
+ # pkg-config support is optional, so explicitly initialse it here
+ if {[pkg-config-init 0]} {
+ lassign $pkgconfig pkg args
+
+ if {[pkg-config {*}$pkgconfig]} {
+ # Found via pkg-config so ignore check and libdep
+ set use_pkgconfig 1
+ }
+ }
+ }
+ if {!$use_pkgconfig} {
+ # Check direct dependencies
+ if [ext-get $ext check 1] {
+ # "check" conditions are met
+ } else {
+ # not met
+ incr depinfo(n)
+ }
}
if {$ext in $withinfo(mod)} {
@@ -104,8 +117,14 @@ proc check-extension-status {ext required} {
user-error "Extension $ext can't be a module"
} else {
msg-result "Extension $ext...module"
- foreach i [ext-get $ext libdep] {
- define-append LDLIBS_$ext [get-define $i ""]
+ if {$use_pkgconfig} {
+ define-append LDLIBS_$ext [pkg-config-get $pkg LIBS]
+ define-append LDFLAGS [pkg-config-get $pkg LDFLAGS]
+ define-append CCOPTS [pkg-config-get $pkg CFLAGS]
+ } else {
+ foreach i [ext-get $ext libdep] {
+ define-append LDLIBS_$ext [get-define $i ""]
+ }
}
}
return [ext-set-status $ext m]
@@ -122,8 +141,14 @@ proc check-extension-status {ext required} {
# Could be selected, but isn't (yet)
return [ext-set-status $ext x]
}
- foreach i [ext-get $ext libdep] {
- define-append LDLIBS [get-define $i ""]
+ if {$use_pkgconfig} {
+ define-append LDLIBS [pkg-config-get $pkg LIBS]
+ define-append LDFLAGS [pkg-config-get $pkg LDFLAGS]
+ define-append CCOPTS [pkg-config-get $pkg CFLAGS]
+ } else {
+ foreach i [ext-get $ext libdep] {
+ define-append LDLIBS [get-define $i ""]
+ }
}
return [ext-set-status $ext y]
}
diff --git a/jim-sdl.c b/jim-sdl.c
index 27e49c4..0c47b21 100644
--- a/jim-sdl.c
+++ b/jim-sdl.c
@@ -36,8 +36,8 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include <SDL/SDL.h>
-#include <SDL/SDL_gfxPrimitives.h>
+#include <SDL.h>
+#include <SDL_gfxPrimitives.h>
#include <jim.h>