source: trunk/configure.in @ 1058

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