jamie@1: AC_PREREQ(2.13) jamie@26: # Increment for major API changes, release status changes jamie@23: m4_define(libxtract_major_version, 0) jamie@23: # Increment for feature additions and enhancements jamie@58: m4_define(libxtract_minor_version, 4) jamie@23: # Increment for fixes jamie@87: m4_define(libxtract_fix_version, 8) jamie@23: jamie@23: m4_define(libxtract_version, libxtract_major_version.libxtract_minor_version.libxtract_fix_version) jamie@23: jamie@18: PACKAGE=libxtract jamie@18: jamie@87: AC_INIT(libxtract, libxtract_version, libxtract-devel@lists.sourceforge.net) jamie@23: AC_DEFINE(LIBXTRACT_VERSION, libxtract_version, [LibXtract Version]) jamie@23: AM_INIT_AUTOMAKE($PACKAGE, $LIBXTRACT_VERSION) jamie@1: AM_CONFIG_HEADER(config.h) jamie@1: AC_PROG_CC jamie@17: AC_PROG_LIBTOOL jamie@1: AC_PROG_INSTALL jamie@17: AC_PATH_PROG(PKG_CONFIG, pkg-config, no) jamie@1: AC_ENABLE_STATIC(no) jamie@1: AC_ENABLE_SHARED(yes) jamie@1: AC_PROG_LIBTOOL jamie@17: AC_CHECK_HEADERS([math.h, stdlib.h, stdio.h]) jamie@2: AC_CHECK_PROG([DOXYGEN], [doxygen], [doc], []) jamie@2: AC_SUBST(DOXYGEN) jamie@1: jamie@30: AC_ARG_ENABLE(fft, jamie@30: [ --enable-fft Turn fft-based fft processing on], jamie@1: [case "${enableval}" in jamie@30: yes) fft=true ;; jamie@30: no) fft=false ;; jamie@30: *) AC_MSG_ERROR(bad value ${enableval} for --enable-fft) ;; jamie@30: esac],[fft=false]) jamie@1: jamie@4: AC_ARG_ENABLE(pd_example, jamie@4: [ --enable-pd_example Compile the Pure Data external example], jamie@4: [case "${enableval}" in jamie@9: yes) pd_example=true ;; jamie@9: no) pd_example=false ;; jamie@4: *) AC_MSG_ERROR(bad value ${enableval} for --enable-pd_external) ;; jamie@9: esac],[pd_example=false]) jamie@29: jamie@29: AC_ARG_ENABLE(simpletest, jamie@29: [ --enable-simpletest Compile the 'simpletest' example], jamie@29: [case "${enableval}" in jamie@29: yes) simpletest=true ;; jamie@29: no) simpletest=false ;; jamie@29: *) AC_MSG_ERROR(bad value ${enableval} for --enable-simpletest) ;; jamie@29: esac],[simpletest=false]) jamie@4: jamie@4: # libtool version: current:revision:age jamie@4: # jamie@4: # If the library source code has changed at all since the last update, then jamie@4: # increment revision (`c:r:a' becomes `c:r+1:a'). jamie@4: # jamie@4: # If any interfaces have been added, removed, or changed since the last update, jamie@4: # increment current, and set revision to 0. jamie@4: # jamie@4: # If any interfaces have been added since the last public release, then jamie@4: # increment age. jamie@4: # jamie@4: # If any interfaces have been removed since the last public release, then set jamie@4: # age to 0. jamie@1: XTRACT_SO_VERSION=0:0:0 jamie@4: jamie@87: CFLAGS="$CFLAGS -pedantic -ansi -fno-strict-aliasing -Wall -std=c99 -I/usr/local/include" jamie@31: LDFLAGS="$LDFLAGS -lm" jamie@1: jamie@4: AC_ARG_WITH(pd_dir, jamie@4: [ --with-pd-dir=path pd header path (default=/usr/local/include) ], jamie@4: [ jamie@7: CFLAGS="$CFLAGS -I$withval" jamie@4: echo jamie@4: echo "pd dir is $withval" jamie@4: echo jamie@4: ]) jamie@4: jamie@9: AC_ARG_WITH(fftw3_dir, jamie@9: [ --with-fftw3-dir=path fftw3 header path (default=/usr/local/include) ], jamie@9: [ jamie@9: CFLAGS="$CFLAGS -I$withval" jamie@9: echo jamie@9: echo "fftw3 dir is $withval" jamie@9: echo jamie@9: ]) jamie@9: jamie@92: dnl set a specific java compiler jamie@92: AC_ARG_WITH(javac, jamie@92: [ --with-javac=compiler set a specific java compiler (determined automatically if not set) ], jamie@92: [JAVAC="$withval" jamie@92: echo jamie@92: echo "JAVAC is set to $withval" jamie@92: echo jamie@92: ]) jamie@92: jamie@88: dnl If --enable-swig, make with java bindings jamie@88: AC_ARG_WITH(java, jamie@88: [ --with-java If --enable-swig - make with java bindings (default=no) ], jamie@88: [with_java=true]) jamie@88: jamie@88: AM_CONDITIONAL(BUILD_JAVA, test "x${with_java}" = 'xtrue') jamie@88: jamie@88: dnl If --enable-swig, make with java bindings jamie@88: AC_ARG_WITH(python, jamie@88: [ --with-python If --enable-swig - make with python bindings (default=no) ], [with_python=true]) jamie@88: jamie@88: AM_CONDITIONAL(BUILD_PYTHON, test "x${with_python}" = 'xtrue') jamie@88: jamie@29: jamie@29: dnl are we building the simpletest example jamie@29: if [[ "$simpletest" = "true" ]] ; then jamie@29: AC_DEFINE([BUILD_SIMPLETEST], [1], [Build the simpletest example]) jamie@29: fi jamie@29: jamie@29: AM_CONDITIONAL(BUILD_SIMPLETEST, test "x${simpletest}" = 'xtrue') jamie@29: jamie@9: jamie@9: dnl Are we building the PD examples? jamie@9: if [[ "$pd_example" = "true" ]] ; then jamie@9: PD_SOURCES="xtract~.c" jamie@9: AC_DEFINE([BUILD_PD_EXAMPLE], [1], [Build the pd example]) jamie@9: AC_CHECK_HEADER(m_pd.h, [have_pd_hdr=yes ], [ jamie@4: have_pd_hdr=no jamie@4: echo jamie@4: echo "no m_pd.h header found. try with option --with-pd-dir=/path/to/pd/src" jamie@4: echo jamie@4: exit jamie@4: ]) jamie@9: fi jamie@4: jamie@4: AM_CONDITIONAL(BUILD_PD_EXAMPLE, test "x${pd_example}" = 'xtrue') jamie@4: jamie@87: jamie@17: dnl Enable debugging (no) jamie@17: AC_ARG_ENABLE(debug, jamie@17: [ --enable-debug[[=value]] compile with debug [[default=no]]], jamie@17: with_debug="yes", jamie@17: with_debug="no") jamie@17: if test "$with_debug" = "yes" jamie@17: then jamie@17: AC_DEFINE(DEBUG,1,[Define to enable debug]) jamie@54: CFLAGS="$CFLAGS -O0 -ggdb -g" jamie@17: fi jamie@17: jamie@87: AC_ARG_ENABLE(swig, jamie@87: [ --enable-swig Generate swig bindings], jamie@87: [case "${enableval}" in jamie@87: yes) swig=true ;; jamie@87: no) swig=false ;; jamie@87: *) AC_MSG_ERROR(bad value ${enableval} for --enable-swig) ;; jamie@87: esac],[swig=false]) jamie@87: jamie@87: jamie@87: dnl SWIG stuff jamie@87: if [[ "$swig" = "true" ]] ; then jamie@87: AC_PROG_SWIG(1.3.21) jamie@88: AC_DEFINE([BUILD_SWIG], [1], [Build the swig bindings]) jamie@88: fi jamie@88: jamie@88: if [[ "$with_java" = "true" ]] ; then jamie@92: if test "$JAVAC" = "" jamie@92: then jamie@92: AC_PROG_JAVAC jamie@92: fi jamie@90: if test "$JAVAC" = "javac" jamie@90: then jamie@90: AC_JNI_INCLUDE_DIR jamie@90: jamie@90: for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS jamie@90: do jamie@90: CFLAGS="$CFLAGS -I$JNI_INCLUDE_DIR" jamie@90: done jamie@90: fi jamie@88: dnl AC_PROG_JAVAH jamie@88: dnl AC_PATH_PROG(JAVAH,javah) jamie@88: fi jamie@88: jamie@88: if [[ "$with_python" = "true" ]] ; then jamie@87: AM_PATH_PYTHON jamie@87: SWIG_PYTHON jamie@87: fi jamie@87: jamie@88: jamie@87: AM_CONDITIONAL(BUILD_SWIG, test "x${swig}" = 'xtrue') jamie@87: jamie@90: dnl Are we building with fftw? jamie@90: if [[ "$fft" = "true" ]] ; then jamie@90: LDFLAGS="$LDFLAGS -lfftw3f" jamie@90: AC_DEFINE([BUILD_FFT], [1], [Build the fft functions]) jamie@90: AC_CHECK_HEADER(fftw3.h, [have_fftw3_hdr=yes ], [ jamie@90: have_pd_hdr=no jamie@90: echo jamie@90: echo "no fftw3.h header found. try with option --with-fftw3-dir=/path/to/fftw3/header" jamie@90: echo jamie@90: exit jamie@90: ]) jamie@90: fi jamie@90: jamie@90: AM_CONDITIONAL(BUILD_FFT, test "x${fft}" = 'xtrue') jamie@90: jamie@90: jamie@4: dnl ------------------------------------------ jamie@4: dnl ---- do some magic to gues the host opsys jamie@4: dnl ---- taken from libvorbis configure.in jamie@4: dnl ------------------------------------------ jamie@7: dnl AC_CANONICAL_HOST jamie@4: jamie@9: dnl AC_SUBST(PD_CFLAGS,"$PD_CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes -O1") jamie@7: dnl AC_SUBST(PD_LDFLAGS,"$PD_LDFLAGS -shared") jamie@7: dnl pd_ldflags="$PD_LDFLAGS -L/usr/local/lib -ldl" jamie@4: if test -z "$GCC"; then jamie@4: case $host in jamie@4: *-*-irix*) jamie@4: dnl If we're on IRIX, we wanna use cc even if gcc jamie@4: dnl is there (unless the user has overriden us)... jamie@4: if test -z "$CC"; then jamie@4: CC=cc jamie@4: fi jamie@4: ;; jamie@4: sparc-sun-solaris*) jamie@4: PD_CFLAGS="-xO4 -fast -w -fsimple -native -xcg92" jamie@4: ;; jamie@4: *) jamie@4: PD_CFLAGS="-O" jamie@4: ;; jamie@4: esac jamie@4: else jamie@4: jamie@4: case $host in jamie@4: *86-*-linux*) jamie@54: PD_CFLAGS="$PD_CFLAGS -DUNIX -Wall -Wimplicit -Wunused" jamie@17: PD_LDFLAGS="$PD_LDFLAGS -shared -export_dynamic" jamie@4: dnl we could test for bad glibc here, but don't jamie@7: PD_SUFFIX=pd_linux jamie@4: ;; jamie@4: powerpc-*-linux*) jamie@17: PD_CFLAGS="$PD_CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes" jamie@4: PD_LDFLAGS="$PD_LDFLAGS -shared" jamie@7: PD_SUFFIX=pd_linux jamie@4: ;; jamie@4: *-*-linux*) jamie@17: PD_CFLAGS="$PD_CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes -fPIC" jamie@17: PD_LDFLAGS="$PD_LDFLAGS -shared -export_dynamic" jamie@7: PD_SUFFIX=pd_linux jamie@4: ;; jamie@4: sparc-sun-*) jamie@4: echo "YOU HAVE A SPARC STATION, not setting any flags, not supported yet" jamie@4: ;; jamie@17: *86-*-darwin*) jamie@17: PD_CFLAGS="$PD_CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes" jamie@31: PD_LDFLAGS="$PD_LDFLAGS -dynamiclib -mmacosx-version-min=10.3 -undefined dynamic_lookup -single_module" jamie@7: PD_SUFFIX=pd_darwin jamie@17: ;; jamie@17: *-*-darwin*) jamie@17: PD_CFLAGS="$PD_CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes" jamie@17: PD_LDFLAGS="$PD_LDFLAGS -bundle -arch ppc -undefined suppress -flat_namespace" jamie@17: PD_SUFFIX=pd_darwin jamie@17: ;; jamie@17: jamie@4: *) jamie@4: dnl assume unix jamie@9: PD_CFLAGS="$PD_CFLAGS -DUNIX -Wall -Wimplicit -Wunused -Wmissing-prototypes -O1" jamie@4: PD_LDFLAGS="$PD_LDFLAGS -shared" jamie@7: PD_SUFFIX=pd_linux jamie@4: ;; jamie@4: esac jamie@4: fi jamie@4: jamie@9: PD_CFLAGS="$PD_CFLAGS -DPD" jamie@9: jamie@7: AC_SUBST(PD_CFLAGS) jamie@7: AC_SUBST(PD_LDFLAGS) jamie@7: AC_SUBST(PD_SUFFIX) jamie@9: AC_SUBST(PD_SOURCES) jamie@7: jamie@13: AC_CONFIG_FILES([doc/documentation.doxygen jamie@13: libxtract.pc]) jamie@2: jamie@88: dnl There must be a better way to do this... jamie@88: AC_OUTPUT(Makefile src/Makefile xtract/Makefile doc/Makefile examples/Makefile examples/puredata/Makefile examples/simpletest/Makefile swig/Makefile swig/python/Makefile swig/java/Makefile) jamie@16: jamie@16: echo jamie@16: echo "**************************************************************" jamie@27: echo jamie@16: echo "Summary:" jamie@27: echo jamie@27: dnl echo you are using the ${host} architecture jamie@16: jamie@30: if test "$fft" = "true"; then jamie@30: echo "fft: yes (using fftw3f)" jamie@16: else jamie@30: echo "fft: no (not using fftw3, no fft functions)" jamie@29: fi jamie@29: if test "$simpletest" = "true"; then jamie@29: echo "simpletest example: yes" jamie@29: else jamie@29: echo "simpletest example: no" jamie@16: fi jamie@17: if test "$pd_example" = "true"; then jamie@27: echo "PD external: yes" jamie@27: echo jamie@27: echo "The PD help files will be installed in:" jamie@27: echo ${prefix}"/lib/doc/5.reference/xtract/" jamie@27: echo "You must make sure that this is in your PD help path" jamie@16: else jamie@29: echo "PD external: no" jamie@16: fi jamie@87: if test "$swig" == "true"; then jamie@88: echo "SWIG bindings: yes" jamie@87: else jamie@88: echo "SWIG bindings: no" jamie@88: fi jamie@88: if test "$with_java" == "true"; then jamie@88: echo "with JAVA module: yes" jamie@88: else jamie@88: echo "with JAVA module: no" jamie@87: fi jamie@27: echo jamie@16: echo "**************************************************************" jamie@27: echo jamie@16: echo Configuration completed successfully. Type \'make\' to build ${PACKAGE} jamie@27: echo jamie@16: jamie@16: