fixed install targets
[jackctlmmc.git] / configure.ac
blob60fc81fbce7827de8ba2dacaf978c4db034c997f
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ([2.68])
5 AC_INIT(QjackMMC, 4, apmontgo@users.sourceforge.net, qjackmmc)
6 AC_CONFIG_SRCDIR([main.c])
7 AC_CONFIG_HEADERS([config.h])
9 AC_PREFIX_DEFAULT(/usr/local)
10 ac_prefix=$prefix
11 if test "x$ac_prefix" = "xNONE"; then
12     ac_prefix=$ac_default_prefix
14 AC_SUBST(ac_prefix)
15 AC_DEFINE_UNQUOTED(CONFIG_PREFIX, ["$ac_prefix"], [Default installation prefix.])
17 ac_cflags="$ac_cflags -Wall"
18 ac_build_jackctlmmc="yes"
19 ac_build_qjackmmc="yes"
21 # Enable debugging argument option.
22 AC_ARG_ENABLE(debug,
23   AC_HELP_STRING([--enable-debug], [enable debugging (default=no)]),
24   [ac_debug="$enableval"])
26 if test "x$ac_debug" = "xyes"; then
27    ac_debug="debug"
28 else
29    ac_debug="release"
32 AC_SUBST(ac_debug)
34 # check if the user wants QJackMMC built
35 AC_ARG_ENABLE(gui,
36   AC_HELP_STRING([--enable-gui], [build the gui program qjackmmc (default=yes)]),
37   [ac_build_qjackmmc="$enableval"],
38   [ac_build_qjackmmc="yes"])
40 # check if the user wants jackctlmmc built
41 AC_ARG_ENABLE(cli,
42   AC_HELP_STRING([--enable-cli], [build the command line program jackctlmmc (default=no)]),
43   [ac_build_jackctlmmc="$enableval"],
44   [ac_build_jackctlmmc="yes"])
46 AC_PATH_PROG(PKG_CONFIG,pkg-config,no)
48 # Standard installation base dirs.
49 ac_with_paths="/usr /usr/local"
51 # Some a-la-debian alternatives...
52 for X in /usr/lib /usr/lib64 /usr/share; do
53   for Y in qt qt4; do
54     if test -d $X/$Y/bin; then
55       ac_with_paths="$ac_with_paths $X/$Y"
56     fi
57   done
58 done
60 # Set for alternate Qt installation dir.
61 AC_ARG_WITH(qt,
62   AC_HELP_STRING([--with-qt=PATH], [use alternate Qt install path]),
63   [ac_with_paths="$ac_with_paths $withval"])
65 # Set for alternate JACK installation dir.
66 AC_ARG_WITH(jack,
67   AC_HELP_STRING([--with-jack=PATH], [use alternate JACK install path]),
68   [ac_with_paths="$ac_with_paths $withval"])
70 # Set for alternate ALSA installation dir.
71 AC_ARG_WITH(alsa,
72   AC_HELP_STRING([--with-alsa=PATH], [use alternate ALSA install path]),
73   [ac_with_paths="$ac_with_paths $withval"])
75 # Set for alternate LASH installation dir.
76 AC_ARG_WITH(lash,
77   AC_HELP_STRING([--with-lash=PATH], [use alternate LASH install path]),
78   [ac_with_paths="$ac_with_paths $withval"])
80 # Checks for programs.
81 AC_PROG_CXX
82 AC_PROG_CC
83 AC_PROG_LN_S
84 AC_PROG_MAKE_SET
85 AC_PROG_INSTALL
87 # Checks for languages.
88 AC_LANG_C
89 AC_LANG_CPLUSPLUS
91 # Prepend alternate dependencies paths.
92 ac_path=$PATH
93 for X in $ac_with_paths; do
94   if test -d $X/bin; then
95     ac_path="$X/bin:$ac_path"
96   fi
97   if test -x $X/qmake; then
98     ac_path="$X:$ac_path"
99   fi
100   if test -d $X/lib64; then
101     ac_libs="-L$X/lib64 $ac_libs"
102   fi
103   if test -d $X/lib; then
104     ac_libs="-L$X/lib $ac_libs"
105   fi
106 done
109 PKG_PROG_PKG_CONFIG
111 # Check for JACK and ALSA libraries.
112 PKG_CHECK_MODULES([REQUIREDPKGS], [jack >= 0.99.0 alsa >= 1.0.0])
113 ac_cflags="$CFLAGS $REQUIREDPKGS_CFLAGS"
114 ac_libs="$ac_libs $REQUIREDPKGS_LIBS"
115 ac_pkgs="alsa jack"
117 # Check for proper Qt version.
118 PKG_CHECK_MODULES(QT_UP_TO_DATE, [QtCore >= 4.2], [], [ac_build_qjackmmc="no"])
120 # A common error message:
121 ac_errmsg="not found in current PATH. Maybe QT development environment isn't available (qt-devel). QJackMMC cannot be built."
123 # Check for Qt qmake utility.
124 AC_PATH_PROG(ac_qmake, qmake, [no], $ac_path)
125 if test "x$ac_qmake" = "xno"; then
126    AC_MSG_WARN([*** qmake $ac_errmsg])
127    ac_build_qjackmmc="no"
129 AC_SUBST(ac_qmake)
131 # Check for Qt moc utility.
132 AC_PATH_PROG(ac_moc, moc, [no], $ac_path)
133 if test "x$ac_moc" = "xno"; then
134    AC_MSG_WARN([*** moc $ac_errmsg])
135    ac_build_qjackmmc="no"
137 AC_SUBST(ac_moc)
139 # Check for Qt uic utility.
140 AC_PATH_PROG(ac_uic, uic, [no], $ac_path)
141 if test "x$ac_uic" = "xno"; then
142    AC_MSG_WARN([*** uic $ac_errmsg])
143    ac_build_qjackmmc="no"
145 AC_SUBST(ac_uic)
147 if test "x$ac_build_qjackmmc" = "xyes"; then
148    AC_DEFINE(ENABLE_QJACKMMC, 1, [Define if QJackMMC can be built.])
149    ac_libs="$ac_libs -lX11"
150 else
151    AC_DEFINE(ENABLE_QJACKMMC, 0, [Define if QJackMMC can be built.])
154 ac_default_deps=""
155 ac_default_install=""
156 ac_default_uninstall=""
158 if test "x$ac_build_jackctlmmc" = "xyes"; then
159    ac_default_deps="jackctlmmc"
160    ac_default_install="cli_install"
161    ac_default_uninstall="cli_uninstall"
164 if test "x$ac_build_qjackmmc" = "xyes"; then
165    ac_default_deps="$ac_default_deps qjackmmc"
166    ac_default_install="$ac_default_install gui_install"
167    ac_default_uninstall="$ac_default_uninstall gui_uninstall"
170 if test "x$ac_default_deps" = "x"; then
171    AC_MSG_ERROR([both jackctlmmc and qjackmmc have been disabled, either voluntarily or by missing dependencies, bailing out.])
174 AC_SUBST(ac_default_deps)
175 AC_SUBST(ac_default_install)
176 AC_SUBST(ac_default_uninstall)
179 # Check for JACK headers.
180 AC_CHECK_HEADER(jack/jack.h, [ac_jack_h="yes"], [ac_jack_h="no"])
181 if test "x$ac_jack_h" = "xno"; then
182    AC_MSG_ERROR([JACK headers not found.])
185 # Check for ALSA headers and ultimately
186 # for ALSA/MIDI sequencer support.
187 if test "x$ac_alsa_seq" = "xyes"; then
188    AC_CHECK_HEADER(alsa/asoundlib.h, [ac_alsa_h="yes"], [ac_alsa_h="no"])
189    if test "x$ac_alsa_h" = "xyes"; then
190       AC_DEFINE(CONFIG_ALSA_SEQ, 1, [Define if ALSA/MIDI sequencer support is enabled.])
191    else
192       AC_MSG_ERROR([*** ALSA headers not found.])
193    fi
196 # check if the user wants LASH support
197 AC_ARG_ENABLE(lash_support,
198   AC_HELP_STRING([--enable-lash_support], [enable LASH support (default=yes)]),
199   [ac_lashsupport="$enableval"],
200   [ac_lashsupport="yes"])
202 # check if the user wants JACK midi support
203 AC_ARG_ENABLE(jack_midi,
204   AC_HELP_STRING([--enable-jack_midi], [enable JACK MIDI support (default=yes)]),
205   [ac_jack_midi="$enableval"],
206   [ac_jack_midi="yes"])
208 # Check for JACK MIDI headers availability.
209 if test "x$ac_jack_midi" = "xyes"; then
210    AC_CHECK_HEADER(jack/midiport.h, [ac_jack_midi="yes"], [ac_jack_midi="no"])
211    if test "x$ac_jack_midi" = "xyes"; then
212       AC_DEFINE(JACK_MIDI_SUPPORT, 1, [Define if JACK MIDI support is available.])
213    else
214       AC_DEFINE(JACK_MIDI_SUPPORT, 0, [Define if JACK MIDI support is available.])
215       AC_MSG_WARN([*** jack/midiport.h file not found.])
216       AC_MSG_WARN([*** JACK 0.103.0 or later may be required.])
217       AC_MSG_WARN([*** JACK MIDI support will be disabled.])
218    fi
219 else
220    AC_DEFINE(JACK_MIDI_SUPPORT, 0, [Define if JACK MIDI support is available.])
223 PKG_CHECK_MODULES(LASH, lash-1.0 >= 0.5.0, have_lash="yes", have_lash="no")
224 if test "x$ac_lashsupport" = "xyes"; then
225    if test "$have_lash" = "yes"; then
226       AC_DEFINE(LASH_SUPPORT, 1, [Has lash.h])
227       ac_cflags="$ac_cflags $LASH_CFLAGS"
228       ac_libs="$ac_libs $LASH_LIBS"
229       ac_pkgs="$ac_pkgs lash-1.0"
230    else
231       AC_MSG_WARN([LASH not found, session support will not be built.])
232       AC_DEFINE(LASH_SUPPORT, 0, [Has lash.h])
233    fi
234    else
235       AC_MSG_WARN([LASH intentionally disabled.])
236       AC_DEFINE(LASH_SUPPORT, 0, [Has lash.h])
239 # export makefile variables
240 AC_SUBST(ac_libs)
241 AC_SUBST(ac_cflags)
242 AC_SUBST(ac_pkgs)
244 # Checks for library functions.
245 AC_CHECK_FUNCS(system)
247 # Checks for header files.
248 AC_CHECK_HEADERS([stdlib.h unistd.h])
250 # Checks for typedefs, structures, and compiler characteristics.
251 AC_HEADER_STDBOOL
252 AC_TYPE_SIZE_T
253 AC_TYPE_UINT32_T
254 AC_TYPE_UINT64_T
255 AC_TYPE_UINT8_T
257 # Checks for library functions.
258 AC_FUNC_ALLOCA
259 AC_FUNC_ERROR_AT_LINE
260 AC_CHECK_FUNCS([strtol])
262 AC_CONFIG_FILES([GNUmakefile qt/qjackmmc.desktop qt/src/src.pro])
263 AC_OUTPUT