Chris@42
|
1
|
Chris@214
|
2 AC_INIT([Sonic Annotator], [], cannam@all-day-breakfast.com)
|
Chris@42
|
3
|
Chris@42
|
4 AC_CONFIG_SRCDIR(runner/main.cpp)
|
Chris@42
|
5
|
Chris@42
|
6 # Autoconf will set CXXFLAGS; we don't usually want it to, because we
|
Chris@42
|
7 # either define our own flags (at least if GCC is in use) or else use
|
Chris@42
|
8 # the user's preferences. We need to ensure CXXFLAGS is only set if
|
Chris@42
|
9 # the user has expressly set it. So, save the user's (or empty)
|
Chris@42
|
10 # setting now and restore it after Autoconf has done its bit of
|
Chris@42
|
11 # piddling about.
|
Chris@42
|
12 USER_CXXFLAGS="$CXXFLAGS"
|
Chris@42
|
13
|
Chris@48
|
14 # If the user supplied CFLAGS but not CXXFLAGS, use CFLAGS instead
|
Chris@48
|
15 if test x"$USER_CXXFLAGS" = x; then
|
Chris@48
|
16 if test x"$CFLAGS" != x; then
|
Chris@48
|
17 USER_CXXFLAGS="$CFLAGS"
|
Chris@48
|
18 fi
|
Chris@48
|
19 fi
|
Chris@48
|
20
|
Chris@42
|
21 AC_LANG_CPLUSPLUS
|
Chris@42
|
22
|
Chris@42
|
23 AC_PROG_CC
|
Chris@42
|
24 AC_PROG_CXX
|
Chris@42
|
25 AC_PROG_INSTALL
|
Chris@42
|
26 AC_PROG_MKDIR_P
|
Chris@42
|
27
|
Chris@222
|
28 # We are daringly making use of C++11 now
|
Chris@222
|
29 AX_CXX_COMPILE_STDCXX_11(noext)
|
Chris@222
|
30
|
Chris@42
|
31 AC_HEADER_STDC
|
Chris@42
|
32
|
Chris@42
|
33 # These are the flags Autoconf guesses for us; we use them later if
|
Chris@42
|
34 # the user has set none and we are not using GCC (so lack our own
|
Chris@42
|
35 # preferred flags)
|
Chris@42
|
36 AUTOCONF_CXXFLAGS="$CXXFLAGS"
|
Chris@42
|
37
|
Chris@42
|
38 PKG_PROG_PKG_CONFIG
|
Chris@42
|
39
|
Chris@42
|
40 SV_CHECK_QT
|
Chris@42
|
41
|
Chris@42
|
42 SV_DEFINES_DEBUG="-DDEBUG -DBUILD_DEBUG -DWANT_TIMING"
|
Chris@334
|
43 SV_DEFINES_RELEASE="-DNDEBUG -DBUILD_RELEASE -DNO_TIMING -DNO_HIT_COUNTS"
|
Chris@42
|
44
|
Chris@42
|
45 # Now we have: USER_CXXFLAGS contains any flags the user set
|
Chris@42
|
46 # explicitly; AUTOCONF_CXXFLAGS contains flags that Autoconf thought
|
Chris@42
|
47 # we should use. If we have GCC, we override the latter but then
|
Chris@42
|
48 # allow ourselves to be overridden (later) by the former
|
Chris@42
|
49
|
Chris@42
|
50 CXXFLAGS_DEBUG="$AUTOCONF_CXXFLAGS"
|
Chris@334
|
51 OPTFLAGS_DEBUG="-O2"
|
Chris@334
|
52 LDFLAGS_DEBUG=""
|
Chris@42
|
53 CXXFLAGS_RELEASE="$AUTOCONF_CXXFLAGS"
|
Chris@334
|
54 OPTFLAGS_RELEASE="-O2"
|
Chris@334
|
55 LDFLAGS_RELEASE=""
|
Chris@334
|
56 CXXSTANDARD=c++14
|
Chris@42
|
57
|
Chris@42
|
58 if test "x$GCC" = "xyes"; then
|
Chris@334
|
59 CXXFLAGS_ANY="-fpic -Wall -Wextra -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -Wconversion -pipe"
|
Chris@303
|
60 CXXFLAGS_DEBUG="$CXXFLAGS_ANY -g -Werror"
|
Chris@334
|
61 OPTFLAGS_DEBUG="-O2"
|
Chris@334
|
62 CXXFLAGS_RELEASE="$CXXFLAGS_ANY -g0"
|
Chris@334
|
63 OPTFLAGS_RELEASE="-O3 -ffast-math"
|
Chris@334
|
64 LIBS_DEBUG="$LIBS"
|
Chris@334
|
65 AX_CHECK_COMPILE_FLAG(--std=$CXXSTANDARD, [], [AC_MSG_NOTICE([Compiler does not appear to support $CXXSTANDARD, falling back to c++11])
|
Chris@334
|
66 CXXSTANDARD=c++11])
|
Chris@42
|
67 fi
|
Chris@42
|
68
|
Chris@334
|
69 CXXFLAGS_BUILD="$CXXFLAGS_RELEASE $OPTFLAGS_RELEASE"
|
Chris@334
|
70 LDFLAGS_BUILD="$LDFLAGS_RELEASE $OPTFLAGS_RELEASE"
|
Chris@42
|
71 SV_DEFINES_BUILD="$SV_DEFINES_RELEASE"
|
Chris@42
|
72
|
Chris@42
|
73 QMAKE_CONFIG="release"
|
Chris@42
|
74
|
Chris@42
|
75 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],[enable debug support [default=no]])],[AC_MSG_NOTICE([enabling debug build])
|
Chris@42
|
76 QMAKE_CONFIG="debug"
|
Chris@334
|
77 CXXFLAGS_BUILD="$CXXFLAGS_DEBUG $OPTFLAGS_DEBUG"
|
Chris@334
|
78 LDFLAGS_BUILD="$LDFLAGS_DEBUG"
|
Chris@334
|
79 SV_DEFINES_BUILD="$SV_DEFINES_DEBUG"
|
Chris@334
|
80 LIBS="$LIBS_DEBUG"])
|
Chris@42
|
81
|
Chris@42
|
82 if test x"$USER_CXXFLAGS" != x; then
|
Chris@42
|
83 AC_MSG_NOTICE([The CXXFLAGS environment variable is set to "$USER_CXXFLAGS".])
|
Chris@42
|
84 AC_MSG_NOTICE(Overriding default compiler flags with the above user setting.)
|
Chris@42
|
85 CXXFLAGS_BUILD="$USER_CXXFLAGS"
|
Chris@334
|
86 LDFLAGS_BUILD=""
|
Chris@42
|
87 fi
|
Chris@42
|
88
|
Chris@42
|
89 CXXFLAGS="$CXXFLAGS_BUILD $SV_DEFINES_BUILD"
|
Chris@334
|
90 LDFLAGS="$LDFLAGS_BUILD"
|
Chris@42
|
91
|
Chris@42
|
92 SV_MODULE_REQUIRED([bz2],[],[bzlib.h],[bz2],[BZ2_bzReadOpen])
|
Chris@42
|
93 SV_MODULE_REQUIRED([fftw3],[fftw3 >= 3.0.0],[fftw3.h],[fftw3],[fftw_execute])
|
Chris@42
|
94 SV_MODULE_REQUIRED([fftw3f],[fftw3f >= 3.0.0],[fftw3.h],[fftw3f],[fftwf_execute])
|
Chris@42
|
95 SV_MODULE_REQUIRED([sndfile],[sndfile >= 1.0.16],[sndfile.h],[sndfile],[sf_open])
|
Chris@42
|
96 SV_MODULE_REQUIRED([samplerate],[samplerate >= 0.1.2],[samplerate.h],[samplerate],[src_new])
|
Chris@82
|
97 SV_MODULE_REQUIRED([sord],[sord-0 >= 0.5],[sord/sord.h],[sord-0],[sord_world_new])
|
Chris@82
|
98 SV_MODULE_REQUIRED([serd],[serd-0 >= 0.5],[serd/serd.h],[serd-0],[serd_reader_read_file])
|
Chris@42
|
99
|
Chris@90
|
100 SV_MODULE_OPTIONAL([liblo],[],[lo/lo.h],[lo],[lo_address_new])
|
Chris@42
|
101 SV_MODULE_OPTIONAL([lrdf],[lrdf >= 0.2],[lrdf.h],[lrdf],[lrdf_init])
|
Chris@42
|
102 SV_MODULE_OPTIONAL([oggz],[oggz >= 1.0.0],[oggz/oggz.h],[oggz],[oggz_run])
|
Chris@42
|
103 SV_MODULE_OPTIONAL([fishsound],[fishsound >= 1.0.0],[fishsound/fishsound.h],[fishsound],[fish_sound_new])
|
Chris@42
|
104 SV_MODULE_OPTIONAL([mad],[mad >= 0.15.0],[mad.h],[mad],[mad_decoder_init])
|
Chris@42
|
105 SV_MODULE_OPTIONAL([id3tag],[id3tag >= 0.15.0],[id3tag.h],[id3tag],[id3_tag_new])
|
Chris@334
|
106 SV_MODULE_OPTIONAL([opus],[opusfile],[opus/opusfile.h],[opusfile],[op_read_float])
|
Chris@42
|
107
|
Chris@42
|
108 AC_SUBST(PERL)
|
Chris@42
|
109 AC_SUBST(XARGS)
|
Chris@42
|
110 AC_SUBST(MAKEDEPEND)
|
Chris@42
|
111 AC_SUBST(SHA1SUM)
|
Chris@42
|
112 AC_SUBST(CUT)
|
Chris@42
|
113
|
Chris@42
|
114 AC_SUBST(CFLAGS)
|
Chris@42
|
115 AC_SUBST(CXXFLAGS)
|
Chris@334
|
116 AC_SUBST(CXXSTANDARD)
|
Chris@77
|
117 AC_SUBST(LDFLAGS)
|
Chris@42
|
118 AC_SUBST(HAVES)
|
Chris@42
|
119 AC_SUBST(LIBS)
|
Chris@42
|
120
|
Chris@42
|
121 AC_SUBST(CC)
|
Chris@42
|
122 AC_SUBST(CXX)
|
Chris@42
|
123
|
Chris@334
|
124 AC_SUBST(prefix)
|
Chris@334
|
125
|
Chris@42
|
126 AC_SUBST(QMAKE_CONFIG)
|
Chris@42
|
127
|
Chris@214
|
128 AC_CONFIG_FILES([config.pri])
|
Chris@42
|
129
|
Chris@67
|
130 AC_OUTPUT
|
Chris@42
|
131
|
Chris@318
|
132 if test -x repoint ; then
|
Chris@303
|
133 if test -d .hg -o -d .git ; then
|
Chris@318
|
134 if ! ./repoint install; then
|
Chris@318
|
135 AC_MSG_ERROR([Repoint failed; please fix any reported errors and try again])
|
Chris@303
|
136 fi
|
Chris@303
|
137 else
|
Chris@318
|
138 AC_MSG_NOTICE([Repoint executable found but not in an Hg or Git working-copy: not running it])
|
Chris@303
|
139 if ! test -d vamp-plugin-sdk ; then
|
Chris@303
|
140 AC_MSG_WARN([No vamp-plugin-sdk directory present, so external libraries might not have been updated])
|
Chris@303
|
141 fi
|
Chris@303
|
142 fi
|
Chris@303
|
143 else
|
Chris@318
|
144 AC_MSG_NOTICE([No Repoint executable found: assuming external libraries are already here])
|
Chris@303
|
145 if ! test -d vamp-plugin-sdk ; then
|
Chris@303
|
146 AC_MSG_WARN([No vamp-plugin-sdk directory present, so external libraries might not have been updated])
|
Chris@303
|
147 fi
|
Chris@303
|
148 fi
|
Chris@303
|
149
|
Chris@74
|
150 if ! $QMAKE -r sonic-annotator.pro; then
|
Chris@42
|
151 AC_MSG_ERROR([qmake failed: Command was "$QMAKE -r"])
|
Chris@42
|
152 fi
|
Chris@42
|
153
|
Chris@42
|
154 AC_MSG_NOTICE([
|
Chris@42
|
155
|
Chris@42
|
156 Configuration complete.
|
Chris@42
|
157 Please check the above messages for any warnings that you
|
Chris@42
|
158 might care about, and then run "make".
|
Chris@42
|
159
|
Chris@42
|
160 The file config.pri contains the configuration settings for
|
Chris@42
|
161 qmake. If you want to adjust these by hand, edit config.pri
|
Chris@303
|
162 and run "$QMAKE -r" again to regenerate the Makefile.
|
Chris@42
|
163 ])
|