source: trunk/configure.in @ 1062

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