dnl ===================================================================
dnl file:	configure.in
dnl contents:	autoconf template
dnl author:	stefan kersten <steve@k-hornz.de>
dnl CVS:	$Id$
dnl ===================================================================

# initialize autoconf
AC_PREREQ(2.52)
AC_INIT(BinaryOpUGens.cpp)
AC_CANONICAL_SYSTEM

# we dont't want plugins to be linked statically.
AC_DISABLE_STATIC

# initialize automake
AM_INIT_AUTOMAKE(SuperCollider,3.0)

# config.h is not currently used
AM_CONFIG_HEADER(config.h)

# variables
SC_PLUGIN_DIR='"$(pkglibdir)/plugins"'
AC_SUBST(SC_PLUGIN_DIR)

# check for programs
AC_PROG_CC
AC_PROG_CXX
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LD
AM_PROG_LIBTOOL

# additional configure flags
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],[enable debugging features]))

# X11 support is optional
AC_PATH_XTRA
if test "$with_x" = no || test "$no_x" = yes; then
    HAVE_X11=false
else
    if test -z "$X_DISPLAY_MISSING"; then
        HAVE_X11=true
        AC_CHECK_HEADERS(X11/Intrinsic.h)
        AC_CHECK_LIB(X11, XQueryPointer)
        SC_X11_CFLAGS="$X_CFLAGS"
        SC_X11_LIBS="$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS -lX11"
    else
        HAVE_X11=false
    fi
fi
AM_CONDITIONAL(HAVE_X11, $HAVE_X11)
AC_SUBST(SC_X11_CFLAGS)
AC_SUBST(SC_X11_LIBS)

# assemble compiler flags
SC_CPPFLAGS="-Wall -DSC_LINUX -D_REENTRANT"

# add default (platform dependent) flags 
case "$target_cpu" in
    powerpc*|ppc*)
	SC_CFLAGS="-fsigned-char"
	SC_CFLAGS_OPT="-maltivec"
	;;
esac

if test "x$enable_debug" = "xyes" ; then
    # add debugging flags
    AC_MSG_NOTICE([enabling debugging symbols])
    SC_CFLAGS="-O0 -g $SC_CFLAGS"
else
    SC_CPPFLAGS="$SC_CPPFLAGS -DNDEBUG"
    SC_CFLAGS="$SC_CFLAGS $SC_CFLAGS_OPT"
fi

# generate output files
AC_OUTPUT(
Makefile
)

dnl EOF ===============================================================
