source: trunk/configure.in @ 1092

Last change on this file since 1092 was 1092, checked in by gah, 16 years ago

yet another fix for perl language binding

File size: 12.8 KB
Line 
1AC_INIT([Rappture], [1.1], [rappture@nanohub.org])
2AC_CONFIG_AUX_DIR(cf)
3
4#------------------------------------------------------------------------
5# Handle the --prefix=... option
6#------------------------------------------------------------------------
7
8if test "${prefix}" = "NONE"; then
9    prefix=/usr/local
10fi
11if test "${exec_prefix}" = "NONE"; then
12    exec_prefix=$prefix
13fi
14
15if test "${libdir}" != "${prefix}/lib"; then
16    LIB_SEARCH_DIRS="-L${prefix}/lib -L${libdir}"
17else
18    LIB_SEARCH_DIRS="-L${libdir}"
19fi
20
21AC_SUBST(LIB_SEARCH_DIRS)
22
23AC_PROG_INSTALL
24AC_PROG_MAKE_SET
25
26dnl find and test the C compiler
27AC_PROG_CC
28AC_PROG_F77
29AC_LANG_C
30
31AC_PROG_INSTALL
32AC_PROG_RANLIB
33AC_PROG_LN_S
34AC_PROG_MKDIR_P
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
77with_tclsh="check"
78AC_ARG_WITH(
79    [tclsh],
80    [AS_HELP_STRING([--with-tclsh[=DIR]],
81        [location of tclsh @<:@default=check@:>@])],
82    [],
83    [with_tclsh=check])
84
85TCLSH=
86if test "$with_tclsh" != "no" ; then
87    AC_MSG_CHECKING([for tclsh])
88    if test -x "$with_tclsh/bin/tclsh"
89    then
90        echo Found tclsh in $with_tclsh/bin/tclsh
91        TCLSH="$with_tclsh/bin/tclsh"
92    else
93        if test -x "$with_tclsh"
94        then
95            echo Found tclsh in $with_tclsh
96            TCLSH="$with_tclsh"
97        else
98            AC_PATH_PROG(TCLSH, tclsh)
99        fi
100    fi
101fi
102AC_MSG_RESULT([${TCLSH}])
103AC_SUBST(TCLSH)
104
105
106AC_ARG_WITH(
107    [matlab],
108    [AS_HELP_STRING([--with-matlab[=DIR]],
109        [location of matlab and mex compiler @<:@default=check@:>@])],
110    [with_matlab=$withval],
111    [with_matlab=yes])
112
113MEX=""
114MEX_ARCH=""
115MEXEXT=""
116if test "$with_matlab" != "no" ; then
117  if test "$with_matlab" = "yes" ; then
118    AC_PATH_PROG(MEX, mex)
119  else
120    AC_PATH_PROG(MEX, mex, [${with_matlab}/bin/mex:${with_matlab}])
121  fi
122fi
123
124AC_SUBST(MEX)
125AC_SUBST(MEX_ARCH)
126AC_SUBST(MEXEXT)
127
128AC_ARG_WITH(
129    [octave],
130    [AS_HELP_STRING([--with-octave[=DIR]],
131        [location of octave compiler MKOCTFILE @<:@default=check@:>@])],
132    [with_octave=$withval],
133    [with_octave=yes])
134
135MKOCTFILE=
136if test "$with_octave" != "no" ; then
137  if test "$with_octave" = "yes" ; then
138    AC_PATH_PROG(MKOCTFILE, mkoctfile)
139  else
140    AC_PATH_PROG(MKOCTFILE, mkoctfile,
141        [${with_octave}/bin/mkoctfile:${with_octave}])
142  fi
143fi
144AC_SUBST(MKOCTFILE)
145
146
147AC_ARG_WITH(
148    [perl],
149    [AS_HELP_STRING([--with-perl[=DIR]], [location of perl @<:@default=check@:>@])],
150    [],
151    [with_perl=check])
152
153PERL=
154PERL_INCLUDES=
155PERL_ARCHLIB=
156PERL_VERSION=
157PERL_VENDORLIB=
158PERL_PRIVLIB=
159PERL_CPPFLAGS=
160PERL_CCFlAGS=
161PERL_VERSION_RV=
162if test "$with_perl" != "no" ; then
163    AC_MSG_CHECKING([for perl])
164    if test "$with_perl" != "yes" ; then
165      AC_PATH_PROG(PERL, perl, [$with_perl/bin:$with_perl])
166    else
167      AC_PATH_PROG(PERL, perl)
168    fi
169    if test "x${PERL}" != "x" ; then
170      PERL_ARCHLIB=`${PERL} -MConfig -e 'print $Config{archlib}'`
171      PERL_VERSION=`${PERL} -MConfig -e 'print $Config{version}'`
172      PERL_CCFLAGS=`${PERL} -MConfig -e 'print $Config{ccflags}'`
173      PERL_CPPFLAGS=`${PERL} -MConfig -e 'print $Config{cppflags}'`
174      PERL_VENDORLIB=`${PERL} -MConfig -e 'print $Config{vendorlib}'`
175      PERL_PRIVLIB=`${PERL} -MConfig -e 'print $Config{privlib}'`
176      PERL_VERSION_RV=`echo ${PERL_VERSION} | cut -d'.' -f1-2`
177    fi
178fi
179AC_MSG_RESULT([${PERL}])
180AC_SUBST(PERL)
181AC_SUBST(PERL_INCLUDES)
182AC_SUBST(PERL_ARCHLIB)
183AC_SUBST(PERL_VERSION)
184AC_SUBST(PERL_CCFLAGS)
185AC_SUBST(PERL_CPPFLAGS)
186AC_SUBST(PERL_VENDORLIB)
187AC_SUBST(PERL_PRIVLIB)
188AC_SUBST(PERL_VERSION_RV)
189
190PYTHON=""
191PYTHON_CFLAGS=""
192PYTHON_CPPFLAGS=""
193HAVE_PYTHON_DISTUTILS=""
194PYTHON_INCLUDES=""
195PYTHON_LDFLAGS=""
196PYTHON_LIB=""
197PYTHON_LIBDIR=""
198PYTHON_SITE_DIR=""
199PYTHON_SITE_PACKAGES=""
200PYTHON_VERSION=""
201pythondir=""
202
203AC_ARG_WITH([python],
204    [AS_HELP_STRING([--with-python[=DIR]],[location of python @<:@default=check@:>@])],
205    [],
206    [with_python=check])
207
208if test "$with_python" != "no" ; then
209  AC_MSG_CHECKING([for python])
210  if test -x "$with_python/bin/python"; then
211    echo Found python in $with_python/bin/python
212    PYTHON="$with_python/bin/python"
213  elif test -x "$with_python"; then
214    echo Found python in $with_python
215    PYTHON="$with_python"
216  else
217    AC_PATH_PROG(PYTHON, python python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
218  fi
219  if test "x${PYTHON}" != "x"; then
220    PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
221    echo Using python version $PYTHON_VERSION
222  fi
223  if test "x${PYTHON_VERSION}" != "x"; then
224    if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
225     -d $with_python/lib/python$PYTHON_VERSION/site-packages; then
226      PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
227      PYTHON_SITE_PACKAGES=$with_python/lib/python$PYTHON_VERSION/site-packages
228    else
229      if test -r $prefix/include/python$PYTHON_VERSION/Python.h; then
230        PYTHON_INCLUDES='$(prefix)/include/python$(PYTHON_VERSION)'
231        PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
232      else
233        if test -r /usr/include/python$PYTHON_VERSION/Python.h; then
234          PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
235          PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
236        else
237          echo could not find python$PYTHON_VERSION/Python.h
238        fi
239      fi
240      if test ! -d "$PYTHON_SITE_PACKAGES"; then
241        PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
242      fi
243    fi
244  fi
245  if test "x$with_python" != "x" ;  then
246    pythondir='$(PYTHON_SITE_PACKAGES)'
247  else
248    pythondir='$(libdir)/python${PYTHON_VERSION}/site-packages'
249  fi
250
251  AC_MSG_CHECKING([for python distutils])
252  ${PYTHON} -c "from distutils.core import setup; setup(name='test')" \
253        build build_ext 2>&1 > /dev/null
254  if test $? = 0 ; then
255    HAVE_PYTHON_DISTUTILS="yes"
256  else
257    HAVE_PYTHON_DISTUTILS="no"
258  fi
259  AC_MSG_RESULT([$HAVE_PYTHON_DISTUTILS])
260
261  if test "${HAVE_PYTHON_DISTUTILS}" = "yes"; then
262    #
263    # Check for Python include path
264    #
265    AC_MSG_CHECKING([for Python include path])
266    if test "x${PYTHON_CPPFLAGS}" = "x"; then
267      incdir_path=`${PYTHON} -c "import distutils.sysconfig; \
268       print distutils.sysconfig.get_python_inc();"`
269      if test -n "${incdir}"; then
270        python_path="-I${incdir}"
271      fi
272      PYTHON_CPPFLAGS=$python_path
273    fi
274    AC_MSG_RESULT([$PYTHON_CPPFLAGS])
275    AC_SUBST([PYTHON_CPPFLAGS])
276    #
277    # python distutils found, get settings from python directly
278    #
279    AC_MSG_CHECKING([location of site-packages])
280    PYTHON_SITE_DIR="`${PYTHON} -c 'from distutils import sysconfig; print sysconfig.get_python_lib(0);'`"
281
282    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);'`"
283    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);'`"
284    PYTHON_LIB="`$PYTHON -c 'from distutils import sysconfig; print \"python\" + sysconfig.get_config_var(\"VERSION\");'`"
285    PYTHON_LIBDIR="`$PYTHON -c 'from distutils import sysconfig; print sysconfig.get_config_var(\"LIBDIR\");'`"
286  fi
287fi 
288AC_SUBST(pythondir)
289
290AC_SUBST(PYTHON)
291AC_SUBST(PYTHON_VERSION)
292AC_SUBST(PYTHON_INCLUDES)
293AC_SUBST(PYTHON_SITE_PACKAGES)
294AC_SUBST(HAVE_PYTHON_DISTUTILS)
295
296rappture_with_ruby="yes"
297
298RUBY=""
299RUBY_DEV_PKG="no"
300
301AC_ARG_WITH(ruby,
302  AS_HELP_STRING([--with-ruby=PATH], [absolute path to ruby executable]),
303  [rappture_with_ruby=$with_val])
304if test "${rappture_with_ruby}" != "no" ; then
305  if test "${rappture_with_ruby}" = "yes" ; then
306    AC_PATH_PROG(RUBY, ruby)
307  else
308    AC_PATH_PROG(RUBY, ruby,
309      [${rappture_with_ruby}/bin/ruby:${rappture_with_ruby}])
310  fi
311fi
312AC_SUBST(RUBY)
313
314RUBY_VERSION_RV=
315RUBY_PLATFORM=
316if test "x${RUBY}" != "x" ; then
317  AX_PROG_RUBY_VERSION
318  RUBY_VERSION_RV=`echo ${RUBY_VERSION} | cut -d'.' -f1-2`
319  RUBY_PLATFORM=`ruby -e 'puts RUBY_PLATFORM'`
320  ac_mkmf_result=`${RUBY} -r mkmf -e ";" 2>&1`
321  if test -z "$ac_mkmf_result"; then
322    HAVE_RUBY_DEVEL="yes"
323    AX_RUBY_DEV_FLAGS([${RUBY}])
324  fi
325fi
326AC_SUBST(HAVE_RUBY_DEVEL)
327AC_SUBST(RUBY_VERSION_RV)
328AC_SUBST(RUBY_PLATFORM)
329
330RP_BASE=`pwd`
331AC_SUBST(RP_BASE)
332
333SC_ENABLE_SHARED
334
335#--------------------------------------------------------------------
336# This macro figures out what flags to use with the compiler/linker
337# when building shared/static debug/optimized objects.  This information
338# is all taken from the tclConfig.sh file.
339#--------------------------------------------------------------------
340
341AC_SUBST(CFLAGS_DEBUG)
342AC_SUBST(CFLAGS_OPTIMIZE)
343AC_SUBST(STLIB_LD)
344AC_SUBST(SHLIB_LD)
345AC_SUBST(SHLIB_CFLAGS)
346AC_SUBST(SHLIB_LDFLAGS)
347AC_SUBST(SHLIB_SUFFIX)
348
349. ${exec_prefix}/lib/tclConfig.sh
350. ${exec_prefix}/lib/tkConfig.sh
351AC_SUBST(TCL_VERSION)
352AC_SUBST(TK_VERSION)
353
354#--------------------------------------------------------------------
355# Set the default compiler switches based on the --enable-symbols
356# option.
357#--------------------------------------------------------------------
358
359SC_ENABLE_SYMBOLS
360
361if test "${SHARED_BUILD}" = "1" ; then
362    CFLAGS='${CFLAGS_DEFAULT} ${CFLAGS_WARNING} ${SHLIB_CFLAGS}'
363else
364    CFLAGS='${CFLAGS_DEFAULT} ${CFLAGS_WARNING}'
365fi
366
367ac_configure_args="--disable-threads --enable-shared"
368AC_CONFIG_SUBDIRS( [packages/optimizer/src] )
369
370dnl read Makefile.in and write Makefile
371AC_OUTPUT( [
372    Makefile
373    packages/Makefile
374    src/Makefile
375    src/core/Makefile
376    src/core2/Makefile
377    src/objects/Makefile
378    gui/Makefile
379    gui/apps/Makefile
380    gui/apps/rappture
381    gui/apps/rappture.env
382    gui/apps/simsim
383    gui/pkgIndex.tcl
384    gui/scripts/Makefile
385    lang/Makefile
386    lang/perl/Makefile
387    lang/perl/Makefile.PL
388    lang/python/Makefile
389    lang/python/setup.py
390    lang/matlab/Makefile
391    lang/octave/Makefile
392    lang/ruby/Makefile
393    lang/ruby/build.rb
394    lang/tcl/Makefile
395    lang/tcl/pkgIndex.tcl
396    lang/tcl/src/Makefile
397    lang/tcl/scripts/Makefile
398    lang/tcl/tests/Makefile
399    lib/Makefile
400    examples/Makefile
401    examples/3D/Makefile
402    examples/app-fermi/Makefile
403    examples/app-fermi/2.0/Makefile
404    examples/app-fermi/cee/Makefile
405    examples/app-fermi/fortran/Makefile
406    examples/app-fermi/matlab/Makefile
407    examples/app-fermi/octave/Makefile
408    examples/app-fermi/perl/Makefile
409    examples/app-fermi/python/Makefile
410    examples/app-fermi/ruby/Makefile
411    examples/app-fermi/tcl/Makefile
412    examples/app-fermi/wrapper/Makefile
413    examples/app-fermi/wrapper/cee/Makefile
414    examples/app-fermi/wrapper/python/Makefile
415    examples/app-fermi/wrapper/tcl/Makefile
416    examples/c-example/Makefile
417    examples/canvas/Makefile
418    examples/demo.bash
419    examples/graph/Makefile
420    examples/zoo/Makefile
421    examples/zoo/binary/Makefile
422    examples/zoo/boolean/Makefile
423    examples/zoo/choice/Makefile
424    examples/zoo/cloud/Makefile
425    examples/zoo/cloud/matlab/Makefile
426    examples/zoo/curve/Makefile
427    examples/zoo/enable/Makefile
428    examples/zoo/field/Makefile
429    examples/zoo/group/Makefile
430    examples/zoo/image/Makefile
431    examples/zoo/image/docs/Makefile
432    examples/zoo/image/examples/Makefile
433    examples/zoo/integer/Makefile
434    examples/zoo/integer2/Makefile
435    examples/zoo/loader/Makefile
436    examples/zoo/loader/examples/Makefile
437    examples/zoo/log/Makefile
438    examples/zoo/note/Makefile
439    examples/zoo/note/docs/Makefile
440    examples/zoo/number/Makefile
441    examples/zoo/number2/Makefile
442    examples/zoo/phase/Makefile
443    examples/zoo/sequence/Makefile
444    examples/zoo/sequence/examples/Makefile
445    examples/zoo/string/Makefile
446    examples/zoo/structure/Makefile
447    examples/zoo/structure/examples/Makefile
448    examples/zoo/table/Makefile
449    test/Makefile
450    test/src/Makefile
451])
Note: See TracBrowser for help on using the repository browser.