AC_INIT(Rappture Core and Bindings, 1.1, rappture@nanohub.org) VERSION=0.0.1 AC_SUBST(VERSION) #------------------------------------------------------------------------ # Handle the --prefix=... option #------------------------------------------------------------------------ if test "${prefix}" = "NONE"; then prefix=/usr/local fi if test "${exec_prefix}" = "NONE"; then exec_prefix=$prefix fi if test "${libdir}" != "${prefix}/lib"; then LIB_SEARCH_DIRS="-L${prefix}/lib -L${libdir}" else LIB_SEARCH_DIRS="-L${libdir}" fi AC_SUBST(LIB_SEARCH_DIRS) AC_PROG_INSTALL AC_PROG_MAKE_SET dnl find and test the C compiler AC_PROG_CC AC_LANG_C AC_HEADER_STDC AC_CHECK_FUNC(atol,,AC_MSG_ERROR(oops! no atol ?!?)) AC_PROG_CXX AC_LANG_CPLUSPLUS AC_CHECK_LIB(stdc++, main,,AC_MSG_ERROR(librappture requires libstdc++)) AC_CHECK_HEADERS(stack,,AC_MSG_WARN(STL classes missing ?)) AC_CHECK_HEADERS(string,,AC_MSG_WARN(STL classes missing ?)) AC_CHECK_HEADERS(list,,AC_MSG_WARN(STL classes missing ?)) AC_CHECK_HEADERS(vector,,AC_MSG_WARN(STL classes missing ?)) AC_PROG_F77([g77 f77 fort77 f90 xlf xlf90 fl32]) AC_ARG_ENABLE( [gui], [AS_HELP_STRING([--enable-gui], [build code related to the graphical user interface @<:@default=yes@:>@])], [], [enable_gui=yes]) ENABLE_GUI= if test "$enable_gui" != "no" ; then ENABLE_GUI="yes" fi AC_SUBST(ENABLE_GUI) dnl AC_ARG_ENABLE( dnl [tcl], dnl [AS_HELP_STRING([--enable-tcl], [build tcl bindings @<:@default=check@:>@])], dnl [], dnl [enable_tcl=check]) dnl dnl BUILD_TCL=yes dnl AC_SUBST(BUILD_TCL) AC_ARG_WITH( [tclsh], [AS_HELP_STRING([--with-tclsh[=DIR]], [location of tclsh @<:@default=check@:>@])], [], [with_tclsh=check]) TCLSH= if test "$with_tclsh" != "no" ; then AC_MSG_CHECKING([for tclsh]) if test -x "$with_tclsh/bin/tclsh" then echo Found tclsh in $with_tclsh/bin/tclsh TCLSH="$with_tclsh/bin/tclsh" else if test -x "$with_tclsh" then echo Found tclsh in $with_tclsh TCLSH="$with_tclsh" else AC_PATH_PROG(TCLSH, tclsh) fi fi fi AC_MSG_RESULT([${TCLSH}]) AC_SUBST(TCLSH) dnl AC_ARG_ENABLE ( dnl [matlab], dnl [AS_HELP_STRING([--enable-matlab], [build matlab bindings @<:@default=check@:>@])], dnl [], dnl [enable_matlab=check]) dnl BUILD_MATLAB=yes dnl AC_SUBST(BUILD_MATLAB) AC_ARG_WITH( [matlab], [AS_HELP_STRING([--with-matlab[=DIR]], [location of matlab and mex compiler @<:@default=check@:>@])], [], [with_matlab=check]) AC_ARG_WITH( [matlab_arch], [AS_HELP_STRING([--with-matlab-arch[=ARCH]], [build Matlab bindings for ARCH architecture @<:@default=check@:>@])], [], [with_matlab_arch=check]) AC_ARG_WITH( [mexext], [AS_HELP_STRING([--with-mexext[=ARCH]], [fallback extension for building mex files @<:@default=check@:>@])], [], [with_mexext=check]) MEX= MEX_ARCH= MEXEXT= dnl if test "$enable_matlab" != "no" ; then if test "$with_matlab" != "no" ; then AC_MSG_CHECKING([for matlab's mex]) if test "$with_matlab" != "no" ; then dnl WITH_MATLAB = "yes" if test -x "$with_matlab/bin/mex" then dnl # echo Found mex in $with_matlab/bin/mex MEX="$with_matlab/bin/mex" else if test -x "$with_matlab" then dnl # echo Found mex in $with_matlab MEX="$with_matlab" else AC_PATH_PROG(MEX, mex) fi fi matlab_path=`dirname $MEX`/matlab if test -x "$matlab_path" then MEX=${MEX} else MEX= fi AC_MSG_RESULT([${MEX}]) if test "$with_matlab_arch" = "check" ; then dnl still need to write the code to check the arch type with_matlab_arch="" fi if test "x$with_matlab_arch" != "x" ; then echo "using matlab architecture \"$with_matlab_arch\"" MEX_ARCH="-arch=$with_matlab_arch" dnl else dnl # if $with_matlab_arch is blank, get the os name from uname fi if test "x$MEX" != "x" ; then mexext_fxn=`dirname $MEX`/mexext if test -x "$mexext_fxn" ; then MEXEXT=`$mexext_fxn` if test "x${MEXEXT}" = "x" ; then dnl not even mexext can figure out what extension to use.... dnl # we should be doing an os type check instead of default mexglx dnl # use $with_matlab_arch if test "$with_mexext" != "check" ; then MEXEXT="mexglx" fi fi else if test "$with_mexext" != "check" ; then MEXEXT="mexglx" fi fi echo "Using mex file extension \"$MEXEXT\"" AC_MSG_RESULT([${MEXEXT}]) else dnl we shouldn't bother the user if we dont find matlab dnl just put out the message and don't compile matlab bindings echo "can't find the matlab compiler \"mex\"" echo "use --with-matlab=DIR to specify the location of a matlab installation" dnl # exit 1 fi fi fi AC_SUBST(MEX) AC_SUBST(MEX_ARCH) AC_SUBST(MEXEXT) dnl AC_ARG_ENABLE( dnl [octave], dnl [AS_HELP_STRING([--enable-octave], [build octave bindings @<:@default=check@:>@])], dnl [], dnl [enable_octave=check]) dnl BUILD_OCTAVE=yes dnl AC_SUBST(BUILD_OCTAVE) AC_ARG_WITH( [octave], [AS_HELP_STRING([--with-octave[=DIR]], [location of octave compiler MKOCTFILE @<:@default=check@:>@])], [], [with_octave=check]) MKOCTFILE= dnl if test "$enable_octave" != "no" ; then if test "$with_octave" != "no" ; then AC_MSG_CHECKING([for mkoctfile]) if test "$with_octave" != "no" ; then if test -x "$with_octave/bin/mkoctfile" then dnl echo Found octave in $with_octave/bin/mkoctfile MKOCTFILE="$with_octave/bin/mkoctfile" else if test -x "$with_octave" then echo Found mkoctfile in $with_octave MKOCTFILE="$with_octave" else AC_PATH_PROG(MKOCTFILE, mkoctfile) if test "x$MKOCTFILE" == "x" ; then dnl we shouldn't bother the user if we dont find mkoctfile dnl just put out the message and don't compile octave bindings echo "can't find the matlab compiler \"mkoctfile\"" echo "use --with-octave=DIR to specify the location of a mkoctfile installation" dnl # exit 1 fi fi fi fi AC_MSG_RESULT([${MKOCTFILE}]) fi AC_SUBST(MKOCTFILE) dnl perl and python check borrowed from dnl http://www.opensource.apple.com/darwinsource/Current/libxslt-8.1/libxslt/configure.in dnl dnl Perl is just needed for generating some data for XSLtmark dnl dnl AC_ARG_ENABLE( dnl [perl], dnl [AS_HELP_STRING([--enable-perl], [build perl bindings @<:@default=check@:>@])], dnl [], dnl [enable_perl=check]) dnl BUILD_PERL=yes dnl AC_SUBST(BUILD_PERL) AC_ARG_WITH( [perl], [AS_HELP_STRING([--with-perl[=DIR]], [location of perl @<:@default=check@:>@])], [], [with_perl=check]) PERL= PERL_INCLUDES= PERL_SITE_PACKAGES= if test "$with_perl" != "no" ; then AC_MSG_CHECKING([for perl]) if test -x "$with_perl/bin/perl" then echo Found perl in $with_perl/bin/perl PERL="$with_perl/bin/perl" else if test -x "$with_perl" then echo Found perl in $with_perl PERL="$with_perl" else AC_PATH_PROG(PERL, perl) fi fi PERL_SITE_PACKAGES='$(libdir)/perl5' fi AC_MSG_RESULT([${PERL}]) AC_SUBST(PERL) AC_SUBST(PERL_INCLUDES) AC_SUBST(PERL_SITE_PACKAGES) dnl dnl check for python dnl dnl AC_ARG_ENABLE( dnl [python], dnl [AS_HELP_STRING([--enable-pyton], [build python bindings @<:@default=check@:>@])], dnl [], dnl [enable_python=check]) dnl dnl BUILD_PYTHON=yes dnl AC_SUBST(BUILD_PYTHON) PYTHON= PYTHON_VERSION= PYTHON_INCLUDES= PYTHON_SITE_PACKAGES= pythondir= AC_ARG_WITH( [python], [AS_HELP_STRING([--with-python[=DIR]],[location of python @<:@default=check@:>@])], [], [with_python=check]) if test "$with_python" != "no" ; then AC_MSG_CHECKING([for python]) if test -x "$with_python/bin/python" then echo Found python in $with_python/bin/python PYTHON="$with_python/bin/python" else if test -x "$with_python" then echo Found python in $with_python PYTHON="$with_python" else AC_PATH_PROG(PYTHON, python python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5) fi fi if test "$PYTHON" != "" then PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"` echo Using python version $PYTHON_VERSION fi if test "$PYTHON_VERSION" != "" then if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \ -d $with_python/lib/python$PYTHON_VERSION/site-packages then PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION PYTHON_SITE_PACKAGES=$with_python/lib/python$PYTHON_VERSION/site-packages else if test -r $prefix/include/python$PYTHON_VERSION/Python.h then PYTHON_INCLUDES='$(prefix)/include/python$(PYTHON_VERSION)' PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages' else if test -r /usr/include/python$PYTHON_VERSION/Python.h then PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages' else echo could not find python$PYTHON_VERSION/Python.h fi fi if test ! -d "$PYTHON_SITE_PACKAGES" then PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"` fi fi fi if test "$with_python" != "" then pythondir='$(PYTHON_SITE_PACKAGES)' else pythondir='$(libdir)/python${PYTHON_VERSION}/site-packages' fi fi AC_SUBST(pythondir) dnl AC_SUBST(PYTHON_SUBDIR) AC_SUBST(PYTHON) AC_SUBST(PYTHON_VERSION) AC_SUBST(PYTHON_INCLUDES) AC_SUBST(PYTHON_SITE_PACKAGES) RP_BASE=`pwd` AC_SUBST(RP_BASE) if test "$ENABLE_GUI" == "yes" ; then AC_CONFIG_SUBDIRS( gui ) fi if test "$TCLSH" != "" ; then AC_CONFIG_SUBDIRS( src/tcl ) fi ls AC_CONFIG_SUBDIRS( [optimizer/src] ) dnl read Makefile.in and write Makefile AC_OUTPUT( Makefile \ examples/demo.bash examples/app-fermi/cee/Makefile \ examples/app-fermi/fortran/Makefile \ examples/app-fermi/wrapper/cee/Makefile \ examples/c-example/Makefile \ optimizer/src/Makefile \ perl/Makefile.PL \ python/setup.py \ src/Makefile \ src/matlab/Makefile \ src/octave/Makefile \ src2/core/Makefile \ test/Makefile \ gui/apps/simsim \ gui/apps/rappture \ gui/apps/rappture.env )