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