1dnl Process this file with autoconf to produce a configure script.
2
3AC_INIT(DSSI, 1.1.1, dssi-devel@lists.sourceforge.net)
4
5AC_CONFIG_SRCDIR(dssi/dssi.h)
6AM_INIT_AUTOMAKE
7AM_CONFIG_HEADER(config.h)
8
9AC_PROG_CC
10AC_PROG_CXX
11AC_ENABLE_STATIC(no)
12AC_ENABLE_SHARED(yes)
13AC_PROG_LIBTOOL
14AC_PROG_LN_S
15
16AC_C_BIGENDIAN
17
18dnl Check for LADSPA
19AC_CHECK_HEADERS(ladspa.h)
20
21dnl Require ALSA or libdssialsacompat
22PKG_CHECK_MODULES(ALSA, alsa >= 0.9, with_alsa=ALSA, with_alsa=no)
23if test "x${with_alsa}" = xno ; then
24  PKG_CHECK_MODULES(ALSA, libdssialsacompat, with_alsa=libdssialsacompat,
25                    AC_MSG_ERROR([neither ALSA nor libdssialsacompat found]))
26fi
27AC_SUBST(ALSA_CFLAGS)
28AC_SUBST(ALSA_LIBS)
29
30dnl Check for liblo
31PKG_CHECK_MODULES(LIBLO, liblo >= 0.12, with_liblo=yes, with_liblo=no)
32AC_SUBST(LIBLO_CFLAGS)
33AC_SUBST(LIBLO_LIBS)
34AM_CONDITIONAL(HAVE_LIBLO, test x$with_liblo = xyes)
35
36dnl Check for JACK
37PKG_CHECK_MODULES(JACK, jack >= 0.99.14, with_jack=yes, with_jack=no)
38AC_SUBST(JACK_CFLAGS)
39AC_SUBST(JACK_LIBS)
40AM_CONDITIONAL(HAVE_JACK, test x$with_jack = xyes)
41
42dnl Check for libsndfile and libsamplerate for trivial_sampler
43PKG_CHECK_MODULES(SNDFILE, sndfile, with_sndfile=yes, with_sndfile=no)
44PKG_CHECK_MODULES(SRC, samplerate, with_SRC=yes, with_SRC=no)
45AC_SUBST(SNDFILE_CFLAGS)
46AC_SUBST(SNDFILE_LIBS)
47AC_SUBST(SRC_CFLAGS)
48AC_SUBST(SRC_LIBS)
49
50dnl Check for Qt
51with_qt=no
52PKG_CHECK_MODULES(QT, [QtCore >= 4.0.1 QtGui >= 4.0.1],
53    [with_qt=yes
54     QT_MOC=`$PKG_CONFIG --variable=moc_location QtCore`],
55    AC_MSG_NOTICE([pkg-config could not find Qt >= 4.0.1]))
56if test "x${with_qt}" = xno ; then
57  case "${host_os}" in
58  darwin*)
59    AC_MSG_NOTICE([checking for Qt OS X frameworks])
60    AC_LANG_SAVE
61    AC_LANG_CPLUSPLUS
62    dssi_save_cppflags="$CPPFLAGS"
63    CPPFLAGS="$CPPFLAGS -I/Library/Frameworks/QtCore.framework/Headers"
64    CPPFLAGS="$CPPFLAGS -I/Library/Frameworks/QtGui.framework/Headers"
65    AC_CHECK_HEADERS(QApplication, [with_qt=yes])
66    CPPFLAGS="$dssi_save_cppflags"
67    AC_LANG_RESTORE
68    if test "x${with_qt}" = xyes ; then
69      AC_PATH_PROG(QT_MOC, moc)
70      if test "x$QT_MOC" = x ; then
71        echo moc not found
72        with_qt=no
73      else
74        QT_CFLAGS="-I/Library/Frameworks/QtCore.framework/Headers"
75        QT_CFLAGS="$QT_CFLAGS -I/Library/Frameworks/QtGui.framework/Headers"
76        QT_LIBS="-Xlinker -framework -Xlinker QtCore -Xlinker -framework -Xlinker QtGui"
77      fi
78    fi
79    ;;
80  esac
81fi
82if test "x${with_qt}" = xyes ; then
83  dnl both less_trivial_synth_qt_gui and trivial_sampler_qt_gui need
84  dnl '-lX11' in QT_LIBS when on an X11 system (because they both
85  dnl utilize X11 directly; we check if Q_WS_X11 is defined.)
86  AC_MSG_CHECKING([whether Qt is X11-based])
87  AC_LANG_SAVE
88  AC_LANG_CPLUSPLUS
89  dssi_save_cxxflags="$CXXFLAGS"
90  CXXFLAGS="$CXXFLAGS $QT_CFLAGS"
91  AC_TRY_COMPILE([#include <QApplication>],
92      [#ifndef Q_WS_X11
93       #error notX11
94       #endif
95      ], [QT_LIBS="$QT_LIBS -lX11"
96          AC_MSG_RESULT([yes])],
97         [AC_MSG_RESULT([no])])
98  CXXFLAGS="$dssi_save_cxxflags"
99  AC_LANG_RESTORE
100fi
101AC_SUBST(QT_CFLAGS)
102AC_SUBST(QT_LIBS)
103AC_SUBST(QT_MOC)
104AM_CONDITIONAL(HAVE_QT, test x$with_qt = xyes)
105
106dnl OS specific checks
107case "${host_os}" in
108darwin*)
109  darwin=yes
110  AC_DEFINE(MIDI_COREMIDI, 1, [Define for CoreMIDI MIDI support])
111  ;;
112*)
113  darwin=no
114  if test "x${with_alsa}" = xALSA ; then
115    AC_DEFINE(MIDI_ALSA, 1, [Define for ALSA MIDI support])
116  fi
117  ;;
118esac
119AM_CONDITIONAL(DARWIN, test x$darwin = xyes)
120
121dnl Set GCC warning flags
122changequote(,)dnl
123if test "x$GCC" = "xyes"; then
124  case " $CFLAGS " in
125    *[\ \	]-Wall[\ \	]*) ;;
126    *) CFLAGS="$CFLAGS -Wall" ;;
127  esac
128fi
129changequote([,])dnl
130
131jack_dssi_host_needs=''
132dssi_osc_tools_needs=''
133trivial_sampler_needs=''
134less_trivial_synth_gui_needs=''
135trivial_sampler_gui_needs=''
136if test "x$with_liblo" != xyes ; then
137    jack_dssi_host_needs="$jack_dssi_host_needs liblo"
138    dssi_osc_tools_needs="$dssi_osc_tools_needs liblo"
139    less_trivial_synth_gui_needs="$less_trivial_synth_gui_needs liblo"
140    trivial_sampler_gui_needs="$trivial_sampler_gui_needs liblo"
141fi
142if test "x$with_jack" != xyes ; then
143    jack_dssi_host_needs="$jack_dssi_host_needs JACK"
144fi
145if test "x$with_sndfile" != xyes ; then
146    trivial_sampler_needs="$trivial_sampler_needs libsndfile"
147    trivial_sampler_gui_needs="$trivial_sampler_gui_needs libsndfile"
148fi
149if test "x$with_SRC" != xyes ; then
150    trivial_sampler_needs="$trivial_sampler_needs libsamplerate"
151fi
152AM_CONDITIONAL(BUILD_SAMPLER, test -z "$trivial_sampler_needs")
153if test "x$with_qt" != xyes ; then
154    less_trivial_synth_gui_needs="$less_trivial_synth_gui_needs Qt4"
155    trivial_sampler_gui_needs="$trivial_sampler_gui_needs Qt4"
156fi
157
158AC_OUTPUT([
159    Makefile
160    dssi.pc
161    jack-dssi-host/Makefile
162    examples/Makefile
163    tests/Makefile
164])
165
166dnl --- Below here is just pretty output for the user ---
167
168echo "* ======== DSSI ${PACKAGE_VERSION} configured ========"
169
170if test -z "$jack_dssi_host_needs" ; then
171    echo "* building jack-dssi-host:            yes"
172else
173    echo "* building jack-dssi-host:            no (missing$jack_dssi_host_needs)"
174fi
175echo "* building DSSI list/analyse tools:   yes"
176if test -z "$dssi_osc_tools_needs" ; then
177    echo "* building DSSI OSC tools:            yes"
178else
179    echo "* building DSSI OSC tools:            no (missing$dssi_osc_tools_needs)"
180fi
181echo "* building trivial_synth plugin:      yes"
182echo "* building less_trivial_synth plugin: yes"
183echo "* building karplong plugin:           yes"
184if test -z "$trivial_sampler_needs" ; then
185    echo "* building trivial_sampler plugin:    yes"
186else
187    echo "* building trivial_sampler plugin:    no (missing$trivial_sampler_needs)"
188fi
189if test -z "$less_trivial_synth_gui_needs" ; then
190    echo "* building less_trivial_synth GUI:    yes"
191else
192    echo "* building less_trivial_synth GUI:    no (missing$less_trivial_synth_gui_needs)"
193fi
194if test -z "$trivial_sampler_gui_needs" ; then
195    echo "* building trivial_sampler GUI:       yes"
196else
197    echo "* building trivial_sampler GUI:       no (missing$trivial_sampler_gui_needs)"
198fi
199