1 |
# Process this file with autoconf to produce a configure script. |
2 |
AC_INIT(Qsampler, 0.1.3.3, rncbc@rncbc.org, qsampler) |
3 |
AC_CONFIG_SRCDIR(src/qsamplerMainForm.ui.h) |
4 |
AC_CONFIG_HEADERS(config.h) |
5 |
AC_CONFIG_FILES(Makefile qsampler.pro qsampler.spec) |
6 |
|
7 |
# Set default installation prefix. |
8 |
AC_PREFIX_DEFAULT(/usr/local) |
9 |
ac_prefix=$prefix |
10 |
if test "x$ac_prefix" = "xNONE"; then |
11 |
ac_prefix=$ac_default_prefix |
12 |
fi |
13 |
AC_SUBST(ac_prefix) |
14 |
AC_DEFINE_UNQUOTED(CONFIG_PREFIX, ["$ac_prefix"], [Default installation prefix.]) |
15 |
|
16 |
# Enable debugging argument option. |
17 |
AC_ARG_ENABLE(debug, |
18 |
AC_HELP_STRING([--enable-debug], [enable debugging (default=no)]), |
19 |
[ac_debug="debug"], |
20 |
[ac_debug="release"]) |
21 |
AC_SUBST(ac_debug) |
22 |
|
23 |
if test "x$ac_debug" = "xdebug"; then |
24 |
AC_DEFINE(CONFIG_DEBUG, 1, [Define if debugging is enabled.]) |
25 |
fi |
26 |
|
27 |
# Enable libgig availability. |
28 |
AC_ARG_ENABLE(libgig, |
29 |
AC_HELP_STRING([--disable-libgig], [disable libgig interface (default=no)]), |
30 |
[ac_libgig="no"], |
31 |
[ac_libgig="yes"]) |
32 |
|
33 |
# Set for alternate liblscp installation dir. |
34 |
AC_ARG_WITH(liblscp, |
35 |
AC_HELP_STRING([--with-liblscp=PATH], [use alternate liblscp install path]), |
36 |
[ac_with_paths="$ac_with_paths $withval"]) |
37 |
|
38 |
# Set for alternate libgig installation dir. |
39 |
AC_ARG_WITH(libgig, |
40 |
AC_HELP_STRING([--with-libgig=PATH], [use alternate libgig install path]), |
41 |
[ac_with_paths="$ac_with_paths $withval"]) |
42 |
|
43 |
# Checks for programs. |
44 |
AC_PROG_CC |
45 |
AC_PROG_CPP |
46 |
AC_PROG_CXX |
47 |
AC_PROG_CXXCPP |
48 |
AC_PROG_GCC_TRADITIONAL |
49 |
|
50 |
# Checks for languages. |
51 |
AC_LANG_C |
52 |
AC_LANG_CPLUSPLUS |
53 |
|
54 |
# Prepend alternate dependencies paths. |
55 |
for X in $ac_with_paths; do |
56 |
if test -d $X/include; then |
57 |
CFLAGS="$CFLAGS -I$X/include" |
58 |
CPPFLAGS="$CPPFLAGS -I$X/include" |
59 |
ac_incpath="$X/include $ac_incpath" |
60 |
fi |
61 |
if test -d $X/lib64; then |
62 |
LIBS="$LIBS -L$X/lib64" |
63 |
ac_libs="$ac_libs -L$X/lib64" |
64 |
fi |
65 |
if test -d $X/lib; then |
66 |
LIBS="$LIBS -L$X/lib" |
67 |
ac_libs="-L$X/lib $ac_libs" |
68 |
fi |
69 |
done |
70 |
|
71 |
# Check for QTDIR environment variable. |
72 |
AC_MSG_CHECKING([whether QTDIR environment variable is set]) |
73 |
if test "x$QTDIR" = "x"; then |
74 |
AC_MSG_RESULT([no]) |
75 |
AC_MSG_ERROR([QTDIR must be properly set.]) |
76 |
else |
77 |
AC_MSG_RESULT([$QTDIR]) |
78 |
fi |
79 |
|
80 |
CFLAGS="$CFLAGS -I$QTDIR/include" |
81 |
CPPFLAGS="$CPPFLAGS -I$QTDIR/include" |
82 |
if test -d $QTDIR/lib64; then |
83 |
LIBS="$LIBS -L$QTDIR/lib64" |
84 |
else |
85 |
LIBS="$LIBS -L$QTDIR/lib" |
86 |
fi |
87 |
for X in qt qt3; do |
88 |
if test -d $QTDIR/include/$X; then |
89 |
CFLAGS="$CFLAGS -I$QTDIR/include/$X" |
90 |
CPPFLAGS="$CPPFLAGS -I$QTDIR/include/$X" |
91 |
fi |
92 |
done |
93 |
|
94 |
# Checks for Qt library. |
95 |
for X in qt-mt qt; do |
96 |
if test "x$ac_qtlib" = "x"; then |
97 |
AC_CHECK_LIB($X, main, [ac_qtlib=$X]) |
98 |
fi |
99 |
done |
100 |
if test "x$ac_qtlib" = "x"; then |
101 |
AC_MSG_ERROR([Qt library not found. Maybe QTDIR isn't properly set.]) |
102 |
fi |
103 |
AC_SUBST(ac_qtlib) |
104 |
|
105 |
# Check for Qt multi-thread support. |
106 |
if test "x$ac_qtlib" = "xqt-mt"; then |
107 |
ac_thread="thread" |
108 |
fi |
109 |
AC_SUBST(ac_thread) |
110 |
|
111 |
AC_CACHE_CHECK([for Qt library version >= 3.1.1], |
112 |
ac_qtlib_version, [ |
113 |
AC_TRY_LINK([#include "qglobal.h"], [ |
114 |
#if QT_VERSION < 0x030101 |
115 |
#error Qt library 3.1.1 or greater required. |
116 |
#endif |
117 |
], |
118 |
ac_qtlib_version="yes", [ |
119 |
echo "no; Qt 3.1.1 or greater is required" |
120 |
exit |
121 |
]) |
122 |
]) |
123 |
|
124 |
# A common error message: |
125 |
ac_qtdir_errmsg="not found in current PATH. Maybe QT development environment isn't available (qt3-devel)." |
126 |
|
127 |
# Check for Qt qmake utility. |
128 |
AC_PATH_PROG(ac_qmake, qmake, [no], $QTDIR/bin:${PATH}) |
129 |
if test "x$ac_qmake" = "xno"; then |
130 |
AC_MSG_ERROR([qmake $ac_qtdir_errmsg]) |
131 |
fi |
132 |
AC_SUBST(ac_qmake) |
133 |
|
134 |
# Check for Qt moc utility. |
135 |
AC_PATH_PROG(ac_moc, moc, [no], $QTDIR/bin:${PATH}) |
136 |
if test "x$ac_moc" = "xno"; then |
137 |
AC_MSG_ERROR([moc $ac_qtdir_errmsg]) |
138 |
fi |
139 |
AC_SUBST(ac_moc) |
140 |
|
141 |
# Check for Qt uic utility. |
142 |
AC_PATH_PROG(ac_uic, uic, [no], $QTDIR/bin:${PATH}) |
143 |
if test "x$ac_uic" = "xno"; then |
144 |
AC_MSG_ERROR([uic $ac_qtdir_errmsg]) |
145 |
fi |
146 |
AC_SUBST(ac_uic) |
147 |
|
148 |
# Checks for libraries. |
149 |
AC_CHECK_LIB(m, main) |
150 |
AC_CHECK_LIB(X11, main) |
151 |
AC_CHECK_LIB(Xext, main) |
152 |
AC_CHECK_LIB($ac_qtlib, main) |
153 |
|
154 |
# Check for round math function. |
155 |
AC_CHECK_LIB(m, round, [ac_round="yes"], [ac_round="no"]) |
156 |
if test "x$ac_round" = "xyes"; then |
157 |
AC_DEFINE(CONFIG_ROUND, 1, [Define if round is available.]) |
158 |
fi |
159 |
|
160 |
# Check for mandatory libraries. |
161 |
AC_CHECK_LIB(lscp, main, [ac_liblscp="yes"], [ac_liblscp="no"]) |
162 |
if test "x$ac_liblscp" = "xno"; then |
163 |
AC_MSG_ERROR([LSCP library not found.]) |
164 |
fi |
165 |
ac_libs="$ac_libs -llscp" |
166 |
|
167 |
AC_CACHE_CHECK([for instrument_name in lscp_channel_info_t], |
168 |
ac_instrument_name, [ |
169 |
AC_TRY_COMPILE([#include "lscp/client.h"], [ |
170 |
lscp_channel_info_t info; |
171 |
info.instrument_name = 0; |
172 |
], ac_instrument_name="yes", ac_instrument_name="no") |
173 |
]) |
174 |
if test "x$ac_instrument_name" = "xyes"; then |
175 |
AC_DEFINE(CONFIG_INSTRUMENT_NAME, 1, [Define if instrument_name is available.]) |
176 |
fi |
177 |
|
178 |
AC_CACHE_CHECK([for mute/solo in lscp_channel_info_t], |
179 |
ac_mute_solo, [ |
180 |
AC_TRY_COMPILE([#include "lscp/client.h"], [ |
181 |
lscp_channel_info_t info; |
182 |
info.mute = 0; |
183 |
info.solo = 0; |
184 |
], ac_mute_solo="yes", ac_mute_solo="no") |
185 |
]) |
186 |
if test "x$ac_mute_solo" = "xyes"; then |
187 |
AC_CHECK_LIB(lscp, lscp_set_channel_mute, [ac_mute_solo="yes"], [ac_mute_solo="no"]) |
188 |
fi |
189 |
if test "x$ac_mute_solo" = "xyes"; then |
190 |
AC_CHECK_LIB(lscp, lscp_set_channel_solo, [ac_mute_solo="yes"], [ac_mute_solo="no"]) |
191 |
fi |
192 |
if test "x$ac_mute_solo" = "xyes"; then |
193 |
AC_DEFINE(CONFIG_MUTE_SOLO, 1, [Define if mute/solo is available.]) |
194 |
fi |
195 |
|
196 |
AC_CHECK_LIB(lscp, lscp_map_midi_instrument, [ac_midi_instrument="yes"], [ac_midi_instrument="no"]) |
197 |
if test "x$ac_midi_instrument" = "xyes"; then |
198 |
AC_DEFINE(CONFIG_MIDI_INSTRUMENT, 1, [Define if MIDI instrument mapping is available.]) |
199 |
fi |
200 |
|
201 |
# Check for optional libraries. |
202 |
if test "x$ac_libgig" = "xyes"; then |
203 |
AC_CHECK_LIB(gig, main, [ac_libgig="yes"], [ac_libgig="no"]) |
204 |
if test "x$ac_libgig" = "xyes"; then |
205 |
AC_DEFINE(CONFIG_LIBGIG, 1, [Define if libgig is available.]) |
206 |
ac_libs="$ac_libs -lgig" |
207 |
fi |
208 |
fi |
209 |
|
210 |
AC_SUBST(ac_libs) |
211 |
AC_SUBST(ac_incpath) |
212 |
|
213 |
# Checks for header files. |
214 |
AC_HEADER_STDC |
215 |
AC_HEADER_SYS_WAIT |
216 |
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h unistd.h signal.h) |
217 |
|
218 |
AC_CHECK_HEADER(lscp/client.h, [ac_lscp_h="yes"], [ac_lscp_h="no"]) |
219 |
if test "x$ac_lscp_h" = "xno"; then |
220 |
AC_MSG_ERROR([LSCP headers not found.]) |
221 |
fi |
222 |
|
223 |
# Checks for typedefs, structures, and compiler characteristics. |
224 |
# AC_C_CONST |
225 |
|
226 |
# Checks for library functions. |
227 |
AC_CHECK_FUNCS(system) |
228 |
|
229 |
# Finally produce a configure header file and the makefiles. |
230 |
AC_OUTPUT |
231 |
|
232 |
# make clean > /dev/null 2>&1 |
233 |
|
234 |
echo "" |
235 |
echo "Now type 'make', followed by 'make install' as root." |
236 |
echo "" |