Merge branch 'master' of https://github.com/calf-studio-gear/calf
[calf.git] / configure.ac
blob155c0ab1bcdef2235a34a3b11dc702f371331e93
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.63)
5 AC_INIT([calf],[0.0.60],[wdev@foltman.com])
6 AC_CONFIG_SRCDIR([config.h.in])
7 AC_CONFIG_HEADER([config.h])
8 LT_INIT([dlopen])
9 LT_LANG([C++])
11 AM_INIT_AUTOMAKE(1.8)
13 if test "x$prefix" = "xNONE"; then 
14   prefix=$ac_default_prefix
17 # Checks for programs.
18 AC_PROG_INSTALL
20 ############################################################################################
21 # Set initial values of shell variables
22 LV2_GUI_ENABLED="no"
23 JACK_FOUND="no"
24 JACK_ENABLED="no"
25 OLD_JACK="no"
26 GUI_ENABLED="no"
27 LASH_ENABLED="no"
29 ############################################################################################
30 # Create configure substitutions for dependencies
32 AC_SUBST(GLIB_DEPS_CFLAGS)
33 AC_SUBST(GLIB_DEPS_LIBS)
34 AC_SUBST(GUI_DEPS_CFLAGS)
35 AC_SUBST(GUI_DEPS_LIBS)
36 AC_SUBST(JACK_DEPS_CFLAGS)
37 AC_SUBST(JACK_DEPS_LIBS)
38 AC_SUBST(FLUIDSYNTH_DEPS_CFLAGS)
39 AC_SUBST(FLUIDSYNTH_DEPS_LIBS)
40 AC_SUBST(LV2_DEPS_CFLAGS)
41 AC_SUBST(LV2_DEPS_LIBS)
43 ############################################################################################
44 # Detect dependencies
46 # Checks for libraries.
47 PKG_PROG_PKG_CONFIG
49 # Checks for header files.
50 AC_HEADER_STDC
51 AC_CHECK_HEADERS([memory.h stdint.h stdlib.h string.h time.h math.h])
53 AC_CHECK_HEADER(expat.h, true, AC_MSG_ERROR([Expat XML library not found]))
54 AC_CHECK_LIB(expat, XML_Parse, true, AC_MSG_ERROR([Expat XML library not found]))
56 # JACK
57 AC_CHECK_HEADERS([jack/jack.h], have_jack_header=yes, have_jack_header=no)
59 # GLib
60 PKG_CHECK_MODULES(GLIB_DEPS, glib-2.0 >= 2.0.0 gthread-2.0 >= 2.0.0, true, AC_MSG_ERROR([Calf requires glib2 and gthread2]))
62 # Fluidsynth
63 PKG_CHECK_MODULES(FLUIDSYNTH_DEPS, fluidsynth >= 1.0.7, true, AC_MSG_ERROR([fluidsynth library not found]))
65 # Sordi
66 AC_CHECK_PROG(SORDI_ENABLED, sordi, yes, no)
68 if test "$have_jack_header" = "yes"; then
69   PKG_CHECK_MODULES(JACK_DEPS, jack >= 0.103.0,
70     AC_CHECK_LIB([jack], [jack_port_register], JACK_FOUND="yes", ),)
73 if test "$JACK_FOUND" = "yes"; then
74   PKG_CHECK_MODULES(JACK_MIDI_DEPS, jack >= 0.105.0, OLD_JACK="no", OLD_JACK="yes")
77 PKG_CHECK_MODULES(LV2_DEPS, lv2core >= 6, LV2_FOUND="yes", LV2_FOUND="no")
79 PKG_CHECK_MODULES(LASH_DEPS, lash-1.0 >= 0.6.0,
80   AC_CHECK_LIB([lash], [lash_client_is_being_restored], LASH_0_6_FOUND="yes", LASH_0_6_FOUND="no"),
81   LASH_0_6_FOUND="no")
82 if test "$LASH_0_6_FOUND" = "yes"; then
83   LASH_FOUND="yes"
84 else
85   PKG_CHECK_MODULES(LASH_DEPS, lash-1.0 >= 0.5.2, LASH_FOUND="yes", LASH_FOUND="no")
87 PKG_CHECK_MODULES(SLV2_HACK, slv2 <= 0.6.1, SLV2_UNSUPPORTED="yes", SLV2_UNSUPPORTED="no")
89 ############################################################################################
90 # Assign initial values to feature control variables
92 LV2_ENABLED=$LV2_FOUND
93 LASH_ENABLED=$LASH_FOUND
95 if test "$JACK_FOUND" = "yes" -o "$LV2_FOUND" = "yes"; then
96   PKG_CHECK_MODULES(GUI_DEPS, gtk+-2.0 >= 2.12.0 cairo >= 1.2.0,
97     GUI_ENABLED="yes",
98     GUI_ENABLED="no (GTK+ 2.12 and cairo 1.2 or newer required)"
99   )
102 ############################################################################################
103 # Look for settings and installed libraries to determine what to compile/install/use
104 if test "$LV2_FOUND" = "yes"; then
105   AC_MSG_CHECKING([whether to allow LV2])
106   AC_ARG_WITH(lv2,
107     AC_HELP_STRING([--without-lv2],[disable LV2 interface]),
108       [if test "$withval" = "no"; then LV2_ENABLED="no"; fi],[])
109   AC_MSG_RESULT($LV2_ENABLED)
112 if test "$LASH_FOUND" = "yes"; then
113   AC_MSG_CHECKING([whether to allow LASH])
114   AC_ARG_WITH(lash,
115     AC_HELP_STRING([--without-lash],[disable LASH compatibility (GPL)]),
116       [if test "$withval" = "no"; then LASH_ENABLED="no"; fi],[])
117   AC_MSG_RESULT($LASH_ENABLED)
120 AC_MSG_CHECKING([whether to enable experimental/unfinished features])
121 AC_ARG_ENABLE(experimental,
122   AC_HELP_STRING([--enable-experimental],[enable unfinished features - not recommended!]),
123   [set_enable_experimental="$enableval"],
124   [set_enable_experimental="no"])
125 AC_MSG_RESULT($set_enable_experimental)
127 AC_MSG_CHECKING([whether to enable debugging mode])
128 AC_ARG_ENABLE(debug,
129   AC_HELP_STRING([--enable-debug],[enable debug mode - slow!]),
130   [set_enable_debug="$enableval"],
131   [set_enable_debug="no"])
132 AC_MSG_RESULT($set_enable_debug)
134 AC_MSG_CHECKING([whether to compile with SSE])
135 AC_ARG_ENABLE(sse,
136   AC_HELP_STRING([--enable-sse],[compile with SSE extensions]),
137   [set_enable_sse="$enableval"],
138   [set_enable_sse="no"])
139 AC_MSG_RESULT($set_enable_sse)
141 ############################################################################################
142 # Compute status shell variables
144 if test "$GUI_ENABLED" = "yes" -a "$JACK_FOUND" = "yes"; then
145   JACK_ENABLED="yes"
148 if test "$GUI_ENABLED" = "yes" -a "$LV2_ENABLED" = "yes"; then
149   LV2_GUI_ENABLED="yes"
152 if test "$set_enable_debug" = "yes"; then
153   CXXFLAGS="$CXXFLAGS -O0 -g -Wall"
154 else
155   # TODO: remove -finline options if clang is used
156   CXXFLAGS="$CXXFLAGS -O3 -finline-functions -finline-functions-called-once -Wall"
159 if test "$set_enable_sse" = "yes"; then
160   CXXFLAGS="$CXXFLAGS -msse -mfpmath=sse"
163 ############################################################################################
164 # Create automake conditional symbols
165 AM_CONDITIONAL(USE_JACK, test "$JACK_ENABLED" = "yes")
166 AM_CONDITIONAL(USE_LV2, test "$LV2_ENABLED" = "yes")
167 AM_CONDITIONAL(USE_GUI, test "$GUI_ENABLED" = "yes")
168 AM_CONDITIONAL(USE_LV2_GUI, test "$LV2_GUI_ENABLED" = "yes")
169 AM_CONDITIONAL(USE_LASH, test "$LASH_ENABLED" = "yes")
170 AM_CONDITIONAL(USE_LASH_0_6, test "$LASH_0_6_ENABLED" = "yes")
171 AM_CONDITIONAL(USE_DEBUG, test "$set_enable_debug" = "yes")
172 AM_CONDITIONAL(USE_SORDI, test "$SORDI_ENABLED" = "yes")
174 ############################################################################################
175 # Create autoconf symbols for config.h
176 if test "$LV2_ENABLED" = "yes"; then
177   AC_DEFINE(USE_LV2, 1, [LV2 wrapper will be built])
179 if test "$JACK_ENABLED" = "yes"; then
180   AC_DEFINE(USE_JACK, 1, [JACK I/O will be used])
182 if test "$OLD_JACK" = "yes"; then
183   AC_DEFINE(OLD_JACK, 1, [Old JACK version (with extra nframes argument) is to be used])
185 if test "$LASH_ENABLED" = "yes"; then
186   AC_DEFINE(USE_LASH, 1, "LASH Audio Session Handler client functionality is enabled")
187   if test "$LASH_0_6_FOUND" = "yes"; then
188     AC_DEFINE(USE_LASH_0_6, 1, "Unstable LASH API is enabled")
189   fi
191 if test "$LV2_GUI_ENABLED" = "yes"; then
192   AC_DEFINE(USE_LV2_GUI, 1, [GTK+ GUI executable will be used for LV2])
194 if test "$set_enable_experimental" = "yes"; then
195   AC_DEFINE([ENABLE_EXPERIMENTAL], [1], "Experimental features are enabled")
197 if test "$SORDI_ENABLED" = "yes"; then
198   AC_DEFINE(USE_SORDI, 1, "Sordi sanity checks are enabled")
200 ############################################################################################
201 # Output directories
202 if test "$LV2_ENABLED" == "yes"; then
203   AC_MSG_CHECKING(where to install LV2 plugins)
204   AC_ARG_WITH(lv2_dir,
205     AC_HELP_STRING([--with-lv2-dir],[install LV2 calf.lv2 bundle to DIR (default=$prefix/lib/lv2/)]),
206     ,
207     [with_lv2_dir="$prefix/lib/lv2/"])
208   AC_MSG_RESULT($with_lv2_dir)
209   AC_SUBST(with_lv2_dir)
212 ############################################################################################
214 # Other defines
215 AC_DEFINE_UNQUOTED(PKGLIBDIR,"$prefix/share/calf/",[Calf shared data directory (bitmaps, GUI XML etc.)])
216 AC_DEFINE_UNQUOTED(PKGDOCDIR,"$prefix/share/doc/calf/",[Calf documentation directory])
219 ############################################################################################
221 # BASH completion
223 AC_ARG_WITH([bash-completion-dir],
224     AS_HELP_STRING([--with-bash-completion-dir[=PATH]],
225         [Install the bash auto-completion script in this directory. @<:@default=yes@:>@]),
226     [],
227     [with_bash_completion_dir=yes])
228     
229 if test "x$with_bash_completion_dir" = "xyes"; then
230     PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0],
231         [BASH_COMPLETION_DIR="`pkg-config --variable=completionsdir bash-completion`"],
232         [BASH_COMPLETION_DIR="$datadir/bash-completion/completions"])
233 else
234     BASH_COMPLETION_DIR="$with_bash_completion_dir"
236 AC_SUBST([BASH_COMPLETION_DIR])
237 AM_CONDITIONAL([ENABLE_BASH_COMPLETION],[test "x$with_bash_completion_dir" != "xno"])
239 ############################################################################################
240 # Output files for configure step
241 AC_CONFIG_FILES([Makefile
242                  calf.desktop
243                  gui/Makefile
244                  gui/icons/LV2/Makefile
245                  icons/Makefile
246                  src/Makefile
247                  src/calf/Makefile])
249 ############################################################################################
250 # Configuration message
251 AC_MSG_RESULT([
252     Calf configured
254     Debug mode:                  $set_enable_debug
255     With SSE:                    $set_enable_sse
256     Experimental plugins:        $set_enable_experimental
257     Common GUI code:             $GUI_ENABLED
258     LV2 enabled:                 $LV2_ENABLED
259     LV2 GTK+ GUI enabled:        $LV2_GUI_ENABLED
260     JACK host enabled:           $JACK_ENABLED
261     LASH enabled:                $LASH_ENABLED])
262 if test "$LASH_ENABLED" = "yes"; then
263   AC_MSG_RESULT([    Unstable LASH API:           $LASH_0_6_FOUND])
265 AC_MSG_RESULT([    Old-style JACK MIDI:         $OLD_JACK
266     
267     Installation prefix:         $prefix
268     
271 if test "$SLV2_UNSUPPORTED" == "yes" -a "$LV2_ENABLED" == "yes"; then 
272     AC_MSG_RESULT([
273 WARNING:
274 An incompatible version of slv2 library has been found on this system.
276 Some features of Calf LV2 plugins (and other LV2 plugins) may not work
277 as expected in hosts that use currently installed version of libslv2.
279 Please upgrade to slv2 0.6.2 or newer version.
283 AC_OUTPUT