source: trunk/configure.in @ 944

Last change on this file since 944 was 942, checked in by gah, 17 years ago

Makefile fixups

File size: 11.3 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
49AC_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
55ENABLE_GUI=
56if test "$enable_gui" != "no" ; then
57    ENABLE_GUI="yes"
58fi
59AC_SUBST(ENABLE_GUI)
60
61dnl AC_ARG_ENABLE(
62dnl     [tcl],
63dnl     [AS_HELP_STRING([--enable-tcl], [build tcl bindings @<:@default=check@:>@])],
64dnl     [],
65dnl     [enable_tcl=check])
66dnl
67dnl BUILD_TCL=yes
68dnl AC_SUBST(BUILD_TCL)
69
70AC_ARG_WITH(
71    [tclsh],
72    [AS_HELP_STRING([--with-tclsh[=DIR]],
73        [location of tclsh @<:@default=check@:>@])],
74    [],
75    [with_tclsh=check])
76
77TCLSH=
78if 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
93fi
94AC_MSG_RESULT([${TCLSH}])
95AC_SUBST(TCLSH)
96
97
98dnl AC_ARG_ENABLE (
99dnl     [matlab],
100dnl     [AS_HELP_STRING([--enable-matlab], [build matlab bindings @<:@default=check@:>@])],
101dnl     [],
102dnl     [enable_matlab=check])
103dnl BUILD_MATLAB=yes
104dnl AC_SUBST(BUILD_MATLAB)
105
106AC_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
113AC_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
120AC_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
127MEX=
128MEX_ARCH=
129MEXEXT=
130dnl if test "$enable_matlab" != "no" ; then
131if 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
193fi
194AC_SUBST(MEX)
195AC_SUBST(MEX_ARCH)
196AC_SUBST(MEXEXT)
197
198
199dnl AC_ARG_ENABLE(
200dnl     [octave],
201dnl     [AS_HELP_STRING([--enable-octave], [build octave bindings @<:@default=check@:>@])],
202dnl     [],
203dnl     [enable_octave=check])
204dnl BUILD_OCTAVE=yes
205dnl AC_SUBST(BUILD_OCTAVE)
206
207
208AC_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
215MKOCTFILE=
216dnl if test "$enable_octave" != "no" ; then
217if 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}])
242fi
243AC_SUBST(MKOCTFILE)
244
245
246dnl perl and python check borrowed from
247dnl http://www.opensource.apple.com/darwinsource/Current/libxslt-8.1/libxslt/configure.in
248dnl
249dnl Perl is just needed for generating some data for XSLtmark
250dnl
251
252dnl AC_ARG_ENABLE(
253dnl     [perl],
254dnl     [AS_HELP_STRING([--enable-perl], [build perl bindings @<:@default=check@:>@])],
255dnl     [],
256dnl     [enable_perl=check])
257
258dnl BUILD_PERL=yes
259dnl AC_SUBST(BUILD_PERL)
260
261AC_ARG_WITH(
262    [perl],
263    [AS_HELP_STRING([--with-perl[=DIR]], [location of perl @<:@default=check@:>@])],
264    [],
265    [with_perl=check])
266
267PERL=
268PERL_INCLUDES=
269PERL_SITE_PACKAGES=
270if 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'
286fi
287AC_MSG_RESULT([${PERL}])
288AC_SUBST(PERL)
289AC_SUBST(PERL_INCLUDES)
290AC_SUBST(PERL_SITE_PACKAGES)
291
292dnl
293dnl check for python
294dnl
295
296dnl AC_ARG_ENABLE(
297dnl     [python],
298dnl     [AS_HELP_STRING([--enable-pyton], [build python bindings @<:@default=check@:>@])],
299dnl     [],
300dnl     [enable_python=check])
301dnl
302dnl BUILD_PYTHON=yes
303dnl AC_SUBST(BUILD_PYTHON)
304
305PYTHON=
306PYTHON_VERSION=
307PYTHON_INCLUDES=
308PYTHON_SITE_PACKAGES=
309pythondir=
310AC_ARG_WITH(
311    [python],
312    [AS_HELP_STRING([--with-python[=DIR]],[location of python @<:@default=check@:>@])],
313    [],
314    [with_python=check])
315
316if 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
369fi
370
371AC_SUBST(pythondir)
372dnl AC_SUBST(PYTHON_SUBDIR)
373
374AC_SUBST(PYTHON)
375AC_SUBST(PYTHON_VERSION)
376AC_SUBST(PYTHON_INCLUDES)
377AC_SUBST(PYTHON_SITE_PACKAGES)
378
379
380RP_BASE=`pwd`
381AC_SUBST(RP_BASE)
382
383if test "$ENABLE_GUI" == "yes" ; then
384    AC_CONFIG_SUBDIRS( gui )
385fi
386
387if test "$TCLSH" != "" ; then
388    AC_CONFIG_SUBDIRS( src/tcl )
389fi
390
391ls
392AC_CONFIG_SUBDIRS( [optimizer/src] )
393
394dnl read Makefile.in and write Makefile
395AC_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   )
Note: See TracBrowser for help on using the repository browser.