source: trunk/configure.in @ 833

Last change on this file since 833 was 833, checked in by dkearney, 16 years ago

updated configure to allow user to compile with or without perl, python, octave, matlab
updated makefiles in examples dir to keep it quiet during compilation.

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