source: trunk/configure.in @ 498

Last change on this file since 498 was 498, checked in by dkearney, 15 years ago

added checks for matlab's mex compiler and octave's mkoctfile
added hooks for mex and mkoctfile inside src's makefile

File size: 5.6 KB
Line 
1AC_INIT(src/core/RpLibrary.cc)
2
3VERSION=0.0.1
4
5#------------------------------------------------------------------------
6# Handle the --prefix=... option
7#------------------------------------------------------------------------
8
9if test "${prefix}" = "NONE"; then
10    prefix=/usr/local
11fi
12if test "${exec_prefix}" = "NONE"; then
13    exec_prefix=$prefix
14fi
15
16# AC_PROG_INSTALL
17AC_PROG_MAKE_SET
18
19dnl find and test the C compiler
20AC_PROG_CC
21AC_LANG_C
22
23AC_HEADER_STDC
24AC_CHECK_FUNC(atol,,AC_MSG_ERROR(oops! no atol ?!?))
25
26AC_PROG_CXX
27AC_LANG_CPLUSPLUS
28
29AC_CHECK_LIB(stdc++, main,,AC_MSG_ERROR(librappture requires libstdc++))
30AC_CHECK_HEADERS(stack,,AC_MSG_WARN(STL classes missing ?))
31AC_CHECK_HEADERS(string,,AC_MSG_WARN(STL classes missing ?))
32AC_CHECK_HEADERS(list,,AC_MSG_WARN(STL classes missing ?))
33AC_CHECK_HEADERS(vector,,AC_MSG_WARN(STL classes missing ?))
34
35AC_PROG_F77([f77 fort77 g77 f90 xlf xlf90 fl32])
36
37AC_ARG_WITH(matlab, [  --with-matlab[=DIR]         Build Matlab bindings if MEX compiler is found])
38dnl AC_CHECK_PROG(MEX, mex, mex, false)
39if test "$with_matlab" != "no" ; then
40    if test -x "$with_matlab/bin/mex"
41    then
42        echo Found matlab in $with_matlab/bin/mex
43        MEX="$with_matlab/bin/mex"
44    else
45        if test -x "$with_matlab"
46        then
47            echo Found mex in $with_matlab
48            MEX="$with_matlab"
49        else
50            AC_PATH_PROG(MEX, mex)
51        fi
52    fi
53fi
54
55
56AC_ARG_WITH(octave, [  --with-octave[=DIR]         Build Octave bindings if MKOCTFILE compiler is found])
57dnl AC_CHECK_PROG(MKOCTFILE, mkoctfile, mkoctfile, false)
58if test "$with_octave" != "no" ; then
59    if test -x "$with_octave/bin/mkoctfile"
60    then
61        echo Found octave in $with_octave/bin/mkoctfile
62        MKOCTFILE="$with_octave/bin/mkoctfile"
63    else
64        if test -x "$with_octave"
65        then
66            echo Found mkoctfile in $with_octave
67            MKOCTFILE="$with_octave"
68        else
69            AC_PATH_PROG(MKOCTFILE, mkoctfile)
70        fi
71    fi
72fi
73
74
75dnl perl and python check borrowed from
76dnl http://www.opensource.apple.com/darwinsource/Current/libxslt-8.1/libxslt/configure.in
77dnl
78dnl Perl is just needed for generating some data for XSLtmark
79dnl
80
81AC_ARG_WITH(perl, [  --with-perl[=DIR]         Build Perl bindings if found])
82dnl AC_CHECK_PROG(PERL, perl, perl, false)
83dnl AM_CONDITIONAL(WITH_PERL, test "$PERL" != "false")
84if test "$with_perl" != "no" ; then
85    if test -x "$with_perl/bin/perl"
86    then
87        echo Found perl in $with_perl/bin/perl
88        PERL="$with_perl/bin/perl"
89    else
90        if test -x "$with_perl"
91        then
92            echo Found perl in $with_perl
93            PERL="$with_perl"
94        else
95            AC_PATH_PROG(PERL, perl)
96        fi
97    fi
98fi
99
100dnl
101dnl check for python
102dnl
103
104PYTHON=
105PYTHON_VERSION=
106PYTHON_INCLUDES=
107PYTHON_SITE_PACKAGES=
108pythondir=
109AC_ARG_WITH(python, [  --with-python[=DIR]       Build Python bindings if found])
110if test "$with_python" != "no" ; then
111    if test -x "$with_python/bin/python"
112    then
113        echo Found python in $with_python/bin/python
114        PYTHON="$with_python/bin/python"
115    else
116        if test -x "$with_python"
117        then
118            echo Found python in $with_python
119            PYTHON="$with_python"
120        else
121            AC_PATH_PROG(PYTHON, python python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
122        fi
123    fi
124    if test "$PYTHON" != ""
125    then
126        PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
127        echo Using python version $PYTHON_VERSION
128    fi
129    if test "$PYTHON_VERSION" != ""
130    then
131    if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
132       -d $with_python/lib/python$PYTHON_VERSION/site-packages
133    then
134        PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
135        PYTHON_SITE_PACKAGES=$with_python/lib/python$PYTHON_VERSION/site-packages
136    else
137        if test -r $prefix/include/python$PYTHON_VERSION/Python.h
138        then
139            PYTHON_INCLUDES='$(prefix)/include/python$(PYTHON_VERSION)'
140            PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
141        else
142            if test -r /usr/include/python$PYTHON_VERSION/Python.h
143            then
144                PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
145                PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
146            else
147                echo could not find python$PYTHON_VERSION/Python.h
148            fi
149        fi
150        if test ! -d "$PYTHON_SITE_PACKAGES"
151        then
152            PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
153        fi
154    fi
155    fi
156    if test "$with_python" != ""
157    then
158        pythondir='$(PYTHON_SITE_PACKAGES)'
159    else
160        pythondir='$(libdir)/python${PYTHON_VERSION}/site-packages'
161    fi
162fi
163dnl AM_CONDITIONAL(WITH_PYTHON, test "$PYTHON_INCLUDES" != "")
164dnl if test "$PYTHON_INCLUDES" != ""
165dnl then
166dnl     PYTHON_SUBDIR=python
167dnl else
168dnl     PYTHON_SUBDIR=
169dnl fi
170AC_SUBST(pythondir)
171dnl AC_SUBST(PYTHON_SUBDIR)
172
173AC_SUBST(MEX)
174AC_SUBST(MKOCTFILE)
175AC_SUBST(PERL)
176AC_SUBST(PYTHON)
177AC_SUBST(PYTHON_VERSION)
178AC_SUBST(PYTHON_INCLUDES)
179AC_SUBST(PYTHON_SITE_PACKAGES)
180
181AC_SUBST(VERSION)
182
183RP_BASE=`pwd`
184AC_SUBST(RP_BASE)
185
186dnl read Makefile.in and write Makefile
187AC_OUTPUT(  Makefile \
188            examples/app-fermi/cee/Makefile \
189            examples/app-fermi/fortran/Makefile \
190            examples/c-example/Makefile \
191            perl/Makefile.PL \
192            python/setup.py \
193            src/Makefile \
194            src/matlab/Makefile \
195            src/octave/Makefile \
196            test/Makefile \
197            gui/apps/rappture   )
Note: See TracBrowser for help on using the repository browser.