X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=configure.ac;h=e3be4f766216d8e72255e175e8e37088232399de;hb=0b06202a938bc4c6a7c038f22112f08b6bf5bd1c;hp=faea098fbf553fa0cf89f6f229887fd8be721a70;hpb=a4d93bdc07c01f05eb7c39a6fc6fe5c505e2c5fc;p=catta diff --git a/configure.ac b/configure.ac index faea098..e3be4f7 100644 --- a/configure.ac +++ b/configure.ac @@ -21,7 +21,7 @@ # USA. AC_PREREQ(2.57) -AC_INIT([avahi],[0.1],[avahi (at) lists (dot) freedesktop (dot) org]) +AC_INIT([avahi],[0.2],[avahi (at) lists (dot) freedesktop (dot) org]) AC_CONFIG_SRCDIR([avahi-core/server.c]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([foreign 1.9 -Wall]) @@ -29,8 +29,8 @@ AM_INIT_AUTOMAKE([foreign 1.9 -Wall]) AC_SUBST(PACKAGE_URL, [http://www.freedesktop.org/Software/Avahi]) if type -p stow > /dev/null && test -d /usr/local/stow ; then - AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***]) - ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}" + AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***]) + ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}" fi # Checks for programs. @@ -46,6 +46,78 @@ AC_PROG_GCC_TRADITIONAL # libtool stuff AC_PROG_LIBTOOL +# +# Detecting the linux distribution for specific things like init scripts. +# +AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the Linux distribution to target: One of debian, gentoo, archlinux or none])) +if test "z$with_distro" = "z"; then + #AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse") + AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo") + AC_CHECK_FILE(/etc/arch-release,with_distro="archlinux") + AC_CHECK_FILE(/etc/debian_version,with_distro="debian") +fi +with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' ` + +if test "z$with_distro" = "z"; then + 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.]) + exit 1 +else +case $with_distro in + debian|gentoo|archlinux|none) + ;; + *) + 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]) + ;; +esac +fi + +#AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse) +AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo) +AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian) +AM_CONDITIONAL(TARGET_ARCHLINUX, test x"$with_distro" = xarchlinux) + +test_gcc_flag() { + AC_LANG_CONFTEST([int main() {}]) + $CC -c conftest.c $CFLAGS $@ > /dev/null 2> /dev/null + ret=$? + rm -f conftest.o + return $ret +} + +# If using GCC specify some additional parameters +if test "x$GCC" = "xyes" ; then + + DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wlarger-than-4000 -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Winline -Wno-unused-parameter" + + # Test whether rtnetlink.h can be included when compiled with -std=c99 + # some distributions (e.g. archlinux) have broken headers that dont + # define __u64 with -std=c99 + AC_MSG_CHECKING([checking whether rtnetlink.h can be included with -std=c99]) + OLDCFLAGS="$CFLAGS" + CFLAGS="-std=c99" + AC_TRY_COMPILE([#include ], [], + use_stdc99=yes, use_stdc99=no) + + if test x"$use_stdc99" = xyes; then + DESIRED_FLAGS="-std=c99 $DESIRED_FLAGS" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + + CFLAGS="$OLDCFLAGS" + + for flag in $DESIRED_FLAGS ; do + AC_MSG_CHECKING([whether $CC accepts $flag]) + if test_gcc_flag $flag ; then + CFLAGS="$CFLAGS $flag" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + done +fi + # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h limits.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h]) @@ -61,22 +133,23 @@ AC_FUNC_MEMCMP AC_FUNC_SELECT_ARGTYPES AC_FUNC_MALLOC AC_FUNC_REALLOC -AC_CHECK_FUNCS([gethostname memchr memmove memset mkdir select socket strchr strcspn strdup strerror strrchr strspn strstr uname setresuid setreuid strcasecmp gettimeofday]) +AC_CHECK_FUNCS([gethostname memchr memmove memset mkdir select socket strchr strcspn strdup strerror strrchr strspn strstr uname setresuid setreuid strcasecmp gettimeofday putenv strncasecmp]) AC_FUNC_CHOWN AC_FUNC_STAT AC_TYPE_MODE_T AC_TYPE_PID_T -# If using GCC specify some additional parameters -if test "x$GCC" = "xyes" ; then - CFLAGS="$CFLAGS -pipe -W -Wall -pedantic" +# Check for pkg-config manually first, as if its not installed the +# PKG_PROG_PKG_CONFIG macro won't be defined. +AC_CHECK_PROG(have_pkg_config, pkg-config, yes, no) - AC_LANG_CONFTEST([int main() {}]) - $CC -c conftest.c -std=c99 -Wno-unused-parameter $CFLAGS > /dev/null 2> /dev/null && CFLAGS="$CFLAGS -std=c99 -Wno-unused-parameter" - rm -f conftest.o +if test x"$have_pkg_config" == xno; then + AC_MSG_ERROR(pkg-config is required to install this program) fi +PKG_PROG_PKG_CONFIG + # # Check for GLIB 2.0 # @@ -89,14 +162,13 @@ AC_ARG_ENABLE(glib, esac], [HAVE_GLIB=yes]) -if test "x$HAVE_GLIB" = "xyes"; then +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") - # # Check for GTK+ # @@ -109,7 +181,7 @@ AC_ARG_ENABLE(gtk, esac], [HAVE_GTK=yes]) -if test "x$HAVE_GTK" = "xyes"; then +if test "x$HAVE_GTK" = "xyes" ; then # Check for GTK 2.0 PKG_CHECK_MODULES(GTK20, [ gtk+-2.0 >= 2.4.0 ]) AC_SUBST(GTK20_CFLAGS) @@ -120,8 +192,8 @@ if test "x$HAVE_GTK" = "xyes"; then AC_SUBST(GLADE20_CFLAGS) AC_SUBST(GLADE20_LIBS) - interfacesdir="${datadir}/${PACKAGE}/interfaces/" - AC_SUBST(interfacesdir) + interfacesdir="${datadir}/${PACKAGE}/interfaces/" + AC_SUBST(interfacesdir) fi AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes") @@ -138,21 +210,31 @@ AC_ARG_ENABLE(dbus, [HAVE_DBUS=yes]) AC_ARG_WITH(dbus-sys, AS_HELP_STRING([--with-dbus-sys=], [where D-BUS system.d directory is])) +AC_ARG_WITH(dbus-system-socket, AS_HELP_STRING([--with-dbus-system-address=
], [where the dbus system socket is, you probably want to put unix:path= at the start])) -if test "x$HAVE_DBUS" = "xyes"; then - AC_DEFINE(HAVE_DBUS, 1, [Whether we have D-BUS or not]) +if test "x$HAVE_DBUS" = "xyes" ; then + AC_DEFINE(HAVE_DBUS, 1, [Whether we have D-BUS or not]) PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 0.30 ]) DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_API_SUBJECT_TO_CHANGE" AC_SUBST(DBUS_CFLAGS) - AC_SUBST(DBUS_LIBS) - - if ! test -z "$with_dbus_sys" ; then - DBUS_SYS_DIR="$with_dbus_sys" - else - DBUS_SYS_DIR="${sysconfdir}/dbus-1/system.d" - fi - AC_SUBST(DBUS_SYS_DIR) + AC_SUBST(DBUS_LIBS) + + if ! test -z "$with_dbus_sys" ; then + DBUS_SYS_DIR="$with_dbus_sys" + else + DBUS_SYS_DIR="${sysconfdir}/dbus-1/system.d" + fi + AC_SUBST(DBUS_SYS_DIR) + + if ! test -z "$with_dbus_system_address" ; then + DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="$with_dbus_system_address" + else + # Note this default path is hardcoded in D-BUS and should + # not use $localstatedir + DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="unix:path=/var/run/dbus/system_bus_socket" + fi + AC_SUBST(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS) fi AM_CONDITIONAL(HAVE_DBUS, test "x$HAVE_DBUS" = "xyes") @@ -169,12 +251,12 @@ AC_ARG_ENABLE(expat, esac], [HAVE_EXPAT=yes]) -if test "x$HAVE_EXPAT" = "xyes"; then - AC_CHECK_LIB(expat, XML_ParserCreate, [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ], have_expat=false) +if test "x$HAVE_EXPAT" = "xyes" ; then + AC_CHECK_LIB(expat, XML_ParserCreate, [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ], have_expat=false) - if ! $have_expat ; then - AC_MSG_ERROR([*** libexpat not found ***]) - fi + if ! $have_expat ; then + AC_MSG_ERROR([*** libexpat not found ***]) + fi fi AM_CONDITIONAL(HAVE_EXPAT, test "x$HAVE_EXPAT" = "xyes") @@ -190,10 +272,10 @@ AC_ARG_ENABLE(libdaemon, esac], [HAVE_LIBDAEMON=yes]) -if test "x$HAVE_LIBDAEMON" = "xyes"; then - PKG_CHECK_MODULES(LIBDAEMON, [ libdaemon >= 0.5 ]) - AC_SUBST(LIBDAEMON_CFLAGS) - AC_SUBST(LIBDAEMON_LIBS) +if test "x$HAVE_LIBDAEMON" = "xyes" ; then + PKG_CHECK_MODULES(LIBDAEMON, [ libdaemon >= 0.5 ]) + AC_SUBST(LIBDAEMON_CFLAGS) + AC_SUBST(LIBDAEMON_LIBS) fi AM_CONDITIONAL(HAVE_LIBDAEMON, test "x$HAVE_LIBDAEMON" = "xyes") @@ -201,56 +283,20 @@ AM_CONDITIONAL(HAVE_LIBDAEMON, test "x$HAVE_LIBDAEMON" = "xyes") # Python stuff # AC_ARG_ENABLE(python, - AS_HELP_STRING([--disable-python], [Disable scripts that depends on python]), - [case "${enableval}" in - yes) HAVE_PYTHON=yes ;; - no) HAVE_PYTHON=no ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-python]) ;; - esac],[HAVE_PYTHON=yes]) - -if test "y$HAVE_PYTHON" = xyes ; then - AM_PATH_PYTHON(2.4) - - if test "x$HAVE_PYTHON" = xyes ; then - AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(Could not find Python module pygtk)]) - AM_CHECK_PYMOD(dbus,,,[AC_MSG_ERROR(Could not find Python module dbus)]) - fi + AS_HELP_STRING([--disable-python], [Disable scripts that depends on python]), + [case "${enableval}" in + yes) HAVE_PYTHON=yes ;; + no) HAVE_PYTHON=no ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-python]) ;; + esac],[HAVE_PYTHON=yes]) + +if test "x$HAVE_PYTHON" = "xyes" ; then + AM_PATH_PYTHON([2.4]) + AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(Could not find Python module pygtk)]) + AM_CHECK_PYMOD(dbus,,,[AC_MSG_ERROR(Could not find Python module dbus)]) fi AM_CONDITIONAL(HAVE_PYTHON, [test "x$HAVE_PYTHON" = "xyes" ]) -# -# Detecting the linux distro for specific things like initscripts. -# -AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the Linux distribution to target: One of redhat, suse, gentoo, debian, or slackware])) -if test "z$with_distro" = "z"; then - AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat") - AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse") - AC_CHECK_FILE(/etc/fedora-release,with_distro="redhat") - AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo") - AC_CHECK_FILE(/etc/debian_version,with_distro="debian") - AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware") -fi -with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' ` - -if test "z$with_distro" = "z"; then - echo "Linux distribution autodetection failed, you must specify the distribution to target using --with-distro=DISTRO" - exit 1 -else -case $with_distro in - debian|gentoo|suse) - ;; - *) - echo "Your distribution (${with_distro}) is not yet supported, init scripts and dbus configuration will not be installed! (patches welcome)" - ;; -esac - -fi -AM_CONDITIONAL(TARGET_REDHAT, test x"$with_distro" = xredhat) -AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse) -AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo) -AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian) -AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware) - # # Defining Avahi User and Group. # @@ -306,12 +352,16 @@ AC_ARG_ENABLE(xmltoman, esac],[xmltoman=yes]) if test x$xmltoman = xyes ; then - AC_CHECK_PROG(have_xmltoman, xmltoman, yes, no) - - if test x$have_xmltoman = xno ; then - AC_MSG_WARN([*** Not rebuilding man pages as xmltoman is not found ***]) - xmltoman=no - fi + AC_CHECK_PROG(have_xmltoman, xmltoman, yes, no) + + if test x$have_xmltoman = xno ; then + if ! test -e man/avahi-daemon.8 ; then + AC_MSG_ERROR([*** xmltoman was not found, it is required to build the manpages and they have not been pre-built]) + exit 1 + fi + AC_MSG_WARN([*** Not rebuilding man pages as xmltoman is not found ***]) + xmltoman=no + fi fi AM_CONDITIONAL([USE_XMLTOMAN], [test "x$xmltoman" = xyes]) @@ -327,9 +377,9 @@ avahi-daemon/avahi-dbus.conf avahi-discover-standalone/Makefile avahi-client/Makefile initscript/Makefile -initscript/Debian/Makefile -initscript/Gentoo/Makefile -initscript/SUSE/Makefile +initscript/debian/Makefile +initscript/gentoo/Makefile +initscript/archlinux/Makefile avahi-dnsconfd/Makefile avahi-utils/Makefile avahi-utils/avahi/Makefile @@ -337,6 +387,7 @@ examples/Makefile common/Makefile man/Makefile tests/Makefile +service-type-database/Makefile ]) AC_OUTPUT @@ -348,6 +399,7 @@ echo " sysconfdir: ${sysconfdir} dbus-1 system.d dir: ${DBUS_SYS_DIR} dbus-1 version: `pkg-config dbus-1 --modversion` + dbus-1 system socket ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS} compiler: ${CC} cflags: ${CFLAGS} Enable GLIB: ${HAVE_GLIB} @@ -361,23 +413,31 @@ echo " Group for Avahi: ${AVAHI_GROUP} " -BUILD_DAEMON=no +BUILD_DAEMON="no (!)" if test "x$HAVE_EXPAT" = "xyes" -a "x$HAVE_LIBDAEMON" = "xyes" ; then - BUILD_DAEMON=yes + BUILD_DAEMON=yes fi -BUILD_UTILS=no +BUILD_UTILS="no (!)" if test "x$BUILD_DAEMON" = "xyes" -a "x$HAVE_DBUS" = "xyes" -a "x$HAVE_PYTHON" = "xyes" ; then - BUILD_UTILS=yes + BUILD_UTILS=yes +fi + +BUILD_CLIENT="no (!)" + +if test "x$BUILD_DAEMON" = "xyes" -a "x$HAVE_DBUS" = "xyes" ; then + BUILD_CLIENT=yes fi + echo " - Building avahi-core yes + Building libavahi-core yes Building avahi-daemon: ${BUILD_DAEMON} Building avahi-dnsconfd: ${BUILD_DAEMON} Building avahi-utils: ${BUILD_UTILS} - Building avahi-glib: ${HAVE_GLIB} - Building avahi-discover-standalone ${HAVE_GTK} + Building libavahi-glib: ${HAVE_GLIB} + Building libavahi-client: ${BUILD_CLIENT} + Building avahi-discover-standalone: ${HAVE_GTK} "