1 | AC_INIT(Rappture Core and Bindings, 1.1, rappture@nanohub.org) |
---|
2 | |
---|
3 | VERSION=0.0.1 |
---|
4 | AC_SUBST(VERSION) |
---|
5 | |
---|
6 | #------------------------------------------------------------------------ |
---|
7 | # Handle the --prefix=... option |
---|
8 | #------------------------------------------------------------------------ |
---|
9 | |
---|
10 | if test "${prefix}" = "NONE"; then |
---|
11 | prefix=/usr/local |
---|
12 | fi |
---|
13 | if test "${exec_prefix}" = "NONE"; then |
---|
14 | exec_prefix=$prefix |
---|
15 | fi |
---|
16 | |
---|
17 | if test "${libdir}" != "${prefix}/lib"; then |
---|
18 | LIB_SEARCH_DIRS="-L${prefix}/lib -L${libdir}" |
---|
19 | else |
---|
20 | LIB_SEARCH_DIRS="-L${libdir}" |
---|
21 | fi |
---|
22 | |
---|
23 | AC_SUBST(LIB_SEARCH_DIRS) |
---|
24 | |
---|
25 | AC_PROG_INSTALL |
---|
26 | AC_PROG_MAKE_SET |
---|
27 | |
---|
28 | dnl find and test the C compiler |
---|
29 | AC_PROG_CC |
---|
30 | AC_LANG_C |
---|
31 | |
---|
32 | AC_HEADER_STDC |
---|
33 | AC_CHECK_FUNC(atol,,AC_MSG_ERROR(oops! no atol ?!?)) |
---|
34 | |
---|
35 | AC_PROG_CXX |
---|
36 | AC_LANG_CPLUSPLUS |
---|
37 | |
---|
38 | AC_CHECK_LIB(stdc++, main,,AC_MSG_ERROR(librappture requires libstdc++)) |
---|
39 | AC_CHECK_HEADERS(stack,,AC_MSG_WARN(STL classes missing ?)) |
---|
40 | AC_CHECK_HEADERS(string,,AC_MSG_WARN(STL classes missing ?)) |
---|
41 | AC_CHECK_HEADERS(list,,AC_MSG_WARN(STL classes missing ?)) |
---|
42 | AC_CHECK_HEADERS(vector,,AC_MSG_WARN(STL classes missing ?)) |
---|
43 | |
---|
44 | AC_PROG_F77([g77 f77 fort77 f90 xlf xlf90 fl32]) |
---|
45 | |
---|
46 | |
---|
47 | |
---|
48 | |
---|
49 | AC_ARG_ENABLE( |
---|
50 | [gui], |
---|
51 | [AS_HELP_STRING([--enable-gui], [build code related to the graphical user interface @<:@default=yes@:>@])], |
---|
52 | [], |
---|
53 | [enable_gui=yes]) |
---|
54 | |
---|
55 | ENABLE_GUI= |
---|
56 | if test "$enable_gui" != "no" ; then |
---|
57 | ENABLE_GUI="yes" |
---|
58 | fi |
---|
59 | AC_SUBST(ENABLE_GUI) |
---|
60 | |
---|
61 | dnl AC_ARG_ENABLE( |
---|
62 | dnl [tcl], |
---|
63 | dnl [AS_HELP_STRING([--enable-tcl], [build tcl bindings @<:@default=check@:>@])], |
---|
64 | dnl [], |
---|
65 | dnl [enable_tcl=check]) |
---|
66 | dnl |
---|
67 | dnl BUILD_TCL=yes |
---|
68 | dnl AC_SUBST(BUILD_TCL) |
---|
69 | |
---|
70 | AC_ARG_WITH( |
---|
71 | [tclsh], |
---|
72 | [AS_HELP_STRING([--with-tclsh[=DIR]], |
---|
73 | [location of tclsh @<:@default=check@:>@])], |
---|
74 | [], |
---|
75 | [with_tclsh=check]) |
---|
76 | |
---|
77 | TCLSH= |
---|
78 | if test "$with_tclsh" != "no" ; then |
---|
79 | AC_MSG_CHECKING([for tclsh]) |
---|
80 | if test -x "$with_tclsh/bin/tclsh" |
---|
81 | then |
---|
82 | echo Found tclsh in $with_tclsh/bin/tclsh |
---|
83 | TCLSH="$with_tclsh/bin/tclsh" |
---|
84 | else |
---|
85 | if test -x "$with_tclsh" |
---|
86 | then |
---|
87 | echo Found tclsh in $with_tclsh |
---|
88 | TCLSH="$with_tclsh" |
---|
89 | else |
---|
90 | AC_PATH_PROG(TCLSH, tclsh) |
---|
91 | fi |
---|
92 | fi |
---|
93 | fi |
---|
94 | AC_MSG_RESULT([${TCLSH}]) |
---|
95 | AC_SUBST(TCLSH) |
---|
96 | |
---|
97 | |
---|
98 | dnl AC_ARG_ENABLE ( |
---|
99 | dnl [matlab], |
---|
100 | dnl [AS_HELP_STRING([--enable-matlab], [build matlab bindings @<:@default=check@:>@])], |
---|
101 | dnl [], |
---|
102 | dnl [enable_matlab=check]) |
---|
103 | dnl BUILD_MATLAB=yes |
---|
104 | dnl AC_SUBST(BUILD_MATLAB) |
---|
105 | |
---|
106 | AC_ARG_WITH( |
---|
107 | [matlab], |
---|
108 | [AS_HELP_STRING([--with-matlab[=DIR]], |
---|
109 | [location of matlab and mex compiler @<:@default=check@:>@])], |
---|
110 | [], |
---|
111 | [with_matlab=check]) |
---|
112 | |
---|
113 | AC_ARG_WITH( |
---|
114 | [matlab_arch], |
---|
115 | [AS_HELP_STRING([--with-matlab-arch[=ARCH]], |
---|
116 | [build Matlab bindings for ARCH architecture @<:@default=check@:>@])], |
---|
117 | [], |
---|
118 | [with_matlab_arch=check]) |
---|
119 | |
---|
120 | AC_ARG_WITH( |
---|
121 | [mexext], |
---|
122 | [AS_HELP_STRING([--with-mexext[=ARCH]], |
---|
123 | [fallback extension for building mex files @<:@default=check@:>@])], |
---|
124 | [], |
---|
125 | [with_mexext=check]) |
---|
126 | |
---|
127 | MEX= |
---|
128 | MEX_ARCH= |
---|
129 | MEXEXT= |
---|
130 | dnl if test "$enable_matlab" != "no" ; then |
---|
131 | if test "$with_matlab" != "no" ; then |
---|
132 | AC_MSG_CHECKING([for matlab's mex]) |
---|
133 | if test "$with_matlab" != "no" ; then |
---|
134 | dnl WITH_MATLAB = "yes" |
---|
135 | if test -x "$with_matlab/bin/mex" |
---|
136 | then |
---|
137 | dnl # echo Found mex in $with_matlab/bin/mex |
---|
138 | MEX="$with_matlab/bin/mex" |
---|
139 | else |
---|
140 | if test -x "$with_matlab" |
---|
141 | then |
---|
142 | dnl # echo Found mex in $with_matlab |
---|
143 | MEX="$with_matlab" |
---|
144 | else |
---|
145 | AC_PATH_PROG(MEX, mex) |
---|
146 | fi |
---|
147 | fi |
---|
148 | matlab_path=`dirname $MEX`/matlab |
---|
149 | if test -x "$matlab_path" |
---|
150 | then |
---|
151 | MEX=${MEX} |
---|
152 | else |
---|
153 | MEX= |
---|
154 | fi |
---|
155 | AC_MSG_RESULT([${MEX}]) |
---|
156 | if test "$with_matlab_arch" = "check" ; then |
---|
157 | dnl still need to write the code to check the arch type |
---|
158 | with_matlab_arch="" |
---|
159 | fi |
---|
160 | if test "x$with_matlab_arch" != "x" ; then |
---|
161 | echo "using matlab architecture \"$with_matlab_arch\"" |
---|
162 | MEX_ARCH="-arch=$with_matlab_arch" |
---|
163 | dnl else |
---|
164 | dnl # if $with_matlab_arch is blank, get the os name from uname |
---|
165 | fi |
---|
166 | if test "x$MEX" != "x" ; then |
---|
167 | mexext_fxn=`dirname $MEX`/mexext |
---|
168 | if test -x "$mexext_fxn" ; then |
---|
169 | MEXEXT=`$mexext_fxn` |
---|
170 | if test "x${MEXEXT}" = "x" ; then |
---|
171 | dnl not even mexext can figure out what extension to use.... |
---|
172 | dnl # we should be doing an os type check instead of default mexglx |
---|
173 | dnl # use $with_matlab_arch |
---|
174 | if test "$with_mexext" != "check" ; then |
---|
175 | MEXEXT="mexglx" |
---|
176 | fi |
---|
177 | fi |
---|
178 | else |
---|
179 | if test "$with_mexext" != "check" ; then |
---|
180 | MEXEXT="mexglx" |
---|
181 | fi |
---|
182 | fi |
---|
183 | echo "Using mex file extension \"$MEXEXT\"" |
---|
184 | AC_MSG_RESULT([${MEXEXT}]) |
---|
185 | else |
---|
186 | dnl we shouldn't bother the user if we dont find matlab |
---|
187 | dnl just put out the message and don't compile matlab bindings |
---|
188 | echo "can't find the matlab compiler \"mex\"" |
---|
189 | echo "use --with-matlab=DIR to specify the location of a matlab installation" |
---|
190 | dnl # exit 1 |
---|
191 | fi |
---|
192 | fi |
---|
193 | fi |
---|
194 | AC_SUBST(MEX) |
---|
195 | AC_SUBST(MEX_ARCH) |
---|
196 | AC_SUBST(MEXEXT) |
---|
197 | |
---|
198 | |
---|
199 | dnl AC_ARG_ENABLE( |
---|
200 | dnl [octave], |
---|
201 | dnl [AS_HELP_STRING([--enable-octave], [build octave bindings @<:@default=check@:>@])], |
---|
202 | dnl [], |
---|
203 | dnl [enable_octave=check]) |
---|
204 | dnl BUILD_OCTAVE=yes |
---|
205 | dnl AC_SUBST(BUILD_OCTAVE) |
---|
206 | |
---|
207 | |
---|
208 | AC_ARG_WITH( |
---|
209 | [octave], |
---|
210 | [AS_HELP_STRING([--with-octave[=DIR]], |
---|
211 | [location of octave compiler MKOCTFILE @<:@default=check@:>@])], |
---|
212 | [], |
---|
213 | [with_octave=check]) |
---|
214 | |
---|
215 | MKOCTFILE= |
---|
216 | dnl if test "$enable_octave" != "no" ; then |
---|
217 | if test "$with_octave" != "no" ; then |
---|
218 | AC_MSG_CHECKING([for mkoctfile]) |
---|
219 | if test "$with_octave" != "no" ; then |
---|
220 | if test -x "$with_octave/bin/mkoctfile" |
---|
221 | then |
---|
222 | dnl echo Found octave in $with_octave/bin/mkoctfile |
---|
223 | MKOCTFILE="$with_octave/bin/mkoctfile" |
---|
224 | else |
---|
225 | if test -x "$with_octave" |
---|
226 | then |
---|
227 | echo Found mkoctfile in $with_octave |
---|
228 | MKOCTFILE="$with_octave" |
---|
229 | else |
---|
230 | AC_PATH_PROG(MKOCTFILE, mkoctfile) |
---|
231 | if test "x$MKOCTFILE" == "x" ; then |
---|
232 | dnl we shouldn't bother the user if we dont find mkoctfile |
---|
233 | dnl just put out the message and don't compile octave bindings |
---|
234 | echo "can't find the matlab compiler \"mkoctfile\"" |
---|
235 | echo "use --with-octave=DIR to specify the location of a mkoctfile installation" |
---|
236 | dnl # exit 1 |
---|
237 | fi |
---|
238 | fi |
---|
239 | fi |
---|
240 | fi |
---|
241 | AC_MSG_RESULT([${MKOCTFILE}]) |
---|
242 | fi |
---|
243 | AC_SUBST(MKOCTFILE) |
---|
244 | |
---|
245 | |
---|
246 | dnl perl and python check borrowed from |
---|
247 | dnl http://www.opensource.apple.com/darwinsource/Current/libxslt-8.1/libxslt/configure.in |
---|
248 | dnl |
---|
249 | dnl Perl is just needed for generating some data for XSLtmark |
---|
250 | dnl |
---|
251 | |
---|
252 | dnl AC_ARG_ENABLE( |
---|
253 | dnl [perl], |
---|
254 | dnl [AS_HELP_STRING([--enable-perl], [build perl bindings @<:@default=check@:>@])], |
---|
255 | dnl [], |
---|
256 | dnl [enable_perl=check]) |
---|
257 | |
---|
258 | dnl BUILD_PERL=yes |
---|
259 | dnl AC_SUBST(BUILD_PERL) |
---|
260 | |
---|
261 | AC_ARG_WITH( |
---|
262 | [perl], |
---|
263 | [AS_HELP_STRING([--with-perl[=DIR]], [location of perl @<:@default=check@:>@])], |
---|
264 | [], |
---|
265 | [with_perl=check]) |
---|
266 | |
---|
267 | PERL= |
---|
268 | PERL_INCLUDES= |
---|
269 | PERL_SITE_PACKAGES= |
---|
270 | if test "$with_perl" != "no" ; then |
---|
271 | AC_MSG_CHECKING([for perl]) |
---|
272 | if test -x "$with_perl/bin/perl" |
---|
273 | then |
---|
274 | echo Found perl in $with_perl/bin/perl |
---|
275 | PERL="$with_perl/bin/perl" |
---|
276 | else |
---|
277 | if test -x "$with_perl" |
---|
278 | then |
---|
279 | echo Found perl in $with_perl |
---|
280 | PERL="$with_perl" |
---|
281 | else |
---|
282 | AC_PATH_PROG(PERL, perl) |
---|
283 | fi |
---|
284 | fi |
---|
285 | PERL_SITE_PACKAGES='$(libdir)/perl5' |
---|
286 | fi |
---|
287 | AC_MSG_RESULT([${PERL}]) |
---|
288 | AC_SUBST(PERL) |
---|
289 | AC_SUBST(PERL_INCLUDES) |
---|
290 | AC_SUBST(PERL_SITE_PACKAGES) |
---|
291 | |
---|
292 | dnl |
---|
293 | dnl check for python |
---|
294 | dnl |
---|
295 | |
---|
296 | dnl AC_ARG_ENABLE( |
---|
297 | dnl [python], |
---|
298 | dnl [AS_HELP_STRING([--enable-pyton], [build python bindings @<:@default=check@:>@])], |
---|
299 | dnl [], |
---|
300 | dnl [enable_python=check]) |
---|
301 | dnl |
---|
302 | dnl BUILD_PYTHON=yes |
---|
303 | dnl AC_SUBST(BUILD_PYTHON) |
---|
304 | |
---|
305 | PYTHON= |
---|
306 | PYTHON_VERSION= |
---|
307 | PYTHON_INCLUDES= |
---|
308 | PYTHON_SITE_PACKAGES= |
---|
309 | pythondir= |
---|
310 | AC_ARG_WITH( |
---|
311 | [python], |
---|
312 | [AS_HELP_STRING([--with-python[=DIR]],[location of python @<:@default=check@:>@])], |
---|
313 | [], |
---|
314 | [with_python=check]) |
---|
315 | |
---|
316 | if test "$with_python" != "no" ; then |
---|
317 | AC_MSG_CHECKING([for python]) |
---|
318 | if test -x "$with_python/bin/python" |
---|
319 | then |
---|
320 | echo Found python in $with_python/bin/python |
---|
321 | PYTHON="$with_python/bin/python" |
---|
322 | else |
---|
323 | if test -x "$with_python" |
---|
324 | then |
---|
325 | echo Found python in $with_python |
---|
326 | PYTHON="$with_python" |
---|
327 | else |
---|
328 | AC_PATH_PROG(PYTHON, python python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5) |
---|
329 | fi |
---|
330 | fi |
---|
331 | if test "$PYTHON" != "" |
---|
332 | then |
---|
333 | PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"` |
---|
334 | echo Using python version $PYTHON_VERSION |
---|
335 | fi |
---|
336 | if test "$PYTHON_VERSION" != "" |
---|
337 | then |
---|
338 | if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \ |
---|
339 | -d $with_python/lib/python$PYTHON_VERSION/site-packages |
---|
340 | then |
---|
341 | PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION |
---|
342 | PYTHON_SITE_PACKAGES=$with_python/lib/python$PYTHON_VERSION/site-packages |
---|
343 | else |
---|
344 | if test -r $prefix/include/python$PYTHON_VERSION/Python.h |
---|
345 | then |
---|
346 | PYTHON_INCLUDES='$(prefix)/include/python$(PYTHON_VERSION)' |
---|
347 | PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages' |
---|
348 | else |
---|
349 | if test -r /usr/include/python$PYTHON_VERSION/Python.h |
---|
350 | then |
---|
351 | PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION |
---|
352 | PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages' |
---|
353 | else |
---|
354 | echo could not find python$PYTHON_VERSION/Python.h |
---|
355 | fi |
---|
356 | fi |
---|
357 | if test ! -d "$PYTHON_SITE_PACKAGES" |
---|
358 | then |
---|
359 | PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"` |
---|
360 | fi |
---|
361 | fi |
---|
362 | fi |
---|
363 | if test "$with_python" != "" |
---|
364 | then |
---|
365 | pythondir='$(PYTHON_SITE_PACKAGES)' |
---|
366 | else |
---|
367 | pythondir='$(libdir)/python${PYTHON_VERSION}/site-packages' |
---|
368 | fi |
---|
369 | fi |
---|
370 | |
---|
371 | AC_SUBST(pythondir) |
---|
372 | dnl AC_SUBST(PYTHON_SUBDIR) |
---|
373 | |
---|
374 | AC_SUBST(PYTHON) |
---|
375 | AC_SUBST(PYTHON_VERSION) |
---|
376 | AC_SUBST(PYTHON_INCLUDES) |
---|
377 | AC_SUBST(PYTHON_SITE_PACKAGES) |
---|
378 | |
---|
379 | |
---|
380 | RP_BASE=`pwd` |
---|
381 | AC_SUBST(RP_BASE) |
---|
382 | |
---|
383 | if test "$ENABLE_GUI" == "yes" ; then |
---|
384 | AC_CONFIG_SUBDIRS( gui ) |
---|
385 | fi |
---|
386 | |
---|
387 | if test "$TCLSH" != "" ; then |
---|
388 | AC_CONFIG_SUBDIRS( src/tcl ) |
---|
389 | fi |
---|
390 | |
---|
391 | ls |
---|
392 | AC_CONFIG_SUBDIRS( [optimizer/src] ) |
---|
393 | |
---|
394 | dnl read Makefile.in and write Makefile |
---|
395 | AC_OUTPUT( Makefile \ |
---|
396 | examples/demo.bash |
---|
397 | examples/app-fermi/cee/Makefile \ |
---|
398 | examples/app-fermi/fortran/Makefile \ |
---|
399 | examples/app-fermi/wrapper/cee/Makefile \ |
---|
400 | examples/c-example/Makefile \ |
---|
401 | optimizer/src/Makefile \ |
---|
402 | perl/Makefile.PL \ |
---|
403 | python/setup.py \ |
---|
404 | src/Makefile \ |
---|
405 | src/matlab/Makefile \ |
---|
406 | src/octave/Makefile \ |
---|
407 | src2/core/Makefile \ |
---|
408 | test/Makefile \ |
---|
409 | gui/apps/simsim \ |
---|
410 | gui/apps/rappture \ |
---|
411 | gui/apps/rappture.env ) |
---|