summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemi Collet <remi@php.net>2018-02-14 13:28:21 +0100
committerRemi Collet <remi@php.net>2018-02-14 13:28:21 +0100
commita93dba43242402e51da48a643accde72bc9f4df5 (patch)
tree8cd84671e02328cdf7a86b66fd80e207cff00717
parent17164bcf8dfb2f579f6314c2f4dc52fa7f5507a8 (diff)
downloadphp-git-a93dba43242402e51da48a643accde72bc9f4df5.tar.gz
add pkg-config example in extension skeleton
-rwxr-xr-xext/ext_skel18
1 files changed, 18 insertions, 0 deletions
diff --git a/ext/ext_skel b/ext/ext_skel
index d1b8a2874c..09a003c92e 100755
--- a/ext/ext_skel
+++ b/ext/ext_skel
@@ -127,6 +127,24 @@ dnl [ --enable-$extname Enable $extname support])
if test "\$PHP_$EXTNAME" != "no"; then
dnl Write more examples of tests here...
+ dnl # get library FOO build options from pkg-config output
+ dnl AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+ dnl AC_MSG_CHECKING(for libfoo)
+ dnl if test -x "\$PKG_CONFIG" && \$PKG_CONFIG --exists foo; then
+ dnl if \$PKG_CONFIG foo --atleast-version 1.2.3; then
+ dnl LIBFOO_CFLAGS=\`\$PKG_CONFIG foo --cflags\`
+ dnl LIBFOO_LIBDIR=\`\$PKG_CONFIG foo --libs\`
+ dnl LIBFOO_VERSON=\`\$PKG_CONFIG foo --modversion\`
+ dnl AC_MSG_RESULT(from pkgconfig: version \$LIBFOO_VERSON)
+ dnl else
+ dnl AC_MSG_ERROR(system libfoo is too old: version 1.2.3 required)
+ dnl fi
+ dnl else
+ dnl AC_MSG_ERROR(pkg-config not found)
+ dnl fi
+ dnl PHP_EVAL_LIBLINE(\$LIBFOO_LIBDIR, ${EXTNAME}_SHARED_LIBADD)
+ dnl PHP_EVAL_INCLINE(\$LIBFOO_CFLAGS)
+
dnl # --with-$extname -> check with-path
dnl SEARCH_PATH="/usr/local /usr" # you might want to change this
dnl SEARCH_FOR="/include/$extname.h" # you most likely want to change this