AC_INIT([sbsms],[1.5.0]) dnl Use the m4/ directory to contain libtool macros that will be needed to dnl go with the ltmain.sh script (both will be created/updated via the command dnl libtoolize --copy --force AC_CONFIG_MACRO_DIR([m4]) #------------------------------------------------------------------------------------ # Library's "official" release version: LIBSBSMS_RELEASE_MAJOR=1 LIBSBSMS_RELEASE_MINOR=7 LIBSBSMS_RELEASE_BUILD=0 AC_CONFIG_SRCDIR([src/sbsms.cpp]) AC_CANONICAL_TARGET([]) AM_CONFIG_HEADER(src/config.h) AC_DISABLE_SHARED dnl allows for optimizations #------------------------------------------------------------------------------------ # The following is the libtool / shared library version. This doesn't have to # do anything with the release version. It MUST conform to the following rules: # # 1. Start with version information of `0:0:0' for each libtool library. # 2. Update the version information only immediately before a public release of # your software. More frequent updates are unnecessary, and only guarantee # that the current interface number gets larger faster. # 3. If the library source code has changed at all since the last update, then # increment revision (`c:r:a' becomes `c:r+1:a'). # 4. If any interfaces have been added, removed, or changed since the last update, # increment current, and set revision to 0. # 5. If any interfaces have been added since the last public release, then increment # age. # 6. If any interfaces have been removed since the last public release, then set age # to 0. SHARED_VERSION_INFO="8:0:7" AC_PROG_LIBTOOL AM_PROG_LIBTOOL # save $CXXFLAGS etc. since AC_PROG_CXX likes to insert "-g -O2" # if $CXXFLAGS is blank and it finds GCC cflags_save="$CFLAGS" cppflags_save="$CPPFLAGS" cxxflags_save="$CXXFLAGS" AC_LANG([C++]) AC_PROG_CXX AC_PROG_CXXCPP # restore those variables back CFLAGS="$cflags_save" CPPFLAGS="$cppflags_save" CXXFLAGS="$cxxflags_save" AC_CHECK_FUNCS(malloc calloc free memcpy) AC_CHECK_LIB([m],floor) AC_CHECK_FUNCS(floor sqrt log) AC_C99_FUNC_LRINT() AC_C99_FUNC_LRINTF() AC_SUBST(SHLIB_VERSION_ARG) AC_SUBST(SHARED_VERSION_INFO) SBSMS_EXTRA_OBJ="" SBSMS_BIN="" AC_ARG_ENABLE(universal_binary,[ --enable-universal_binary enable universal binary build: (default: disable)],[enable_universal_binary=$enableval],[enable_universal_binary=no]) AC_ARG_ENABLE(static,[ --enable-static enable static build: (default: disable)],[enable_static=$enableval],[enable_static=no]) AC_ARG_ENABLE(multithreaded,[ --enable-multithreaded enable multithreaded build: (default: disable)],[enable_multithreaded=$enableval],[enable_multithreaded=no]) AC_ARG_ENABLE(debug,[ --enable-debug enable debug build: (default: disable)],[enable_debug=$enableval],[enable_debug=no]) AC_ARG_ENABLE(sndfile,[ --enable-sndfile enable sndfile support: (default: disable)],[enable_sndfile=$enableval],[enable_sndfile=no]) AC_ARG_ENABLE(mp3,[ --enable-mp3 enable mp3 support (default: disable)],[enable_mp3=$enableval],[enable_mp3=no]) AC_ARG_ENABLE(portaudio,[ --enable-portaudio enable portaudio support: (default: disable)],[enable_portaudio=$enableval],[enable_portaudio=no]) AC_ARG_ENABLE(wx,[ --enable-wx enable wxWidgets support (default: disable)],[enable_wx=$enableval],[enable_wx=no]) AC_ARG_ENABLE(programs,[ --enable-programs Build SBSMS programs as well as library (default: enable)],[enable_progs=$enableval],[enable_progs=yes]) if test x$enable_mp3 = xyes; then enable_sndfile=yes; AC_CHECK_LIB(mad,mad_stream_init,[mad_libs="-lmad"; SBSMS_EXTRA_OBJ="mp3.lo mp3tech.lo audiobuffer.lo"; use_libmad=yes],[echo "Sorry, you need libmad for mp3 support. Install libmad or ./configure --disable-mp3"; exit -1]) if test x$use_libmad = xyes; then if test x$MAD_LIBS = x; then MAD_LIBS=$mad_libs fi AC_SUBST(MAD_LIBS) AC_DEFINE(HAVE_MAD,1,[Define to use libmad]) fi else MAD_LIBS="" fi AM_CONDITIONAL(ENABLE_MP3, test x$enable_mp3 = xyes) PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.2, ac_cv_sndfile=1, ac_cv_sndfile=0) if test x$enable_sndfile = xyes; then # check for presence of libsndfile if test "$ac_cv_sndfile" = "0"; then echo "Sorry, you need libsndfile to --enable-sndfile. Install libsndfile or --disable-sndfile" exit -1; else AC_SUBST(SNDFILE_CFLAGS) AC_SUBST(SNDFILE_LIBS) AC_DEFINE(HAVE_SNDFILE,1,[Define to use libsndfile]) fi else SNDFILE_LIBS="" fi AM_CONDITIONAL(ENABLE_SNDFILE, test x$enable_sndfile = xyes) PKG_CHECK_MODULES(PORTAUDIO, portaudio-2.0 >= 0.0.19, ac_cv_portaudio=1, ac_cv_portaudio=0) if test x$enable_portaudio = xyes; then # check for presence of libportaudio if test "$ac_cv_portaudio" = "0"; then echo "Sorry, you need libportaudio-2.0 to --enable-portaudio. Install libportaudio or --disable-portaudio" exit -1; else AC_SUBST(PORTAUDIO_CFLAGS) AC_SUBST(PORTAUDIO_LIBS) AC_DEFINE(HAVE_PORTAUDIO,1,[Define to use libportaudio]) fi else PORTAUDIO_LIBS="" fi AM_CONDITIONAL(ENABLE_PORTAUDIO, test x$enable_portaudio = xyes) # legitimately we can add -g to flags for debug builds, because they won't # be much use otherwise if test x$enable_debug = xyes; then CXXFLAGS="$CXXFLAGS -g" fi if test x$enable_static = xyes; then CXXFLAGS="$CXXFLAGS" else case "$target_os" in darwin*) CXXFLAGS="$CXXFLAGS -mdynamic-no-pic" ;; *) ;; esac fi if test x$enable_universal_binary = xyes; then case "$target_os" in darwin*) CXXFLAGS="$CXXFLAGS -mmacosx-version-min=10.4 -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk" ;; *) ;; esac else CXXFLAGS="$CXXFLAGS" fi case "$target_os" in darwin*) macosx="yes" ;; *) macosx="no" ;; esac AC_SUBST(SBSMS_BIN) if test x$enable_wx = xyes; then wxconfigargs="" if test x$enable_static = xyes; then wxconfigargs="$wxconfigargs --static=yes" else wxconfigargs="$wxconfigargs --static=no" fi if test x$enable_debug = xyes; then wxconfigargs="$wxconfigargs --debug=yes" else wxconfigargs="$wxconfigargs --debug=no" fi AC_PATH_PROG(WX_CONFIG, wx-config, no, $PATH:/usr/local/bin ) if [[ "$WX_CONFIG" = "no" ]] ; then AC_MSG_ERROR("Could not find wx-config: is wxWidgets installed? is wx-config in your path?") fi AC_MSG_NOTICE([Checking that the chosen version of wxWidgets is 2.8.x]) wx_version=`${WX_CONFIG} --version` case "${wx_version}" in 2.8.*) echo "Great, you're using wxWidgets ${wx_version}!" ;; *) wx_list=`${WX_CONFIG} --list` AC_MSG_ERROR([Unable to locate a suitable configuration of wxWidgets v2.8.x or higher. The currently available configurations are listed below. If necessary, either install the package for your distribution or download the latest version of wxWidgets from http://wxwidgets.org. ${wx_list}]) esac WX_LIBS="`$WX_CONFIG $wxconfigargs --libs`" WX_CFLAGS="`$WX_CONFIG $wxconfigargs --cxxflags`" AC_SUBST(WX_LIBS) AC_SUBST(WX_CFLAGS) fi AM_CONDITIONAL(ENABLE_WX, test x$enable_wx = xyes) AM_CONDITIONAL(MACOSX, test "$macosx" = "yes") if test x$enable_progs = xyes; then # we would like programs, so work out which ones can be built # sbsms can always be built (doesn't need optional libs) SBSMS_PROGS="sbsms" if test x$enable_portaudio = xyes; then # portaudio available, build sbsmsplay SBSMS_PROGS="$SBSMS_PROGS sbsmsplay" if test x$enable_wx = xyes; then # wx available, build wxsbsmsplayer SBSMS_PROGS="$SBSMS_PROGS wxsbsmsplayer" fi fi else # no progs please SBSMS_PROGS="" fi AC_SUBST(SBSMS_PROGS) if test x$enable_multithreaded = xyes; then AC_DEFINE(MULTITHREADED,1,[Define to compile multithreaded sbsms]) fi AM_INIT_AUTOMAKE(libsbsms, "$LIBSBSMS_RELEASE_MAJOR.$LIBSBSMS_RELEASE_MINOR.$LIBSBSMS_RELEASE_BUILD") dnl Audacity policy: don't enable automatic rebuild of configure et al if dnl sources change AM_MAINTAINER_MODE([enabled]) AC_CONFIG_FILES([Makefile src/Makefile libsbsms.spec sbsms.pc]) AC_OUTPUT