[avahi] Patch: negative results during autoconfiguration would abort ./configure

Trent Lloyd lathiat at bur.st
Sat Sep 2 11:07:58 PDT 2006


Hi Adam,

While I understand many peoples like of the fact things just "figure
themselves out" I've personally always hated it as I could never figure
out all the deps a program needs to be fully functional.

I can however see how this can be usefull *especially* in the case of
jhbuild and such

As such I propose an option, e.g. --auto-deps that would globally
automatically enable/disable dependencies as much as possible.

Lennart, Adam, what do you think of this?

(If this seems good I will implement it!)

Cheers,
Trent

On Sat, Sep 02, 2006 at 07:20:35AM +0800, Adam J. Richter wrote:
> 	The following patch is related to ticket #34 ("Avahi
> configure script is diffult for things like jhbuld to use",
> reported by james at jamesh.id.au four months ago).  Even though
> I'm logged in to wwww.avahi.org to my newly created account,
> I don't see where I can update the ticket.  Perhaps I'm not
> allowed to, because my account is brand new.  So, I'll post the
> explanation and patch here.
> 
> 	My explanation is kind of long because I think I should
> address to some of the discussion posted to the bug report, in the
> hopes of getting everyone on the same page (although I am glad to
> see that it already is targeted for implementation in 0.7).
> 
> 	Also, before I get into what may seem a bit whiney, let
> me say thanks for the work that has gone into avahi.  Although
> I don't use it yet, it sounds like something that should be a
> useful convenience.
> 
> 	autocconfiguration scripts are not normally supposed to
> abort when they discover that an optional facility that was not
> explicitly requested is absent.  This way, a larger fraction of
> potential users can build the source code and find it a worthwile
> trade off of their engineering time.  Also, that way, it is
> possible install new software and then know that it will be
> picked up the next time software packages that use it are
> rebuilt, instead of continuing to be disabled by whatever
> custom build scripts with the extra "--disable-foo" switches
> were put in place in order to get the package to build previously.
> In addition, every time new features are added to avahi based on external
> software, then under the model requiring "--disable", then everybody's
> build breaks on the new release unless they happen to have the software
> used by the new optional feature.
> 
> 	I've probably seen a couple of hundred packages that build
> with GNU autoconf.  Occassionally, one will need an explicit
> "--disable-foo" switch in order to build, but, in every case that
> I can recall, that was either because of some very unusual
> difficulty in automatating the test, or, more commonly, because
> the test automation was something that just hadn't been written
> yet, but never in my recollection a desired objective.
> 
> 	I only built avahi because I was trying to build another
> software package that could optionally use avahi, so I figured I'd
> give avahi a whirl.  If it's going to be worth keeping around, it
> should be able to configure based what it finds on my system
> without special arguments.  If you want also to have a mode where
> everything that is not available must explicitly be called on with
> its own "--disable-foo" switch, then that mode should be invoked
> with a special switch rather than requiring a special switch to get
> the standard autoconfiguration behavior, because the standard
> autoconfiguration and ease of building is obviously of more value to
> people who want to autoconfiguration, and the people (person, I think)
> who want(s) ./configure to abort on any negative autoconfiguration
> decision are already committed to customization of their build
> process, so they shouldn't mind an extra switch as much.
> 
> 	Anyhow, here is a patch that fixes the abort that I tripped.
> It does not fix all of the aborts.  It does not fix all such cases,
> but I think it is an incremental improvement, which should help
> make avahi more appealling.
> 
> 	In order to make some of the changes smaller and more
> consistent, I wrote two autoconf macros in a new file common/opt_module.m4.
> They are AVAHI_OPT_MODULE() and AVAVI_OPT_PYMOD.  I am not a very
> experienced autoconf hacker, as you might notice from the fact
> that I have a commented out AC_REQUIRE() call in each of those
> macros that I think is supposed to be there to ensure correct
> dependencies, but somehow breaks things.  Anyhow, I think that
> applying this patch should be an improvement, and then later someone
> can figure out whethere to delete the commented out AC_REQUIRE
> lines entirely or make whatever correction they ideally should
> have.
> 
> 	I also moved some of the AC_SUBST() calls outside of "if"
> statements.  I believe that in almost all cases, AC_SUBST should
> be executed unconditionally.  That is, you want  AC_SUBST(foo_CFLAGS)
> to replace @foo_CFLAGS@ in Makefile.in with th value of the
> shell variable $foo_CFLAGS even in the cases where the foo package
> is absent and $foo_CFLAGS is an empty string.
> 
> 	Likewise, I changed the error about failure to detect
> a particular Linux configuration from an aborting error to a
> warning.  Perhaps in the future, that code could be changed to
> configure the startup files based on specific boot script
> characteristics (sysvinit, has /etc/init.d, etc.) rather than
> having special cases for each platform ("redhat", "debian", etc.)
> 
> 	Anyhow, if this patch looks OK, I hope the appropriate person
> will integrate it or some change based on it.  I don't think that
> trouble ticket #34 should be closed yet, since there are other
> checks in configure.in that have the same problem, but this patch
> fixes some of the problems identified (all of the ones I noticed on my
> system).
> 
> Adam Richter

> --- /dev/null	2006-09-01 12:16:45.000000000 +0800
> +++ avahi/common/opt_modules.m4	2006-09-02 05:40:44.000000000 +0800
> @@ -0,0 +1,40 @@
> +dnl AVAHI_OPT_MODULE(MODNAME, VERSION_CHECK)
> +dnl 
> +dnl HAVE_${MODNAME} is a shell variable that will be have one of three
> +dnl values:
> +dnl "yes" : Require the version check to success.
> +dnl "no" :  Do nothing.
> +dnl "" :    Do the version check, and change HAVE_${MODNAME} to "yes" or "no"
> +dnl         based on the results of the version check.
> +dnl
> +dnl Note that the version check sets ${MODNAME}_CFLAGS and ${MODNAME}_LIBS.
> +dnl
> +AC_DEFUN([AVAHI_OPT_MODULES],
> +[
> +
> +dnl For now, comment out the AC_REQUIRE.  Why does it make aclocal barf?
> +dnl AC_REQUIRE(PKG_CHECK_MODULES)
> +
> +case "x$HAVE_[]$1" in
> +	xyes )	PKG_CHECK_MODULES([$1], [$2]) ;;
> +	x )	PKG_CHECK_MODULES([$1], [$2],
> +			          [HAVE_[]$1[]=yes],
> +				  [HAVE_[]$1[]=no]) ;;
> +esac
> +])
> +
> +
> +dnl
> +dnl AVAHI_OPT_PYMOD(HAVE_SHELL_VARIABLE, module_name_in_lowercase)
> +dnl
> +AC_DEFUN([AVAHI_OPT_PYMOD],
> +[
> +dnl AC_REQUIRE(PKG_CHECK_MODULES)
> +
> +AM_CHECK_PYMOD([$2],,[$1[]="yes"],
> +	[if "$[]$1" = "yes" ; then
> +		AC_MSG_ERROR(Could not find Python module [$2] even though it was explicitly enabled)
> +	fi
> +	$1[]="no"])
> +])
> +
> --- avahi-0.6.13/configure.ac	2006-08-25 07:27:06.000000000 +0800
> +++ avahi/configure.ac	2006-09-02 05:54:52.000000000 +0800
> @@ -160,11 +160,8 @@
>      netbsd)
>       AC_MSG_WARN([Your distribution (${with_distro}) is supported but no init script exist yet! (patches welcome)])
>       ;;
> -    linux)
> -     AC_MSG_ERROR([Linux distribution autodetection failed, you must specify the distribution to target using --with-distro=DISTRO, set DISTRO to none if your distribution is not supported.])
> -     ;;
>      *)
> -     AC_MSG_ERROR([Your distribution (${with_distro}) is not yet supported, init scripts and dbus configuration will not be installed! (patches welcome), you can specify --with-distro=none to skip this check])
> +     AC_MSG_WARN([Your distribution (${with_distro}) is not yet supported.  init scripts and dbus configuration will not be installed! (patches welcome). You can specify --with-distro=none to silence this warning.])
>       ;;
>  esac
>  
> @@ -283,18 +280,16 @@
>  AC_ARG_ENABLE(glib,
>          AS_HELP_STRING([--disable-glib],[Disable use of GLib]),
>          [case "${enableval}" in
> -                yes) HAVE_GLIB=yes ;;
> -                no)  HAVE_GLIB=no ;;
> +                yes) HAVE_GLIB20=yes ;;
> +                no)  HAVE_GLIB20=no ;;
>                  *) AC_MSG_ERROR(bad value ${enableval} for --enable-glib) ;;
>          esac],
> -        [HAVE_GLIB=yes])
> +        [HAVE_GLIB20=yes])
>  
> -if test "x$HAVE_GLIB" = "xyes" ; then
> -        PKG_CHECK_MODULES(GLIB20, [ glib-2.0 >= 2.4.0 ])
> -        AC_SUBST(GLIB20_CFLAGS)
> -        AC_SUBST(GLIB20_LIBS)
> -fi
> -AM_CONDITIONAL(HAVE_GLIB, test "x$HAVE_GLIB" = "xyes")
> +AVAHI_OPT_MODULES(GLIB20, [ glib-2.0 >= 2.4.0 ])
> +AC_SUBST(GLIB20_CFLAGS)
> +AC_SUBST(GLIB20_LIBS)
> +AM_CONDITIONAL(HAVE_GLIB20, test "x$HAVE_GLIB20" = "xyes")
>  
>  #
>  # Check for Qt 3
> @@ -305,13 +300,13 @@
>                  yes) HAVE_QT3=yes ;;
>                  no)  HAVE_QT3=no ;;
>                  *) AC_MSG_ERROR(bad value ${enableval} for --enable-qt3) ;;
> -        esac],
> -        [HAVE_QT3=yes])
> +        esac])
> +
> +AVAHI_OPT_MODULES( QT3, [ qt-mt >= 3.0.0 ])
> +AC_SUBST(QT3_CFLAGS)
> +AC_SUBST(QT3_LIBS)
>  
>  if test "x$HAVE_QT3" = "xyes" ; then
> -        PKG_CHECK_MODULES( QT3, [ qt-mt >= 3.0.0 ])
> -        AC_SUBST(QT3_CFLAGS)
> -        AC_SUBST(QT3_LIBS)
>  	    QT3_PREFIX="`$PKG_CONFIG --variable=prefix qt-mt`/bin"
>          MOC_QT3="no"
>  	    AC_CHECK_FILE( "$QT3_PREFIX/moc-qt3", [ MOC_QT3=$QT3_PREFIX/moc-qt3 ], [
> @@ -330,13 +325,13 @@
>                  yes) HAVE_QT4=yes ;;
>                  no)  HAVE_QT4=no ;;
>                  *) AC_MSG_ERROR(bad value ${enableval} for --enable-qt4) ;;
> -        esac],
> -        [HAVE_QT4=yes])
> +        esac])
> +
> +AVAHI_OPT_MODULES( QT4, [ QtCore >= 4.0.0 ])
> +AC_SUBST(QT4_CFLAGS)
> +AC_SUBST(QT4_LIBS)
>  
>  if test "x$HAVE_QT4" = "xyes" ; then
> -        PKG_CHECK_MODULES( QT4, [ QtCore >= 4.0.0 ])
> -        AC_SUBST(QT4_CFLAGS)
> -        AC_SUBST(QT4_LIBS)
>  	    QT4_PREFIX="`$PKG_CONFIG --variable=prefix QtCore`/bin"
>          MOC_QT4="no"
>  	    AC_CHECK_FILE( "$QT4_PREFIX/moc-qt4", [ MOC_QT4=$QT4_PREFIX/moc-qt4 ], [
> @@ -380,8 +375,7 @@
>                  yes) HAVE_DBUS=yes ;;
>                  no)  HAVE_DBUS=no ;;
>                  *) AC_MSG_ERROR(bad value ${enableval} for --enable-dbus) ;;
> -        esac],
> -        [HAVE_DBUS=yes]) 
> +        esac])
>  
>  AC_ARG_WITH(dbus-sys, AS_HELP_STRING([--with-dbus-sys=<dir>], [where D-BUS system.d directory is]))
>  AC_ARG_WITH(dbus-system-socket, AS_HELP_STRING([--with-dbus-system-address=<address>], [where the dbus system socket is, you probably want to put unix:path= at the start]))
> @@ -389,8 +383,8 @@
>  DBUS_VERSION="Disabled"
>  DBUS_SYS_DIR="Disabled"
>  DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="Disabled"
> +AVAHI_OPT_MODULES(DBUS, [ dbus-1 >= 0.34 ])
>  if test "x$HAVE_DBUS" = "xyes" ; then
> -    PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 0.34 ])
>  
>      AC_DEFINE(HAVE_DBUS, 1, [Whether we have D-BUS or not])
>  
> @@ -490,8 +484,7 @@
>                  yes) HAVE_DBM=yes ;;
>                  no)  HAVE_DBM=no ;;
>                  *) AC_MSG_ERROR(bad value ${enableval} for --enable-dbm) ;;
> -        esac],
> -        [HAVE_DBM=no]) 
> +        esac])
>  
>  AC_ARG_ENABLE(gdbm,
>          AS_HELP_STRING([--disable-gdbm],[Disable use of GDBM]),
> @@ -499,8 +492,7 @@
>                  yes) HAVE_GDBM=yes ;;
>                  no)  HAVE_GDBM=no ;;
>                  *) AC_MSG_ERROR(bad value ${enableval} for --disable-gdbm) ;;
> -        esac],
> -        [HAVE_GDBM=yes]) 
> +        esac])
>  
>  if test "x$HAVE_GDBM" = "xyes" ; then
>      if test "x$HAVE_DBM" = "xyes" ; then
> @@ -534,14 +526,11 @@
>                  yes) HAVE_LIBDAEMON=yes ;;
>                  no)  HAVE_LIBDAEMON=no ;;
>                  *) AC_MSG_ERROR(bad value ${enableval} for --enable-libdaemon) ;;
> -        esac],
> -        [HAVE_LIBDAEMON=yes]) 
> +        esac])
>  
> -if test "x$HAVE_LIBDAEMON" = "xyes" ; then
> -    PKG_CHECK_MODULES(LIBDAEMON, [ libdaemon >= 0.5 ])
> -    AC_SUBST(LIBDAEMON_CFLAGS)
> -    AC_SUBST(LIBDAEMON_LIBS)
> -fi
> +AVAHI_OPT_MODULES(LIBDAEMON, [ libdaemon >= 0.5 ])
> +AC_SUBST(LIBDAEMON_CFLAGS)
> +AC_SUBST(LIBDAEMON_LIBS)
>  AM_CONDITIONAL(HAVE_LIBDAEMON, test "x$HAVE_LIBDAEMON" = "xyes")
>  
>  #
> @@ -567,13 +556,9 @@
>                  yes) HAVE_PYGTK=yes ;;
>                  no)  HAVE_PYGTK=no ;;
>                  *) AC_MSG_ERROR(bad value ${enableval} for --enable-pygtk) ;;
> -        esac],
> -        [HAVE_PYGTK=yes])
> -    
> -    if test "x$HAVE_PYGTK" = "xyes" ; then
> -        AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(Could not find Python module gtk)])
> -    fi
> +        esac])
>  
> +    AVAHI_OPT_PYMOD(HAVE_PYGTK, gtk)
>  
>      if test "x$HAVE_DBUS" = "xyes" ; then
>          AC_ARG_ENABLE(python-dbus,
> @@ -582,12 +567,9 @@
>                     yes) HAVE_PYTHON_DBUS=yes ;;
>                     no)  HAVE_PYTHON_DBUS=no ;;
>                     *) AC_MSG_ERROR(bad value ${enableval} for --enable-python-dbus) ;;
> -            esac],
> -            [HAVE_PYTHON_DBUS=yes])
> -    
> -        if test "x$HAVE_PYTHON_DBUS" = "xyes"; then
> -            AM_CHECK_PYMOD(dbus,,,[AC_MSG_ERROR(Could not find Python module dbus)])
> -        fi
> +            esac])
> +
> +        AVAHI_OPT_PYMOD(HAVE_PYTHON_DBUS, dbus)
>  
>          AM_CHECK_PYMOD(socket,,,[AC_MSG_ERROR(Could not find Python module socket)])
>          if test "x$HAVE_GDBM" = "xyes"; then
> @@ -602,6 +584,7 @@
>  AM_CONDITIONAL(HAVE_PYGTK, test "x$HAVE_PYGTK" = "xyes")
>  AM_CONDITIONAL(HAVE_PYTHON_DBUS, test "x$HAVE_PYTHON_DBUS" = "xyes")
>  
> +
>  #
>  # Check for mono stuff
>  #
> @@ -613,24 +596,34 @@
>                      yes) HAVE_MONO=yes ;;
>                      no)  HAVE_MONO=no ;;
>                      *) AC_MSG_ERROR(bad value ${enableval} for --enable-mono) ;;
> -            esac],
> -            [HAVE_MONO=yes])
> +            esac])
>  
> -    if test "x$HAVE_MONO" = "xyes" ; then
> +    if test "x$HAVE_MONO" != "xno" ; then
>          AC_PATH_PROG(MCS, mcs)
>          if test "x$MCS" = "x" ; then
> -            AC_MSG_ERROR([Can not find "mcs" - The Mono C-Sharp Compiler) in your PATH])
> +	    if test "x$HAVE_MONO" = "xyes" ; then
> +                AC_MSG_ERROR([Can not find "mcs" - The Mono C-Sharp Compiler) in your PATH])
> +	    else
> +                AC_MSG_WARN([Can not find "mcs" - The Mono C-Sharp Compiler) in your PATH, disabling it.])
> +		HAVE_MONO=no
> +	    fi
>          fi
>  
>          AC_PATH_PROG(GACUTIL, gacutil)
>          if test "x$GACUTIL" = "x" ; then
> -            AC_MSG_ERROR([Can not find "gacutil" in your PATH])
> +	    if test "x$HAVE_MONO" = "xyes" ; then
> +                AC_MSG_ERROR([Can not find "gacutil" in your PATH])
> +	    else
> +                AC_MSG_WARN([Can not find "gacutil" in your PATH, disabling mono.])
> +		HAVE_MONO=no
> +	    fi
> +        else
> +	    HAVE_MONO=yes
>          fi
> -
> -        AC_SUBST(MCS)
> -        AC_SUBST(GACUTIL)
>      fi
>  fi
> +AC_SUBST(MCS)
> +AC_SUBST(GACUTIL)
>  AM_CONDITIONAL(HAVE_MONO, test "x$HAVE_MONO" = "xyes")
>  
>  #
> @@ -860,7 +853,7 @@
>      dbus-1 system socket:                      ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS}
>      C Compiler:                                ${CC}
>      CFLAGS:                                    ${CFLAGS}
> -    Enable GLIB:                               ${HAVE_GLIB}
> +    Enable GLIB:                               ${HAVE_GLIB20}
>      Enable GTK:                                ${HAVE_GTK}
>      Enable D-BUS:                              ${HAVE_DBUS}
>      Enable Expat:                              ${HAVE_EXPAT}
> @@ -914,7 +907,7 @@
>      Building libavahi-client:           ${BUILD_CLIENT}
>      Building avahi-utils:               ${BUILD_CLIENT}
>      Building avahi-python:              ${BUILD_PYTHON}
> -    Building libavahi-glib:             ${HAVE_GLIB}
> +    Building libavahi-glib:             ${HAVE_GLIB20}
>      Building avahi-discover-standalone: ${HAVE_GTK}
>      Building libavahi-qt3:              ${HAVE_QT3}
>      Building libavahi-qt4:              ${HAVE_QT4}

> _______________________________________________
> avahi mailing list
> avahi at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/avahi


-- 
Trent Lloyd <lathiat at bur.st>
Bur.st Networking Inc.


More information about the avahi mailing list