changeset 1614:e5ead8c8f5ed

Update configure check for Cap'n Proto to avoid directly looking up mangled symbols
author Chris Cannam
date Mon, 27 Feb 2017 13:24:29 +0000
parents 3f6c18fcc075
children cc481995c96d
files .hgsubstate configure configure.ac
diffstat 3 files changed, 48 insertions(+), 256 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsubstate	Sat Feb 25 19:24:13 2017 +0000
+++ b/.hgsubstate	Mon Feb 27 13:24:29 2017 +0000
@@ -7,7 +7,7 @@
 3d2cde3b1ab3d39c7f9e542250c288a9da0f6850 icons/scalable
 d06300b789ea62fcdc61a847b636be9d348682ef piper-cpp
 95867ba8caa86f69fdd57366dbfe2f977dd9cb5d sv-dependency-builds
-5f488e1868ccf6aa4c27597b5c0254dce28940f6 svapp
+0f82c719d88548314dd5c6664a382187c82065ab svapp
 9b52f1a952b5ea62810aedbf99e2ad884ea6e580 svcore
 3ec95b7d1bfcf8eecfcde5063328c25fc5e71b81 svgui
 fb3e0ca3e700c2dc5c75c0749dd85383b2e06da5 vamp-plugin-sdk
--- a/configure	Sat Feb 25 19:24:13 2017 +0000
+++ b/configure	Mon Feb 27 13:24:29 2017 +0000
@@ -650,8 +650,6 @@
 portaudio_CFLAGS
 liblo_LIBS
 liblo_CFLAGS
-kj_LIBS
-kj_CFLAGS
 capnp_LIBS
 capnp_CFLAGS
 serd_LIBS
@@ -768,8 +766,6 @@
 serd_LIBS
 capnp_CFLAGS
 capnp_LIBS
-kj_CFLAGS
-kj_LIBS
 liblo_CFLAGS
 liblo_LIBS
 portaudio_CFLAGS
@@ -1442,8 +1438,6 @@
   capnp_CFLAGS
               C compiler flags for capnp, overriding pkg-config
   capnp_LIBS  linker flags for capnp, overriding pkg-config
-  kj_CFLAGS   C compiler flags for kj, overriding pkg-config
-  kj_LIBS     linker flags for kj, overriding pkg-config
   liblo_CFLAGS
               C compiler flags for liblo, overriding pkg-config
   liblo_LIBS  linker flags for liblo, overriding pkg-config
@@ -5690,29 +5684,8 @@
 
 # Cap'n Proto 0.5.3 is the latest release at the time of writing, but
 # it lacks the expectedSizeInWordsFromPrefix function which exists in
-# the git repo. Check for a newer release or, if that's not found with
-# pkg-config, check for that specific symbol (mangled).
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking specifically for a newer Cap'n Proto than the 0.5.3 release" >&5
-$as_echo "$as_me: checking specifically for a newer Cap'n Proto than the 0.5.3 release" >&6;}
-
-SV_MODULE_MODULE=capnp
-SV_MODULE_VERSION_TEST="capnp >= 0.5.4"
-SV_MODULE_HEADER=capnp/common.h
-SV_MODULE_LIB=capnp
-SV_MODULE_FUNC=_ZN5capnp29expectedSizeInWordsFromPrefixEN2kj8ArrayPtrIKNS_4wordEEE
-SV_MODULE_HAVE=HAVE_$(echo capnp | tr 'a-z' 'A-Z')
-SV_MODULE_FAILED=1
-if test -n "$capnp_LIBS" ; then
-   { $as_echo "$as_me:${as_lineno-$LINENO}: User set ${SV_MODULE_MODULE}_LIBS explicitly, skipping test for $SV_MODULE_MODULE" >&5
-$as_echo "$as_me: User set ${SV_MODULE_MODULE}_LIBS explicitly, skipping test for $SV_MODULE_MODULE" >&6;}
-   CXXFLAGS="$CXXFLAGS $capnp_CFLAGS"
-   LIBS="$LIBS $capnp_LIBS"
-   SV_MODULE_FAILED=""
-fi
-if test -z "$SV_MODULE_VERSION_TEST" ; then
-   SV_MODULE_VERSION_TEST=$SV_MODULE_MODULE
-fi
-if test -n "$SV_MODULE_FAILED" && test -n "$PKG_CONFIG"; then
+# the git repo. Our check is for that specific symbol, which would
+# indicate a git checkout, or release 0.5.4 or later.
 
 pkg_failed=no
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for capnp" >&5
@@ -5722,12 +5695,12 @@
     pkg_cv_capnp_CFLAGS="$capnp_CFLAGS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$SV_MODULE_VERSION_TEST\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "$SV_MODULE_VERSION_TEST") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"capnp => 0.5.4\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "capnp => 0.5.4") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_capnp_CFLAGS=`$PKG_CONFIG --cflags "$SV_MODULE_VERSION_TEST" 2>/dev/null`
+  pkg_cv_capnp_CFLAGS=`$PKG_CONFIG --cflags "capnp => 0.5.4" 2>/dev/null`
 		      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -5739,12 +5712,12 @@
     pkg_cv_capnp_LIBS="$capnp_LIBS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$SV_MODULE_VERSION_TEST\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "$SV_MODULE_VERSION_TEST") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"capnp => 0.5.4\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "capnp => 0.5.4") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_capnp_LIBS=`$PKG_CONFIG --libs "$SV_MODULE_VERSION_TEST" 2>/dev/null`
+  pkg_cv_capnp_LIBS=`$PKG_CONFIG --libs "capnp => 0.5.4" 2>/dev/null`
 		      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -5765,237 +5738,46 @@
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        capnp_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$SV_MODULE_VERSION_TEST" 2>&1`
+	        capnp_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "capnp => 0.5.4" 2>&1`
         else
-	        capnp_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$SV_MODULE_VERSION_TEST" 2>&1`
+	        capnp_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "capnp => 0.5.4" 2>&1`
         fi
 	# Put the nasty error message in config.log where it belongs
 	echo "$capnp_PKG_ERRORS" >&5
 
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: Failed to find required module $SV_MODULE_MODULE using pkg-config, trying again by old-fashioned means" >&5
-$as_echo "$as_me: Failed to find required module $SV_MODULE_MODULE using pkg-config, trying again by old-fashioned means" >&6;}
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: Failed to find required module capnp using pkg-config, trying again by old-fashioned means" >&5
+$as_echo "$as_me: Failed to find required module capnp using pkg-config, trying again by old-fashioned means" >&6;}
 elif test $pkg_failed = untried; then
      	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: Failed to find required module $SV_MODULE_MODULE using pkg-config, trying again by old-fashioned means" >&5
-$as_echo "$as_me: Failed to find required module $SV_MODULE_MODULE using pkg-config, trying again by old-fashioned means" >&6;}
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: Failed to find required module capnp using pkg-config, trying again by old-fashioned means" >&5
+$as_echo "$as_me: Failed to find required module capnp using pkg-config, trying again by old-fashioned means" >&6;}
 else
 	capnp_CFLAGS=$pkg_cv_capnp_CFLAGS
 	capnp_LIBS=$pkg_cv_capnp_LIBS
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-	HAVES="$HAVES $SV_MODULE_HAVE";CXXFLAGS="$CXXFLAGS $capnp_CFLAGS";LIBS="$LIBS $capnp_LIBS";SV_MODULE_FAILED=""
-fi
-fi
-if test -n "$SV_MODULE_FAILED"; then
-   as_ac_Header=`$as_echo "ac_cv_header_$SV_MODULE_HEADER" | $as_tr_sh`
-ac_fn_cxx_check_header_mongrel "$LINENO" "$SV_MODULE_HEADER" "$as_ac_Header" "$ac_includes_default"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  HAVES="$HAVES $SV_MODULE_HAVE"
-else
-  as_fn_error $? "Failed to find header $SV_MODULE_HEADER for required module $SV_MODULE_MODULE" "$LINENO" 5
-fi
-
-
-   if test -n "$SV_MODULE_LIB"; then
-     as_ac_Lib=`$as_echo "ac_cv_lib_$SV_MODULE_LIB''_$SV_MODULE_FUNC" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $SV_MODULE_FUNC in -l$SV_MODULE_LIB" >&5
-$as_echo_n "checking for $SV_MODULE_FUNC in -l$SV_MODULE_LIB... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$SV_MODULE_LIB  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+	HAVES="$HAVES HAVE_CAPNP";CXXFLAGS="$CXXFLAGS $capnp_CFLAGS";LIBS="$LIBS $capnp_LIBS"
+fi
+if test -z "$capnp_LIBS" ; then
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $SV_MODULE_FUNC ();
-int
-main ()
-{
-return $SV_MODULE_FUNC ();
-  ;
-  return 0;
-}
+
+        #include <capnp/serialize.h>
+        int main() {
+            kj::Array<capnp::word> prefix;
+            return capnp::expectedSizeInWordsFromPrefix(prefix.asPtr());
+        }
 _ACEOF
-if ac_fn_cxx_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
-else
-  eval "$as_ac_Lib=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-eval ac_res=\$$as_ac_Lib
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  LIBS="$LIBS -l$SV_MODULE_LIB"
-else
-  as_fn_error $? "Failed to find library $SV_MODULE_LIB for required module $SV_MODULE_MODULE" "$LINENO" 5
-fi
-
-   fi
-fi
-
-
-SV_MODULE_MODULE=kj
-SV_MODULE_VERSION_TEST="kj >= 0.5.4"
-SV_MODULE_HEADER=kj/common.h
-SV_MODULE_LIB=kj
-SV_MODULE_FUNC=_ZN2kj20BufferedOutputStreamD0Ev
-SV_MODULE_HAVE=HAVE_$(echo kj | tr 'a-z' 'A-Z')
-SV_MODULE_FAILED=1
-if test -n "$kj_LIBS" ; then
-   { $as_echo "$as_me:${as_lineno-$LINENO}: User set ${SV_MODULE_MODULE}_LIBS explicitly, skipping test for $SV_MODULE_MODULE" >&5
-$as_echo "$as_me: User set ${SV_MODULE_MODULE}_LIBS explicitly, skipping test for $SV_MODULE_MODULE" >&6;}
-   CXXFLAGS="$CXXFLAGS $kj_CFLAGS"
-   LIBS="$LIBS $kj_LIBS"
-   SV_MODULE_FAILED=""
-fi
-if test -z "$SV_MODULE_VERSION_TEST" ; then
-   SV_MODULE_VERSION_TEST=$SV_MODULE_MODULE
-fi
-if test -n "$SV_MODULE_FAILED" && test -n "$PKG_CONFIG"; then
-
-pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for kj" >&5
-$as_echo_n "checking for kj... " >&6; }
-
-if test -n "$kj_CFLAGS"; then
-    pkg_cv_kj_CFLAGS="$kj_CFLAGS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$SV_MODULE_VERSION_TEST\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "$SV_MODULE_VERSION_TEST") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_kj_CFLAGS=`$PKG_CONFIG --cflags "$SV_MODULE_VERSION_TEST" 2>/dev/null`
-		      test "x$?" != "x0" && pkg_failed=yes
-else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
-fi
-if test -n "$kj_LIBS"; then
-    pkg_cv_kj_LIBS="$kj_LIBS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$SV_MODULE_VERSION_TEST\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "$SV_MODULE_VERSION_TEST") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_kj_LIBS=`$PKG_CONFIG --libs "$SV_MODULE_VERSION_TEST" 2>/dev/null`
-		      test "x$?" != "x0" && pkg_failed=yes
-else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
-fi
-
-
-
-if test $pkg_failed = yes; then
-   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
-        _pkg_short_errors_supported=yes
-else
-        _pkg_short_errors_supported=no
-fi
-        if test $_pkg_short_errors_supported = yes; then
-	        kj_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$SV_MODULE_VERSION_TEST" 2>&1`
-        else
-	        kj_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$SV_MODULE_VERSION_TEST" 2>&1`
-        fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$kj_PKG_ERRORS" >&5
-
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: Failed to find required module $SV_MODULE_MODULE using pkg-config, trying again by old-fashioned means" >&5
-$as_echo "$as_me: Failed to find required module $SV_MODULE_MODULE using pkg-config, trying again by old-fashioned means" >&6;}
-elif test $pkg_failed = untried; then
-     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: Failed to find required module $SV_MODULE_MODULE using pkg-config, trying again by old-fashioned means" >&5
-$as_echo "$as_me: Failed to find required module $SV_MODULE_MODULE using pkg-config, trying again by old-fashioned means" >&6;}
-else
-	kj_CFLAGS=$pkg_cv_kj_CFLAGS
-	kj_LIBS=$pkg_cv_kj_LIBS
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-	HAVES="$HAVES $SV_MODULE_HAVE";CXXFLAGS="$CXXFLAGS $kj_CFLAGS";LIBS="$LIBS $kj_LIBS";SV_MODULE_FAILED=""
-fi
-fi
-if test -n "$SV_MODULE_FAILED"; then
-   as_ac_Header=`$as_echo "ac_cv_header_$SV_MODULE_HEADER" | $as_tr_sh`
-ac_fn_cxx_check_header_mongrel "$LINENO" "$SV_MODULE_HEADER" "$as_ac_Header" "$ac_includes_default"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  HAVES="$HAVES $SV_MODULE_HAVE"
-else
-  as_fn_error $? "Failed to find header $SV_MODULE_HEADER for required module $SV_MODULE_MODULE" "$LINENO" 5
-fi
-
-
-   if test -n "$SV_MODULE_LIB"; then
-     as_ac_Lib=`$as_echo "ac_cv_lib_$SV_MODULE_LIB''_$SV_MODULE_FUNC" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $SV_MODULE_FUNC in -l$SV_MODULE_LIB" >&5
-$as_echo_n "checking for $SV_MODULE_FUNC in -l$SV_MODULE_LIB... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$SV_MODULE_LIB  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $SV_MODULE_FUNC ();
-int
-main ()
-{
-return $SV_MODULE_FUNC ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
-else
-  eval "$as_ac_Lib=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-eval ac_res=\$$as_ac_Lib
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  LIBS="$LIBS -l$SV_MODULE_LIB"
-else
-  as_fn_error $? "Failed to find library $SV_MODULE_LIB for required module $SV_MODULE_MODULE" "$LINENO" 5
-fi
-
-   fi
-fi
-
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  HAVES="$HAVES HAVE_CAPNP";LIBS="$LIBS -lcapnp -lkj"
+else
+  as_fn_error $? "Failed to find appropriate capnp library" "$LINENO" 5
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
 
 
 SV_MODULE_MODULE=liblo
--- a/configure.ac	Sat Feb 25 19:24:13 2017 +0000
+++ b/configure.ac	Mon Feb 27 13:24:29 2017 +0000
@@ -89,11 +89,21 @@
 
 # Cap'n Proto 0.5.3 is the latest release at the time of writing, but
 # it lacks the expectedSizeInWordsFromPrefix function which exists in
-# the git repo. Check for a newer release or, if that's not found with
-# pkg-config, check for that specific symbol (mangled).
-AC_MSG_NOTICE([checking specifically for a newer Cap'n Proto than the 0.5.3 release])
-SV_MODULE_REQUIRED([capnp],[capnp >= 0.5.4],[capnp/common.h],[capnp],[_ZN5capnp29expectedSizeInWordsFromPrefixEN2kj8ArrayPtrIKNS_4wordEEE])
-SV_MODULE_REQUIRED([kj],[kj >= 0.5.4],[kj/common.h],[kj],[_ZN2kj20BufferedOutputStreamD0Ev])
+# the git repo. Our check is for that specific symbol, which would
+# indicate a git clone, or for release 0.5.4 or later via pkg-config.
+PKG_CHECK_MODULES([capnp],[capnp => 0.5.4],[HAVES="$HAVES HAVE_CAPNP";CXXFLAGS="$CXXFLAGS $capnp_CFLAGS";LIBS="$LIBS $capnp_LIBS"],[AC_MSG_NOTICE([Failed to find required module capnp using pkg-config, trying again by old-fashioned means])])
+if test -z "$capnp_LIBS" ; then
+    AC_COMPILE_IFELSE([
+        AC_LANG_SOURCE([[
+        #include <capnp/serialize.h>
+        int main() {
+            kj::Array<capnp::word> prefix;
+            return capnp::expectedSizeInWordsFromPrefix(prefix.asPtr());
+        }]])],
+        [HAVES="$HAVES HAVE_CAPNP";LIBS="$LIBS -lcapnp -lkj"],
+        [AC_MSG_ERROR([Failed to find appropriate capnp library])]
+    )
+fi
 
 SV_MODULE_OPTIONAL([liblo],[],[lo/lo.h],[lo],[lo_address_new])
 SV_MODULE_OPTIONAL([portaudio],[portaudio-2.0 >= 19],[portaudio.h],[portaudio],[Pa_IsFormatSupported])