]> granicus.if.org Git - php/commitdiff
add pkg-config example in extension skeleton
authorRemi Collet <remi@php.net>
Wed, 14 Feb 2018 12:28:21 +0000 (13:28 +0100)
committerRemi Collet <remi@php.net>
Wed, 14 Feb 2018 12:28:21 +0000 (13:28 +0100)
ext/ext_skel

index d1b8a2874c19e01c1e0daec86e04c367d600a282..09a003c92e378c205e53935e54c36d9fc2e67ba8 100755 (executable)
@@ -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