]> git.donarmstrong.com Git - lilypond.git/blob - configure.in
release: 0.0.68pre
[lilypond.git] / configure.in
1 dnl -*-shell-script-*-
2 dnl  Process this file with autoconf to produce a configure script. 
3
4 dnl should cache result.
5 dnl should  look in $prefix first.
6
7 AC_DEFUN(AC_TEX_PREFIX, [
8     
9
10     AC_MSG_CHECKING(TeX/MF root dir directory)    
11
12     find_root_prefix="$prefix"
13     
14
15     test "x$find_root_prefix" = xNONE && find_root_prefix="$ac_default_prefix"
16     find_texpostfix="";
17     for postfix in "/lib/tex/" "/lib/texmf" "/lib" "/tex" "/texmf"; do
18         find_texprefix="$find_root_prefix$postfix"
19         if test -d $find_texprefix; then
20             find_texpostfix=$postfix
21             break;
22         fi
23     done
24     
25     if test "x$find_texpostfix" = x; then
26         find_texpostfix='/lib/texmf/tex'
27         AC_MSG_WARN(Cannot determine the TeX-directory. Please use --enable-tex-prefix)
28     fi
29
30     find_texprefix="$find_root_prefix/$find_texpostfix"
31
32     # only assign if variablename not empty
33     if test x != "x$1"; then
34         $1='${prefix}'/"$find_texpostfix"
35     fi
36     AC_MSG_RESULT($find_texprefix)
37
38 ])
39  
40
41 # find a directory inside a prefix, 
42 # $1 the prefix (expanded version)
43 # $2 variable to assign
44 # $3 the directory name 
45 # $4 description
46 AC_DEFUN(AC_FIND_DIR_IN_PREFIX, [
47     
48     AC_MSG_CHECKING($4 directory)    
49     find_dirdir=`(cd $1; 
50       $FIND ./ -type d -a -name $3 -print |sort|head -1|sed 's#^\./##')`
51     
52
53     if test "x$find_dirdir" = x; then
54        find_dirdir="/$3";
55        AC_MSG_WARN(Cannot determine $4 subdirectory. Please set from command-line)
56         true
57     fi
58     $2=$find_dirdir
59     AC_MSG_RESULT($1/$find_dirdir)
60 ])
61
62 AC_DEFUN(AC_TEX_SUBDIR, [
63 dnl    AC_REQUIRE([AC_TEX_PREFIX])
64     AC_FIND_DIR_IN_PREFIX($find_texprefix, $1, tex,TeX input)
65     $1="$TEXPREFIX/$$1"
66 ])
67
68 AC_DEFUN(AC_MF_SUBDIR, [
69 dnl     AC_REQUIRE([AC_TEX_PREFIX])
70     AC_FIND_DIR_IN_PREFIX($find_texprefix, $1, source, MF input)
71     $1="$TEXPREFIX/$$1"
72 ])
73    
74 AC_INIT(flower/choleski.cc)
75
76
77 # if given here, these vars are initted at the checking point.
78 printing_b=no
79 checking_b=yes
80 debug_b=yes
81 optimise_b=no
82 profile_b=no
83     
84 AC_LANG_CPLUSPLUS
85
86 AC_ARG_ENABLE(printing,
87     [  enable-printing         turn on debug printing],
88     [printing_b=$enableval])
89
90         
91 AC_ARG_ENABLE(checking,
92     [  disable-checking        set runtime checks (assert calls)],
93     [checking_b=$enableval] )
94
95 AC_ARG_ENABLE(debugging,
96     [  disable-debugging       set debug info ],
97     [debug_b=$enableval])
98
99 AC_ARG_ENABLE(optimise,
100     [  enable-optimise         use maximal speed optimisations],
101     [optimise_b=$enableval])
102     
103 AC_ARG_ENABLE(profiling, 
104     [  enable-profiling        compile with gprof support],
105     [profile_b=$enableval])
106     
107 AC_ARG_ENABLE(mingw32,
108     [  mingw-prefix=DIR        set the mingw32 directory (standalone windows32 exes)],
109     [MINGWPREFIX=$enableval],
110     [MINGWPREFIX=$enableval])
111     
112 AC_ARG_ENABLE(tex-prefix,
113     [  tex-prefix=DIR          set the tex-directory to find TeX subdirectories. (default: PREFIX)],
114     [TEXPREFIX=$enableval],
115     [TEXPREFIX=auto] )
116     
117 AC_ARG_ENABLE(tex-dir,
118     [  tex-dir=DIR             set the directory to put LilyPond  TeX files in. ],
119     [TEXDIR=$enableval],
120     [TEXDIR=auto] )
121
122 AC_ARG_ENABLE(mf-dir,
123     [  mf-dir=DIR              set the directory to put LilyPond MetaFont files in.],
124     [MFDIR=$enableval],
125     [MFDIR=auto] )
126
127 if test $profile_b = yes; then
128     EXTRA_LIBES="-pg"
129     DEFINES="$DEFINES -pg"
130 fi
131     
132 if test $printing_b = no; then
133     DEFINES="$DEFINES -DNPRINT=1"
134 fi
135     
136 if test $debug_b = yes; then    
137     DEFINES="$DEFINES -g"
138 fi
139 if test $checking_b = no; then
140     DEFINES="$DEFINES -DNDEBUG=1"
141 fi
142
143 # however, C++ support in mingw32 v 0.1.4 is still flaky
144 if test x$MINGWPREFIX != xno; then 
145     ICFLAGS="-I$MINGWPREFIX/include"
146     ILDFLAGS="-$MINGWPREFIX/lib"
147 fi
148
149 if test $optimise_b = yes; then
150     DEFINES="$DEFINES -O2 -DSTRING_UTILS_INLINED"
151 fi
152
153 dnl COMPILEINFO="$HOST $host $TARGET $target"
154 AUTOHEADER="This file was automatically generated by configure"
155 CPPFLAGS=${CPPFLAGS:-""}        # we don't want -g -O junk
156 CXXFLAGS=${CXXFLAGS:-""}        # we don't want -g -O junk
157
158 AC_PROG_CXX
159 AC_PROG_RANLIB
160 AC_PROG_INSTALL
161 AC_CHECK_PROGS(FIND, find, error)
162
163 dnl should check out -print
164 if test FIND = error; then
165    AC_MSG_WARN(Couldn't find \`find'.  Please use --enable-tex-dir)
166 fi
167     
168 AC_SUBST(CXXFLAGS)
169 AC_SUBST(CPPFLAGS)
170 AC_SUBST(CXX)
171 AC_SUBST(ICFLAGS)
172 AC_SUBST(ILDFLAGS)
173 AC_SUBST(DEFINES)
174 AC_SUBST(COMPILEINFO)
175 AC_SUBST(AUTOHEADER)
176 AC_SUBST(BISON)
177 AC_SUBST(FLEX)
178 AC_SUBST(TEXPREFIX)
179 AC_SUBST(TEXDIR)
180 AC_SUBST(MFDIR)
181 AC_SUBST(EXTRA_LIBES)
182
183 AC_CHECK_PROGS(BISON, bison, error)
184 AC_CHECK_PROGS(FLEX, flex, error)
185 AC_CHECK_PROGS(MAKE, make, error)
186 AC_CHECK_PROGS(PODMAN, pod2man, error)
187
188     
189 if test "x$TEXPREFIX" = xauto ; then
190     AC_TEX_PREFIX(TEXPREFIX)
191 else
192  find_texprefix=$TEXPREFIX
193 fi
194     
195 if test "x$TEXDIR" = xauto ; then
196     AC_TEX_SUBDIR(TEXDIR)
197 fi
198
199 if test "x$MFDIR" = xauto; then
200     AC_MF_SUBDIR(MFDIR)
201 fi
202     
203 if test $MAKE = "error" 
204 then
205         AC_MSG_ERROR(Please install GNU make)
206 else
207         $MAKE -v| grep GNU > /dev/null
208         if test "$?" = 1
209         then
210             AC_MSG_WARN(Please install *GNU* make) 
211     fi 
212 fi 
213     
214 if test $BISON = "error" 
215 then
216         AC_MSG_WARN(can't find bison. Please install Bison (1.25 or better))
217 else
218     bison_version=`$BISON --version| sed 's/^.*version 1.//g' `
219     if test $bison_version -lt 25; then
220         AC_MSG_WARN(Your bison is too old (1.$bison_version). Please install 1.25)
221     fi  
222 fi
223
224 if test $PODMAN = "error" 
225 then
226         AC_MSG_WARN(can't find pod. You should install Perl (version 5 or better))
227 fi
228
229 if test $FLEX = "error" 
230 then
231         AC_MSG_WARN(can't find flex. Please install Flex (2.5 or better))
232 fi
233
234 if $CXX --version | grep '2\.7' > /dev/null
235 then
236         true
237 else
238         AC_MSG_WARN(can't find g++ 2.7)
239 fi
240
241 AC_CHECK_HEADER(FlexLexer.h, true,
242         AC_MSG_WARN(can't find flex header. Please install Flex headers correctly))
243 AC_CONFIG_SUBDIRS(flower)
244 AC_OUTPUT(make/out/Configure_variables.make:make/Configure_variables.make.in)
245
246
247
248 dnl URG!!!!!!
249 eval "DIR_DATADIR=$datadir"
250 DIR_DATADIR="$DIR_DATADIR/lilypond"
251 AC_MSG_CHECKING
252
253 cat << EOF > lib/out/config.hh
254
255 /* automatically generated by configure */
256 /* include this file only once! */
257
258 #define  DIR_DATADIR "$DIR_DATADIR"
259
260 EOF
261
262 CXX="$ac_cv_prog_CXX" bin/make_version >> lib/out/config.hh
263
264 touch make/out/Site.make
265
266 # ugr
267 (cd mi2mu; CXX="$ac_cv_prog_CXX" ../bin/make_version > out/version.hh
268 dnl    echo 0 > out/.build
269 )
270 # rgu
271 sed 's/TOPLEVEL_//g' <  .version >  lily/.version
272 (cd lily; CXX="$ac_cv_prog_CXX" ../bin/make_version > out/version.hh
273 )
274
275 $MAKE -f make/Toplevel.make.in Makefile
276
277 cat << END
278 Finished configuring. For making everything, do:
279
280         make all
281
282 If you only want help on the make targets, do a
283
284         make help
285
286 assuming that \`make' is GNU make, of course.
287
288 If you want to make site-wide extensions to the makefiles, please use
289
290     make/out/Site.make
291
292 If you can't find a toplevel makefile, please execute
293
294     make -f make/Toplevel.make.in Makefile              # GNU make, of course
295     
296 END
297