pragha-music-player / pragha

Pragha is a Lightweight Music Player for GNU/Linux.
GNU General Public License v3.0
180 stars 35 forks source link

Configure script fails if certain optional libs are not present #60

Closed dumblob closed 10 years ago

dumblob commented 10 years ago

Try to run autoconf && ./configure e.g. on a system without libnotify installed and you'll get error:

...
checking for optional package totem-plparser >= 2.26... not found
checking that generated files are newer than configure... done
configure: error: conditional "HAVE_LIBNOTIFY" was never defined.
Usually this means the macro was only invoked conditionally.
master 1$ 

I've investigated that the problem lies in a badly written configure.ac where there the following snippet

dnl Check notify support
LIBNOTIFY_FOUND="no"
if test x"$LIBPEAS_FOUND" = x"yes"; then
XDT_CHECK_OPTIONAL_PACKAGE([LIBNOTIFY],
                           [libnotify], [0.4.4],
                           [libnotify],
                           [libnotify library], [yes])
fi

generates

LIBNOTIFY_FOUND="no"
if test x"$LIBPEAS_FOUND" = x"yes"; then
  ...
  if test x"$LIBNOTIFY_FOUND" = x"yes"; then
    HAVE_LIBNOTIFY_TRUE=
    HAVE_LIBNOTIFY_FALSE='#'
  else
    HAVE_LIBNOTIFY_TRUE='#'
    HAVE_LIBNOTIFY_FALSE=
  fi
fi

whereas variables HAVE_LIBNOTIFY_TRUE and HAVE_LIBNOTIFY_FALSE are then always checked later in the ./configure script and produce the above-mentioned error.

The solution would be to add the check for "$LIBNOTIFY_FOUND" value and setting appropriately HAVE_LIBNOTIFY_TRUE and HAVE_LIBNOTIFY_FALSE after the if test x"$LIBPEAS_FOUND" = x"yes"; then ...; fi block in ./configure.ac (maybe there is some macro provided by autoconf for it). But I'd rather solve it differently and in a more robust way. Any ideas?

This problem could of course occur with other modules as well.

alium commented 10 years ago

same problem

[alois@lenovo pragha-master]$ autoreconf Makefile.am:6: error: HAVE_LIBPEAS does not appear in AM_CONDITIONAL plugins/Makefile.am:16: error: HAVE_LIBGLYR does not appear in AM_CONDITIONAL plugins/Makefile.am:20: error: HAVE_LIBKEYBINDER does not appear in AM_CONDITIONAL plugins/Makefile.am:24: error: HAVE_LIBNOTIFY does not appear in AM_CONDITIONAL plugins/Makefile.am:28: error: HAVE_LIBMTP does not appear in AM_CONDITIONAL plugins/devices/Makefile.am:56: error: HAVE_GSTREAMER_AUDIO does not appear in AM_CONDITIONAL plugins/devices/Makefile.am:61: error: HAVE_LIBXFCE4UI does not appear in AM_CONDITIONAL plugins/keybinder/Makefile.am:46: error: HAVE_GSTREAMER_AUDIO does not appear in AM_CONDITIONAL plugins/keybinder/Makefile.am:51: error: HAVE_LIBXFCE4UI does not appear in AM_CONDITIONAL plugins/mpris2/Makefile.am:44: error: HAVE_GSTREAMER_AUDIO does not appear in AM_CONDITIONAL plugins/mpris2/Makefile.am:49: error: HAVE_LIBXFCE4UI does not appear in AM_CONDITIONAL plugins/notify/Makefile.am:47: error: HAVE_GSTREAMER_AUDIO does not appear in AM_CONDITIONAL plugins/notify/Makefile.am:52: error: HAVE_LIBXFCE4UI does not appear in AM_CONDITIONAL plugins/song-info/Makefile.am:47: error: HAVE_GSTREAMER_AUDIO does not appear in AM_CONDITIONAL plugins/song-info/Makefile.am:52: error: HAVE_LIBXFCE4UI does not appear in AM_CONDITIONAL src/Makefile.am:117: error: HAVE_GSTREAMER_AUDIO does not appear in AM_CONDITIONAL src/Makefile.am:122: error: HAVE_LIBCLASTFM does not appear in AM_CONDITIONAL src/Makefile.am:127: error: HAVE_LIBXFCE4UI does not appear in AM_CONDITIONAL src/Makefile.am:132: error: HAVE_PLPARSER does not appear in AM_CONDITIONAL src/Makefile.am:137: error: HAVE_LIBPEAS does not appear in AM_CONDITIONAL autoreconf: automake failed with exit status: 1

matiasdelellis commented 10 years ago

Ohh.. Thanks for reporting!. Shame .. because seemed a good solution.

Making libpeas obligatory will solve the problem.. but I wanted the plugins completely optionals..

Tomorrow look if I can find a better choice..

Well, for now, please, try comment (Adding # or simple removing) all the lines: if test x"$LIBPEAS_FOUND" = x"yes"; then fi

alium commented 10 years ago

Yes, after installing libpeas i can compile Pragha again, without comment lines.

Adding 'libpeas' as a dependency (to GTK3/GObject) allows you to do plugins optional, or not? Is libpeas a "heavy" dependency? Depending only on GTK3 and GObject-Introspection.

matiasdelellis commented 10 years ago

mm.. The master branch now depends on GTK3 (Gtk2 support was completely removed), If you need GTK2 use the branch pragha-1.2. Long story, but if I kept forcing GTK2, it would have been easier porting to QT than porting to GTK3. I tell it a little ironic, but partly true, because of inconsistencies GTK developers. :sweat:

So, the idea is able to compile Pragha completely free of plugins (Without even notifications, which only wants to play audio in a lightweight audio player). This, compiling without libpeas

Compiling with libpeas, all plugins are optional according dependencies. (Test ./autgen.sh --disable-libnotify)

The idea is that libpeas and all plugins should be optional. ;)

On GObject-Introspection, nothing works yet, but could be implemented in the near future.

Regards, Matias

matiasdelellis commented 10 years ago

Hi all, Please test last commit.. :grin: Regards.

dumblob commented 10 years ago

Great! Now it works for me. Thanks.