[go: up one dir, main page]

Menu

[r49]: / trunk / configure.ac  Maximize  Restore  History

Download this file

275 lines (230 with data), 6.3 kB

# -*- autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_INIT(configure.ac, 0.3, http://midimon.sourceforge.net/)
AM_INIT_AUTOMAKE(midimon, 0.3)
AM_CONFIG_HEADER(src/config.h)

# compilation
with_debug="no"
AC_ARG_ENABLE([debug], 
    [AC_HELP_STRING([--enable-debug],
        [enable debugging information, accepting a performance penalty (default is NO)])],
    [if test x$enable_debug = xyes; then with_debug=yes ; fi])

if test x$with_debug = xno; then
    CFLAGS="-O3"
else
    AC_DEFINE(DEBUG, 1, [[whether to display debugging output or not]])
fi

# standard autoconf checks
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_RANLIB
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h string.h sys/time.h unistd.h])
AC_C_CONST
AC_C_INLINE
AC_HEADER_TIME
AC_FUNC_MALLOC
AC_CHECK_FUNCS([floor gettimeofday pow strchr strdup])

# pthreads
# AC_PTHREAD

MIDIMON_CFLAGS=""
AC_SUBST(MIDIMON_CFLAGS)
CFLAGS="$MIDIMON_CFLAGS $CFLAGS" 

config_error="no"

# gtk			   
PKG_CHECK_MODULES(GTK, gtk+-2.0, HAVE_GTK="yes", config_error="yes")
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)

# gthread
PKG_CHECK_MODULES(GTHREAD, gthread-2.0, HAVE_GTHREAD="yes", config_error="yes")
AC_SUBST(GTHREAD_CFLAGS)
AC_SUBST(GTHREAD_LIBS)

# gtkmm
PKG_CHECK_MODULES(GTKMM, gtkmm-2.4, HAVE_GTKMM="yes", config_error="yes")
AC_SUBST(GTKMM_CFLAGS)
AC_SUBST(GTKMM_LIBS)

# giomm
PKG_CHECK_MODULES(GIOMM, giomm-2.4, HAVE_GIOMM="yes", config_error="yes")
AC_SUBST(GIOMM_CFLAGS)
AC_SUBST(GIOMM_LIBS)

PKG_CHECK_MODULES(LIBGLADEMM, libglademm-2.4, HAVE_LIBGLADEMM="yes", config_error="yes")
AC_SUBST(LIBGLADEMM_CFLAGS)
AC_SUBST(LIBGLADEMM_LIBS)

# libxml
PKG_CHECK_MODULES(LIBXML, libxml-2.0, HAVE_LIBXML="yes", config_error="yes")
AC_SUBST(LIBXML_CFLAGS)
AC_SUBST(LIBXML_LIBS)

## # alsa
## PKG_CHECK_MODULES(ALSA, alsa, HAVE_ALSA="yes", config_error="no")
## AC_SUBST(ALSA_CFLAGS)
##AC_SUBST(ALSA_LIBS)


# disable alsa support?
AC_ARG_ENABLE([alsa], 
    [AC_HELP_STRING([--disable-alsa],
        [disable alsa support (default is NO)])], disable_alsa="yes", [])

# has alsa?
have_alsa="no"
if test x$disable_alsa != xyes; then
   PKG_CHECK_MODULES(ALSA, alsa, HAVE_ALSA="yes", config_error="yes")
   if test x$HAVE_ALSA = xyes; then
      AC_DEFINE([HAVE_ALSA], 1, [Has Alsa])
      AC_SUBST(ALSA_CFLAGS)
      AC_SUBST(ALSA_LIBS)
   else
      AC_MSG_WARN([Alsa not found])
   fi
fi

# disable lash support?
AC_ARG_ENABLE([lash], 
    [AC_HELP_STRING([--disable-lash],
        [disable lash support (default is NO)])], disable_lash="yes", [])

# LASH
have_lash="no"
if test x$disable_lash != xyes; then
   PKG_CHECK_MODULES(LASH, lash-1.0 >= 0.5.0, HAVE_LASH="yes", config_error="yes")

   if test x$HAVE_LASH = xyes; then
      AC_DEFINE([HAVE_LASH], 1, [Has lash.h])
      AC_SUBST(LASH_CFLAGS)
      AC_SUBST(LASH_LIBS)
   else
      AC_MSG_WARN([LASH not found, session support will not be built.])
   fi
fi


# disable jack support?
AC_ARG_ENABLE([jack], 
    [AC_HELP_STRING([--disable-jack],
        [disable jack support (default is NO)])], disable_jack="yes", [])

# jack
have_jack="no"
if test x$disable_jack != xyes; then
   PKG_CHECK_MODULES(JACK, jack >= 0.99.0, HAVE_JACK="yes", config_error="yes")
   if test x$HAVE_JACK = xyes ; then
      PKG_CHECK_MODULES(JACK_MIDI, jack >= 0.105.0, HAVE_JACK_MIDI="yes", config_error="yes")
      if test "x$HAVE_JACK_MIDI" = xyes; then
         AC_DEFINE([HAVE_JACK_MIDI], 1, [Define if we have jack midi support.])
         AC_SUBST(JACK_CFLAGS)
         AC_SUBST(JACK_LIBS)
      else
         AC_MSG_WARN([Jack MIDI support too old])
      fi
   fi
fi

CC="$PTHREAD_CC"

# print build summary
AC_CONFIG_COMMANDS_POST([
echo
echo    "                   BUILD SUMMARY"
echo    "                   ============="
echo    "    Compiler full flags: $CFLAGS"
echo -n "             Build type: "
if test x$with_debug = xyes; then
    echo "debugging"
else
    echo "optimized"
fi

echo -n "      LASH support:      "
if test x$HAVE_LASH = xyes; then
    echo "yes"
else
    echo "no"
fi

echo -n "      Jack midi support: "
if test "x$HAVE_JACK_MIDI" = xyes; then
    echo "yes with jack >= 0.105.0"
else
    echo "no"
fi

echo -n "      Alsa midi support: "
if test x$HAVE_ALSA = xyes; then
    echo "yes"
else
    echo "no"
fi

echo
echo
])

# are we good to go?

if test x$config_error = "xyes"; then

AC_MSG_RESULT([
*** ERROR: the following required packages are missing ***
])

if test "x$HAVE_GTK" != xyes ; then
  AC_MSG_RESULT([
*** GTK+ version 2.2.x or greater, available from :
		http://www.gtk.org/
])
fi

if test "x$HAVE_GTHREAD" != xyes ; then
  AC_MSG_RESULT([
*** GTHREAD Dev Files Not Found
		http://www.gtk.org/
])
fi

if test "x$HAVE_GTKMM" != xyes ; then
  AC_MSG_RESULT([
*** GTKMM Dev Files Not Found
		http://www.gtk.org/
])
fi

if test "x$HAVE_GIOMM" != xyes ; then
  AC_MSG_RESULT([
*** GIOMM Dev Files Not Found
		http://www.gtk.org/
])
fi

if test "x$HAVE_LIBGLADEMM" != xyes ; then
  AC_MSG_RESULT([
*** LIBGLADEMM Dev Files Not Found
		http://www.gtk.org/
])
fi

if test x$disable_alsa != xyes; then
if test "x$HAVE_ALSA" != xyes ; then
  AC_MSG_RESULT([
*** Check your distro - ALSA not found
])
fi
fi

if test x$disable_jack != xyes; then
if test "x$HAVE_JACK_MIDI" != xyes ; then
  AC_MSG_RESULT([
*** JACK 0.105.0 or greater, available from:
		http://www.jackaudio.org/
])
fi
fi

if test "x$HAVE_LIBXML" != xyes ; then
  AC_MSG_RESULT([
*** libxml2, available from:
		http://ftp.gnome.org/pub/gnome/sources/libxml2/
])
fi

if test x$disable_lash != xyes; then
	if test "x$HAVE_LASH" != xyes ; then
  	AC_MSG_RESULT([
*** LASH,  available from:
		http://savannah.nongnu.org/projects/lash
	Note: you may get this message if jack is not installed since lash
    requires jack.	

    To disable lash support, add --disable-lash to
    your configure options.])
	fi
fi

AC_MSG_RESULT([
Please ensure that all the above software is properly installed
before running configure again. To do this, use your package
manager to install the correct versions of the binary AND 
development (dev) packages or, download them from the 
above link(s) and build and install them from source manually.
])

AC_MSG_ERROR([
*************************************************
see ./config.log for full details.
])
else
AC_OUTPUT([
Makefile
src/Makefile
])
fi