source: trunk/configure.in @ 1020

Last change on this file since 1020 was 1020, checked in by gah, 16 years ago
File size: 14.1 KB
Line 
1AC_INIT([Rappture], [1.1], [rappture@nanohub.org])
2
3#------------------------------------------------------------------------
4# Handle the --prefix=... option
5#------------------------------------------------------------------------
6
7if test "${prefix}" = "NONE"; then
8    prefix=/usr/local
9fi
10if test "${exec_prefix}" = "NONE"; then
11    exec_prefix=$prefix
12fi
13
14if test "${libdir}" != "${prefix}/lib"; then
15    LIB_SEARCH_DIRS="-L${prefix}/lib -L${libdir}"
16else
17    LIB_SEARCH_DIRS="-L${libdir}"
18fi
19
20AC_SUBST(LIB_SEARCH_DIRS)
21
22AC_PROG_INSTALL
23AC_PROG_MAKE_SET
24
25dnl find and test the C compiler
26AC_PROG_CC
27AC_LANG_C
28
29AC_PROG_INSTALL
30AC_PROG_RANLIB
31AC_PROG_LN_S
32
33AC_HEADER_STDC
34AC_CHECK_FUNC(atol,,AC_MSG_ERROR(oops! no atol ?!?))
35
36AC_PROG_CXX
37AC_LANG_CPLUSPLUS
38
39AC_CHECK_LIB(stdc++, main,,AC_MSG_ERROR(librappture requires libstdc++))
40AC_CHECK_HEADERS(stack,,AC_MSG_WARN(STL classes missing ?))
41AC_CHECK_HEADERS(string,,AC_MSG_WARN(STL classes missing ?))
42AC_CHECK_HEADERS(list,,AC_MSG_WARN(STL classes missing ?))
43AC_CHECK_HEADERS(vector,,AC_MSG_WARN(STL classes missing ?))
44
45AC_PROG_F77([g77 gfortran f77 fort77 f90 xlf xlf90 fl32])
46
47SC_CONFIG_GCC
48SC_CONFIG_CFLAGS
49SC_MAKE_LIB
50
51AC_ARG_ENABLE(
52    [gui],
53    [AS_HELP_STRING([--enable-gui], [build code related to the graphical user interface @<:@default=yes@:>@])],
54    [],
55    [enable_gui=yes])
56
57ENABLE_GUI=
58if test "$enable_gui" != "no" ; then
59    ENABLE_GUI="yes"
60fi
61AC_SUBST(ENABLE_GUI)
62
63dnl AC_ARG_ENABLE(
64dnl     [tcl],
65dnl     [AS_HELP_STRING([--enable-tcl], [build tcl bindings @<:@default=check@:>@])],
66dnl     [],
67dnl     [enable_tcl=check])
68dnl
69dnl BUILD_TCL=yes
70dnl AC_SUBST(BUILD_TCL)
71
72with_tclsh="check"
73AC_ARG_WITH(
74    [tclsh],
75    [AS_HELP_STRING([--with-tclsh[=DIR]],
76        [location of tclsh @<:@default=check@:>@])],
77    [],
78    [with_tclsh=check])
79
80TCLSH=
81if test "$with_tclsh" != "no" ; then
82    AC_MSG_CHECKING([for tclsh])
83    if test -x "$with_tclsh/bin/tclsh"
84    then
85        echo Found tclsh in $with_tclsh/bin/tclsh
86        TCLSH="$with_tclsh/bin/tclsh"
87    else
88        if test -x "$with_tclsh"
89        then
90            echo Found tclsh in $with_tclsh
91            TCLSH="$with_tclsh"
92        else
93            AC_PATH_PROG(TCLSH, tclsh)
94        fi
95    fi
96fi
97AC_MSG_RESULT([${TCLSH}])
98AC_SUBST(TCLSH)
99
100
101dnl AC_ARG_ENABLE (
102dnl     [matlab],
103dnl     [AS_HELP_STRING([--enable-matlab], [build matlab bindings @<:@default=check@:>@])],
104dnl     [],
105dnl     [enable_matlab=check])
106dnl BUILD_MATLAB=yes
107dnl AC_SUBST(BUILD_MATLAB)
108
109AC_ARG_WITH(
110    [matlab],
111    [AS_HELP_STRING([--with-matlab[=DIR]],
112        [location of matlab and mex compiler @<:@default=check@:>@])],
113    [],
114    [with_matlab=check])
115
116AC_ARG_WITH(
117    [matlab_arch],
118    [AS_HELP_STRING([--with-matlab-arch[=ARCH]],
119        [build Matlab bindings for ARCH architecture @<:@default=check@:>@])],
120    [],
121    [with_matlab_arch=check])
122
123AC_ARG_WITH(
124    [mexext],
125    [AS_HELP_STRING([--with-mexext[=ARCH]],
126        [fallback extension for building mex files @<:@default=check@:>@])],
127    [],
128    [with_mexext=check])
129
130MEX=
131MEX_ARCH=
132MEXEXT=
133dnl if test "$enable_matlab" != "no" ; then
134if test "$with_matlab" != "no" ; then
135    AC_MSG_CHECKING([for matlab's mex])
136    if test "$with_matlab" != "no" ; then
137        dnl WITH_MATLAB = "yes"
138        if test -x "$with_matlab/bin/mex"
139        then
140            dnl # echo Found mex in $with_matlab/bin/mex
141            MEX="$with_matlab/bin/mex"
142        else
143            if test -x "$with_matlab"
144            then
145                dnl # echo Found mex in $with_matlab
146                MEX="$with_matlab"
147            else
148                AC_PATH_PROG(MEX, mex)
149            fi
150        fi
151        matlab_path=`dirname $MEX`/matlab
152        if test -x "$matlab_path"
153        then
154            MEX=${MEX}
155        else
156            MEX=
157        fi
158        AC_MSG_RESULT([${MEX}])
159        if test "$with_matlab_arch" = "check" ; then
160            dnl still need to write the code to check the arch type
161            with_matlab_arch=""
162        fi
163        if test "x$with_matlab_arch" != "x" ; then
164            echo "using matlab architecture \"$with_matlab_arch\""
165            MEX_ARCH="-arch=$with_matlab_arch"
166        dnl else
167            dnl # if $with_matlab_arch is blank, get the os name from uname
168        fi
169        if test "x$MEX" != "x" ; then
170            mexext_fxn=`dirname $MEX`/mexext
171            if test -x "$mexext_fxn" ; then
172                MEXEXT=`$mexext_fxn`
173                if test "x${MEXEXT}" = "x" ; then
174                    dnl not even mexext can figure out what extension to use....
175                    dnl # we should be doing an os type check instead of default mexglx
176                    dnl # use $with_matlab_arch
177                    if test "$with_mexext" != "check" ; then
178                        MEXEXT="mexglx"
179                    fi
180                fi
181            else
182                if test "$with_mexext" != "check" ; then
183                    MEXEXT="mexglx"
184                fi
185            fi
186            echo "Using mex file extension \"$MEXEXT\""
187            AC_MSG_RESULT([${MEXEXT}])
188        else
189            dnl we shouldn't bother the user if we dont find matlab
190            dnl just put out the message and don't compile matlab bindings
191            echo "can't find the matlab compiler \"mex\""
192            echo "use --with-matlab=DIR to specify the location of a matlab installation"
193            dnl # exit 1
194        fi
195    fi
196fi
197AC_SUBST(MEX)
198AC_SUBST(MEX_ARCH)
199AC_SUBST(MEXEXT)
200
201
202dnl AC_ARG_ENABLE(
203dnl     [octave],
204dnl     [AS_HELP_STRING([--enable-octave], [build octave bindings @<:@default=check@:>@])],
205dnl     [],
206dnl     [enable_octave=check])
207dnl BUILD_OCTAVE=yes
208dnl AC_SUBST(BUILD_OCTAVE)
209
210
211AC_ARG_WITH(
212    [octave],
213    [AS_HELP_STRING([--with-octave[=DIR]],
214        [location of octave compiler MKOCTFILE @<:@default=check@:>@])],
215    [],
216    [with_octave=check])
217
218MKOCTFILE=
219dnl if test "$enable_octave" != "no" ; then
220if test "$with_octave" != "no" ; then
221    AC_MSG_CHECKING([for mkoctfile])
222    if test "$with_octave" != "no" ; then
223        if test -x "$with_octave/bin/mkoctfile"
224        then
225            dnl echo Found octave in $with_octave/bin/mkoctfile
226            MKOCTFILE="$with_octave/bin/mkoctfile"
227        else
228            if test -x "$with_octave"
229            then
230                echo Found mkoctfile in $with_octave
231                MKOCTFILE="$with_octave"
232            else
233                AC_PATH_PROG(MKOCTFILE, mkoctfile)
234                if test "x$MKOCTFILE" == "x" ; then
235                    dnl we shouldn't bother the user if we dont find mkoctfile
236                    dnl just put out the message and don't compile octave bindings
237                    echo "can't find the matlab compiler \"mkoctfile\""
238                    echo "use --with-octave=DIR to specify the location of a mkoctfile installation"
239                    dnl # exit 1
240                fi
241            fi
242        fi
243    fi
244    AC_MSG_RESULT([${MKOCTFILE}])
245fi
246AC_SUBST(MKOCTFILE)
247
248
249dnl perl and python check borrowed from
250dnl http://www.opensource.apple.com/darwinsource/Current/libxslt-8.1/libxslt/configure.in
251dnl
252dnl Perl is just needed for generating some data for XSLtmark
253dnl
254
255dnl AC_ARG_ENABLE(
256dnl     [perl],
257dnl     [AS_HELP_STRING([--enable-perl], [build perl bindings @<:@default=check@:>@])],
258dnl     [],
259dnl     [enable_perl=check])
260
261dnl BUILD_PERL=yes
262dnl AC_SUBST(BUILD_PERL)
263
264AC_ARG_WITH(
265    [perl],
266    [AS_HELP_STRING([--with-perl[=DIR]], [location of perl @<:@default=check@:>@])],
267    [],
268    [with_perl=check])
269
270PERL=
271PERL_INCLUDES=
272PERL_SITE_PACKAGES=
273if test "$with_perl" != "no" ; then
274    AC_MSG_CHECKING([for perl])
275    if test -x "$with_perl/bin/perl"
276    then
277        echo Found perl in $with_perl/bin/perl
278        PERL="$with_perl/bin/perl"
279    else
280        if test -x "$with_perl"
281        then
282            echo Found perl in $with_perl
283            PERL="$with_perl"
284        else
285            AC_PATH_PROG(PERL, perl)
286        fi
287    fi
288    PERL_SITE_PACKAGES='$(libdir)/perl5'
289fi
290AC_MSG_RESULT([${PERL}])
291AC_SUBST(PERL)
292AC_SUBST(PERL_INCLUDES)
293AC_SUBST(PERL_SITE_PACKAGES)
294
295dnl
296dnl check for python
297dnl
298
299dnl AC_ARG_ENABLE(
300dnl     [python],
301dnl     [AS_HELP_STRING([--enable-pyton], [build python bindings @<:@default=check@:>@])],
302dnl     [],
303dnl     [enable_python=check])
304dnl
305dnl BUILD_PYTHON=yes
306dnl AC_SUBST(BUILD_PYTHON)
307
308PYTHON=
309PYTHON_VERSION=
310PYTHON_INCLUDES=
311PYTHON_SITE_PACKAGES=
312pythondir=
313AC_ARG_WITH(
314    [python],
315    [AS_HELP_STRING([--with-python[=DIR]],[location of python @<:@default=check@:>@])],
316    [],
317    [with_python=check])
318
319if test "$with_python" != "no" ; then
320    AC_MSG_CHECKING([for python])
321    if test -x "$with_python/bin/python"
322    then
323        echo Found python in $with_python/bin/python
324        PYTHON="$with_python/bin/python"
325    else
326        if test -x "$with_python"
327        then
328            echo Found python in $with_python
329            PYTHON="$with_python"
330        else
331            AC_PATH_PROG(PYTHON, python python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
332        fi
333    fi
334    if test "$PYTHON" != ""
335    then
336        PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
337        echo Using python version $PYTHON_VERSION
338    fi
339    if test "$PYTHON_VERSION" != ""
340    then
341    if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
342       -d $with_python/lib/python$PYTHON_VERSION/site-packages
343    then
344        PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
345        PYTHON_SITE_PACKAGES=$with_python/lib/python$PYTHON_VERSION/site-packages
346    else
347        if test -r $prefix/include/python$PYTHON_VERSION/Python.h
348        then
349            PYTHON_INCLUDES='$(prefix)/include/python$(PYTHON_VERSION)'
350            PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
351        else
352            if test -r /usr/include/python$PYTHON_VERSION/Python.h
353            then
354                PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
355                PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
356            else
357                echo could not find python$PYTHON_VERSION/Python.h
358            fi
359        fi
360        if test ! -d "$PYTHON_SITE_PACKAGES"
361        then
362            PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
363        fi
364    fi
365    fi
366    if test "$with_python" != ""
367    then
368        pythondir='$(PYTHON_SITE_PACKAGES)'
369    else
370        pythondir='$(libdir)/python${PYTHON_VERSION}/site-packages'
371    fi
372fi
373
374AC_SUBST(pythondir)
375dnl AC_SUBST(PYTHON_SUBDIR)
376
377AC_SUBST(PYTHON)
378AC_SUBST(PYTHON_VERSION)
379AC_SUBST(PYTHON_INCLUDES)
380AC_SUBST(PYTHON_SITE_PACKAGES)
381
382AC_ARG_WITH(
383    [ruby],
384    [AS_HELP_STRING([--with-ruby[=DIR]], [location of ruby @<:@default=check@:>@])],
385    [],
386    [with_ruby=check])
387
388RUBY=""
389if test "$with_ruby" != "no" ; then
390    AC_MSG_CHECKING([for ruby])
391    if test -x "$with_ruby/bin/ruby"
392    then
393        echo Found perl in $with_ruby/bin/ruby
394        PERL="$with_ruby/bin/ruby"
395    else
396        if test -x "$with_ruby"
397        then
398            echo Found ruby in $with_ruby
399            PERL="$with_ruby"
400        else
401            AC_PATH_PROG(RUBY, ruby)
402        fi
403    fi
404fi
405AC_MSG_RESULT([${RUBY}])
406AC_SUBST(RUBY)
407
408RP_BASE=`pwd`
409AC_SUBST(RP_BASE)
410
411SC_ENABLE_SHARED
412
413#--------------------------------------------------------------------
414# This macro figures out what flags to use with the compiler/linker
415# when building shared/static debug/optimized objects.  This information
416# is all taken from the tclConfig.sh file.
417#--------------------------------------------------------------------
418
419AC_SUBST(CFLAGS_DEBUG)
420AC_SUBST(CFLAGS_OPTIMIZE)
421AC_SUBST(STLIB_LD)
422AC_SUBST(SHLIB_LD)
423AC_SUBST(SHLIB_CFLAGS)
424AC_SUBST(SHLIB_LDFLAGS)
425AC_SUBST(SHLIB_SUFFIX)
426
427#--------------------------------------------------------------------
428# Set the default compiler switches based on the --enable-symbols
429# option.
430#--------------------------------------------------------------------
431
432SC_ENABLE_SYMBOLS
433
434if test "${SHARED_BUILD}" = "1" ; then
435    CFLAGS='${CFLAGS_DEFAULT} ${CFLAGS_WARNING} ${SHLIB_CFLAGS}'
436else
437    CFLAGS='${CFLAGS_DEFAULT} ${CFLAGS_WARNING}'
438fi
439
440AC_CONFIG_SUBDIRS( [packages/optimizer/src] )
441
442dnl read Makefile.in and write Makefile
443AC_OUTPUT( [
444        Makefile
445        packages/Makefile
446        src/Makefile
447        src/core/Makefile
448        src/core2/Makefile
449        src/objects/Makefile
450        gui/Makefile
451        gui/apps/Makefile
452        gui/apps/rappture
453        gui/apps/rappture.env
454        gui/apps/simsim
455        gui/pkgIndex.tcl
456        gui/scripts/Makefile
457        lang/Makefile
458        lang/perl/Makefile
459        lang/perl/Makefile.PL
460        lang/python/Makefile
461        lang/python/setup.py
462        lang/matlab/Makefile
463        lang/octave/Makefile
464        lang/ruby/Makefile
465        lang/ruby/build.rb
466        lang/tcl/Makefile
467        lang/tcl/pkgIndex.tcl
468        lang/tcl/src/Makefile
469        lang/tcl/scripts/Makefile
470        lang/tcl/tests/Makefile
471        examples/Makefile
472        examples/3D/Makefile
473        examples/app-fermi/Makefile
474        examples/app-fermi/cee/Makefile
475        examples/app-fermi/fortran/Makefile
476        examples/app-fermi/matlab/Makefile
477        examples/app-fermi/octave/Makefile
478        examples/app-fermi/perl/Makefile
479        examples/app-fermi/python/Makefile
480        examples/app-fermi/ruby/Makefile
481        examples/app-fermi/tcl/Makefile
482        examples/app-fermi/wrapper/Makefile
483        examples/app-fermi/wrapper/cee/Makefile
484        examples/app-fermi/wrapper/python/Makefile
485        examples/app-fermi/wrapper/tcl/Makefile
486        examples/c-example/Makefile
487        examples/canvas/Makefile
488        examples/demo.bash
489        examples/graph/Makefile
490        examples/zoo/Makefile
491        examples/zoo/binary/Makefile
492        examples/zoo/boolean/Makefile
493        examples/zoo/choice/Makefile
494        examples/zoo/cloud/Makefile
495        examples/zoo/cloud/matlab/Makefile
496        examples/zoo/curve/Makefile
497        examples/zoo/enable/Makefile
498        examples/zoo/field/Makefile
499        examples/zoo/group/Makefile
500        examples/zoo/image/Makefile
501        examples/zoo/image/docs/Makefile
502        examples/zoo/image/examples/Makefile 
503        examples/zoo/integer/Makefile
504        examples/zoo/loader/Makefile
505        examples/zoo/loader/examples/Makefile
506        examples/zoo/log/Makefile
507        examples/zoo/note/Makefile
508        examples/zoo/note/docs/Makefile
509        examples/zoo/number/Makefile
510        examples/zoo/phase/Makefile
511        examples/zoo/sequence/Makefile
512        examples/zoo/sequence/examples/Makefile
513        examples/zoo/string/Makefile
514        examples/zoo/structure/Makefile
515        examples/zoo/structure/examples/Makefile
516        examples/zoo/table/Makefile
517        test/Makefile
518        test/src/Makefile
519])
Note: See TracBrowser for help on using the repository browser.