annotate configure.ac @ 2532:405ab562cc7f

Update CSV import to support the same quote-doubling escape that we now use in export
author Chris Cannam
date Mon, 11 May 2020 14:47:28 +0100
parents 7bf8a0179e32
children
rev   line source
Chris@350 1
Chris@941 2 AC_INIT([Sonic Visualiser], [], cannam@all-day-breakfast.com)
Chris@350 3
Chris@351 4 AC_CONFIG_SRCDIR(main/main.cpp)
Chris@350 5
Chris@350 6 # Autoconf will set CXXFLAGS; we don't usually want it to, because we
Chris@350 7 # either define our own flags (at least if GCC is in use) or else use
Chris@350 8 # the user's preferences. We need to ensure CXXFLAGS is only set if
Chris@350 9 # the user has expressly set it. So, save the user's (or empty)
Chris@350 10 # setting now and restore it after Autoconf has done its bit of
Chris@350 11 # piddling about.
Chris@350 12 USER_CXXFLAGS="$CXXFLAGS"
Chris@350 13
Chris@405 14 # If the user supplied CFLAGS but not CXXFLAGS, use CFLAGS instead
Chris@405 15 if test x"$USER_CXXFLAGS" = x; then
Chris@405 16 if test x"$CFLAGS" != x; then
Chris@405 17 USER_CXXFLAGS="$CFLAGS"
Chris@405 18 fi
Chris@405 19 fi
Chris@405 20
Chris@350 21 AC_LANG_CPLUSPLUS
Chris@350 22
Chris@350 23 AC_PROG_CC
Chris@350 24 AC_PROG_CXX
Chris@350 25 AC_PROG_INSTALL
Chris@350 26 AC_PROG_MKDIR_P
Chris@350 27
Chris@884 28 # We are daringly making use of C++11 now
Chris@884 29 AX_CXX_COMPILE_STDCXX_11(noext)
Chris@884 30
Chris@350 31 AC_HEADER_STDC
Chris@350 32
Chris@350 33 # These are the flags Autoconf guesses for us; we use them later if
Chris@350 34 # the user has set none and we are not using GCC (so lack our own
Chris@350 35 # preferred flags)
Chris@350 36 AUTOCONF_CXXFLAGS="$CXXFLAGS"
Chris@350 37
Chris@350 38 PKG_PROG_PKG_CONFIG
Chris@350 39
Chris@350 40 SV_CHECK_QT
Chris@350 41
Chris@350 42 SV_DEFINES_DEBUG="-DDEBUG -DBUILD_DEBUG -DWANT_TIMING"
Chris@1483 43 SV_DEFINES_RELEASE="-DNDEBUG -DBUILD_RELEASE -DNO_TIMING -DNO_HIT_COUNTS"
Chris@350 44
Chris@350 45 # Now we have: USER_CXXFLAGS contains any flags the user set
Chris@350 46 # explicitly; AUTOCONF_CXXFLAGS contains flags that Autoconf thought
Chris@350 47 # we should use. If we have GCC, we override the latter but then
Chris@350 48 # allow ourselves to be overridden (later) by the former
Chris@350 49
Chris@350 50 CXXFLAGS_DEBUG="$AUTOCONF_CXXFLAGS"
Chris@2104 51 OPTFLAGS_DEBUG="-O2"
Chris@2104 52 LDFLAGS_DEBUG=""
Chris@350 53 CXXFLAGS_RELEASE="$AUTOCONF_CXXFLAGS"
Chris@2104 54 OPTFLAGS_RELEASE="-O2"
Chris@2104 55 LDFLAGS_RELEASE=""
Chris@1976 56 CXXSTANDARD=c++14
Chris@350 57
Chris@350 58 if test "x$GCC" = "xyes"; then
Chris@1969 59 CXXFLAGS_ANY="-fpic -Wall -Wextra -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -Wconversion -pipe"
Chris@2104 60 CXXFLAGS_DEBUG="$CXXFLAGS_ANY -g -Werror"
Chris@2104 61 OPTFLAGS_DEBUG="-O2"
Chris@2104 62 CXXFLAGS_RELEASE="$CXXFLAGS_ANY -g0"
Chris@2153 63 OPTFLAGS_RELEASE="-O3 -ffast-math"
Chris@1976 64 LIBS_DEBUG="$LIBS"
Chris@1976 65 AX_CHECK_COMPILE_FLAG(--std=$CXXSTANDARD, [], [AC_MSG_NOTICE([Compiler does not appear to support $CXXSTANDARD, falling back to c++11])
Chris@1976 66 CXXSTANDARD=c++11])
Chris@350 67 fi
Chris@350 68
Chris@2104 69 CXXFLAGS_BUILD="$CXXFLAGS_RELEASE $OPTFLAGS_RELEASE"
Chris@2104 70 LDFLAGS_BUILD="$LDFLAGS_RELEASE $OPTFLAGS_RELEASE"
Chris@350 71 SV_DEFINES_BUILD="$SV_DEFINES_RELEASE"
Chris@350 72
Chris@361 73 QMAKE_CONFIG="release"
Chris@361 74
Chris@350 75 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],[enable debug support [default=no]])],[AC_MSG_NOTICE([enabling debug build])
Chris@361 76 QMAKE_CONFIG="debug"
Chris@2104 77 CXXFLAGS_BUILD="$CXXFLAGS_DEBUG $OPTFLAGS_DEBUG"
Chris@2104 78 LDFLAGS_BUILD="$LDFLAGS_DEBUG"
Chris@1754 79 SV_DEFINES_BUILD="$SV_DEFINES_DEBUG"
Chris@1754 80 LIBS="$LIBS_DEBUG"])
Chris@350 81
Chris@350 82 if test x"$USER_CXXFLAGS" != x; then
Chris@350 83 AC_MSG_NOTICE([The CXXFLAGS environment variable is set to "$USER_CXXFLAGS".])
Chris@350 84 AC_MSG_NOTICE(Overriding default compiler flags with the above user setting.)
Chris@350 85 CXXFLAGS_BUILD="$USER_CXXFLAGS"
Chris@2104 86 LDFLAGS_BUILD=""
Chris@350 87 fi
Chris@350 88
Chris@350 89 CXXFLAGS="$CXXFLAGS_BUILD $SV_DEFINES_BUILD"
Chris@2515 90
Chris@2515 91 # Set our own LDFLAGS only if the user didn't request any
Chris@2515 92 if test x"LDFLAGS" = x; then
Chris@2515 93 LDFLAGS="$LDFLAGS_BUILD"
Chris@2515 94 fi
Chris@350 95
Chris@350 96 SV_MODULE_REQUIRED([bz2],[],[bzlib.h],[bz2],[BZ2_bzReadOpen])
Chris@350 97 SV_MODULE_REQUIRED([fftw3],[fftw3 >= 3.0.0],[fftw3.h],[fftw3],[fftw_execute])
Chris@350 98 SV_MODULE_REQUIRED([fftw3f],[fftw3f >= 3.0.0],[fftw3.h],[fftw3f],[fftwf_execute])
Chris@350 99 SV_MODULE_REQUIRED([sndfile],[sndfile >= 1.0.16],[sndfile.h],[sndfile],[sf_open])
Chris@1035 100 SV_MODULE_REQUIRED([libsamplerate],[samplerate >= 0.1.2],[samplerate.h],[samplerate],[src_new])
Chris@2207 101 SV_MODULE_REQUIRED([rubberband],[rubberband],[rubberband/RubberBandStretcher.h],[rubberband],[rubberband_new])
Chris@572 102 SV_MODULE_REQUIRED([sord],[sord-0 >= 0.5],[sord/sord.h],[sord-0],[sord_world_new])
Chris@572 103 SV_MODULE_REQUIRED([serd],[serd-0 >= 0.5],[serd/serd.h],[serd-0],[serd_reader_read_file])
Chris@1534 104
Chris@1695 105 # We need a Cap'n Proto version with the expectedSizeInWordsFromPrefix
Chris@1695 106 # function, which appeared in v0.6. If we can't find at least that
Chris@1695 107 # version with pkg-config, we check for the symbol with the compiler.
Chris@1695 108 PKG_CHECK_MODULES([capnp],[capnp >= 0.6],[HAVES="$HAVES HAVE_CAPNP";CXXFLAGS="$CXXFLAGS $capnp_CFLAGS";LIBS="$LIBS $capnp_LIBS"],[AC_MSG_NOTICE([Failed to find required module capnp using pkg-config, trying again by old-fashioned means])])
Chris@1614 109 if test -z "$capnp_LIBS" ; then
Chris@1614 110 AC_COMPILE_IFELSE([
Chris@1614 111 AC_LANG_SOURCE([[
Chris@1614 112 #include <capnp/serialize.h>
Chris@1614 113 int main() {
Chris@1614 114 kj::Array<capnp::word> prefix;
Chris@1614 115 return capnp::expectedSizeInWordsFromPrefix(prefix.asPtr());
Chris@1614 116 }]])],
Chris@1614 117 [HAVES="$HAVES HAVE_CAPNP";LIBS="$LIBS -lcapnp -lkj"],
Chris@1614 118 [AC_MSG_ERROR([Failed to find appropriate capnp library])]
Chris@1614 119 )
Chris@1614 120 fi
Chris@350 121
Chris@350 122 SV_MODULE_OPTIONAL([liblo],[],[lo/lo.h],[lo],[lo_address_new])
Chris@1035 123 SV_MODULE_OPTIONAL([portaudio],[portaudio-2.0 >= 19],[portaudio.h],[portaudio],[Pa_IsFormatSupported])
Chris@350 124 SV_MODULE_OPTIONAL([JACK],[jack >= 0.100],[jack/jack.h],[jack],[jack_client_open])
Chris@350 125 SV_MODULE_OPTIONAL([libpulse],[libpulse >= 0.9],[pulse/pulseaudio.h],[pulse],[pa_stream_new])
Chris@2270 126
Chris@2270 127 SV_MODULE_REQUIRED([lrdf],[lrdf >= 0.2],[lrdf.h],[lrdf],[lrdf_init])
Chris@2270 128 SV_MODULE_REQUIRED([oggz],[oggz >= 1.0.0],[oggz/oggz.h],[oggz],[oggz_run])
Chris@2270 129 SV_MODULE_REQUIRED([fishsound],[fishsound >= 1.0.0],[fishsound/fishsound.h],[fishsound],[fish_sound_new])
Chris@2270 130 SV_MODULE_REQUIRED([mad],[mad >= 0.15.0],[mad.h],[mad],[mad_decoder_init])
Chris@2270 131 SV_MODULE_REQUIRED([id3tag],[id3tag >= 0.15.0],[id3tag.h],[id3tag],[id3_tag_new])
Chris@2270 132 SV_MODULE_REQUIRED([opus],[opusfile],[opus/opusfile.h],[opusfile],[op_read_float])
Chris@350 133
Chris@488 134 # Link in -lX11 if it exists -- this is for the X error handler
Chris@488 135 SV_MODULE_OPTIONAL([X11],[x11 >= 1.0.0],[X11/X.h],[x11],[XGetErrorText])
Chris@488 136
Chris@350 137 AC_SUBST(PERL)
Chris@350 138 AC_SUBST(XARGS)
Chris@350 139 AC_SUBST(MAKEDEPEND)
Chris@350 140 AC_SUBST(SHA1SUM)
Chris@350 141 AC_SUBST(CUT)
Chris@350 142
Chris@350 143 AC_SUBST(CFLAGS)
Chris@350 144 AC_SUBST(CXXFLAGS)
Chris@1976 145 AC_SUBST(CXXSTANDARD)
Chris@560 146 AC_SUBST(LDFLAGS)
Chris@350 147 AC_SUBST(HAVES)
Chris@350 148 AC_SUBST(LIBS)
Chris@350 149
Chris@350 150 AC_SUBST(CC)
Chris@350 151 AC_SUBST(CXX)
Chris@350 152
Chris@1753 153 AC_SUBST(prefix)
Chris@1753 154
Chris@361 155 AC_SUBST(QMAKE_CONFIG)
Chris@361 156
Chris@941 157 AC_CONFIG_FILES([config.pri])
Chris@350 158
Chris@517 159 AC_OUTPUT
Chris@350 160
Chris@1808 161 if test -x repoint ; then
Chris@1709 162 if test -d .hg -o -d .git ; then
Chris@1808 163 if ! ./repoint install; then
Chris@1808 164 AC_MSG_ERROR([Repoint failed; please fix any reported errors and try again])
Chris@1709 165 fi
Chris@1709 166 else
Chris@1808 167 AC_MSG_NOTICE([Repoint executable found but not in an Hg or Git working-copy: not running it])
Chris@1709 168 if ! test -d vamp-plugin-sdk ; then
Chris@1709 169 AC_MSG_WARN([No vamp-plugin-sdk directory present, so external libraries might not have been updated])
Chris@1709 170 fi
Chris@1709 171 fi
Chris@1709 172 else
Chris@2363 173 AC_MSG_NOTICE([No Repoint executable found: assuming external components are already here])
Chris@1709 174 if ! test -d vamp-plugin-sdk ; then
Chris@2363 175 AC_MSG_WARN([No vamp-plugin-sdk directory present, so external components might not have been updated])
Chris@1707 176 fi
Chris@1706 177 fi
Chris@1709 178
Chris@521 179 if ! $QMAKE -r sonic-visualiser.pro; then
Chris@350 180 AC_MSG_ERROR([qmake failed: Command was "$QMAKE -r"])
Chris@350 181 fi
Chris@350 182
Chris@350 183 AC_MSG_NOTICE([
Chris@350 184
Chris@350 185 Configuration complete.
Chris@350 186 Please check the above messages for any warnings that you
Chris@350 187 might care about, and then run "make".
Chris@350 188
Chris@350 189 The file config.pri contains the configuration settings for
Chris@350 190 qmake. If you want to adjust these by hand, edit config.pri
Chris@548 191 and run "$QMAKE -r" again to regenerate the Makefile.
Chris@350 192 ])