1# Process this file with autoconf to produce a configure script.
2AC_INIT(Qsynth, 0.9.2, rncbc@rncbc.org, qsynth)
3
4AC_CONFIG_SRCDIR(src/qsynth.cpp)
5AC_CONFIG_HEADERS(src/config.h)
6AC_CONFIG_FILES(Makefile qsynth.spec src/src.pri)
7
8# Build version string.
9AC_CACHE_VAL([ac_cv_build_version], [
10   ac_cv_build_version=$(git describe --tags --dirty --abbrev=6 2>/dev/null)
11   if test -n "$ac_cv_build_version"; then
12      ac_cv_build_version=$(echo $ac_cv_build_version | sed 's/^[[^0-9]]\+//')
13      ac_cv_build_version=$(echo $ac_cv_build_version | sed 's/-g/git./')
14      ac_cv_build_version=$(echo $ac_cv_build_version | sed 's/[[_|-]]\+/./g')
15      ac_cv_build_version_extra=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
16      if test "x$ac_cv_build_version_extra" != "xmaster"; then
17         ac_cv_build_version="$ac_cv_build_version [[$ac_cv_build_version_extra]]"
18      fi
19   else
20      ac_cv_build_version=$PACKAGE_VERSION
21   fi
22])
23ac_build_version="$ac_cv_build_version"
24AC_DEFINE_UNQUOTED(CONFIG_BUILD_VERSION, ["$ac_build_version"], [Build version string.])
25
26# Sanitized version string.
27AC_CACHE_VAL([ac_cv_version], [
28   ac_cv_version=$(echo $PACKAGE_VERSION | sed -r 's/^([[0-9|\.]]+).*$/\1/')
29])
30ac_version="$ac_cv_version"
31AC_DEFINE_UNQUOTED(CONFIG_VERSION, ["$ac_version"], [Version string.])
32AC_SUBST(ac_version)
33
34# Set default installation prefix.
35AC_PREFIX_DEFAULT(/usr/local)
36if test "x$prefix" = "xNONE"; then
37   prefix=$ac_default_prefix
38fi
39if test "x$exec_prefix" = "xNONE"; then
40   exec_prefix=$prefix
41fi
42eval ac_prefix=$prefix
43AC_SUBST(ac_prefix)
44AC_DEFINE_UNQUOTED(CONFIG_PREFIX, ["$ac_prefix"], [Default installation prefix.])
45
46# Set default installation directories.
47eval ac_bindir=$bindir
48AC_SUBST(ac_bindir)
49AC_DEFINE_UNQUOTED(CONFIG_BINDIR, ["$ac_bindir"], [Default executable binary path.])
50
51eval ac_libdir=$libdir
52AC_SUBST(ac_libdir)
53AC_DEFINE_UNQUOTED(CONFIG_LIBDIR, ["$ac_libdir"], [Default object library path.])
54
55eval datarootdir=$datarootdir
56eval ac_datadir=$datadir
57AC_SUBST(ac_datadir)
58AC_DEFINE_UNQUOTED(CONFIG_DATADIR, ["$ac_datadir"], [Default arch-idependent data path.])
59
60eval ac_mandir=$mandir
61AC_SUBST(ac_mandir)
62AC_DEFINE_UNQUOTED(CONFIG_MANDIR, ["$ac_mandir"], [Default man page path.])
63
64
65# Enable debugging argument option.
66AC_ARG_ENABLE(debug,
67  AS_HELP_STRING([--enable-debug], [enable debugging (default=no)]),
68  [ac_debug="$enableval"])
69
70if test "x$ac_debug" = "xyes"; then
71   AC_DEFINE(CONFIG_DEBUG, 1, [Define if debugging is enabled.])
72   ac_stacktrace="yes"
73   ac_debug="debug"
74else
75   ac_stacktrace="no"
76   ac_debug="release"
77fi
78AC_SUBST(ac_debug)
79
80
81# Enable system tray argument option.
82AC_ARG_ENABLE(system_tray,
83  AS_HELP_STRING([--enable-system-tray], [enable system tray (default=yes)]),
84  [ac_system_tray="$enableval"],
85  [ac_system_tray="yes"])
86
87# Enable fluid_synth_get_channel_info function (DEPRECATED).
88AC_ARG_ENABLE(fluid_channel_info,
89  AS_HELP_STRING([--enable-fluid-channel-info], [enable FluidSynth channel info support (DEPRECATED) (default=no)]),
90  [ac_fluid_channel_info="$enableval"],
91  [ac_fluid_channel_info="no"])
92
93# Enable fluid_synth_set_midi_router function (DEPRECATED).
94AC_ARG_ENABLE(fluid_midi_router,
95  AS_HELP_STRING([--enable-fluid-midi-router], [enable FluidSynth MIDI router support (DEPRECATED) (default=no)]),
96  [ac_fluid_midi_router="$enableval"],
97  [ac_fluid_midi_router="no"])
98
99# Enable new_fluid_server function.
100AC_ARG_ENABLE(fluid_server,
101  AS_HELP_STRING([--enable-fluid-server], [enable FluidSynth server (default=yes)]),
102  [ac_fluid_server="$enableval"],
103  [ac_fluid_server="yes"])
104
105# Enable unique/single instance.
106AC_ARG_ENABLE(xunique,
107  AS_HELP_STRING([--enable-xunique], [enable unique/single instance (default=yes)]),
108  [ac_xunique="$enableval"],
109  [ac_xunique="yes"])
110
111# Enable gradient eye-candy.
112AC_ARG_ENABLE(gradient,
113  AS_HELP_STRING([--enable-gradient], [enable gradient eye-candy (default=yes)]),
114  [ac_gradient="$enableval"],
115  [ac_gradient="yes"])
116
117# Enable debugger stack-trace option (assumes --enable-debug).
118AC_ARG_ENABLE(stacktrace,
119  AS_HELP_STRING([--enable-stacktrace], [enable debugger stack-trace (default=no)]),
120  [ac_stacktrace="$enableval"])
121
122
123# Standard installation base dirs.
124ac_path=$PATH
125ac_pkg_config_path=$PKG_CONFIG_PATH
126ac_with_paths=""
127
128# Set for alternate Qt installation dir.
129AC_ARG_WITH(qt,
130  AS_HELP_STRING([--with-qt=PATH], [use alternate Qt install path]),
131  [ac_qt_path="$withval"], [ac_qt_path="no"])
132
133if test "x$ac_qt_path" != "xno"; then
134   ac_path="$ac_qt_path/bin:$ac_path"
135   ac_pkg_config_path="$ac_qt_path/lib/pkgconfig:$ac_pkg_config_path"
136fi
137
138# Set for alternate fluidsynth installation dir.
139AC_ARG_WITH(fluidsynth,
140  AS_HELP_STRING([--with-fluidsynth=PATH], [use alternate fluidsynth install path]),
141  [ac_with_paths="$ac_with_paths $withval"])
142
143
144# Honor user specified flags.
145ac_cflags=$CFLAGS
146ac_ldflags=$LDFLAGS
147
148
149# Checks for programs.
150AC_PROG_CPP
151AC_PROG_CXX
152AC_PROG_CXXCPP
153
154# Checks for languages.
155AC_LANG_CPLUSPLUS
156
157# Check for pkg-config.
158PKG_PROG_PKG_CONFIG
159
160# Check whether -std=c++11 support is necessary (4 < g++ version < 6).
161AC_CACHE_CHECK([for g++ major version], [ac_cv_gxx_version_major], [
162   ac_cv_gxx_version_major=$($CC -dumpversion)
163   if test -n "$ac_cv_gxx_version_major"; then
164      ac_cv_gxx_version_major=$(echo $ac_cv_gxx_version_major | cut -d'.' -f1);
165   fi
166   ac_gxx_version_major=$(($ac_cv_gxx_version_major + 0))
167])
168ac_gxx_version_major=$ac_cv_gxx_version_major
169if test $ac_gxx_version_major -ge 4 -a $ac_gxx_version_major -lt 6; then
170   CXXFLAGS="-std=c++11 $CXXFLAGS"
171   ac_cflags="-std=c++11 $ac_cflags"
172elif test $ac_gxx_version_major -ge 6 -a $ac_gxx_version_major -lt 11; then
173   CXXFLAGS="-std=c++17 $CXXFLAGS"
174   ac_cflags="-std=c++17 $ac_cflags"
175fi
176
177# Check for proper flags.
178ac_arch=$(uname -m)
179
180# Check for install paths and alternatives...
181ac_libdirs="lib"
182
183if test "x$ac_arch" = "xx86_64"; then
184   ac_libdirs="$ac_libdirs lib64"
185fi
186
187CFLAGS="-fPIC $CFLAGS"
188CPPFLAGS="-fPIC $CPPFLAGS"
189
190# Prepend alternate dependencies paths.
191for X in $ac_with_paths; do
192  if test -d $X/bin; then
193     ac_path="$X/bin:$ac_path"
194  fi
195  if test -d $X/include; then
196     CFLAGS="-I$X/include $CFLAGS "
197     CPPFLAGS="-I$X/include $CPPFLAGS"
198     ac_incpath="$X/include $ac_incpath"
199  fi
200  for Y in $ac_libdirs; do
201     if test -d $X/$Y; then
202        LIBS="-L$X/$Y $LIBS"
203        ac_libs="-L$X/$Y $ac_libs"
204        if test -d $X/$Y/pkgconfig; then
205           ac_pkg_config_path="$X/$Y/pkgconfig:$ac_pkg_config_path"
206        fi
207     fi
208  done
209done
210
211# Set pkg-config path.
212if test -n "$ac_pkg_config_path"; then
213   export PKG_CONFIG_PATH=$ac_pkg_config_path
214fi
215
216
217# A common error message:
218ac_errmsg="not found in current PATH. Maybe QT development environment isn't available."
219
220# Check for qtchooser availability.
221AC_PATH_TOOL(ac_qtchooser, qtchooser, [no], $ac_path)
222if test -x $ac_qtchooser; then
223   export QT_SELECT=5
224fi
225
226# Check for proper qmake path/version alternatives.
227AC_PATH_TOOL(ac_qmake, qmake, [no], $ac_path)
228if test "x$ac_qmake" = "xno"; then
229   AC_PATH_TOOL(ac_cv_qmake, qmake-qt5, [no], $ac_path)
230   ac_qmake=$ac_cv_qmake
231fi
232if test "x$ac_qmake" = "xno"; then
233   AC_PATH_TOOL(ac_cv_qmake, qmake-qt6, [no], $ac_path)
234   ac_qmake=$ac_cv_qmake
235fi
236
237# Check for proper Qt major version.
238AC_CACHE_CHECK([for Qt major version], [ac_cv_qt_version_major], [
239   ac_cv_qt_version_major=$($ac_qmake -query QT_VERSION | cut -d'.' -f1)
240   ac_cv_qt_version_major=$(($ac_cv_qt_version_major + 0))
241])
242ac_qt_version_major=$ac_cv_qt_version_major
243if test "x$ac_qmake" = "xno"; then
244   if test $ac_qt_version_major -lt 6; then
245      AC_MSG_ERROR([qmake-qt5 $ac_errmsg (qt5-devel)])
246   else
247      AC_MSG_ERROR([qmake-qt6 $ac_errmsg (qt6-devel)])
248   fi
249fi
250
251# Check for proper Qt install path.
252AC_CACHE_CHECK([for Qt install path], [ac_cv_qt_install_path], [
253   ac_cv_qt_install_path=$($ac_qmake -query QT_INSTALL_BINS)
254])
255ac_qt_install_path=$ac_cv_qt_install_path
256if test -d $ac_qt_install_path; then
257   ac_path="$ac_qt_install_path:$ac_path"
258fi
259
260# Check it again, now with updated PATH, just in case...
261AC_PATH_TOOL(ac_cv_qmake, qmake, [no], $ac_path)
262ac_qmake=$ac_cv_qmake
263if test "x$ac_qmake" = "xno"; then
264   AC_MSG_ERROR([qmake $ac_errmsg])
265fi
266
267AC_SUBST(ac_qmake)
268
269AC_CACHE_CHECK([for Qt install headers], [ac_cv_qt_install_headers], [
270   ac_cv_qt_install_headers=$($ac_qmake -query QT_INSTALL_HEADERS)
271])
272ac_qt_install_headers=$ac_cv_qt_install_headers
273if test -d $ac_qt_install_headers; then
274   CFLAGS="-I$ac_qt_install_headers $CFLAGS "
275   CPPFLAGS="-I$ac_qt_install_headers $CPPFLAGS"
276   ac_incpath="$ac_qt_install_headers $ac_incpath"
277fi
278
279AC_CACHE_CHECK([for Qt install libraries], [ac_cv_qt_install_libs], [
280   ac_cv_qt_install_libs=$($ac_qmake -query QT_INSTALL_LIBS)
281])
282ac_qt_install_libs=$ac_cv_qt_install_libs
283if test -d $ac_qt_install_libs; then
284   LIBS="-L$ac_qt_install_libs $LIBS"
285   ac_libs="-L$ac_qt_install_libs $ac_libs"
286fi
287
288# Finally, check for proper Qt version.
289AC_CACHE_CHECK([for Qt library version >= 5.1],
290   ac_cv_qtversion, [
291   AC_TRY_COMPILE([#include "QtCore/qglobal.h"], [
292      #if QT_VERSION < 0x050100
293      #error Qt library 5.1 or greater required.
294      #endif
295   ], ac_cv_qtversion="yes", [
296      echo "no; Qt 5.1 or greater is required"
297      exit 1
298   ])
299])
300
301# Check for Qt moc utility.
302AC_PATH_TOOL(ac_moc, moc, [no], $ac_path)
303if test "x$ac_moc" = "xno"; then
304   AC_MSG_ERROR([moc $ac_errmsg])
305fi
306AC_SUBST(ac_moc)
307
308# Check for Qt uic utility.
309AC_PATH_TOOL(ac_uic, uic, [no], $ac_path)
310if test "x$ac_uic" = "xno"; then
311   AC_MSG_ERROR([uic $ac_errmsg])
312fi
313AC_SUBST(ac_uic)
314
315
316# Check for Qt lupdate utility.
317AC_PATH_TOOL(ac_lupdate, lupdate, [no], $ac_path)
318if test "x$ac_lupdate" = "xno"; then
319   if test $ac_qt_version_major -lt 6; then
320      AC_PATH_TOOL(ac_cv_lupdate, lupdate-qt5, [no], $ac_path)
321   else
322      AC_PATH_TOOL(ac_cv_lupdate, lupdate-qt6, [no], $ac_path)
323   fi
324   if test "x$ac_cv_lupdate" = "xno"; then
325      if test $ac_qt_version_major -lt 6; then
326         AC_MSG_ERROR([lupdate $ac_errmsg (qt5-linguist)])
327      else
328         AC_MSG_ERROR([lupdate $ac_errmsg (qt6-linguist)])
329      fi
330   else
331      ac_lupdate=$ac_cv_lupdate;
332   fi
333fi
334AC_SUBST(ac_lupdate)
335
336# Check for Qt lrelease utility.
337AC_PATH_TOOL(ac_lrelease, lrelease, [no], $ac_path)
338if test "x$ac_lrelease" = "xno"; then
339   if test $ac_qt_version_major -lt 6; then
340      AC_PATH_TOOL(ac_cv_lrelease, lrelease-qt5, [no], $ac_path)
341   else
342      AC_PATH_TOOL(ac_cv_lrelease, lrelease-qt6, [no], $ac_path)
343   fi
344   if test "x$ac_cv_lrelease" = "xno"; then
345      if test $ac_qt_version_major -lt 6; then
346         AC_MSG_ERROR([lrelease $ac_errmsg (qt5-linguist)])
347      else
348         AC_MSG_ERROR([lrelease $ac_errmsg (qt6-linguist)])
349      fi
350   else
351      ac_lrelease=$ac_cv_lrelease;
352   fi
353fi
354AC_SUBST(ac_lrelease)
355
356
357# Checks for libraries.
358AC_CHECK_LIB(m, main)
359AC_CHECK_LIB(X11, main)
360AC_CHECK_LIB(Xext, main)
361
362# Check for lroundf math function.
363AC_CHECK_LIB(m, lroundf, [ac_round="yes"], [ac_round="no"])
364if test "x$ac_round" = "xyes"; then
365   AC_DEFINE(CONFIG_ROUND, 1, [Define if lroundf is available.])
366fi
367
368# Check for fluidsynth library.
369PKG_CHECK_MODULES([FLUIDSYNTH], [fluidsynth >= 0.80.0], [ac_fluidsynth_lib="yes"], [ac_fluidsynth_lib="no"])
370if test "x$ac_fluidsynth_lib" = "xyes"; then
371   AC_DEFINE(CONFIG_FLUIDSYNTH, 1, [Define if FLUIDSYNTH library is available.])
372   ac_cflags="$ac_cflags $FLUIDSYNTH_CFLAGS"
373   ac_libs="$ac_libs $FLUIDSYNTH_LIBS"
374   CFLAGS="$CFLAGS $FLUIDSYNTH_CFLAGS"
375   CPPFLAGS="$CPPFLAGS $FLUIDSYNTH_CFLAGS"
376   LIBS="$LIBS $FLUIDSYNTH_LIBS"
377else
378   AC_MSG_ERROR([*** FLUIDSYNTH library not found.])
379fi
380
381
382# Checks for header files.
383AC_HEADER_STDC
384AC_HEADER_SYS_WAIT
385AC_CHECK_HEADERS(fcntl.h sys/ioctl.h unistd.h signal.h)
386
387# Check for unique/single instance support.
388if test "x$ac_xunique" = "xyes"; then
389   if test $ac_qt_version_major -lt 6; then
390      PKG_CHECK_MODULES([QT5NETWORK], [Qt5Network], [ac_xunique="yes"], [ac_xunique="no"])
391   else
392      PKG_CHECK_MODULES([QT6NETWORK], [Qt6Network], [ac_xunique="yes"], [ac_xunique="no"])
393   fi
394fi
395if test "x$ac_xunique" = "xyes"; then
396   AC_DEFINE(CONFIG_XUNIQUE, 1, [Define if unique/single instance is enabled.])
397   ac_qnetwork="network"
398fi
399AC_SUBST(ac_qnetwork)
400
401# Check for gradient eye-candy.
402if test "x$ac_gradient" = "xyes"; then
403   AC_DEFINE(CONFIG_GRADIENT, 1, [Define if gradient eye-candy is enabled.])
404fi
405
406# Check for debugging stack-trace.
407if test "x$ac_stacktrace" = "xyes"; then
408   AC_DEFINE(CONFIG_STACKTRACE, 1, [Define if debugger stack-trace is enabled.])
409fi
410
411AC_SUBST(ac_cflags)
412AC_SUBST(ac_incpath)
413AC_SUBST(ac_ldflags)
414AC_SUBST(ac_libs)
415
416
417# Checks for typedefs, structures, and compiler characteristics.
418# AC_C_CONST
419
420# Checks for library functions.
421AC_CHECK_FUNCS(system)
422
423# Check for system-tray icon.
424if test "x$ac_system_tray" = "xyes"; then
425   AC_DEFINE(CONFIG_SYSTEM_TRAY, 1, [Define if system tray is enabled.])
426fi
427
428# Check for new_fluid_server function.
429if test "x$ac_fluid_server" = "xyes"; then
430   AC_CHECK_LIB(fluidsynth, new_fluid_server, [ac_fluid_server="yes"], [ac_fluid_server="no"])
431   if test "x$ac_fluid_server" = "xyes"; then
432      AC_DEFINE(CONFIG_FLUID_SERVER, 1, [Define if FluidSynth server support is enabled])
433   fi
434fi
435
436# Check for fluid_synth_system_reset function.
437AC_CHECK_LIB(fluidsynth, fluid_synth_system_reset, [ac_fluid_system_reset="yes"], [ac_fluid_system_reset="no"])
438if test "x$ac_fluid_system_reset" = "xyes"; then
439   AC_DEFINE(CONFIG_FLUID_SYSTEM_RESET, 1, [Define if fluid_synth_system_reset is available.])
440fi
441
442# Check for fluid_synth_set_bank_offset function.
443AC_CHECK_LIB(fluidsynth, fluid_synth_set_bank_offset, [ac_fluid_bank_offset="yes"], [ac_fluid_bank_offset="no"])
444if test "x$ac_fluid_bank_offset" = "xyes"; then
445   AC_DEFINE(CONFIG_FLUID_BANK_OFFSET, 1, [Define if fluid_synth_set_bank_offset is available.])
446fi
447
448# Check for fluid_synth_get_channel_info function (DEPRECATED).
449if test "x$ac_fluid_channel_info" = "xyes"; then
450   AC_CHECK_LIB(fluidsynth, fluid_synth_get_channel_info, [ac_fluid_channel_info="yes"], [ac_fluid_channel_info="no"])
451   if test "x$ac_fluid_channel_info" = "xyes"; then
452      AC_DEFINE(CONFIG_FLUID_CHANNEL_INFO, 1, [Define if FluidSynth channel info support is enabled.])
453   fi
454fi
455
456# Check for fluid_synth_set_midi_router function (DEPRECATED).
457if test "x$ac_fluid_midi_router" = "xyes"; then
458   AC_CHECK_LIB(fluidsynth, fluid_synth_set_midi_router, [ac_fluid_midi_router="yes"], [ac_fluid_midi_router="no"])
459   if test "x$ac_fluid_midi_router" = "xyes"; then
460      AC_DEFINE(CONFIG_FLUID_MIDI_ROUTER, 1, [Define if FluidSynth MIDI router support is enabled.])
461   fi
462fi
463
464# Check for fluid_synth_unset_program function.
465AC_CHECK_LIB(fluidsynth, fluid_synth_unset_program, [ac_fluid_unset_program="yes"], [ac_fluid_unset_program="no"])
466if test "x$ac_fluid_unset_program" = "xyes"; then
467   AC_DEFINE(CONFIG_FLUID_UNSET_PROGRAM, 1, [Define if fluid_synth_unset_program is available.])
468fi
469
470# Check for fluid_version_str function.
471AC_CHECK_LIB(fluidsynth, fluid_version_str, [ac_fluid_version_str="yes"], [ac_fluid_version_str="no"])
472if test "x$ac_fluid_version_str" = "xyes"; then
473   AC_DEFINE(CONFIG_FLUID_VERSION_STR, 1, [Define if fluid_version_str is available.])
474fi
475
476# Check for fluid_settings_dupstr function.
477AC_CHECK_LIB(fluidsynth, fluid_settings_dupstr, [ac_fluid_settings_dupstr="yes"], [ac_fluid_settings_dupstr="no"])
478if test "x$ac_fluid_settings_dupstr" = "xyes"; then
479   AC_DEFINE(CONFIG_FLUID_SETTINGS_DUPSTR, 1, [Define if fluid_settings_dupstr is available.])
480fi
481
482
483# Check for fluid_preset_get_banknum function.
484AC_CHECK_LIB(fluidsynth, fluid_preset_get_banknum, [ac_fluid_preset_get_banknum="yes"], [ac_fluid_preet_get_banknum="no"])
485if test "x$ac_fluid_preset_get_banknum" = "xyes"; then
486   AC_DEFINE(CONFIG_FLUID_PRESET_GET_BANKNUM, 1, [Define if fluid_preet_get_banknum is available.])
487fi
488
489# Check for fluid_preset_get_num function.
490AC_CHECK_LIB(fluidsynth, fluid_preset_get_num, [ac_fluid_preset_get_num="yes"], [ac_fluid_preet_get_num="no"])
491if test "x$ac_fluid_preset_get_num" = "xyes"; then
492   AC_DEFINE(CONFIG_FLUID_PRESET_GET_NUM, 1, [Define if fluid_preet_get_num is available.])
493fi
494
495# Check for fluid_preset_get_name function.
496AC_CHECK_LIB(fluidsynth, fluid_preset_get_name, [ac_fluid_preset_get_name="yes"], [ac_fluid_preet_get_name="no"])
497if test "x$ac_fluid_preset_get_name" = "xyes"; then
498   AC_DEFINE(CONFIG_FLUID_PRESET_GET_NAME, 1, [Define if fluid_preet_get_name is available.])
499fi
500
501
502# Check for fluid_preset_get_sfont function.
503AC_CHECK_LIB(fluidsynth, fluid_preset_get_sfont, [ac_fluid_preset_get_sfont="yes"], [ac_fluid_preet_get_sfont="no"])
504if test "x$ac_fluid_preset_get_sfont" = "xyes"; then
505   AC_DEFINE(CONFIG_FLUID_PRESET_GET_SFONT, 1, [Define if fluid_preet_get_sfont is available.])
506fi
507
508# Check for fluid_sfont_get_id function.
509AC_CHECK_LIB(fluidsynth, fluid_sfont_get_id, [ac_fluid_sfont_get_id="yes"], [ac_fluid_sfont_get_id="no"])
510if test "x$ac_fluid_sfont_get_id" = "xyes"; then
511   AC_DEFINE(CONFIG_FLUID_SFONT_GET_ID, 1, [Define if fluid_sfont_get_id is available.])
512fi
513
514# Check for fluid_sfont_get_name function.
515AC_CHECK_LIB(fluidsynth, fluid_sfont_get_name, [ac_fluid_sfont_get_name="yes"], [ac_fluid_sfont_get_name="no"])
516if test "x$ac_fluid_sfont_get_name" = "xyes"; then
517   AC_DEFINE(CONFIG_FLUID_SFONT_GET_NAME, 1, [Define if fluid_sfont_get_name is available.])
518fi
519
520
521# Check for fluid_sfont_iteration_start function.
522AC_CHECK_LIB(fluidsynth, fluid_sfont_iteration_start, [ac_fluid_sfont_iteration_start="yes"], [ac_fluid_sfont_iteration_start="no"])
523if test "x$ac_fluid_sfont_iteration_start" = "xyes"; then
524   AC_DEFINE(CONFIG_FLUID_SFONT_ITERATION_START, 1, [Define if fluid_sfont_iteration_start is available.])
525fi
526
527# Check for fluid_sfont_iteration_next function.
528AC_CHECK_LIB(fluidsynth, fluid_sfont_iteration_next, [ac_fluid_sfont_iteration_next="yes"], [ac_fluid_sfont_iteration_next="no"])
529if test "x$ac_fluid_sfont_iteration_next" = "xyes"; then
530   AC_DEFINE(CONFIG_FLUID_SFONT_ITERATION_NEXT, 1, [Define if fluid_sfont_iteration_next is available.])
531fi
532
533
534# Check for fluid_synth_get_chorus_speed function.
535AC_CHECK_LIB(fluidsynth, fluid_synth_get_chorus_speed, [ac_fluid_synth_get_chorus_speed="yes"], [ac_fluid_synth_get_chorus_speed="no"])
536if test "x$ac_fluid_synth_get_chorus_speed" = "xyes"; then
537   AC_DEFINE(CONFIG_FLUID_SYNTH_GET_CHORUS_SPEED, 1, [Define if fluid_synth_get_chorus_speed is available.])
538fi
539
540# Check for fluid_synth_get_chorus_depth function.
541AC_CHECK_LIB(fluidsynth, fluid_synth_get_chorus_depth, [ac_fluid_synth_get_chorus_depth="yes"], [ac_fluid_synth_get_chorus_speed="no"])
542if test "x$ac_fluid_synth_get_chorus_depth" = "xyes"; then
543   AC_DEFINE(CONFIG_FLUID_SYNTH_GET_CHORUS_DEPTH, 1, [Define if fluid_synth_get_chorus_depth is available.])
544fi
545
546
547# Check for FluidSynth API V2 (>= 2.0.0).
548AC_CACHE_CHECK([for FluidSynth API V2 (>= 2.0.0)],
549   ac_cv_fluidsynth2, [
550   AC_TRY_COMPILE([#include "fluidsynth.h"], [
551      #if FLUIDSYNTH_VERSION_MAJOR < 2
552      #error FluidSynth API V2 or greater is not available.
553      #endif
554   ], ac_cv_fluidsynth2="yes", ac_cv_fluidsynth2="no")
555])
556if test "x$ac_cv_fluidsynth2" = "xyes"; then
557  # Check for fluid_settings_getnum_default function.
558  AC_CHECK_LIB(fluidsynth, fluid_settings_getnum_default, [ac_fluid_settings_getnum_default="yes"], [ac_fluid_settings_getnum_default="no"])
559  if test "x$ac_fluid_settings_getnum_default" = "xyes"; then
560     AC_DEFINE(CONFIG_FLUID_SETTINGS_GETNUM_DEFAULT, 1, [Define if fluid_settings_getnum_default is available.])
561  fi
562  # Check for fluid_settings_getint_default function.
563  AC_CHECK_LIB(fluidsynth, fluid_settings_getint_default, [ac_fluid_settings_getint_default="yes"], [ac_fluid_settings_getint_default="no"])
564  if test "x$ac_fluid_settings_getint_default" = "xyes"; then
565     AC_DEFINE(CONFIG_FLUID_SETTINGS_GETINT_DEFAULT, 1, [Define if fluid_settings_getint_default is available.])
566  fi
567  # Check for fluid_settings_getstr_default function.
568  AC_CHECK_LIB(fluidsynth, fluid_settings_getstr_default, [ac_fluid_settings_getstr_default="yes"], [ac_fluid_settings_getstr_default="no"])
569  if test "x$ac_fluid_settings_getstr_default" = "xyes"; then
570     AC_DEFINE(CONFIG_FLUID_SETTINGS_GETSTR_DEFAULT, 1, [Define if fluid_settings_getstr_default is available.])
571  fi
572  # Check for fluid_settings_foreach function.
573  AC_CHECK_LIB(fluidsynth, fluid_settings_foreach, [ac_fluid_settings_foreach="yes"], [ac_fluid_settings_foreach="no"])
574  if test "x$ac_fluid_settings_foreach" = "xyes"; then
575     AC_DEFINE(CONFIG_FLUID_SETTINGS_FOREACH, 1, [Define if fluid_settings_foreach is available.])
576  fi
577  # Check for fluid_settings_foreach_option function.
578  AC_CHECK_LIB(fluidsynth, fluid_settings_foreach_option, [ac_fluid_settings_foreach_option="yes"], [ac_fluid_settings_foreach_option="no"])
579  if test "x$ac_fluid_settings_foreach_option" = "xyes"; then
580    AC_DEFINE(CONFIG_FLUID_SETTINGS_FOREACH_OPTION, 1, [Define if fluid_settings_foreach_option is available.])
581  fi
582  # Check for new_fluid_server function.
583  if test "x$ac_fluid_server" = "xyes"; then
584     AC_CHECK_LIB(fluidsynth, new_fluid_server, [ac_new_fluid_server="yes"], [ac_new_fluid_server="no"])
585     if test "x$ac_new_fluid_server" = "xyes"; then
586        AC_DEFINE(CONFIG_NEW_FLUID_SERVER, 1, [Define if new_fluid_server is available.])
587     fi
588  fi
589fi
590
591
592# Finally produce a configure header file and the makefiles.
593AC_OUTPUT
594
595# make clean > /dev/null 2>&1
596
597# Output summary message
598
599echo
600echo "  $PACKAGE_NAME $ac_build_version"
601echo
602echo "  Build target . . . . . . . . . . . . . . . . . . .: $ac_debug"
603echo
604echo "  FluidSynth library support . . . . . . . . . . . .: $ac_fluidsynth_lib"
605echo "  FluidSynth server support  . . . . . . . . . . . .: $ac_fluid_server"
606echo "  FluidSynth system reset support  . . . . . . . . .: $ac_fluid_system_reset"
607echo "  FluidSynth bank offset support . . . . . . . . . .: $ac_fluid_bank_offset"
608echo "  FluidSynth channel info support (DEPRECATED) . . .: $ac_fluid_channel_info"
609echo "  FluidSynth MIDI router support  (DEPRECATED) . . .: $ac_fluid_midi_router"
610echo "  FluidSynth unset program support . . . . . . . . .: $ac_fluid_unset_program"
611echo "  FluidSynth version string support  . . . . . . . .: $ac_fluid_version_str"
612echo
613echo "  System tray icon support . . . . . . . . . . . . .: $ac_system_tray"
614echo
615echo "  Unique/Single instance support . . . . . . . . . .: $ac_xunique"
616echo "  Gradient eye-candy . . . . . . . . . . . . . . . .: $ac_gradient"
617echo "  Debugger stack-trace (gdb) . . . . . . . . . . . .: $ac_stacktrace"
618echo
619echo "  Install prefix . . . . . . . . . . . . . . . . . .: $ac_prefix"
620echo
621echo "Now type 'make', followed by 'make install' as root."
622echo
623
624