]> git.donarmstrong.com Git - lilypond.git/blob - configure.in
release: 0.0.54
[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 AC_LANG_CPLUSPLUS
78 printing_b=no
79 checking_b=yes
80 debug_b=yes
81 optimise_b=no
82 profile_b=no
83 #shared_b=no
84
85 AC_ARG_ENABLE(printing,
86     [  enable-printing        set debug printing],
87     [printing_b=$enableval])
88
89         
90 AC_ARG_ENABLE(checking,
91     [  disable-checking       set runtime checks],
92     [checking_b=$enableval] )
93
94 AC_ARG_ENABLE(debugging,
95     [  disable-debugging         set debug info],
96     [debug_b=$enableval])
97
98 AC_ARG_ENABLE(optimise,
99     [  enable-optimise       use maximal speed optimisations],
100     [optimise_b=$enableval])
101     
102    
103 AC_ARG_ENABLE(profiling, 
104     [  enable-profiling      compile with gprof support],
105     [profile_b=$enableval])
106     
107 AC_ARG_ENABLE(tex-prefix,
108     [  tex-prefix=DIR  set the tex-directory to find TeX subdirectories.],
109     [TEXPREFIX=$enableval],
110     [TEXPREFIX=auto] )
111     
112 AC_ARG_ENABLE(tex-dir,
113     [  tex-dir=DIR  set the directory to put LilyPond  TeX files in.],
114     [TEXDIR=$enableval],
115     [TEXDIR=auto] )
116 AC_ARG_ENABLE(mf-dir,
117     [  mf-dir=DIR  set the directory to put LilyPond MetaFont files in.],
118     [MFDIR=$enableval],
119     [MFDIR=auto] )
120
121 if test $profile_b = yes; then
122     EXTRA_LIBES="-pg"
123     DEFINES="$DEFINES -pg"
124 fi
125     
126 if test $printing_b = no; then
127     DEFINES="$DEFINES -DNPRINT=1"
128 fi
129     
130 if test $debug_b = yes; then    
131     DEFINES="$DEFINES -g"
132 fi
133 if test $checking_b = no; then
134     DEFINES="$DEFINES -DNDEBUG=1"
135 fi
136
137 if test $optimise_b = yes; then
138     DEFINES="$DEFINES -O2 -DSTRING_UTILS_INLINED"
139 fi
140
141 dnl COMPILEINFO="$HOST $host $TARGET $target"
142 AUTOHEADER="This file was automatically generated by configure"
143 CXXFLAGS=${CXXFLAGS:-""}        # we don't want -g -O junk
144 AC_PROG_CXX
145 AC_PROG_RANLIB
146 AC_PROG_INSTALL
147 AC_CHECK_PROGS(FIND, find, error)
148
149 dnl should check out -print
150 if test FIND = error; then
151    AC_MSG_WARN(Couldn't find \`find'.  Please use --enable-tex-dir)
152 fi
153     
154 AC_SUBST(CXX)
155 AC_SUBST(DEFINES)
156 AC_SUBST(COMPILEINFO)
157 AC_SUBST(AUTOHEADER)
158 AC_SUBST(BISON)
159 AC_SUBST(FLEX)
160 AC_SUBST(TEXPREFIX)
161 AC_SUBST(TEXDIR)
162 AC_SUBST(MFDIR)
163 AC_SUBST(EXTRA_LIBES)
164
165 AC_CHECK_PROGS(BISON, bison, error)
166 AC_CHECK_PROGS(FLEX, flex, error)
167 AC_CHECK_PROGS(MAKE, make, error)
168 AC_CHECK_PROGS(PODMAN, pod2man, error)
169
170     
171 if test "x$TEXPREFIX" = xauto ; then
172     AC_TEX_PREFIX(TEXPREFIX)
173 fi
174     
175 if test "x$TEXDIR" = xauto ; then
176     AC_TEX_SUBDIR(TEXDIR)
177 fi
178
179 if test "x$MFDIR" = xauto; then
180     AC_MF_SUBDIR(MFDIR)
181 fi
182     
183 if test $MAKE = "error" 
184 then
185         AC_MSG_ERROR(Please install GNU make)
186 else
187         $MAKE -v| grep GNU > /dev/null
188         if test "$?" = 1
189         then
190             AC_MSG_WARN(Please install *GNU* make) 
191     fi 
192 fi 
193     
194 if test $BISON = "error" 
195 then
196         AC_MSG_WARN(can't find bison. Please install Bison (1.24 or better))
197 fi
198
199 if test $PODMAN = "error" 
200 then
201         AC_MSG_WARN(can't find pod. You should install Perl (version 5 or better))
202 fi
203
204 if test $FLEX = "error" 
205 then
206         AC_MSG_WARN(can't find flex. Please install Flex (2.5 or better))
207 fi
208
209 if $CXX --version | grep '2\.7' > /dev/null
210 then
211         true
212 else
213         AC_MSG_WARN(can't find g++ 2.7)
214 fi
215
216 AC_CHECK_HEADER(FlexLexer.h, true,
217         AC_MSG_WARN(can't find flex header. Please install Flex headers correctly))
218 AC_CONFIG_SUBDIRS(flower)
219 AC_OUTPUT(make/out/Configure_variables.make:make/Configure_variables.make.in
220     Makefile:make/Toplevel.make.in
221     )
222
223
224
225 dnl URG!!!!!!
226 eval "DIR_DATADIR=$datadir"
227 DIR_DATADIR="$DIR_DATADIR/lilypond"
228 AC_MSG_CHECKING
229
230 cat << EOF > lib/out/config.hh
231
232 /* automatically generated by configure */
233 /* include this file only once! */
234
235 #define  DIR_DATADIR "$DIR_DATADIR"
236
237 EOF
238
239 CXX="$ac_cv_prog_CXX" bin/make_version >> lib/out/config.hh
240
241 touch make/out/Site.make
242
243 # ugr
244 (cd mi2mu; CXX="$ac_cv_prog_CXX" ../bin/make_version > out/version.hh
245 dnl    echo 0 > out/.build
246 )
247 # rgu
248 sed 's/TOPLEVEL_//g' <  .version >  lily/.version
249 (cd lily; CXX="$ac_cv_prog_CXX" ../bin/make_version > out/version.hh
250 )
251
252 cat << END
253 Finished configuring. For making everything, do:
254
255         make all
256
257 If you only want help on the make targets, do a
258
259         make help
260
261 assuming that \`make' is GNU make, of course.
262
263 If you want to make site-wide extensions to the makefiles, please use
264
265     make/out/Site.make
266     
267 END
268