]> git.donarmstrong.com Git - lilypond.git/blob - configure.in
release: 0.0.72pre
[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=no])
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(TAR, tar, error)
162 AC_CHECK_PROGS(FIND, find, error)
163
164 dnl should check out -print
165 if test FIND = error; then
166    AC_MSG_WARN(Couldn't find \`find'.  Please use --enable-tex-dir)
167 fi
168     
169 AC_SUBST(CXXFLAGS)
170 AC_SUBST(CPPFLAGS)
171 AC_SUBST(CXX)
172 AC_SUBST(ICFLAGS)
173 AC_SUBST(ILDFLAGS)
174 AC_SUBST(DEFINES)
175 AC_SUBST(COMPILEINFO)
176 AC_SUBST(AUTOHEADER)
177 AC_SUBST(BISON)
178 AC_SUBST(FLEX)
179 AC_SUBST(TEXPREFIX)
180 AC_SUBST(TEXDIR)
181 AC_SUBST(MFDIR)
182 AC_SUBST(EXTRA_LIBES)
183
184 AC_CHECK_PROGS(BISON, bison, error)
185 AC_CHECK_PROGS(FLEX, flex, error)
186 AC_CHECK_PROGS(MAKE, make, error)
187 AC_CHECK_PROGS(PODMAN, pod2man, error)
188
189     
190 if test "x$TEXPREFIX" = xauto ; then
191     AC_TEX_PREFIX(TEXPREFIX)
192 else
193  find_texprefix=$TEXPREFIX
194 fi
195     
196 if test "x$TEXDIR" = xauto ; then
197     AC_TEX_SUBDIR(TEXDIR)
198 fi
199
200 if test "x$MFDIR" = xauto; then
201     AC_MF_SUBDIR(MFDIR)
202 fi
203     
204 if test $MAKE = "error" 
205 then
206         AC_MSG_ERROR(Please install GNU make)
207 else
208         $MAKE -v| grep GNU > /dev/null
209         if test "$?" = 1
210         then
211             AC_MSG_WARN(Please install *GNU* make) 
212     fi 
213 fi 
214     
215 if test $BISON = "error" 
216 then
217         AC_MSG_WARN(can't find bison. Please install Bison (1.25 or better))
218 else
219     bison_version=`$BISON --version| sed 's/^.*version 1.//g' `
220     if test $bison_version -lt 25; then
221         AC_MSG_WARN(Your bison is too old (1.$bison_version). Please install 1.25)
222     fi  
223 fi
224
225 if test $PODMAN = "error" 
226 then
227         AC_MSG_WARN(can't find pod. You should install Perl (version 5 or better))
228 fi
229
230 if test $FLEX = "error" 
231 then
232         AC_MSG_WARN(can't find flex. Please install Flex (2.5 or better))
233 fi
234
235 if $CXX --version | grep '2\.7' > /dev/null
236 then
237         true
238 else
239         AC_MSG_WARN(can't find g++ 2.7)
240 fi
241
242 AC_CHECK_HEADER(FlexLexer.h, true,
243         AC_MSG_WARN(can't find flex header. Please install Flex headers correctly))
244 AC_CONFIG_SUBDIRS(flower)
245 AC_OUTPUT(make/out/Configure_variables.make:make/Configure_variables.make.in)
246
247
248
249 dnl URG!!!!!!
250 eval "DIR_DATADIR=$datadir"
251 DIR_DATADIR="$DIR_DATADIR/lilypond"
252 AC_MSG_CHECKING
253
254 cat << EOF > lib/out/config.hh
255
256 /* automatically generated by configure */
257 /* include this file only once! */
258
259 #define  DIR_DATADIR "$DIR_DATADIR"
260
261 EOF
262
263 CXX="$ac_cv_prog_CXX" bin/make_version >> lib/out/config.hh
264
265 touch make/out/Site.make
266
267 # ugr
268 (cd mi2mu; CXX="$ac_cv_prog_CXX" ../bin/make_version > out/version.hh
269 dnl    echo 0 > out/.build
270 )
271 # rgu
272 sed 's/TOPLEVEL_//g' <  .version >  lily/.version
273 (cd lily; CXX="$ac_cv_prog_CXX" ../bin/make_version > out/version.hh
274 )
275
276 $MAKE -f make/Toplevel.make.in Makefile
277
278 cat << END
279 Finished configuring. For making everything, do:
280
281         make all
282
283 If you only want help on the make targets, do a
284
285         make help
286
287 assuming that \`make' is GNU make, of course.
288
289 If you want to make site-wide extensions to the makefiles, please use
290
291     make/out/Site.make
292
293 If you can't find a toplevel makefile, please execute
294
295     make -f make/Toplevel.make.in Makefile              # GNU make, of course
296     
297 END
298