source: trunk/configure.in @ 1095

Last change on this file since 1095 was 1093, checked in by gah, 14 years ago

yet another fix for perl language binding

File size: 12.9 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_INSTALLARCHLIB=`${PERL} -MConfig -e 'print $Config{installarchlib}'`
177      PERL_VERSION_RV=`echo ${PERL_VERSION} | cut -d'.' -f1-2`
178    fi
179fi
180AC_MSG_RESULT([${PERL}])
181AC_SUBST(PERL)
182AC_SUBST(PERL_INCLUDES)
183AC_SUBST(PERL_ARCHLIB)
184AC_SUBST(PERL_VERSION)
185AC_SUBST(PERL_CCFLAGS)
186AC_SUBST(PERL_CPPFLAGS)
187AC_SUBST(PERL_VENDORLIB)
188AC_SUBST(PERL_PRIVLIB)
189AC_SUBST(PERL_INSTALLARCHLIB)
190AC_SUBST(PERL_VERSION_RV)
191
192PYTHON=""
193PYTHON_CFLAGS=""
194PYTHON_CPPFLAGS=""
195HAVE_PYTHON_DISTUTILS=""
196PYTHON_INCLUDES=""
197PYTHON_LDFLAGS=""
198PYTHON_LIB=""
199PYTHON_LIBDIR=""
200PYTHON_SITE_DIR=""
201PYTHON_SITE_PACKAGES=""
202PYTHON_VERSION=""
203pythondir=""
204
205AC_ARG_WITH([python],
206    [AS_HELP_STRING([--with-python[=DIR]],[location of python @<:@default=check@:>@])],
207    [],
208    [with_python=check])
209
210if test "$with_python" != "no" ; then
211  AC_MSG_CHECKING([for python])
212  if test -x "$with_python/bin/python"; then
213    echo Found python in $with_python/bin/python
214    PYTHON="$with_python/bin/python"
215  elif test -x "$with_python"; then
216    echo Found python in $with_python
217    PYTHON="$with_python"
218  else
219    AC_PATH_PROG(PYTHON, python python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5)
220  fi
221  if test "x${PYTHON}" != "x"; then
222    PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
223    echo Using python version $PYTHON_VERSION
224  fi
225  if test "x${PYTHON_VERSION}" != "x"; then
226    if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
227     -d $with_python/lib/python$PYTHON_VERSION/site-packages; then
228      PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
229      PYTHON_SITE_PACKAGES=$with_python/lib/python$PYTHON_VERSION/site-packages
230    else
231      if test -r $prefix/include/python$PYTHON_VERSION/Python.h; then
232        PYTHON_INCLUDES='$(prefix)/include/python$(PYTHON_VERSION)'
233        PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
234      else
235        if test -r /usr/include/python$PYTHON_VERSION/Python.h; then
236          PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
237          PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
238        else
239          echo could not find python$PYTHON_VERSION/Python.h
240        fi
241      fi
242      if test ! -d "$PYTHON_SITE_PACKAGES"; then
243        PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"`
244      fi
245    fi
246  fi
247  if test "x$with_python" != "x" ;  then
248    pythondir='$(PYTHON_SITE_PACKAGES)'
249  else
250    pythondir='$(libdir)/python${PYTHON_VERSION}/site-packages'
251  fi
252
253  AC_MSG_CHECKING([for python distutils])
254  ${PYTHON} -c "from distutils.core import setup; setup(name='test')" \
255        build build_ext 2>&1 > /dev/null
256  if test $? = 0 ; then
257    HAVE_PYTHON_DISTUTILS="yes"
258  else
259    HAVE_PYTHON_DISTUTILS="no"
260  fi
261  AC_MSG_RESULT([$HAVE_PYTHON_DISTUTILS])
262
263  if test "${HAVE_PYTHON_DISTUTILS}" = "yes"; then
264    #
265    # Check for Python include path
266    #
267    AC_MSG_CHECKING([for Python include path])
268    if test "x${PYTHON_CPPFLAGS}" = "x"; then
269      incdir_path=`${PYTHON} -c "import distutils.sysconfig; \
270       print distutils.sysconfig.get_python_inc();"`
271      if test -n "${incdir}"; then
272        python_path="-I${incdir}"
273      fi
274      PYTHON_CPPFLAGS=$python_path
275    fi
276    AC_MSG_RESULT([$PYTHON_CPPFLAGS])
277    AC_SUBST([PYTHON_CPPFLAGS])
278    #
279    # python distutils found, get settings from python directly
280    #
281    AC_MSG_CHECKING([location of site-packages])
282    PYTHON_SITE_DIR="`${PYTHON} -c 'from distutils import sysconfig; print sysconfig.get_python_lib(0);'`"
283
284    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);'`"
285    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);'`"
286    PYTHON_LIB="`$PYTHON -c 'from distutils import sysconfig; print \"python\" + sysconfig.get_config_var(\"VERSION\");'`"
287    PYTHON_LIBDIR="`$PYTHON -c 'from distutils import sysconfig; print sysconfig.get_config_var(\"LIBDIR\");'`"
288  fi
289fi 
290AC_SUBST(pythondir)
291
292AC_SUBST(PYTHON)
293AC_SUBST(PYTHON_VERSION)
294AC_SUBST(PYTHON_INCLUDES)
295AC_SUBST(PYTHON_SITE_PACKAGES)
296AC_SUBST(HAVE_PYTHON_DISTUTILS)
297
298rappture_with_ruby="yes"
299
300RUBY=""
301RUBY_DEV_PKG="no"
302
303AC_ARG_WITH(ruby,
304  AS_HELP_STRING([--with-ruby=PATH], [absolute path to ruby executable]),
305  [rappture_with_ruby=$with_val])
306if test "${rappture_with_ruby}" != "no" ; then
307  if test "${rappture_with_ruby}" = "yes" ; then
308    AC_PATH_PROG(RUBY, ruby)
309  else
310    AC_PATH_PROG(RUBY, ruby,
311      [${rappture_with_ruby}/bin/ruby:${rappture_with_ruby}])
312  fi
313fi
314AC_SUBST(RUBY)
315
316RUBY_VERSION_RV=
317RUBY_PLATFORM=
318if test "x${RUBY}" != "x" ; then
319  AX_PROG_RUBY_VERSION
320  RUBY_VERSION_RV=`echo ${RUBY_VERSION} | cut -d'.' -f1-2`
321  RUBY_PLATFORM=`ruby -e 'puts RUBY_PLATFORM'`
322  ac_mkmf_result=`${RUBY} -r mkmf -e ";" 2>&1`
323  if test -z "$ac_mkmf_result"; then
324    HAVE_RUBY_DEVEL="yes"
325    AX_RUBY_DEV_FLAGS([${RUBY}])
326  fi
327fi
328AC_SUBST(HAVE_RUBY_DEVEL)
329AC_SUBST(RUBY_VERSION_RV)
330AC_SUBST(RUBY_PLATFORM)
331
332RP_BASE=`pwd`
333AC_SUBST(RP_BASE)
334
335SC_ENABLE_SHARED
336
337#--------------------------------------------------------------------
338# This macro figures out what flags to use with the compiler/linker
339# when building shared/static debug/optimized objects.  This information
340# is all taken from the tclConfig.sh file.
341#--------------------------------------------------------------------
342
343AC_SUBST(CFLAGS_DEBUG)
344AC_SUBST(CFLAGS_OPTIMIZE)
345AC_SUBST(STLIB_LD)
346AC_SUBST(SHLIB_LD)
347AC_SUBST(SHLIB_CFLAGS)
348AC_SUBST(SHLIB_LDFLAGS)
349AC_SUBST(SHLIB_SUFFIX)
350
351. ${exec_prefix}/lib/tclConfig.sh
352. ${exec_prefix}/lib/tkConfig.sh
353AC_SUBST(TCL_VERSION)
354AC_SUBST(TK_VERSION)
355
356#--------------------------------------------------------------------
357# Set the default compiler switches based on the --enable-symbols
358# option.
359#--------------------------------------------------------------------
360
361SC_ENABLE_SYMBOLS
362
363if test "${SHARED_BUILD}" = "1" ; then
364    CFLAGS='${CFLAGS_DEFAULT} ${CFLAGS_WARNING} ${SHLIB_CFLAGS}'
365else
366    CFLAGS='${CFLAGS_DEFAULT} ${CFLAGS_WARNING}'
367fi
368
369ac_configure_args="--disable-threads --enable-shared"
370AC_CONFIG_SUBDIRS( [packages/optimizer/src] )
371
372dnl read Makefile.in and write Makefile
373AC_OUTPUT( [
374    Makefile
375    packages/Makefile
376    src/Makefile
377    src/core/Makefile
378    src/core2/Makefile
379    src/objects/Makefile
380    gui/Makefile
381    gui/apps/Makefile
382    gui/apps/rappture
383    gui/apps/rappture.env
384    gui/apps/simsim
385    gui/pkgIndex.tcl
386    gui/scripts/Makefile
387    lang/Makefile
388    lang/perl/Makefile
389    lang/perl/Makefile.PL
390    lang/python/Makefile
391    lang/python/setup.py
392    lang/matlab/Makefile
393    lang/octave/Makefile
394    lang/ruby/Makefile
395    lang/ruby/build.rb
396    lang/tcl/Makefile
397    lang/tcl/pkgIndex.tcl
398    lang/tcl/src/Makefile
399    lang/tcl/scripts/Makefile
400    lang/tcl/tests/Makefile
401    lib/Makefile
402    examples/Makefile
403    examples/3D/Makefile
404    examples/app-fermi/Makefile
405    examples/app-fermi/2.0/Makefile
406    examples/app-fermi/cee/Makefile
407    examples/app-fermi/fortran/Makefile
408    examples/app-fermi/matlab/Makefile
409    examples/app-fermi/octave/Makefile
410    examples/app-fermi/perl/Makefile
411    examples/app-fermi/python/Makefile
412    examples/app-fermi/ruby/Makefile
413    examples/app-fermi/tcl/Makefile
414    examples/app-fermi/wrapper/Makefile
415    examples/app-fermi/wrapper/cee/Makefile
416    examples/app-fermi/wrapper/python/Makefile
417    examples/app-fermi/wrapper/tcl/Makefile
418    examples/c-example/Makefile
419    examples/canvas/Makefile
420    examples/demo.bash
421    examples/graph/Makefile
422    examples/zoo/Makefile
423    examples/zoo/binary/Makefile
424    examples/zoo/boolean/Makefile
425    examples/zoo/choice/Makefile
426    examples/zoo/cloud/Makefile
427    examples/zoo/cloud/matlab/Makefile
428    examples/zoo/curve/Makefile
429    examples/zoo/enable/Makefile
430    examples/zoo/field/Makefile
431    examples/zoo/group/Makefile
432    examples/zoo/image/Makefile
433    examples/zoo/image/docs/Makefile
434    examples/zoo/image/examples/Makefile
435    examples/zoo/integer/Makefile
436    examples/zoo/integer2/Makefile
437    examples/zoo/loader/Makefile
438    examples/zoo/loader/examples/Makefile
439    examples/zoo/log/Makefile
440    examples/zoo/note/Makefile
441    examples/zoo/note/docs/Makefile
442    examples/zoo/number/Makefile
443    examples/zoo/number2/Makefile
444    examples/zoo/phase/Makefile
445    examples/zoo/sequence/Makefile
446    examples/zoo/sequence/examples/Makefile
447    examples/zoo/string/Makefile
448    examples/zoo/structure/Makefile
449    examples/zoo/structure/examples/Makefile
450    examples/zoo/table/Makefile
451    test/Makefile
452    test/src/Makefile
453])
Note: See TracBrowser for help on using the repository browser.