source: trunk/configure.in @ 1057

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