- added autoconf support, made lash optional, added desktop file
[jackctlmmc.git] / configure.ac
blob50b6d19cb7c37dd821760bee2709c5a080fe5c88
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_DEFINE(CONFIG_DEBUG, 1, [Define if debugging is enabled.]))
26 # check if the user wants only jackctlmmc built
27 AC_ARG_ENABLE(cli_only,
28   AC_HELP_STRING([--enable-cli_only], [only build command line program jackctlmmc (default=no)]),
29   [AC_MSG_WARN([qjackmmc intentionally disabled.])
30   ac_build_qjackmmc="no"])
32 # check if the user wants only qjackmmc built
33 AC_ARG_ENABLE(gui_only,
34   AC_HELP_STRING([--enable-gui_only], [only build graphical program qjackmmc (default=no)]),
35   [AC_MSG_WARN([jackctlmmc intentionally disabled.])
36   ac_build_jackctlmmc="no"])
38 AC_PATH_PROG(PKG_CONFIG,pkg-config,no)
40 # Standard installation base dirs.
41 ac_with_paths="/usr /usr/local"
43 # Some a-la-debian alternatives...
44 for X in /usr/lib /usr/lib64 /usr/share; do
45   for Y in qt qt4; do
46     if test -d $X/$Y/bin; then
47       ac_with_paths="$ac_with_paths $X/$Y"
48     fi
49   done
50 done
52 # Set for alternate Qt installation dir.
53 AC_ARG_WITH(qt,
54   AC_HELP_STRING([--with-qt=PATH], [use alternate Qt install path]),
55   [ac_with_paths="$ac_with_paths $withval"])
57 # Set for alternate JACK installation dir.
58 AC_ARG_WITH(jack,
59   AC_HELP_STRING([--with-jack=PATH], [use alternate JACK install path]),
60   [ac_with_paths="$ac_with_paths $withval"])
62 # Set for alternate ALSA installation dir.
63 AC_ARG_WITH(alsa,
64   AC_HELP_STRING([--with-alsa=PATH], [use alternate ALSA install path]),
65   [ac_with_paths="$ac_with_paths $withval"])
67 # Set for alternate LASH installation dir.
68 AC_ARG_WITH(lash,
69   AC_HELP_STRING([--with-lash=PATH], [use alternate LASH install path]),
70   [ac_with_paths="$ac_with_paths $withval"])
72 # Checks for programs.
73 AC_PROG_CXX
74 AC_PROG_CC
75 AC_PROG_LN_S
76 AC_PROG_MAKE_SET
77 AC_PROG_INSTALL
79 # Checks for languages.
80 AC_LANG_C
81 AC_LANG_CPLUSPLUS
83 # Prepend alternate dependencies paths.
84 ac_path=$PATH
85 for X in $ac_with_paths; do
86   if test -d $X/bin; then
87     ac_path="$X/bin:$ac_path"
88   fi
89   if test -x $X/qmake; then
90     ac_path="$X:$ac_path"
91   fi
92   if test -d $X/lib64; then
93     ac_libs="-L$X/lib64 $ac_libs"
94   fi
95   if test -d $X/lib; then
96     ac_libs="-L$X/lib $ac_libs"
97   fi
98 done
101 PKG_PROG_PKG_CONFIG
103 # Check for JACK and ALSA libraries.
104 PKG_CHECK_MODULES([REQUIREDPKGS], [jack >= 0.99.0 alsa >= 1.0.0])
105 ac_cflags="$CFLAGS $REQUIREDPKGS_CFLAGS"
106 ac_libs="$ac_libs $REQUIREDPKGS_LIBS"
107 ac_pkgs="alsa jack"
109 # Check for proper Qt version.
110 PKG_CHECK_MODULES(QT_UP_TO_DATE, [QtCore >= 4.2], [], [ac_build_qjackmmc="no"])
112 # A common error message:
113 ac_errmsg="not found in current PATH. Maybe QT development environment isn't available (qt-devel). QJackMMC cannot be built."
115 # Check for Qt qmake utility.
116 AC_PATH_PROG(ac_qmake, qmake, [no], $ac_path)
117 if test "x$ac_qmake" = "xno"; then
118    AC_MSG_WARN([*** qmake $ac_errmsg])
119    ac_build_qjackmmc="no"
121 AC_SUBST(ac_qmake)
123 # Check for Qt moc utility.
124 AC_PATH_PROG(ac_moc, moc, [no], $ac_path)
125 if test "x$ac_moc" = "xno"; then
126    AC_MSG_WARN([*** moc $ac_errmsg])
127    ac_build_qjackmmc="no"
129 AC_SUBST(ac_moc)
131 # Check for Qt uic utility.
132 AC_PATH_PROG(ac_uic, uic, [no], $ac_path)
133 if test "x$ac_uic" = "xno"; then
134    AC_MSG_WARN([*** uic $ac_errmsg])
135    ac_build_qjackmmc="no"
137 AC_SUBST(ac_uic)
139 if test "x$ac_build_qjackmmc" = "xyes"; then
140    AC_DEFINE(ENABLE_QJACKMMC, 1, [Define if QJackMMC can be built.])
141    ac_libs="$ac_libs -lX11"
142 else
143    AC_DEFINE(ENABLE_QJACKMMC, 0, [Define if QJackMMC can be built.])
146 ac_default_deps=""
147 ac_default_install=""
149 if test "x$ac_build_jackctlmmc" = "xyes"; then
150    ac_default_deps="jackctlmmc"
151    ac_default_install="cli_install"
154 if test "x$ac_build_qjackmmc" = "xyes"; then
155    ac_default_deps="$ac_default_deps qjackmmc"
156    ac_default_install="$ac_default_install gui_install"
159 if test "x$ac_default_deps" = "x"; then
160    AC_MSG_ERROR([both jackctlmmc and qjackmmc have been disabled, either voluntarily or by missing dependencies, bailing out.])
163 AC_SUBST(ac_default_deps)
164 AC_SUBST(ac_default_install)
167 # Check for JACK headers.
168 AC_CHECK_HEADER(jack/jack.h, [ac_jack_h="yes"], [ac_jack_h="no"])
169 if test "x$ac_jack_h" = "xno"; then
170    AC_MSG_ERROR([JACK headers not found.])
173 # Check for ALSA headers and ultimately
174 # for ALSA/MIDI sequencer support.
175 if test "x$ac_alsa_seq" = "xyes"; then
176    AC_CHECK_HEADER(alsa/asoundlib.h, [ac_alsa_h="yes"], [ac_alsa_h="no"])
177    if test "x$ac_alsa_h" = "xyes"; then
178       AC_DEFINE(CONFIG_ALSA_SEQ, 1, [Define if ALSA/MIDI sequencer support is enabled.])
179    else
180       AC_MSG_ERROR([*** ALSA headers not found.])
181    fi
184 # check if the user wants LASH support
185 AC_ARG_ENABLE(lashsupport,
186   AC_HELP_STRING([--enable-lashsupport], [enable LASH support (default=yes)]),
187   [ac_lashsupport="$enableval"],
188   [ac_lashsupport="yes"])
190 PKG_CHECK_MODULES(LASH, lash-1.0 >= 0.5.0, have_lash="yes", have_lash="no")
191 if test "x$ac_lashsupport" = "xyes"; then
192    if test "$have_lash" = "yes"; then
193       AC_DEFINE(LASH_SUPPORT, 1, [Has lash.h])
194       ac_cflags="$ac_cflags $LASH_CFLAGS"
195       ac_libs="$ac_libs $LASH_LIBS"
196       ac_pkgs="$ac_pkgs lash-1.0"
197    else
198       AC_MSG_WARN([LASH not found, session support will not be built.])
199       AC_DEFINE(LASH_SUPPORT, 0, [Has lash.h])
200    fi
201    else
202       AC_MSG_WARN([LASH intentionally disabled.])
203       AC_DEFINE(LASH_SUPPORT, 0, [Has lash.h])
206 # export makefile variables
207 AC_SUBST(ac_libs)
208 AC_SUBST(ac_cflags)
209 AC_SUBST(ac_pkgs)
211 # Checks for library functions.
212 AC_CHECK_FUNCS(system)
214 # Checks for header files.
215 AC_CHECK_HEADERS([stdlib.h unistd.h])
217 # Checks for typedefs, structures, and compiler characteristics.
218 AC_HEADER_STDBOOL
219 AC_TYPE_SIZE_T
220 AC_TYPE_UINT32_T
221 AC_TYPE_UINT64_T
222 AC_TYPE_UINT8_T
224 # Checks for library functions.
225 AC_FUNC_ALLOCA
226 AC_FUNC_ERROR_AT_LINE
227 AC_CHECK_FUNCS([strtol])
229 AC_CONFIG_FILES([GNUmakefile qt/qjackmmc.desktop qt/src/src.pro])
230 AC_OUTPUT