Project

General

Profile

Model Ampache Browser dependency on neon/HTTP

Added by Róbert Čerňanský over 7 years ago

Hi,

I've realized that Ampache Browser plugin depends on neon library (and on HTTP support in Audacious). Without neon it does not connect to a server and without HTTP support in Audacious does not play remote files. (Build passes, so it is a runtime dependency.)

So I was thinking that it would be good to express this dependency in the build system explicitly. Otherwise users may produce a build that has dysfunctional/broken plugin. I came up with a solution but I have much respect for the build system so better that I double check here ;-)

diff --git a/configure.ac b/configure.ac
index 990d93cda..36412f88c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -106,6 +106,12 @@ check_allowed () {
             if test $plugin_allowed = no -a $2 = yes ; then
                 AC_MSG_ERROR([--enable-$1 cannot be used without --enable-qt])
             fi
+            ;;&
+        ampache)
+            plugin_allowed=$have_neon
+            if test $plugin_allowed = no -a $2 = yes ; then
+                AC_MSG_ERROR([--enable-$1 cannot be used without --enable-neon])
+            fi
             ;;
         *)
             plugin_allowed=yes

I have tested all combinations of --disable/enable-neon --disable/enable-ampache and not passing one or both of the options and it works here. Does it look OK?

Robert


Replies (3)

RE: Model Ampache Browser dependency on neon/HTTP - Added by John Lindgren over 7 years ago

Two concerns:
1. The ";;&" syntax might not be portable enough (for example, to Mac OS). See the comments on https://stackoverflow.com/questions/12010686/case-statement-fallthrough/12010977#12010977.
2. Did you test that this works correctly (i.e. disables ampache) without --enable-qt? It looks like the result of the Qt check might get overridden by the later neon check.

RE: Model Ampache Browser dependency on neon/HTTP - Added by Róbert Čerňanský over 7 years ago

1. Let's go with a simple if-then:

diff --git a/configure.ac b/configure.ac
index 990d93cda..077733a02 100644
--- a/configure.ac
+++ b/configure.ac
@@ -106,6 +106,12 @@ check_allowed () {
             if test $plugin_allowed = no -a $2 = yes ; then
                 AC_MSG_ERROR([--enable-$1 cannot be used without --enable-qt])
             fi
+            if test $plugin_allowed = yes -a $1 = ampache ; then
+                plugin_allowed=$have_neon
+                if test $plugin_allowed = no -a $2 = yes ; then
+                    AC_MSG_ERROR([--enable-$1 cannot be used without --enable-neon])
+                fi
+            fi
             ;;
         *)
             plugin_allowed=yes

2. Ah! Right. I've added additional check $plugin_allowed = yes so the next check (for neon) is performed only if the fist one (Qt) passes.

And now I've tested also with --enable/disable-qt combination (with assumption that --disable-qt is the default):

$ ./configure 2>&1 --disable-neon --disable-ampache | grep -i "ampache\|neon" 
  HTTP/HTTPS (via neon):                  no
  Ampache browser (requires Qt):          no

$ ./configure 2>&1 --disable-neon --enable-ampache | grep -i "ampache\|neon" 
configure: error: --enable-ampache cannot be used without --enable-qt

$ ./configure 2>&1 --disable-neon | grep -i "ampache\|neon" 
  HTTP/HTTPS (via neon):                  no
  Ampache browser (requires Qt):          no

$ ./configure 2>&1 --disable-ampache | grep -i "ampache\|neon" 
checking for NEON... yes
  HTTP/HTTPS (via neon):                  yes
  Ampache browser (requires Qt):          no

$ ./configure 2>&1 --enable-ampache | grep -i "ampache\|neon" 
checking for NEON... yes
configure: error: --enable-ampache cannot be used without --enable-qt

$ ./configure 2>&1 | grep -i "ampache\|neon" 
checking for NEON... yes
  HTTP/HTTPS (via neon):                  yes
  Ampache browser (requires Qt):          no

$ ./configure 2>&1 --enable-qt --disable-neon --disable-ampache | grep -i "ampache\|neon" 
  HTTP/HTTPS (via neon):                  no
  Ampache browser (requires Qt):          no

$ ./configure 2>&1 --enable-qt --disable-neon --enable-ampache | grep -i "ampache\|neon" 
configure: error: --enable-ampache cannot be used without --enable-neon

$ ./configure 2>&1 --enable-qt --disable-neon | grep -i "ampache\|neon" 
  HTTP/HTTPS (via neon):                  no
  Ampache browser (requires Qt):          no

$ ./configure  2>&1 --enable-qt --enable-neon --disable-ampache | grep -i "ampache\|neon" 
checking for NEON... yes
  HTTP/HTTPS (via neon):                  yes
  Ampache browser (requires Qt):          no

$ ./configure 2>&1 --enable-qt --enable-neon --enable-ampache | grep -i "ampache\|neon" 
checking for NEON... yes
checking for AMPACHE... yes
  HTTP/HTTPS (via neon):                  yes
  Ampache browser (requires Qt):          yes

$ ./configure 2>&1 --enable-qt --enable-neon | grep -i "ampache\|neon" 
checking for NEON... yes
checking for AMPACHE... yes
  HTTP/HTTPS (via neon):                  yes
  Ampache browser (requires Qt):          yes
    (1-3/3)