]> git.donarmstrong.com Git - lilypond.git/blob - configure.ac
0a753325d1eec6384b6c0972ae2d8330543bfdb6
[lilypond.git] / configure.ac
1 dnl configure.ac   -*-shell-script-*-
2 dnl Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ(2.60)
5
6 # Bootstrap the init process.
7 AC_INIT
8
9 # Bootstrap StepMake configure
10 AC_CONFIG_AUX_DIR([config])
11
12 STEPMAKE_INIT
13
14 # List a file that identifies your package.
15 AC_CONFIG_SRCDIR([lily/main.cc])
16
17 # Move to aclocal.m4?
18 AC_CONFIG_HEADERS([$CONFIGFILE.hh:config.hh.in])
19
20 # Uncomment the configuration options your package needs.
21
22 DOCUMENTATION=yes
23 AC_ARG_ENABLE(documentation,
24     [AS_HELP_STRING([--enable-documentation],
25                     [build Documentation.  Default: on])],
26     [DOCUMENTATION=$enableval])
27 AC_SUBST(DOCUMENTATION)
28
29 GUILEv2=no
30 AC_ARG_ENABLE(guile2,
31     [AS_HELP_STRING([--enable-guile2],
32                     [highly experimental GUILE 2 support.  Default: off])],
33     [GUILEv2=$enableval])
34
35 AC_ARG_WITH(texgyre-dir,
36     [AS_HELP_STRING([--with-texgyre-dir=DIR],
37                     [location of TeX Gyre fonts.])],
38     [TEXGYRE_DIR=$withval],
39     [TEXGYRE_DIR=""])
40
41 reloc_b=no
42 AC_ARG_ENABLE(relocation,
43     [AS_HELP_STRING([--enable-relocation],
44                     [compile with dynamic relocation.  Default: off])],
45     [reloc_b=$enableval])
46
47 rpath_b=no
48 AC_ARG_ENABLE(rpath,
49     [AS_HELP_STRING([--enable-rpath],
50                     [hardcode runtime library path.  Default: off])],
51     [rpath_b=$enableval])
52
53 LINK_GXX_STATICALLY=no
54 AC_ARG_ENABLE(static-gxx,
55     [AS_HELP_STRING([--enable-static-gxx],
56                     [link libstdc++.a statically.  Default: off])],
57     [LINK_GXX_STATICALLY=$enableval])
58 AC_SUBST(LINK_GXX_STATICALLY)
59
60 # must come before any header checks
61 STEPMAKE_COMPILE
62
63 AC_CHECK_PROG(FCLIST, fc-list, fc-list)
64 AC_MSG_CHECKING([for TeX Gyre fonts OTF files])
65 AC_SUBST(TEXGYRE_DIR)
66 AC_SUBST(TEXGYRE_FILES)
67 if test "$TEXGYRE_DIR" = ""; then
68   if test "$FCLIST" != ""; then
69     TEXGYRE_FILE=`$FCLIST "TeX Gyre Schola:fontformat=CFF" file | head -n 1`
70     if test "$TEXGYRE_FILE" != ""; then
71       TEXGYRE_FILE=`echo $TEXGYRE_FILE | sed 's/\(:.*\)$//g'`
72       TEXGYRE_FILE=`$PYTHON "$srcdir/scripts/auxiliar/readlink.py" $TEXGYRE_FILE`
73       TEXGYRE_DIR=`AS_DIRNAME($TEXGYRE_FILE)`
74     fi
75   fi
76 fi
77 if test "$TEXGYRE_DIR" != "" ;  then
78   for f in texgyreschola-regular.otf texgyreschola-italic.otf \
79            texgyreschola-bold.otf texgyreschola-bolditalic.otf \
80            texgyreheros-regular.otf texgyreheros-italic.otf \
81            texgyreheros-bold.otf texgyreheros-bolditalic.otf \
82            texgyrecursor-regular.otf texgyrecursor-italic.otf \
83            texgyrecursor-bold.otf texgyrecursor-bolditalic.otf; do
84     if test ! -f "$TEXGYRE_DIR/$f"; then
85       MISSING_TEXGYRE_FILES="$MISSING_TEXGYRE_FILES $f"
86     else
87       TEXGYRE_FILES="$TEXGYRE_FILES $f"
88     fi
89   done
90 fi
91 if test "$TEXGYRE_DIR" = "" -o "$MISSING_TEXGYRE_FILES" != ""; then
92   AC_MSG_RESULT(no)
93   STEPMAKE_ADD_ENTRY(REQUIRED,TeX Gyre fonts OTF)
94   if test "$TEXGYRE_DIR" = ""; then
95     if test "$FCLIST" = ""; then
96       STEPMAKE_ADD_ENTRY(REQUIRED,'(install the fc-list utility from FontConfig, or use --with-texgyre-dir)')
97     else
98       STEPMAKE_ADD_ENTRY(REQUIRED,"(make sure the fc-list utility can see them, e.g. 'sudo apt-get install fonts-texgyre', or use --with-texgyre-dir)")
99     fi
100   else
101     STEPMAKE_ADD_ENTRY(REQUIRED,'(these files are missing: $MISSING_TEXGYRE_FILES)')
102   fi
103 else
104   AC_MSG_RESULT(yes)
105 fi
106
107 AC_LANG([C++])
108
109 STEPMAKE_PYTHON(REQUIRED, 2.4, 3.0)
110 # this checks if we have GNU C by compiling a program with
111 # __GNUC__, but that macro now unofficially means "the compiler
112 # supports the GNU C extensions" -- the intel C compiler and clang
113 # both support __GNUC__!
114 STEPMAKE_GCC_OR_CLANG(REQUIRED, 3.4)
115
116 STEPMAKE_CXX(REQUIRED)
117 STEPMAKE_GXX_OR_CLANG(REQUIRED, 3.4)
118 STEPMAKE_GXXCODEGENBUG
119 STEPMAKE_CXXTEMPLATE
120 STEPMAKE_STL_DATA_METHOD
121 STEPMAKE_LIB(REQUIRED)
122 STEPMAKE_DLOPEN
123 # Do not use bison 1.50 and 1.75.
124 # 1.29 is required fr %locations, but I'm not sure it's enough --ns
125 STEPMAKE_BISON(REQUIRED, 1.29)
126 STEPMAKE_FLEX(REQUIRED)
127 STEPMAKE_FLEXLEXER(REQUIRED)
128 STEPMAKE_FLEXLEXER_LOCATION
129 STEPMAKE_LOCALE
130 STEPMAKE_GETTEXT
131 STEPMAKE_MSGFMT(REQUIRED)
132 STEPMAKE_TEXMF(REQUIRED)
133 STEPMAKE_TEXMF_DIRS(REQUIRED)
134 if test "$GUILEv2" = "yes"
135 then
136     STEPMAKE_GUILE_DEVEL(REQUIRED, 2.0.7, 2.2.0)
137 else
138     STEPMAKE_GUILE_DEVEL(REQUIRED, 1.8.2, 1.9.0)
139 fi
140
141 # check for 3 typedefs added in Guile 1.9
142 save_CXXFLAGS="$CXXFLAGS"
143 CXXFLAGS="$GUILE_CFLAGS $CXXFLAGS"
144 AC_CHECK_TYPES([scm_t_hash_fold_fn, scm_t_hash_handle_fn],
145                [AC_DEFINE(HAVE_GUILE_HASH_FUNC)], [],
146                [#include <libguile.h>])
147 AC_CHECK_TYPES([scm_t_subr],
148                [AC_DEFINE(HAVE_GUILE_SUBR_TYPE)], [],
149                [#include <libguile.h>])
150 CXXFLAGS="$save_CXXFLAGS"
151
152 ## Check for usable cxxabi
153 save_LIBS="$LIBS"
154 LIBS="$LIBS $CXXABI_LIBS"
155 AC_MSG_CHECKING(for usable C++ demangler)
156 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <cxxabi.h>],
157             [abi::__cxa_demangle ("", 0, 0, 0)])],
158     [AC_DEFINE(HAVE_CXA_DEMANGLE)
159         AC_MSG_RESULT(yes)],[
160         LIBS="$LIBS -lsupc++"
161         AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <cxxabi.h>],
162                     [abi::__cxa_demangle ("", 0, 0, 0)])],
163             [AC_DEFINE(HAVE_CXA_DEMANGLE)
164                 AC_MSG_RESULT([yes, using -lsupc++])
165                 CXXABI_LIBS="$CXXABI_LIBS -lsupc++"],
166             [AC_MSG_RESULT([no, use c++filt -t for manual demangling])])])
167 LIBS="$save_LIBS"
168 AC_SUBST(CXXABI_LIBS)
169
170 ## check rational bugfix.
171 save_CPPFLAGS="$CPPFLAGS"
172 CPPFLAGS="$GUILE_CFLAGS $CPPFLAGS"
173 AC_MSG_CHECKING(GUILE rational bugfix)
174 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <libguile.h>
175 #ifdef SCM_FRACTION_REDUCED_BIT
176 #error
177 #endif
178 ]])],[AC_MSG_RESULT(ok)],[REQUIRED="$REQUIRED GUILE-with-rational-bugfix"
179 AC_MSG_RESULT(Must have patched GUILE rational support. See INSTALL.txt)])
180 CPPFLAGS="$save_CPPFLAGS"
181
182
183 STEPMAKE_PYTHON_DEVEL(REQUIRED, 2.4, 3.0)
184
185 STEPMAKE_PATH_PROG(FONTFORGE, fontforge, REQUIRED, 20110222)
186
187 STEPMAKE_PATH_PROG(T1ASM, t1asm, REQUIRED)
188
189 AC_CHECK_HEADERS([assert.h grp.h libio.h pwd.h sys/stat.h wchar.h fpu_control.h])
190 AC_CHECK_HEADERS([sstream])
191 AC_HEADER_STAT
192 AC_FUNC_MEMCMP
193 AC_FUNC_VPRINTF
194 AC_CHECK_FUNCS([chroot fopencookie gettext isinf memmem snprintf vsnprintf])
195
196 STEPMAKE_PROGS(PKG_CONFIG, pkg-config, REQUIRED, 0.9.0)
197
198 AC_MSG_CHECKING(whether to enable dynamic relocation)
199 if test "$reloc_b" = "yes"; then
200     AC_DEFINE(ARGV0_RELOCATION)
201 fi
202 AC_MSG_RESULT($reloc_b)
203
204 AC_MSG_CHECKING(for rpath linkage)
205 if test "$rpath_b" = "yes"; then
206     LDFLAGS="$LDFLAGS -Wl,-rpath -Wl,\\\$\$ORIGIN/../lib"
207 elif test "$rpath_b" != "no"; then
208     LDFLAGS="$LDFLAGS -Wl,-rpath -Wl,$rpath_b"
209 fi
210 AC_MSG_RESULT($rpath_b)
211
212 HOST_ARCH=`$CC -dumpmachine`
213 AC_SUBST(HOST_ARCH)
214
215 STEPMAKE_PANGO_FT2(pangoft2, REQUIRED, 1.6.0)
216 STEPMAKE_FONTCONFIG(fontconfig, REQUIRED, 2.4.0)
217 STEPMAKE_FREETYPE2(freetype2, REQUIRED, 2.1.10)
218
219 STEPMAKE_WINDOWS
220
221 # guile executable for some scripts
222 STEPMAKE_GUILE(OPTIONAL, 1.8.2, 1.9.0)
223
224 # perl for help2man and for mf2pt1.pl
225 STEPMAKE_PERL(REQUIRED)
226
227 ## Optional tools for building documentation, website, extra fonts.
228 if test "$DOCUMENTATION" = "yes"; then
229   DOCUMENTATION_REQUIRED=REQUIRED
230 else
231   DOCUMENTATION_REQUIRED=OPTIONAL
232 fi
233
234 STEPMAKE_PATH_PROG(GHOSTSCRIPT, gs, $DOCUMENTATION_REQUIRED, 8.60)
235
236 STEPMAKE_PROGS(MAKEINFO, makeinfo, REQUIRED, 4.11)
237 STEPMAKE_PROGS(TEXI2HTML, texi2html, $DOCUMENTATION_REQUIRED, 1.82)
238 STEPMAKE_PROGS(DBLATEX, dblatex, $DOCUMENTATION_REQUIRED, 0.1.4)
239 STEPMAKE_PROGS(BIBTEX, bibtex, $DOCUMENTATION_REQUIRED)
240 STEPMAKE_PROGS(PDFLATEX, xelatex pdflatex, $DOCUMENTATION_REQUIRED)
241 if test "$PDFLATEX" = "xelatex"; then
242     STEPMAKE_PROGS(PDFTEX, xetex, $DOCUMENTATION_REQUIRED)
243     if test "$PDFTEX" = "xetex"; then
244         # For avoiding PDF destination name replacement.
245         PDFTEX=$ugh_ugh_autoconf250_builddir/scripts/build/out$CONFIGSUFFIX/xetex-with-options
246     fi
247 else
248     STEPMAKE_PROGS(PDFTEX, pdfetex pdftex etex, $DOCUMENTATION_REQUIRED)
249 fi
250 STEPMAKE_PROGS(TEXI2PDF, texi2pdf, $DOCUMENTATION_REQUIRED)
251 STEPMAKE_PROGS(TEXINDEX, texindex, $DOCUMENTATION_REQUIRED)
252 AC_MSG_CHECKING(for epsf.tex)
253 TEX_EPSF=`kpsewhich tex epsf`
254 if test "$TEX_EPSF" = ""; then
255     AC_MSG_RESULT(not found)
256     STEPMAKE_ADD_ENTRY($DOCUMENTATION_REQUIRED,epsf.tex)
257 else
258     AC_MSG_RESULT($TEX_EPSF)
259 fi
260 AC_MSG_CHECKING(for Cyrillic characters support in TeX)
261 TEX_FIKPARM=`kpsewhich -format=mf fikparm`
262 if test "$TEX_FIKPARM" = ""; then
263     AC_MSG_RESULT(not found)
264     STEPMAKE_ADD_ENTRY($DOCUMENTATION_REQUIRED,
265 ['lh CTAN package (texlive-lang-cyrillic or texlive-texmf-fonts)'])
266 else
267     AC_MSG_RESULT(yes)
268 fi
269 STEPMAKE_PROGS(NETPBM, pngtopnm, $DOCUMENTATION_REQUIRED)
270 STEPMAKE_PROGS(IMAGEMAGICK, convert, $DOCUMENTATION_REQUIRED)
271 # this name avoids a conflict with ZIP in stepmake/aclocal.m4
272 STEPMAKE_PROGS(ZIPDOC, zip, $DOCUMENTATION_REQUIRED)
273 STEPMAKE_PROGS(RSYNC, rsync, $DOCUMENTATION_REQUIRED)
274
275 AC_DEFINE_UNQUOTED(FLOWER_VERSION, "${FULL_FLOWER_VERSION}")
276
277 # must also have local.make if configure fails.
278 touch local.make
279
280 if test "$reloc_b$rpath_b" = "yesno"; then
281     STEPMAKE_WARN([Using --enable-relocation without --enable-rpath.  LilyPond may have trouble finding libraries.])
282 fi
283
284 # Gather requirements and generate output.
285 STEPMAKE_END
286
287 test -n "$CONFIGURATION" && mc=" conf=$CONFIGURATION" || mc=""
288
289 if make top-doc 1>/dev/null 2>&1; then
290     rm -f INSTALL.txt && ln Documentation/topdocs/out/INSTALL.txt .
291     rm -f README.txt && ln Documentation/topdocs/out/README.txt .
292 fi
293
294 cat <<EOF
295
296 Type:
297     make$mc all       to build LilyPond
298     make$mc install   to install LilyPond
299     make$mc help      to see all possible targets
300
301 Edit local.make for local Makefile overrides.
302
303
304 EOF