+LDFLAGS="$LDFLAGS -L/usr/local/lib"
+
+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"
+ ctlib_graphics="$ctlibs_base -lctgraphics"
+ AC_MSG_RESULT(yes)
+ if test "$g2" = "true" ; then
+ ctlib_graphics="$ctlib_graphics -lg2"
+ AC_DEFINE(HAVE_G2)
+ fi
+ ctlib_graphics="$ctlib_graphics $X_BASIC_LIBS $X_TOOLKIT_LIBS"
+ if test "$libgl" = "true" ; then
+ ctlib_graphics="$ctlib_graphics -lwx_gtk_gl -lglut -lGL -lGLU"
+ fi
+else
+ if test "$wxwin" = "true" ; then
+ AC_DEFINE(HAVE_SGP)
+ AM_CONDITIONAL(HAVE_SGP, test 1==1)
+ fi
+ AC_MSG_RESULT(no)
+fi
+
+if test "$png" = "true" ; then
+ ctlibs_tools="$ctlibs_tools -lpng"
+fi
+if test "$zlib" = "true" ; then
+ ctlibs_tools="$ctlibs_tools -lz"
+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_CHECKING([for enable-dmalloc])
+AC_ARG_ENABLE(dmalloc,
+[ --enable-dmalloc Use dmalloc memory allocation],
+[case "${enableval}" in
+ yes) usedmalloc=true
+ AC_MSG_RESULT(yes)
+ ;;
+ no) usedmalloc=false
+ AC_MSG_RESULT(no)
+ ;;
+ *) AC_MSG_RESULT([bad value ${enableval} for --enable-dmalloc])
+ ;;
+esac],
+[usedmalloc=false; AC_MSG_RESULT(no)])
+
+if test "$dmallocxx" = "true" -a "$usedmalloc" = "true" ; then
+ ctlibs_tools="$ctlibs_tools -ldmallocxx"
+ AC_DEFINE(HAVE_DMALLOC)
+ AC_MSG_RESULT(Using dmalloc)