fixed uninstall target, now using debug flag properly in qt
[jackctlmmc.git] / configure.ac
blob4af6e45ab79cd781eb1e8c950b9b9fe611cc24d5
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="debug"],[ac_debug="release"])
26 AC_SUBST(ac_debug)
28 # check if the user wants only jackctlmmc built
29 AC_ARG_ENABLE(cli_only,
30   AC_HELP_STRING([--enable-cli_only], [only build command line program jackctlmmc (default=no)]),
31   [AC_MSG_WARN([qjackmmc intentionally disabled.])
32   ac_build_qjackmmc="no"])
34 # check if the user wants only qjackmmc built
35 AC_ARG_ENABLE(gui_only,
36   AC_HELP_STRING([--enable-gui_only], [only build graphical program qjackmmc (default=no)]),
37   [AC_MSG_WARN([jackctlmmc intentionally disabled.])
38   ac_build_jackctlmmc="no"])
40 AC_PATH_PROG(PKG_CONFIG,pkg-config,no)
42 # Standard installation base dirs.
43 ac_with_paths="/usr /usr/local"
45 # Some a-la-debian alternatives...
46 for X in /usr/lib /usr/lib64 /usr/share; do
47   for Y in qt qt4; do
48     if test -d $X/$Y/bin; then
49       ac_with_paths="$ac_with_paths $X/$Y"
50     fi
51   done
52 done
54 # Set for alternate Qt installation dir.
55 AC_ARG_WITH(qt,
56   AC_HELP_STRING([--with-qt=PATH], [use alternate Qt install path]),
57   [ac_with_paths="$ac_with_paths $withval"])
59 # Set for alternate JACK installation dir.
60 AC_ARG_WITH(jack,
61   AC_HELP_STRING([--with-jack=PATH], [use alternate JACK install path]),
62   [ac_with_paths="$ac_with_paths $withval"])
64 # Set for alternate ALSA installation dir.
65 AC_ARG_WITH(alsa,
66   AC_HELP_STRING([--with-alsa=PATH], [use alternate ALSA install path]),
67   [ac_with_paths="$ac_with_paths $withval"])
69 # Set for alternate LASH installation dir.
70 AC_ARG_WITH(lash,
71   AC_HELP_STRING([--with-lash=PATH], [use alternate LASH install path]),
72   [ac_with_paths="$ac_with_paths $withval"])
74 # Checks for programs.
75 AC_PROG_CXX
76 AC_PROG_CC
77 AC_PROG_LN_S
78 AC_PROG_MAKE_SET
79 AC_PROG_INSTALL
81 # Checks for languages.
82 AC_LANG_C
83 AC_LANG_CPLUSPLUS
85 # Prepend alternate dependencies paths.
86 ac_path=$PATH
87 for X in $ac_with_paths; do
88   if test -d $X/bin; then
89     ac_path="$X/bin:$ac_path"
90   fi
91   if test -x $X/qmake; then
92     ac_path="$X:$ac_path"
93   fi
94   if test -d $X/lib64; then
95     ac_libs="-L$X/lib64 $ac_libs"
96   fi
97   if test -d $X/lib; then
98     ac_libs="-L$X/lib $ac_libs"
99   fi
100 done
103 PKG_PROG_PKG_CONFIG
105 # Check for JACK and ALSA libraries.
106 PKG_CHECK_MODULES([REQUIREDPKGS], [jack >= 0.99.0 alsa >= 1.0.0])
107 ac_cflags="$CFLAGS $REQUIREDPKGS_CFLAGS"
108 ac_libs="$ac_libs $REQUIREDPKGS_LIBS"
109 ac_pkgs="alsa jack"
111 # Check for proper Qt version.
112 PKG_CHECK_MODULES(QT_UP_TO_DATE, [QtCore >= 4.2], [], [ac_build_qjackmmc="no"])
114 # A common error message:
115 ac_errmsg="not found in current PATH. Maybe QT development environment isn't available (qt-devel). QJackMMC cannot be built."
117 # Check for Qt qmake utility.
118 AC_PATH_PROG(ac_qmake, qmake, [no], $ac_path)
119 if test "x$ac_qmake" = "xno"; then
120    AC_MSG_WARN([*** qmake $ac_errmsg])
121    ac_build_qjackmmc="no"
123 AC_SUBST(ac_qmake)
125 # Check for Qt moc utility.
126 AC_PATH_PROG(ac_moc, moc, [no], $ac_path)
127 if test "x$ac_moc" = "xno"; then
128    AC_MSG_WARN([*** moc $ac_errmsg])
129    ac_build_qjackmmc="no"
131 AC_SUBST(ac_moc)
133 # Check for Qt uic utility.
134 AC_PATH_PROG(ac_uic, uic, [no], $ac_path)
135 if test "x$ac_uic" = "xno"; then
136    AC_MSG_WARN([*** uic $ac_errmsg])
137    ac_build_qjackmmc="no"
139 AC_SUBST(ac_uic)
141 if test "x$ac_build_qjackmmc" = "xyes"; then
142    AC_DEFINE(ENABLE_QJACKMMC, 1, [Define if QJackMMC can be built.])
143    ac_libs="$ac_libs -lX11"
144 else
145    AC_DEFINE(ENABLE_QJACKMMC, 0, [Define if QJackMMC can be built.])
148 ac_default_deps=""
149 ac_default_install=""
151 if test "x$ac_build_jackctlmmc" = "xyes"; then
152    ac_default_deps="jackctlmmc"
153    ac_default_install="cli_install"
156 if test "x$ac_build_qjackmmc" = "xyes"; then
157    ac_default_deps="$ac_default_deps qjackmmc"
158    ac_default_install="$ac_default_install gui_install"
161 if test "x$ac_default_deps" = "x"; then
162    AC_MSG_ERROR([both jackctlmmc and qjackmmc have been disabled, either voluntarily or by missing dependencies, bailing out.])
165 AC_SUBST(ac_default_deps)
166 AC_SUBST(ac_default_install)
169 # Check for JACK headers.
170 AC_CHECK_HEADER(jack/jack.h, [ac_jack_h="yes"], [ac_jack_h="no"])
171 if test "x$ac_jack_h" = "xno"; then
172    AC_MSG_ERROR([JACK headers not found.])
175 # Check for ALSA headers and ultimately
176 # for ALSA/MIDI sequencer support.
177 if test "x$ac_alsa_seq" = "xyes"; then
178    AC_CHECK_HEADER(alsa/asoundlib.h, [ac_alsa_h="yes"], [ac_alsa_h="no"])
179    if test "x$ac_alsa_h" = "xyes"; then
180       AC_DEFINE(CONFIG_ALSA_SEQ, 1, [Define if ALSA/MIDI sequencer support is enabled.])
181    else
182       AC_MSG_ERROR([*** ALSA headers not found.])
183    fi
186 # check if the user wants LASH support
187 AC_ARG_ENABLE(lashsupport,
188   AC_HELP_STRING([--enable-lashsupport], [enable LASH support (default=yes)]),
189   [ac_lashsupport="$enableval"],
190   [ac_lashsupport="yes"])
192 PKG_CHECK_MODULES(LASH, lash-1.0 >= 0.5.0, have_lash="yes", have_lash="no")
193 if test "x$ac_lashsupport" = "xyes"; then
194    if test "$have_lash" = "yes"; then
195       AC_DEFINE(LASH_SUPPORT, 1, [Has lash.h])
196       ac_cflags="$ac_cflags $LASH_CFLAGS"
197       ac_libs="$ac_libs $LASH_LIBS"
198       ac_pkgs="$ac_pkgs lash-1.0"
199    else
200       AC_MSG_WARN([LASH not found, session support will not be built.])
201       AC_DEFINE(LASH_SUPPORT, 0, [Has lash.h])
202    fi
203    else
204       AC_MSG_WARN([LASH intentionally disabled.])
205       AC_DEFINE(LASH_SUPPORT, 0, [Has lash.h])
208 # export makefile variables
209 AC_SUBST(ac_libs)
210 AC_SUBST(ac_cflags)
211 AC_SUBST(ac_pkgs)
213 # Checks for library functions.
214 AC_CHECK_FUNCS(system)
216 # Checks for header files.
217 AC_CHECK_HEADERS([stdlib.h unistd.h])
219 # Checks for typedefs, structures, and compiler characteristics.
220 AC_HEADER_STDBOOL
221 AC_TYPE_SIZE_T
222 AC_TYPE_UINT32_T
223 AC_TYPE_UINT64_T
224 AC_TYPE_UINT8_T
226 # Checks for library functions.
227 AC_FUNC_ALLOCA
228 AC_FUNC_ERROR_AT_LINE
229 AC_CHECK_FUNCS([strtol])
231 AC_CONFIG_FILES([GNUmakefile qt/qjackmmc.desktop qt/src/src.pro])
232 AC_OUTPUT