source: trunk/configure.in @ 1087

Last change on this file since 1087 was 1087, checked in by dkearney, 16 years ago

adjusted how we calculate the library path for perl and ruby bindings

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