]> git.donarmstrong.com Git - lilypond.git/blob - configure.ac
PO: update template.
[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 AC_ARG_WITH(urwotf-dir,
42     [AS_HELP_STRING([--with-urwotf-dir=DIR],
43                     [location of URW++ OTF fonts.])],
44     [URWOTF_DIR=$withval],
45     [URWOTF_DIR=""])
46
47 reloc_b=no
48 AC_ARG_ENABLE(relocation,
49     [AS_HELP_STRING([--enable-relocation],
50                     [compile with dynamic relocation.  Default: off])],
51     [reloc_b=$enableval])
52
53 rpath_b=no
54 AC_ARG_ENABLE(rpath,
55     [AS_HELP_STRING([--enable-rpath],
56                     [hardcode runtime library path.  Default: off])],
57     [rpath_b=$enableval])
58
59 LINK_GXX_STATICALLY=no
60 AC_ARG_ENABLE(static-gxx,
61     [AS_HELP_STRING([--enable-static-gxx],
62                     [link libstdc++.a statically.  Default: off])],
63     [LINK_GXX_STATICALLY=$enableval])
64 AC_SUBST(LINK_GXX_STATICALLY)
65
66 # must come before any header checks
67 STEPMAKE_COMPILE
68
69 AC_CHECK_PROG(FCLIST, fc-list, fc-list)
70 AC_MSG_CHECKING([for TeX Gyre fonts OTF files])
71 AC_SUBST(TEXGYRE_DIR)
72 AC_SUBST(TEXGYRE_FILES)
73 if test "$TEXGYRE_DIR" = ""; then
74   if test "$FCLIST" != ""; then
75     TEXGYRE_FILE=`$FCLIST "TeX Gyre Schola:fontformat=CFF" file | head -n 1`
76     if test "$TEXGYRE_FILE" != ""; then
77       TEXGYRE_FILE=`echo $TEXGYRE_FILE | sed 's/\(:.*\)$//g'`
78       TEXGYRE_FILE=`$PYTHON "$srcdir/scripts/auxiliar/readlink.py" $TEXGYRE_FILE`
79       TEXGYRE_DIR=`AS_DIRNAME($TEXGYRE_FILE)`
80     fi
81   fi
82 fi
83 if test "$TEXGYRE_DIR" != "" ;  then
84   for f in texgyreschola-regular.otf texgyreschola-italic.otf \
85            texgyreschola-bold.otf texgyreschola-bolditalic.otf \
86            texgyreheros-regular.otf texgyreheros-italic.otf \
87            texgyreheros-bold.otf texgyreheros-bolditalic.otf \
88            texgyrecursor-regular.otf texgyrecursor-italic.otf \
89            texgyrecursor-bold.otf texgyrecursor-bolditalic.otf; do
90     if test ! -f "$TEXGYRE_DIR/$f"; then
91       MISSING_TEXGYRE_FILES="$MISSING_TEXGYRE_FILES $f"
92     else
93       TEXGYRE_FILES="$TEXGYRE_FILES $f"
94     fi
95   done
96 fi
97 if test "$TEXGYRE_DIR" = "" -o "$MISSING_TEXGYRE_FILES" != ""; then
98   AC_MSG_RESULT(no)
99   STEPMAKE_ADD_ENTRY(REQUIRED,TeX Gyre fonts OTF)
100   if test "$TEXGYRE_DIR" = ""; then
101     if test "$FCLIST" = ""; then
102       STEPMAKE_ADD_ENTRY(REQUIRED,'(install the fc-list utility from FontConfig, or use --with-texgyre-dir)')
103     else
104       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)")
105     fi
106   else
107     STEPMAKE_ADD_ENTRY(REQUIRED,'(these files are missing: $MISSING_TEXGYRE_FILES)')
108   fi
109 else
110   AC_MSG_RESULT(yes)
111 fi
112 AC_MSG_CHECKING([for URW++ OTF files])
113 AC_SUBST(URWOTF_DIR)
114 AC_SUBST(URWOTF_FILES)
115 if test "$URWOTF_DIR" = ""; then
116   if test "$FCLIST" != ""; then
117     URWOTF_FILE=`$FCLIST "C059:fontformat=CFF" file | head -n 1`
118     if test "$URWOTF_FILE" != ""; then
119       URWOTF_FILE=`echo $URWOTF_FILE | sed 's/\(:.*\)$//g'`
120       URWOTF_FILE=`$PYTHON "$srcdir/scripts/auxiliar/readlink.py" $URWOTF_FILE`
121       URWOTF_DIR=`AS_DIRNAME($URWOTF_FILE)`
122     fi
123   fi
124 fi
125 if test "$URWOTF_DIR" != "" ;  then
126   for f in C059-BdIta.otf C059-Bold.otf \
127            C059-Italic.otf C059-Roman.otf \
128            NimbusMonoPS-Bold.otf NimbusMonoPS-BoldItalic.otf \
129            NimbusMonoPS-Italic.otf NimbusMonoPS-Regular.otf \
130            NimbusSans-Bold.otf NimbusSans-BoldOblique.otf \
131            NimbusSans-Oblique.otf NimbusSans-Regular.otf; do
132     if test ! -f "$URWOTF_DIR/$f"; then
133       MISSING_URWOTF_FILES="$MISSING_URWOTF_FILES $f"
134     else
135       URWOTF_FILES="$URWOTF_FILES $f"
136     fi
137   done
138 fi
139 if test "$URWOTF_DIR" = "" -o "$MISSING_URWOTF_FILES" != ""; then
140   AC_MSG_RESULT(no)
141   STEPMAKE_ADD_ENTRY(OPTIONAL,URW++ OTF fonts)
142   if test "$URWOTF_DIR" = ""; then
143     if test "$FCLIST" = ""; then
144       STEPMAKE_ADD_ENTRY(OPTIONAL,'(install the fc-list utility from FontConfig, or use --with-urwotf-dir)')
145     else
146       STEPMAKE_ADD_ENTRY(OPTIONAL,"(download OTF files from 'http://git.ghostscript.com/?p=urw-core35-fonts.git;a=commit;h=79bcdfb34fbce12b592cce389fa7a19da6b5b018' and put them under '~/.local/share/fonts' etc., or use --with-urwotf-dir)")
147     fi
148   else
149     STEPMAKE_ADD_ENTRY(OPTIONAL,'(these files are missing: $MISSING_URWOTF_FILES)')
150   fi
151 else
152   AC_MSG_RESULT(yes)
153 fi
154
155 AC_LANG([C++])
156
157 STEPMAKE_PYTHON(REQUIRED, 2.4, 3.0)
158 # this checks if we have GNU C by compiling a program with
159 # __GNUC__, but that macro now unofficially means "the compiler
160 # supports the GNU C extensions" -- the intel C compiler and clang
161 # both support __GNUC__!
162 STEPMAKE_GCC_OR_CLANG(REQUIRED, 3.4)
163
164 STEPMAKE_CXX(REQUIRED)
165 STEPMAKE_GXX_OR_CLANG(REQUIRED, 3.4)
166 STEPMAKE_GXXCODEGENBUG
167 STEPMAKE_CXXTEMPLATE
168 STEPMAKE_STL_DATA_METHOD
169 STEPMAKE_LIB(REQUIRED)
170 STEPMAKE_DLOPEN
171 # Do not use bison 1.50 and 1.75.
172 # 1.29 is required fr %locations, but I'm not sure it's enough --ns
173 STEPMAKE_BISON(REQUIRED, 1.29)
174 STEPMAKE_FLEX(REQUIRED)
175 STEPMAKE_FLEXLEXER(REQUIRED)
176 STEPMAKE_FLEXLEXER_LOCATION
177 STEPMAKE_LOCALE
178 STEPMAKE_GETTEXT
179 STEPMAKE_MSGFMT(REQUIRED)
180 STEPMAKE_TEXMF(REQUIRED)
181 STEPMAKE_TEXMF_DIRS(REQUIRED)
182 if test "$GUILEv2" = "yes"
183 then
184     STEPMAKE_GUILE_DEVEL(REQUIRED, 2.0.7, 2.2.0)
185 else
186     STEPMAKE_GUILE_DEVEL(REQUIRED, 1.8.2, 1.9.0)
187 fi
188
189 # check for 3 typedefs added in Guile 1.9
190 save_CXXFLAGS="$CXXFLAGS"
191 CXXFLAGS="$GUILE_CFLAGS $CXXFLAGS"
192 AC_CHECK_TYPES([scm_t_hash_fold_fn, scm_t_hash_handle_fn],
193                [AC_DEFINE(HAVE_GUILE_HASH_FUNC)], [],
194                [#include <libguile.h>])
195 AC_CHECK_TYPES([scm_t_subr],
196                [AC_DEFINE(HAVE_GUILE_SUBR_TYPE)], [],
197                [#include <libguile.h>])
198 CXXFLAGS="$save_CXXFLAGS"
199
200 ## Check for usable cxxabi
201 save_LIBS="$LIBS"
202 LIBS="$LIBS $CXXABI_LIBS"
203 AC_MSG_CHECKING(for usable C++ demangler)
204 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <cxxabi.h>],
205             [abi::__cxa_demangle ("", 0, 0, 0)])],
206     [AC_DEFINE(HAVE_CXA_DEMANGLE)
207         AC_MSG_RESULT(yes)],[
208         LIBS="$LIBS -lsupc++"
209         AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <cxxabi.h>],
210                     [abi::__cxa_demangle ("", 0, 0, 0)])],
211             [AC_DEFINE(HAVE_CXA_DEMANGLE)
212                 AC_MSG_RESULT([yes, using -lsupc++])
213                 CXXABI_LIBS="$CXXABI_LIBS -lsupc++"],
214             [AC_MSG_RESULT([no, use c++filt -t for manual demangling])])])
215 LIBS="$save_LIBS"
216 AC_SUBST(CXXABI_LIBS)
217
218 ## check rational bugfix.
219 save_CPPFLAGS="$CPPFLAGS"
220 CPPFLAGS="$GUILE_CFLAGS $CPPFLAGS"
221 AC_MSG_CHECKING(GUILE rational bugfix)
222 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <libguile.h>
223 #ifdef SCM_FRACTION_REDUCED_BIT
224 #error
225 #endif
226 ]])],[AC_MSG_RESULT(ok)],[REQUIRED="$REQUIRED GUILE-with-rational-bugfix"
227 AC_MSG_RESULT(Must have patched GUILE rational support. See INSTALL.txt)])
228 CPPFLAGS="$save_CPPFLAGS"
229
230
231 STEPMAKE_PYTHON_DEVEL(REQUIRED, 2.4, 3.0)
232
233 STEPMAKE_PATH_PROG(FONTFORGE, fontforge, REQUIRED, 20110222)
234
235 STEPMAKE_PATH_PROG(T1ASM, t1asm, REQUIRED)
236
237 AC_CHECK_HEADERS([assert.h grp.h libio.h pwd.h sys/stat.h wchar.h fpu_control.h])
238 AC_CHECK_HEADERS([sstream])
239 AC_HEADER_STAT
240 AC_FUNC_MEMCMP
241 AC_FUNC_VPRINTF
242 AC_CHECK_FUNCS([chroot fopencookie gettext isinf memmem snprintf vsnprintf])
243
244 STEPMAKE_PROGS(PKG_CONFIG, pkg-config, REQUIRED, 0.9.0)
245
246 AC_MSG_CHECKING(whether to enable dynamic relocation)
247 if test "$reloc_b" = "yes"; then
248     AC_DEFINE(ARGV0_RELOCATION)
249 fi
250 AC_MSG_RESULT($reloc_b)
251
252 AC_MSG_CHECKING(for rpath linkage)
253 if test "$rpath_b" = "yes"; then
254     LDFLAGS="$LDFLAGS -Wl,-rpath -Wl,\\\$\$ORIGIN/../lib"
255 elif test "$rpath_b" != "no"; then
256     LDFLAGS="$LDFLAGS -Wl,-rpath -Wl,$rpath_b"
257 fi
258 AC_MSG_RESULT($rpath_b)
259
260 HOST_ARCH=`$CC -dumpmachine`
261 AC_SUBST(HOST_ARCH)
262
263 STEPMAKE_PANGO_FT2(pangoft2, REQUIRED, 1.6.0)
264 STEPMAKE_FONTCONFIG(fontconfig, REQUIRED, 2.4.0)
265 STEPMAKE_FREETYPE2(freetype2, REQUIRED, 2.1.10)
266
267 STEPMAKE_WINDOWS
268
269 # guile executable for some scripts
270 STEPMAKE_GUILE(OPTIONAL, 1.8.2, 1.9.0)
271
272 # perl for help2man and for mf2pt1.pl
273 STEPMAKE_PERL(REQUIRED)
274
275 ## Optional tools for building documentation, website, extra fonts.
276 if test "$DOCUMENTATION" = "yes"; then
277   DOCUMENTATION_REQUIRED=REQUIRED
278 else
279   DOCUMENTATION_REQUIRED=OPTIONAL
280 fi
281
282 STEPMAKE_PATH_PROG(GHOSTSCRIPT, gs, $DOCUMENTATION_REQUIRED, 8.60)
283
284 AC_SUBST(GS920)
285 AC_SUBST(EXTRACTPDFMARK)
286 AC_SUBST(USE_EXTRACTPDFMARK)
287 STEPMAKE_PROGS(GS920, gs, OPTIONAL, 9.20)
288 STEPMAKE_PROGS(EXTRACTPDFMARK, extractpdfmark, OPTIONAL)
289 req=`STEPMAKE_NUMERIC_VERSION(9.20)`
290 USE_EXTRACTPDFMARK=yes
291 if test "$GS920_VERSION" -lt "$req"; then
292     GS920=
293     USE_EXTRACTPDFMARK=no
294 fi
295 if test "$EXTRACTPDFMARK" != "extractpdfmark"; then
296     EXTRACTPDFMARK=
297     USE_EXTRACTPDFMARK=no
298 fi
299 if test "$USE_EXTRACTPDFMARK" != "yes"; then
300     STEPMAKE_ADD_ENTRY(OPTIONAL,
301         ["(Optionally using Ghostscript >= 9.20 together with"])
302     STEPMAKE_ADD_ENTRY(OPTIONAL,
303         [" Extract PDFmark can significantly reduce the disk space required"])
304     STEPMAKE_ADD_ENTRY(OPTIONAL,
305         [" for building the documentation and the final PDF files.)"])
306 fi
307
308 STEPMAKE_PROGS(MAKEINFO, makeinfo, REQUIRED, 4.11)
309 STEPMAKE_PROGS(TEXI2HTML, texi2html, $DOCUMENTATION_REQUIRED, 1.82)
310 STEPMAKE_PROGS(DBLATEX, dblatex, $DOCUMENTATION_REQUIRED, 0.1.4)
311 STEPMAKE_PROGS(BIBTEX, bibtex, $DOCUMENTATION_REQUIRED)
312 STEPMAKE_PROGS(PDFLATEX, xelatex pdflatex, $DOCUMENTATION_REQUIRED)
313 if test "$PDFLATEX" = "xelatex"; then
314     STEPMAKE_PROGS(PDFTEX, xetex, $DOCUMENTATION_REQUIRED)
315     if test "$PDFTEX" = "xetex"; then
316         # For avoiding PDF destination name replacement.
317         PDFTEX=$ugh_ugh_autoconf250_builddir/scripts/build/out$CONFIGSUFFIX/xetex-with-options
318         PDFLATEX=$ugh_ugh_autoconf250_builddir/scripts/build/out$CONFIGSUFFIX/xelatex-with-options
319     fi
320 else
321     STEPMAKE_PROGS(PDFTEX, pdfetex pdftex etex, $DOCUMENTATION_REQUIRED)
322 fi
323 STEPMAKE_PROGS(TEXI2PDF, texi2pdf, $DOCUMENTATION_REQUIRED)
324 STEPMAKE_PROGS(TEXINDEX, texindex, $DOCUMENTATION_REQUIRED)
325 AC_MSG_CHECKING(for epsf.tex)
326 TEX_EPSF=`kpsewhich tex epsf`
327 if test "$TEX_EPSF" = ""; then
328     AC_MSG_RESULT(not found)
329     STEPMAKE_ADD_ENTRY($DOCUMENTATION_REQUIRED,epsf.tex)
330 else
331     AC_MSG_RESULT($TEX_EPSF)
332 fi
333 AC_MSG_CHECKING(for Cyrillic characters support in TeX)
334 TEX_FIKPARM=`kpsewhich -format=mf fikparm`
335 if test "$TEX_FIKPARM" = ""; then
336     AC_MSG_RESULT(not found)
337     STEPMAKE_ADD_ENTRY($DOCUMENTATION_REQUIRED,
338 ['lh CTAN package (texlive-lang-cyrillic or texlive-texmf-fonts)'])
339 else
340     AC_MSG_RESULT(yes)
341 fi
342 STEPMAKE_PROGS(NETPBM, pngtopnm, $DOCUMENTATION_REQUIRED)
343 STEPMAKE_PROGS(IMAGEMAGICK, convert, $DOCUMENTATION_REQUIRED)
344 # this name avoids a conflict with ZIP in stepmake/aclocal.m4
345 STEPMAKE_PROGS(ZIPDOC, zip, $DOCUMENTATION_REQUIRED)
346 STEPMAKE_PROGS(RSYNC, rsync, $DOCUMENTATION_REQUIRED)
347
348 AC_DEFINE_UNQUOTED(FLOWER_VERSION, "${FULL_FLOWER_VERSION}")
349
350 # must also have local.make if configure fails.
351 touch local.make
352
353 if test "$reloc_b$rpath_b" = "yesno"; then
354     STEPMAKE_WARN([Using --enable-relocation without --enable-rpath.  LilyPond may have trouble finding libraries.])
355 fi
356
357 # Gather requirements and generate output.
358 STEPMAKE_END
359
360 test -n "$CONFIGURATION" && mc=" conf=$CONFIGURATION" || mc=""
361
362 if make top-doc 1>/dev/null 2>&1; then
363     rm -f INSTALL.txt && ln Documentation/topdocs/out/INSTALL.txt .
364     rm -f README.txt && ln Documentation/topdocs/out/README.txt .
365 fi
366
367 cat <<EOF
368
369 Type:
370     make$mc all       to build LilyPond
371     make$mc install   to install LilyPond
372     make$mc help      to see all possible targets
373
374 Edit local.make for local Makefile overrides.
375
376
377 EOF