source: trunk/configure.in @ 719

Last change on this file since 719 was 719, checked in by dkearney, 18 years ago

adding include directory and adjusting build system's matlab arch variable

File size: 9.4 KB
Line 
1AC_INIT(rappture, 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
92    AC_MSG_CHECKING([for mex])
93    if test "$with_matlab" != "no" ; then
94        dnl WITH_MATLAB = "yes"
95        if test -x "$with_matlab/bin/mex"
96        then
97            echo Found mex in $with_matlab/bin/mex
98            MEX="$with_matlab/bin/mex"
99        else
100            if test -x "$with_matlab"
101            then
102                echo Found mex in $with_matlab
103                MEX="$with_matlab"
104            else
105                AC_PATH_PROG(MEX, mex)
106            fi
107        fi
108        AC_MSG_RESULT([${MEX}])
109        if test "$with_matlab_arch" = "check" ; then
110            dnl still need to write the code to check the arch type
111            with_matlab_arch=""
112        fi
113        if test "x$with_matlab_arch" != "x" ; then
114            echo "using matlab architecture \"$with_matlab_arch\""
115            MEX_ARCH="-arch=$with_matlab_arch"
116        dnl else
117            dnl # if $with_matlab_arch is blank, get the os name from uname
118        fi
119        if test "x$MEX" != "x" ; then
120            mexext_fxn=`dirname $MEX`/mexext
121            if test -x "$mexext_fxn" ; then
122                MEXEXT=`$mexext_fxn`
123                if test "x${MEXEXT}" = "x" ; then
124                    dnl not even mexext can figure out what extension to use....
125                    dnl # we should be doing an os type check instead of default mexglx
126                    dnl # use $with_matlab_arch
127                    if test "$with_mexext" != "check" ; then
128                        MEXEXT="mexglx"
129                    fi
130                fi
131            else
132                if test "$with_mexext" != "check" ; then
133                    MEXEXT="mexglx"
134                fi
135            fi
136            echo "Using mex file extension \"$MEXEXT\""
137            AC_MSG_RESULT([${MEXEXT}])
138        else
139            echo "can't find the matlab compiler \"mex\""
140            echo "use --with-matlab=DIR to specify the location of a matlab installation"
141            exit 1
142        fi
143    fi
144dnl fi
145AC_SUBST(MEX)
146AC_SUBST(MEX_ARCH)
147AC_SUBST(MEXEXT)
148
149
150dnl AC_ARG_ENABLE(
151dnl     [octave],
152dnl     [AS_HELP_STRING([--enable-octave], [build octave bindings @<:@default=check@:>@])],
153dnl     [],
154dnl     [enable_octave=check])
155dnl BUILD_OCTAVE=yes
156dnl AC_SUBST(BUILD_OCTAVE)
157
158
159AC_ARG_WITH(
160    [octave],
161    [AS_HELP_STRING([--with-octave[=DIR]],
162        [location of octave compiler MKOCTFILE @<:@default=check@:>@])],
163    [],
164    [with_octave=check])
165
166MKOCTFILE=
167dnl if test "$enable_octave" != "no" ; then
168    AC_MSG_CHECKING([for mkoctfile])
169    if test "$with_octave" != "no" ; then
170        if test -x "$with_octave/bin/mkoctfile"
171        then
172            echo Found octave in $with_octave/bin/mkoctfile
173            MKOCTFILE="$with_octave/bin/mkoctfile"
174        else
175            if test -x "$with_octave"
176            then
177                echo Found mkoctfile in $with_octave
178                MKOCTFILE="$with_octave"
179            else
180                AC_PATH_PROG(MKOCTFILE, mkoctfile)
181            fi
182        fi
183    fi
184    AC_MSG_RESULT([${MKOCTFILE}])
185dnl fi
186AC_SUBST(MKOCTFILE)
187
188
189dnl perl and python check borrowed from
190dnl http://www.opensource.apple.com/darwinsource/Current/libxslt-8.1/libxslt/configure.in
191dnl
192dnl Perl is just needed for generating some data for XSLtmark
193dnl
194
195dnl AC_ARG_ENABLE(
196dnl     [perl],
197dnl     [AS_HELP_STRING([--enable-perl], [build perl bindings @<:@default=check@:>@])],
198dnl     [],
199dnl     [enable_perl=check])
200
201dnl BUILD_PERL=yes
202dnl AC_SUBST(BUILD_PERL)
203
204AC_ARG_WITH(
205    [perl],
206    [AS_HELP_STRING([--with-perl[=DIR]], [location of perl @<:@default=check@:>@])],
207    [],
208    [with_perl=check])
209
210PERL=
211PERL_INCLUDES=
212PERL_SITE_PACKAGES=
213AC_MSG_CHECKING([for mkoctfile])
214if test "$with_perl" != "no" ; then
215    if test -x "$with_perl/bin/perl"
216    then
217        echo Found perl in $with_perl/bin/perl
218        PERL="$with_perl/bin/perl"
219    else
220        if test -x "$with_perl"
221        then
222            echo Found perl in $with_perl
223            PERL="$with_perl"
224        else
225            AC_PATH_PROG(PERL, perl)
226        fi
227    fi
228    PERL_SITE_PACKAGES='$(libdir)/perl5'
229fi
230AC_MSG_RESULT([${PERL}])
231AC_SUBST(PERL)
232AC_SUBST(PERL_INCLUDES)
233AC_SUBST(PERL_SITE_PACKAGES)
234
235dnl
236dnl check for python
237dnl
238
239dnl AC_ARG_ENABLE(
240dnl     [python],
241dnl     [AS_HELP_STRING([--enable-pyton], [build python bindings @<:@default=check@:>@])],
242dnl     [],
243dnl     [enable_python=check])
244dnl
245dnl BUILD_PYTHON=yes
246dnl AC_SUBST(BUILD_PYTHON)
247
248PYTHON=
249PYTHON_VERSION=
250PYTHON_INCLUDES=
251PYTHON_SITE_PACKAGES=
252pythondir=
253AC_ARG_WITH(
254    [python],
255    [AS_HELP_STRING([--with-python[=DIR]],[location of python @<:@default=check@:>@])],
256    [],
257    [with_python=check])
258
259if test "$with_python" != "no" ; then
260    if test -x "$with_python/bin/python"
261    then
262        echo Found python in $with_python/bin/python
263        PYTHON="$with_python/bin/python"
264    else
265        if test -x "$with_python"
266        then
267            echo Found python in $with_python
268            PYTHON="$with_python"
269        else
270            AC_PATH_PROG(PYTHON, python python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
271        fi
272    fi
273    if test "$PYTHON" != ""
274    then
275        PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
276        echo Using python version $PYTHON_VERSION
277    fi
278    if test "$PYTHON_VERSION" != ""
279    then
280    if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
281       -d $with_python/lib/python$PYTHON_VERSION/site-packages
282    then
283        PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
284        PYTHON_SITE_PACKAGES=$with_python/lib/python$PYTHON_VERSION/site-packages
285    else
286        if test -r $prefix/include/python$PYTHON_VERSION/Python.h
287        then
288            PYTHON_INCLUDES='$(prefix)/include/python$(PYTHON_VERSION)'
289            PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
290        else
291            if test -r /usr/include/python$PYTHON_VERSION/Python.h
292            then
293                PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
294                PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
295            else
296                echo could not find python$PYTHON_VERSION/Python.h
297            fi
298        fi
299        if test ! -d "$PYTHON_SITE_PACKAGES"
300        then
301            PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
302        fi
303    fi
304    fi
305    if test "$with_python" != ""
306    then
307        pythondir='$(PYTHON_SITE_PACKAGES)'
308    else
309        pythondir='$(libdir)/python${PYTHON_VERSION}/site-packages'
310    fi
311fi
312
313AC_SUBST(pythondir)
314dnl AC_SUBST(PYTHON_SUBDIR)
315
316AC_SUBST(PYTHON)
317AC_SUBST(PYTHON_VERSION)
318AC_SUBST(PYTHON_INCLUDES)
319AC_SUBST(PYTHON_SITE_PACKAGES)
320
321
322RP_BASE=`pwd`
323AC_SUBST(RP_BASE)
324
325AC_CONFIG_SUBDIRS( gui )
326AC_CONFIG_SUBDIRS( src/tcl )
327
328dnl read Makefile.in and write Makefile
329AC_OUTPUT(  Makefile \
330            examples/demo.bash
331            examples/app-fermi/cee/Makefile \
332            examples/app-fermi/fortran/Makefile \
333            examples/app-fermi/wrapper/cee/Makefile \
334            examples/c-example/Makefile \
335            perl/Makefile.PL \
336            python/setup.py \
337            src/Makefile \
338            src/matlab/Makefile \
339            src/octave/Makefile \
340            src2/core/Makefile \
341            test/Makefile \
342            gui/apps/simsim \
343            gui/apps/rappture \
344            gui/apps/rappture.env   )
Note: See TracBrowser for help on using the repository browser.