/[svn]/qsampler/trunk/configure.ac
ViewVC logotype

Contents of /qsampler/trunk/configure.ac

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2988 - (show annotations) (download)
Sat Sep 24 11:55:52 2016 UTC (7 years, 6 months ago) by capela
File size: 15985 byte(s)
- Make configure script use PKG_CONFIG macros
  for LSCP and GIG library settings.
1 # Process this file with autoconf to produce a configure script.
2 AC_INIT(Qsampler, 0.4.1.2, rncbc@rncbc.org, qsampler)
3
4 AC_CONFIG_SRCDIR(src/qsampler.cpp)
5 AC_CONFIG_HEADERS(src/config.h)
6 AC_CONFIG_FILES(Makefile qsampler.spec src/src.pri src/qsampler.desktop)
7
8 # Sanitize version string.
9 ac_version=$(echo $PACKAGE_VERSION | sed -r 's/^([0-9|\.]+).*$/\1/')
10 AC_SUBST(ac_version)
11
12 # Set default installation prefix.
13 AC_PREFIX_DEFAULT(/usr/local)
14 if test "x$prefix" = "xNONE"; then
15 prefix=$ac_default_prefix
16 fi
17 if test "x$exec_prefix" = "xNONE"; then
18 exec_prefix=$prefix
19 fi
20 eval ac_prefix=$prefix
21 AC_SUBST(ac_prefix)
22 AC_DEFINE_UNQUOTED(CONFIG_PREFIX, ["$ac_prefix"], [Default installation prefix.])
23
24 # Set default installation directories.
25 eval ac_bindir=$bindir
26 AC_SUBST(ac_bindir)
27 AC_DEFINE_UNQUOTED(CONFIG_BINDIR, ["$ac_bindir"], [Default executable binary path.])
28
29 eval ac_libdir=$libdir
30 AC_SUBST(ac_libdir)
31 AC_DEFINE_UNQUOTED(CONFIG_LIBDIR, ["$ac_libdir"], [Default object library path.])
32
33 eval datarootdir=$datarootdir
34 eval ac_datadir=$datadir
35 AC_SUBST(ac_datadir)
36 AC_DEFINE_UNQUOTED(CONFIG_DATADIR, ["$ac_datadir"], [Default arch-idependent data path.])
37
38 eval ac_mandir=$mandir
39 AC_SUBST(ac_mandir)
40 AC_DEFINE_UNQUOTED(CONFIG_MANDIR, ["$ac_mandir"], [Default man page path.])
41
42
43 # Enable debugging argument option.
44 AC_ARG_ENABLE(debug,
45 AC_HELP_STRING([--enable-debug], [enable debugging (default=no)]),
46 [ac_debug="$enableval"])
47
48 if test "x$ac_debug" = "xyes"; then
49 AC_DEFINE(CONFIG_DEBUG, 1, [Define if debugging is enabled.])
50 ac_stacktrace="yes"
51 ac_debug="debug"
52 else
53 ac_stacktrace="no"
54 ac_debug="release"
55 fi
56 AC_SUBST(ac_debug)
57
58
59 # Enable Qt4/5 availability.
60 AC_ARG_ENABLE(qt4,
61 AC_HELP_STRING([--enable-qt4], [enable Qt4 build (default=no)]),
62 [ac_qt4="$enableval"],
63 [ac_qt4="no"])
64
65
66 # Enable libgig availability.
67 AC_ARG_ENABLE(libgig,
68 AC_HELP_STRING([--enable-libgig], [enable libgig interface (default=yes)]),
69 [ac_libgig="$enableval"],
70 [ac_libgig="yes"])
71
72 # Enable X11 unique/single instance.
73 AC_ARG_ENABLE(xunique,
74 AC_HELP_STRING([--enable-xunique], [enable X11 unique/single instance (default=yes)]),
75 [ac_xunique="$enableval"],
76 [ac_xunique="yes"])
77
78 # Enable debugger stack-trace option (assumes --enable-debug).
79 AC_ARG_ENABLE(stacktrace,
80 AC_HELP_STRING([--enable-stacktrace], [enable debugger stack-trace (default=no)]),
81 [ac_stacktrace="$enableval"])
82
83
84 # Standard installation base dirs.
85 ac_with_paths=""
86
87 # Set for alternate Qt4/5 installation dir.
88 AC_ARG_WITH(qt4,
89 AC_HELP_STRING([--with-qt4=PATH], [use alternate Qt4 install path]),
90 [ac_qt4_path="$withval"], [ac_qt4_path="no"])
91
92 AC_ARG_WITH(qt5,
93 AC_HELP_STRING([--with-qt5=PATH], [use alternate Qt5 install path]),
94 [ac_qt5_path="$withval"], [ac_qt5_path="no"])
95
96 if test "x$ac_qt4_path" != "xno"; then
97 ac_with_paths="$ac_with_paths $ac_qt4_path"
98 ac_qt4="yes"
99 fi
100
101 if test "x$ac_qt5_path" != "xno"; then
102 ac_with_paths="$ac_with_paths $ac_qt5_path"
103 ac_qt4="no"
104 fi
105
106 # Set for alternate liblscp installation dir.
107 AC_ARG_WITH(liblscp,
108 AC_HELP_STRING([--with-liblscp=PATH], [use alternate liblscp install path]),
109 [ac_with_paths="$ac_with_paths $withval"])
110
111 # Set for alternate libgig installation dir.
112 AC_ARG_WITH(libgig,
113 AC_HELP_STRING([--with-libgig=PATH], [use alternate libgig install path]),
114 [ac_with_paths="$ac_with_paths $withval"])
115
116
117 # Honor user specified flags.
118 ac_cflags=$CFLAGS
119 ac_ldflags=$LDFLAGS
120
121
122 # Checks for programs.
123 AC_PROG_CPP
124 AC_PROG_CXX
125 AC_PROG_CXXCPP
126
127 # Checks for languages.
128 AC_LANG_CPLUSPLUS
129
130 # Check for pkg-config.
131 PKG_PROG_PKG_CONFIG
132
133 # Check for proper flags.
134 ac_arch=`uname -m`
135
136 # Check for install paths and alternatives...
137 ac_libdirs="lib"
138
139 if test "x$ac_arch" = "xx86_64"; then
140 ac_libdirs="$ac_libdirs lib64"
141 fi
142
143 CFLAGS="-fPIC $CFLAGS"
144 CPPFLAGS="-fPIC $CPPFLAGS"
145
146 # Prepend alternate dependencies paths.
147 ac_path=$PATH
148
149 for X in $ac_with_paths; do
150 if test -d $X/bin; then
151 ac_path="$X/bin:$ac_path"
152 fi
153 if test -d $X/include; then
154 CFLAGS="-I$X/include $CFLAGS "
155 CPPFLAGS="-I$X/include $CPPFLAGS"
156 ac_incpath="$X/include $ac_incpath"
157 fi
158 for Y in $ac_libdirs; do
159 if test -d $X/$Y; then
160 LIBS="-L$X/$Y $LIBS"
161 ac_libs="-L$X/$Y $ac_libs"
162 fi
163 done
164 done
165
166 # A common error message:
167 ac_errmsg="not found in current PATH. Maybe QT development environment isn't available."
168
169 if test "x$ac_qt4" = "xyes"; then
170 AC_PATH_PROG(ac_qmake, qmake-qt4, [no], $ac_path)
171 else
172 AC_PATH_PROG(ac_qmake, qmake-qt5, [no], $ac_path)
173 fi
174 if test "x$ac_qmake" = "xno"; then
175 AC_PATH_PROG(ac_cv_qmake, qmake, [no], $ac_path)
176 ac_qmake=$ac_cv_qmake
177 fi
178 if test "x$ac_qmake" = "xno"; then
179 AC_MSG_ERROR([qmake $ac_errmsg])
180 fi
181
182 # Check for proper Qt4/5 major version.
183 ac_qt_version_major=`$ac_qmake -query QT_VERSION | cut -d. -f1`
184 if test "x$ac_qt4" = "xyes"; then
185 if test "x$ac_qt_version_major" != "x4"; then
186 AC_MSG_ERROR([qmake-qt4 $ac_errmsg (qt4-devel)])
187 fi
188 else
189 if test "x$ac_qt_version_major" != "x5"; then
190 AC_MSG_ERROR([qmake-qt5 $ac_errmsg (qt5-devel)])
191 fi
192 fi
193
194 ac_qt_install_bins=`$ac_qmake -query QT_INSTALL_BINS`
195 if test -d $ac_qt_install_bins; then
196 ac_path="$ac_qt_install_bins:$ac_path"
197 fi
198
199 # Check it again, now with updated PATH, just in case...
200 AC_PATH_PROG(ac_cv_qmake, qmake, [no], $ac_path)
201 ac_qmake=$ac_cv_qmake
202 if test "x$ac_qmake" = "xno"; then
203 AC_MSG_ERROR([qmake $ac_errmsg])
204 fi
205
206 AC_SUBST(ac_qmake)
207
208 ac_qt_install_headers=`$ac_qmake -query QT_INSTALL_HEADERS`
209 if test -d $ac_qt_install_headers; then
210 CFLAGS="-I$ac_qt_install_headers $CFLAGS "
211 CPPFLAGS="-I$ac_qt_install_headers $CPPFLAGS"
212 ac_incpath="$ac_qt_install_headers $ac_incpath"
213 fi
214
215 ac_qt_install_libs=`$ac_qmake -query QT_INSTALL_LIBS`
216 if test -d $ac_qt_install_libs; then
217 LIBS="-L$ac_qt_install_libs $LIBS"
218 ac_libs="-L$ac_qt_install_libs $ac_libs"
219 fi
220
221 # Check for proper Qt4/5 version.
222 if test "x$ac_qt4" = "xyes"; then
223 AC_CACHE_CHECK([for Qt library version >= 4.4],
224 ac_cv_qtversion, [
225 AC_TRY_COMPILE([#include "QtCore/qglobal.h"], [
226 #if QT_VERSION < 0x040400 || QT_VERSION >= 0x050000
227 #error Qt library 4.4 or greater required.
228 #endif
229 ], ac_cv_qtversion="yes", [
230 echo "no; Qt 4.4 or greater is required"
231 exit 1
232 ])
233 ])
234 else
235 AC_CACHE_CHECK([for Qt library version >= 5.1],
236 ac_cv_qtversion, [
237 AC_TRY_COMPILE([#include "QtCore/qglobal.h"], [
238 #if QT_VERSION < 0x050100 || QT_VERSION >= 0x060000
239 #error Qt library 5.1 or greater required.
240 #endif
241 ], ac_cv_qtversion="yes", [
242 echo "no; Qt 5.1 or greater is required"
243 exit 1
244 ])
245 ])
246 fi
247
248 # Check for Qt moc utility.
249 AC_PATH_PROG(ac_moc, moc, [no], $ac_path)
250 if test "x$ac_moc" = "xno"; then
251 AC_MSG_ERROR([moc $ac_errmsg])
252 fi
253 AC_SUBST(ac_moc)
254
255 # Check for Qt uic utility.
256 AC_PATH_PROG(ac_uic, uic, [no], $ac_path)
257 if test "x$ac_uic" = "xno"; then
258 AC_MSG_ERROR([uic $ac_errmsg])
259 fi
260 AC_SUBST(ac_uic)
261
262 # Check for Qt lupdate utility.
263 AC_PATH_PROG(ac_lupdate, lupdate, [no], $ac_path)
264 if test "x$ac_lupdate" = "xno"; then
265 AC_MSG_ERROR([lupdate $ac_errmsg])
266 fi
267 AC_SUBST(ac_lupdate)
268
269 # Check for Qt lrelease utility.
270 AC_PATH_PROG(ac_lrelease, lrelease, [no], $ac_path)
271 if test "x$ac_release" = "xno"; then
272 AC_MSG_ERROR([lrelease $ac_errmsg])
273 fi
274 AC_SUBST(ac_lrelease)
275
276
277 # Checks for libraries.
278 AC_CHECK_LIB(m, main)
279 AC_CHECK_LIB(X11, main)
280 AC_CHECK_LIB(Xext, main)
281
282 # Check for round math function.
283 AC_CHECK_LIB(m, round, [ac_round="yes"], [ac_round="no"])
284 if test "x$ac_round" = "xyes"; then
285 AC_DEFINE(CONFIG_ROUND, 1, [Define if round is available.])
286 fi
287
288 # Check for mandatory libraries.
289 PKG_CHECK_MODULES([LSCP], [lscp], [ac_liblscp="yes"], [ac_liblscp="no"])
290 if test "x$ac_liblscp" = "xyes"; then
291 AC_DEFINE(CONFIG_LIBLSCP, 1, [Define if liblscp is available.])
292 ac_cflags="$ac_cflags $LSCP_CFLAGS"
293 ac_libs="$ac_libs $LSCP_LIBS"
294 else
295 AC_MSG_ERROR([*** LSCP library not found (liblscp).])
296 fi
297
298 case "{$host}" in
299 *mingw*)
300 ac_libs="$ac_libs -lws2_32"
301 LIBS="$LIBS -lws2_32"
302 ;;
303 esac
304
305 AC_CACHE_CHECK([for instrument_name in lscp_channel_info_t],
306 ac_cv_instrument_name, [
307 AC_TRY_COMPILE([#include "lscp/client.h"], [
308 lscp_channel_info_t info;
309 info.instrument_name = 0;
310 ], ac_cv_instrument_name="yes", ac_cv_instrument_name="no")
311 ])
312 ac_instrument_name=$ac_cv_instrument_name
313 if test "x$ac_instrument_name" = "xyes"; then
314 AC_DEFINE(CONFIG_INSTRUMENT_NAME, 1, [Define if instrument_name is available.])
315 fi
316
317 AC_CACHE_CHECK([for mute/solo in lscp_channel_info_t],
318 ac_cv_mute_solo, [
319 AC_TRY_COMPILE([#include "lscp/client.h"], [
320 lscp_channel_info_t info;
321 info.mute = 0;
322 info.solo = 0;
323 ], ac_cv_mute_solo="yes", ac_cv_mute_solo="no")
324 ])
325 ac_mute_solo=$ac_cv_mute_solo
326 if test "x$ac_mute_solo" = "xyes"; then
327 AC_CHECK_LIB(lscp, lscp_set_channel_mute, [ac_mute_solo="yes"], [ac_mute_solo="no"])
328 fi
329 if test "x$ac_mute_solo" = "xyes"; then
330 AC_CHECK_LIB(lscp, lscp_set_channel_solo, [ac_mute_solo="yes"], [ac_mute_solo="no"])
331 fi
332 if test "x$ac_mute_solo" = "xyes"; then
333 AC_DEFINE(CONFIG_MUTE_SOLO, 1, [Define if mute/solo is available.])
334 fi
335
336 AC_CHECK_LIB(lscp, lscp_map_midi_instrument, [ac_midi_instrument="yes"], [ac_midi_instrument="no"])
337 if test "x$ac_midi_instrument" = "xyes"; then
338 AC_DEFINE(CONFIG_MIDI_INSTRUMENT, 1, [Define if MIDI instrument mapping is available.])
339 fi
340
341 AC_CHECK_LIB(lscp, lscp_create_fxsend, [ac_fxsend="yes"], [ac_fxsend="no"])
342 if test "x$ac_fxsend" = "xyes"; then
343 AC_DEFINE(CONFIG_FXSEND, 1, [Define if FX sends is available.])
344 AC_CACHE_CHECK([for FX send level in lscp_fxsend_info_t],
345 ac_cv_fxsend_level, [
346 AC_TRY_COMPILE([#include "lscp/client.h"], [
347 lscp_fxsend_info_t info;
348 info.level = 0.0f;
349 ], ac_cv_fxsend_level="yes", ac_cv_fxsend_level="no")
350 ])
351 ac_fxsend_level=$ac_cv_fxsend_level
352 if test "x$ac_fxsend_level" = "xyes"; then
353 AC_DEFINE(CONFIG_FXSEND_LEVEL, 1, [Define if FX send level is available.])
354 fi
355 AC_CHECK_LIB(lscp, lscp_set_fxsend_name, [ac_fxsend_rename="yes"], [ac_fxsend_rename="no"])
356 if test "x$ac_fxsend_rename" = "xyes"; then
357 AC_DEFINE(CONFIG_FXSEND_RENAME, 1, [Define if FX send rename is available.])
358 fi
359 fi
360
361 AC_CACHE_CHECK([for audio_routing array type],
362 ac_cv_audio_routing, [
363 AC_TRY_COMPILE([#include "lscp/client.h"], [
364 lscp_channel_info_t info;
365 char ch = info.audio_routing[0][0];
366 ], ac_cv_audio_routing="no", ac_cv_audio_routing="yes")
367 ])
368 ac_audio_routing=$ac_cv_audio_routing
369 if test "x$ac_audio_routing" = "xyes"; then
370 AC_DEFINE(CONFIG_AUDIO_ROUTING, 1, [Define if audio_routing is an integer array.])
371 fi
372
373 AC_CHECK_LIB(lscp, lscp_set_volume, [ac_volume="yes"], [ac_volume="no"])
374 if test "x$ac_volume" = "xyes"; then
375 AC_DEFINE(CONFIG_VOLUME, 1, [Define if global volume is available.])
376 fi
377
378 AC_CHECK_LIB(lscp, lscp_edit_channel_instrument, [ac_edit_instrument="yes"], [ac_edit_instrument="no"])
379 if test "x$ac_edit_instrument" = "xyes"; then
380 AC_DEFINE(CONFIG_EDIT_INSTRUMENT, 1, [Define if instrument editing is available.])
381 fi
382
383 AC_CACHE_CHECK([for CHANNEL_MIDI LSCP event support in liblscp],
384 ac_cv_channel_midi_event, [
385 AC_TRY_COMPILE([
386 #include "lscp/client.h"
387 #include "lscp/event.h"
388 ], [
389 lscp_event_t ev;
390 ev = LSCP_EVENT_CHANNEL_MIDI;
391 ], ac_cv_channel_midi_event="yes", ac_cv_channel_midi_event="no")
392 ])
393 ac_channel_midi_event=$ac_cv_channel_midi_event
394 if test "x$ac_channel_midi_event" = "xyes"; then
395 AC_DEFINE(CONFIG_EVENT_CHANNEL_MIDI, 1, [Define if LSCP CHANNEL_MIDI event support is available.])
396 fi
397
398 AC_CACHE_CHECK([for DEVICE_MIDI LSCP event support in liblscp],
399 ac_cv_device_midi_event, [
400 AC_TRY_COMPILE([
401 #include "lscp/client.h"
402 #include "lscp/event.h"
403 ], [
404 lscp_event_t ev;
405 ev = LSCP_EVENT_DEVICE_MIDI;
406 ], ac_cv_device_midi_event="yes", ac_cv_device_midi_event="no")
407 ])
408 ac_device_midi_event=$ac_cv_device_midi_event
409 if test "x$ac_device_midi_event" = "xyes"; then
410 AC_DEFINE(CONFIG_EVENT_DEVICE_MIDI, 1, [Define if LSCP DEVICE_MIDI event support is available.])
411 fi
412
413 AC_CHECK_LIB(lscp, lscp_get_voices, [ac_max_voices="yes"], [ac_max_voices="no"])
414 if test "x$ac_max_voices" = "xyes"; then
415 AC_DEFINE(CONFIG_MAX_VOICES, 1, [Define if max. voices / streams is available.])
416 fi
417
418 # Check for optional libraries.
419 if test "x$ac_libgig" = "xyes"; then
420 PKG_CHECK_MODULES([GIG], [gig >= 3.3.0], [ac_libgig="yes"], [ac_libgig="no"])
421 fi
422 if test "x$ac_libgig" = "xyes"; then
423 AC_DEFINE(CONFIG_LIBGIG, 1, [Define if libgig is available.])
424 ac_cflags="$ac_cflags $GIG_CFLAGS"
425 ac_libs="$ac_libs $GIG_LIBS"
426 AC_DEFINE(CONFIG_LIBGIG_SETAUTOLOAD, 1, [Define if libgig provides gig::File::SetAutoLoad() method.])
427 ac_libgig_setautoload="yes"
428 else
429 AC_MSG_WARN([*** GIG library not found (libgig).])
430 fi
431
432 # Check for round math function.
433 AC_CHECK_LIB(m, lroundf, [ac_round="yes"], [ac_round="no"])
434 if test "x$ac_round" = "xyes"; then
435 AC_DEFINE(CONFIG_ROUND, 1, [Define if round is available.])
436 fi
437
438 # Check for X11 unique/single instance.
439 if test "x$ac_xunique" = "xyes"; then
440 AC_DEFINE(CONFIG_XUNIQUE, 1, [Define if X11 unique/single instance is enabled.])
441 fi
442
443 # Check for debugging stack-trace.
444 if test "x$ac_stacktrace" = "xyes"; then
445 AC_DEFINE(CONFIG_STACKTRACE, 1, [Define if debugger stack-trace is enabled.])
446 fi
447
448 # Some recent distros (eg. fedora, debian) require this.
449 if test "x$ac_cv_lib_X11_main" = "xyes"; then
450 ac_libs="$ac_libs -lX11"
451 fi
452
453 AC_SUBST(ac_libs)
454
455
456 # Checks for header files.
457 AC_HEADER_STDC
458 AC_HEADER_SYS_WAIT
459 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h unistd.h signal.h sys/socket.h)
460
461 AC_CHECK_HEADER(lscp/client.h, [ac_lscp_h="yes"], [ac_lscp_h="no"])
462 if test "x$ac_lscp_h" = "xno"; then
463 AC_MSG_ERROR([LSCP headers not found.])
464 fi
465
466 if test "x$ac_libgig" = "xyes"; then
467 AC_CHECK_HEADER(libgig/SF.h, [ac_libgig_sf2="yes"], [ac_libgig_sf2="no"])
468 if test "x$ac_libgig_sf2" = "xyes"; then
469 AC_DEFINE(CONFIG_LIBGIG_SF2, 1, [Define if libgig/SF.h is available.])
470 fi
471 fi
472
473 AC_SUBST(ac_incpath)
474 AC_SUBST(ac_cflags)
475 AC_SUBST(ac_ldflags)
476
477
478 # Checks for typedefs, structures, and compiler characteristics.
479 # AC_C_CONST
480
481 # Checks for library functions.
482 AC_CHECK_FUNCS(system)
483
484 # Finally produce a configure header file and the makefiles.
485 AC_OUTPUT
486
487 # make clean > /dev/null 2>&1
488
489 # Output summary message
490
491 echo
492 echo " $PACKAGE_NAME $PACKAGE_VERSION"
493 echo
494 echo " Build target . . . . . . . . . . . . . . . . . . .: $ac_debug"
495 echo
496 echo " LSCP instrument name support . . . . . . . . . . .: $ac_instrument_name"
497 echo " LSCP mute/solo support . . . . . . . . . . . . . .: $ac_mute_solo"
498 echo " LSCP MIDI instrument support . . . . . . . . . . .: $ac_midi_instrument"
499 echo " LSCP FX send support . . . . . . . . . . . . . . .: $ac_fxsend"
500 echo " LSCP FX send level support . . . . . . . . . . . .: $ac_fxsend_level"
501 echo " LSCP FX send rename support . . . . . . . . . . .: $ac_fxsend_rename"
502 echo " LSCP audio routing support . . . . . . . . . . . .: $ac_audio_routing"
503 echo " LSCP volume support . . . . . . . . . . . . . . .: $ac_volume"
504 echo " LSCP edit instrument support . . . . . . . . . . .: $ac_edit_instrument"
505 echo " GigaSampler instrument file support (libgig) . . .: $ac_libgig"
506 if test "x$ac_libgig" = "xyes"; then
507 echo " libgig supports fast information retrieval . . . .: $ac_libgig_setautoload"
508 echo " libgig supports SoundFont2 instruments files . . .: $ac_libgig_sf2"
509 fi
510 echo " LSCP channel MIDI event support . . . . . . . . .: $ac_channel_midi_event"
511 echo " LSCP device MIDI event support . . . . . . . . . .: $ac_device_midi_event"
512 echo " LSCP runtime max. voices / disk streams support .: $ac_max_voices"
513 echo
514 echo " X11 Unique/Single instance . . . . . . . . . . . .: $ac_xunique"
515 echo " Debugger stack-trace (gdb) . . . . . . . . . . . .: $ac_stacktrace"
516 echo
517 echo " Install prefix . . . . . . . . . . . . . . . . . .: $ac_prefix"
518 echo
519 echo "Now type 'make', followed by 'make install' as root."
520 echo

  ViewVC Help
Powered by ViewVC