dnl CDPATH=
AC_INIT(src/ctsim.cpp)
-AM_INIT_AUTOMAKE(ctsim,2.0.5)
+AM_INIT_AUTOMAKE(ctsim,3.5.0)
AM_CONFIG_HEADER(config.h)
dnl Checks for programs.
AC_CHECK_LIB(m, sin)
AC_CHECK_LIB(curses, main, [curses=true], [curses=false])
AC_CHECK_LIB(ncurses, main, [ncurses=true], [ncurses=false])
-AC_CHECK_LIB(g2, main, [g2=true], [g2=false])
+AC_CHECK_LIB(readline, main, [readline=true; AC_DEFINE(HAVE_READLINE)], [readline=false], [-lcurses])
+AC_CHECK_LIB(ncurses, main, [ncurses=true; AC_DEFINE(HAVE_NCURSES)], [ncurses=false])
+AC_CHECK_LIB(curses, main, [curses=true; AC_DEFINE(HAVE_CURSES)], [curses=false])
wxwin=false
-AC_CHECK_LIB(wx_gtk, main, [wxwin=true; wx_gtk=true; AC_DEFINE(HAVE_WXWINDOWS)])
+AC_CHECK_LIB(wx_gtk-2.2, main, [wxwin=true; wx_gtk=true; AC_DEFINE(HAVE_WXWINDOWS)])
AC_CHECK_LIB(wx, main, [wxwin=true; wx_msw=true; AC_DEFINE(HAVE_WXWINDOWS)])
-AC_CHECK_LIB(hdf5, main, [hdf5=true], [hdf5=false], -lz)
+AC_CHECK_LIB(hdf4, main, [hdf4=true], [hdf4=false], -lz)
AC_CHECK_LIB(fftw, fftw_one, [fftw=true; AC_DEFINE(HAVE_FFTW)], [fftw=false])
+AC_CHECK_LIB(GL, main, [libgl=true], [libgl=false], [-L/usr/X11R6/lib -lXt -lXext])
+AC_CHECK_LIB(pthread, main, [pthread=true], [pthread=false])
if test "$zlib" = "true" ; then
AC_CHECK_LIB(png, main, [png=true ; AC_DEFINE(HAVE_PNG)], [png=false])
dnl Checks for header files.
AC_HEADER_STDC
-AC_CHECK_HEADERS(fcntl.h unistd.h getopt.h sys/fcntl.h setjmp.h stdarg.h stddef.h sys/types.h sys/stat.h string.h ctype.h math.h stdio.h netinet/in.h inttypes.h sys/param.h stdint.h stdlib.h g2.h assert.h sys/time.h sys/resource.h sys/time.h sstream)
+AC_CHECK_HEADERS(fcntl.h unistd.h getopt.h sys/fcntl.h setjmp.h stdarg.h stddef.h sys/types.h sys/stat.h string.h ctype.h math.h stdio.h netinet/in.h inttypes.h sys/param.h stdint.h stdlib.h assert.h sys/time.h sys/resource.h sys/time.h readline.h readline/readline.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_CHECK_FUNC(getopt_long, [ getopt_long=true ], [ getopt_long=false ])
fi
+if test "${pthread}" = "true" ; then
+ AC_ADD_GCC_CFLAGS([-pthread -D_REENTRANT])
+ AC_DEFINE(HAVE_WXTHREADS)
+fi
+
if test "${getopt_long}" = "false" ; then
my_includes="$my_includes -I../getopt"
AC_DEFINE(HAVE_GETOPT_LONG)
AM_CONDITIONAL(INCLUDED_GETOPT_LONG, test 1==1)
fi
+if test "${readline}" = "true" ; then
+ ctlibs_base="$ctlibs_base -lreadline"
+ if test "${ncurses}" = "true"; then
+ ctlibs_base="$ctlibs_base -lncurses"
+ elif test "${curses}" = "true"; then
+ ctlibs_base="$ctlibs_base -lcurses"
+ fi
+fi
+
dnl Check for debug mode
AC_MSG_CHECKING([debug])
AC_ARG_ENABLE(debug,
CFLAGS="-g -DDEBUG"
AC_DEFINE(DEBUG)
else
-dnl AC_ADD_GCC_CFLAGS([-g -O2 -DNDEBUG])
- CFLAGS="-g -O3 -DNDEBUG"
+dnl AC_ADD_GCC_CFLAGS([-O2 -fexpensive-optimizations -DNDEBUG])
+ CFLAGS="-O3 -DNDEBUG -fomit-frame-pointer"
AC_DEFINE(NDEBUG)
fi
+AC_MSG_CHECKING(sstream)
+ if [ test -f /usr/include/sstream || test -f /usr/include/g++/sstream ||
+ test -f /usr/include/g++-2/sstream || test -f /usr/include/g++-3/sstream ]; then
+ AC_DEFINE(HAVE_SSTREAM)
+ AC_MSG_RESULT(yes)
+fi
+AC_MSG_RESULT(no)
+
AC_ADD_GCC_CFLAGS([-Wall])
AC_MSG_CHECKING(whether to enable verbose warnings)
AC_MSG_RESULT([no])
fi
+
+dnl Set CTN path
+AC_ARG_WITH(ctn,
+[ --with-ctn[=PATH] Set path of CTN DICOM library ],
+[ if test "$withval" != "no" ; then
+ tryctndir=$withval
+ fi ]
+)
+
+if test "$withval" != "no" ; then
+ if test "$prefix" != "NONE" ; then
+ tryctndir="$tryctndir $prefix"
+ fi
+
+ AC_MSG_CHECKING([for CTN DICOM installation])
+ for testctndir in "." $tryctndir /usr/local /usr/local/ctn /usr /usr/ctn /opt /opt/ctn ; do
+ if test -f "$testctndir/lib/libctn.a" ; then
+ if test "$testctndir" != "/usr"; then
+ LDFLAGS="$LDFLAGS -L$testctndir/lib"
+ CFLAGS="$CFLAGS -I$testctndir/include"
+ fi
+ ctndir="$testctndir"
+ ctn="true"
+ AC_DEFINE(HAVE_CTN_DICOM)
+ break
+ fi
+ done
+ AC_MSG_RESULT($ctndir)
+else
+ AC_MSG_RESULT([no])
+fi
+
+
+
AC_MSG_CHECKING([for web access])
dnl Set cgi-bin directory
AC_ARG_WITH(cgibin-dir, [ --with-cgibin-dir=PATH Set path of CGI binaries directory ],
AC_SUBST(X_EXTRA_LIBS)
X_TOOLKIT_LIBS="-lXt"
-X_BASIC_LIBS="-lXext -lX11"
+X_BASIC_LIBS="-lXext -lX11 -lXmu"
dnl Check whether libXt has thread support. Some platforms may have
dnl pthread support in libc, but no thread support in libXt/libX11.
AC_MSG_CHECKING([for X])
if test "$no_x" != "yes" ; then
- AC_DEFINE(HAVE_SGP)
- AM_CONDITIONAL(HAVE_SGP, test 1==1)
AC_DEFINE(HAVE_X11)
LDFLAGS="$LDFLAGS -L../libctgraphics -L/usr/X11R6/lib"
- ctlibs_graphics="$ctlibs_base -lctgraphics"
+ ctlib_graphics="$ctlibs_base -lctgraphics"
AC_MSG_RESULT(yes)
- if test "$g2" = "true" ; then
- ctlibs_graphics="$ctlibs_graphics -lg2"
- AC_DEFINE(HAVE_G2)
- fi
- ctlibs_graphics="$ctlibs_graphics $X_BASIC_LIBS $X_TOOLKIT_LIBS"
-else
+ ctlib_graphics="$ctlib_graphics $X_BASIC_LIBS $X_TOOLKIT_LIBS"
+ if test "$libgl" = "true" ; then
+ ctlib_graphics="$ctlib_graphics -lglut -lGL -lGLU"
+ if test "$wxwin" = "true" ; then
+ ctlib_graphics="$ctlib_graphics -lwx_gtk_gl-2.2"
+ fi
+ fi
if test "$wxwin" = "true" ; then
AC_DEFINE(HAVE_SGP)
AM_CONDITIONAL(HAVE_SGP, test 1==1)
fi
+else
AC_MSG_RESULT(no)
fi
if test "$fftw" = "true" ; then
ctlibs_tools="$ctlibs_tools -lrfftw -lfftw"
fi
+if test "$ctn" = "true"; then
+ ctlibs_tools="$ctlibs_tools -lctn"
+fi
dnl Check for dmalloc
AC_CHECK_LIB(dmallocxx, main, [dmallocxx=true], [dmallocxx=false])
AC_MSG_RESULT(Using dmalloc)
fi
+dnl Check for efence
+AC_CHECK_LIB(efence, main, [efence=true], [efence=false])
+AC_MSG_CHECKING([for enable-efence])
+AC_ARG_ENABLE(efence,
+[ --enable-efence Use ElectricFence memory allocation],
+[case "${enableval}" in
+ yes) useefence=true
+ AC_MSG_RESULT(yes)
+ ;;
+ no) useefence=false
+ AC_MSG_RESULT(no)
+ ;;
+ *) AC_MSG_RESULT([bad value ${enableval} for --enable-efence])
+ ;;
+esac],
+[useefence=false; AC_MSG_RESULT(no)])
+
+if test "$efence" = "true" -a "$useefence" = "true" ; then
+ ctlibs_tools="$ctlibs_tools -lefence"
+ AC_DEFINE(HAVE_EFENCE)
+ AC_MSG_RESULT(Using efence)
+fi
+
if test "$wxwin" = "true" ; then
if test "$wx_gtk" = "true" ; then
wxcflags=`$wxconfig --cflags`
wxlibs="-lwx -lglui -ljpeg -lxpm -lzlib -ltiff"
fi
CFLAGS="$CFLAGS -I../include $wxcflags"
- ctlibs_graphics="$ctlibs_graphics $wxlibs"
+ ctlib_graphics="$ctlib_graphics $wxlibs"
AM_CONDITIONAL(HAVE_WXWINDOWS, test 1==1 )
fi
AC_SUBST(wxcflags)
dnl Setting projet libraries and includes
LDFLAGS="$LDFLAGS -L../libctsupport -L../libctsim"
-ctlibs="$ctlibs_base -lctsim $ctlibs_graphics -lctsupport $ctlibs_tools"
+ctlibs="$ctlibs_base -lctsim $ctlib_graphics -lctsupport $ctlibs_tools"
AC_SUBST(ctlibs)
if test -n "$lamdir" ; then
- lamprograms="pjrec-lam phm2if-lam phm2pj-lam"
+ lamprograms="ctsimtext-lam"
AC_SUBST(lamprograms)
lamdefs="$CFLAGS"
AC_SUBST(lamdefs)
CXXFLAGS="$CFLAGS"
-AC_OUTPUT(Makefile libctgraphics/Makefile libctsupport/Makefile libctsim/Makefile Makefile man/Makefile doc/Makefile cgi-bin/ctsim.cgi cgi-bin/Makefile html/simulate.html html/Makefile include/Makefile getopt/Makefile tools/sample-ctsim.sh cgi-bin/ctsim.conf tools/Makefile src/Makefile)
+AC_OUTPUT(Makefile libctgraphics/Makefile libctsupport/Makefile libctsim/Makefile Makefile man/Makefile doc/Makefile cgi-bin/ctsim.cgi cgi-bin/Makefile html/simulate.html html/Makefile include/Makefile getopt/Makefile tools/sample-ctsim.sh cgi-bin/ctsim.conf tools/Makefile src/Makefile helical/Makefile helical/sample-helical.sh)