configure.ac 3.1 KB
Newer Older
ale's avatar
ale committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#
# IMMS: Intelligent Multimedia Management System
# Copyright (C) 2001-2009 Michael Grigoriev
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
#
define([svnversion], [1.0])
AC_INIT([imms-analyzer],[svnversion],[mag@luminal.org])

AM_INIT_AUTOMAKE([foreign])

ale's avatar
ale committed
24
LT_INIT([disable-static])
25

ale's avatar
ale committed
26 27
AC_CONFIG_SRCDIR([immscore/immsutil.h])

28
dnl AC_PREFIX_DEFAULT("/usr")
ale's avatar
ale committed
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80

AC_ARG_ENABLE(debug,
            AC_HELP_STRING([--enable-debug],
                           [Extra debug output]),
            [enable_debug=$enableval])

AC_ARG_ENABLE(analyzer,
            AC_HELP_STRING([--disable-analyzer],
                           [Disable acoustic song similarity analyzer]),
            [enable_analyzer=$enableval])

AC_PROG_CXX
AC_PROG_CC
AC_PROG_RANLIB
AC_PROG_INSTALL

AC_LANG(C++)

AC_MSG_CHECKING([for --enable-debug])

XCPPFLAGS="-ggdb -O0 -DDEBUG"
if test "$enable_debug" != "yes"; then
    XCPPFLAGS="-O3"
    AC_MSG_RESULT([no])
else
    AC_MSG_RESULT([yes])
fi

AC_MSG_CHECKING([for usability of initstate_r])

AC_TRY_COMPILE([#include <stdlib.h>],[
  static struct random_data rand_data;
  static char rand_state[256];
  initstate_r(0, rand_state, sizeof(rand_state), &rand_data);
  exit(0);
], initstate_r_works=yes,)

if test "$initstate_r_works" != "yes"; then
    AC_MSG_RESULT([no])
else
    AC_MSG_RESULT([yes])
    AC_DEFINE(INITSTATE_USABLE,, [initstate_r is usable])
fi

PKG_CHECK_MODULES([pcre], [libpcre], [], [with_pcre=no])
if test "$with_pcre" = "no"; then
    AC_MSG_ERROR([PCRE required and missing.])
else
    LIBS="$LIBS $pcre_LIBS"
    CPPFLAGS="$CPPFLAGS $pcre_CFLAGS"
fi

81 82 83 84
PKG_CHECK_MODULES([FFTW], [fftw3 >= 3.0],
                  [], [have_fftw=no])
if test "$have_fftw" = "no"; then
    AC_MSG_WARN("fftw3 >= 3.0 required for analyzer and missing");
ale's avatar
ale committed
85
fi
86 87
LIBS="$LIBS $FFTW_LIBS"
CFLAGS="$CFLAGS $FFTW_CFLAGS"
ale's avatar
ale committed
88 89 90 91

saved_cppflags="$CPPFLAGS"
saved_libs="$LIBS"

92 93 94 95 96 97
CPPFLAGS="`pkg-config fftw3 --cflags`"
LIBS="`pkg-config fftw3 --libs`"
AC_CHECK_HEADERS(fftw3.h,, [with_fftw=no])
AC_CHECK_LIB(fftw3, fftw_plan_dft_r2c_1d,, [with_fftw=no])
if test "$with_fftw" = "no"; then
   AC_MSG_ERROR([fftw >= 3.0 required and missing.])
ale's avatar
ale committed
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
fi

LIBS=$saved_libs
CPPFLAGS=$saved_cppflags

AC_DEFINE(ANALYZER_ENABLED,, [Analyzer enabled])

AC_SUBST(CXX)
AC_SUBST(CC)
AC_SUBST(INSTALL)
AC_SUBST(XCPPFLAGS)
AC_SUBST(TAGCPPFLAGS)
AC_SUBST(LIBS)
AC_SUBST(PLUGINS)
AC_SUBST(OPTIONAL)

AC_CONFIG_HEADERS(immsconf.h)
AC_OUTPUT(
Makefile
117 118
ext/Makefile
ext/torch3/Makefile
ale's avatar
ale committed
119 120 121 122 123
immscore/Makefile
analyzer/Makefile
model/Makefile
)