update automake adjunct file
[ctsim.git] / configure.ac
index bf2fba62d3ab541afe6e0d5e7eca529ceb0cead5..230c87534c26949a1da72918722e8d6140471678 100644 (file)
@@ -6,9 +6,17 @@ dnl CDPATH=
 AC_INIT
 AC_CONFIG_SRCDIR([src/ctsim.cpp])
 AM_MAINTAINER_MODE
-AM_INIT_AUTOMAKE(ctsim,4.3.4)
+AM_INIT_AUTOMAKE(ctsim,5.0.0)
 AM_CONFIG_HEADER(config.h)
 
+CFLAGS=""
+CXXFLAGS=""
+
+AM_PATH_GLIB_2_0(2.0.0,,AC_MSG_ERROR(You should get glib 2.0.0 or better.))
+AM_PATH_GTK_2_0(2.0.0,havegtk=yes,havegtk=no)
+
+CFLAGS="${CFLAGS} ${GTK_CFLAGS} ${GLIB_CFLAGS}"
+
 dnl Checks for programs.
 AC_PROG_AWK
 AC_PROG_INSTALL
@@ -19,10 +27,7 @@ AC_PROG_CC
 AC_PROG_CXX
 AC_C_BIGENDIAN
 
-AC_PATH_PROG(wxconfig,wxgtk-2.4-config)
-if [ ! "$wxconfig" ]; then
-  AC_PATH_PROG(wxconfig,wx-config)
-fi
+AC_PATH_PROG(wxconfig,wx-config)
 
 dnl Check for C operation
 AC_CANONICAL_HOST 
@@ -44,8 +49,8 @@ AC_CHECK_LIB(readline, main, [readline=true;
                  AC_DEFINE([HAVE_READLINE],1,[Readline library])],
                 [readline=false], [-lcurses])  
 wxwin=false
-AC_CHECK_LIB(wx_gtk-2.4, main, [wxwin=true; wx_gtk=true; AC_DEFINE(HAVE_WXWINDOWS,1,[wxwindows library])], [], [-L/usr/lib64 -L/usr/lib `gtk-config --libs` `glib-config --libs glib gmodule gthread` ])
-AC_CHECK_LIB(wx_mac-2.4, main, [wxwin=true; wx_mac=true; AC_DEFINE(HAVE_WXWINDOWS,1,[wxwindows library])])
+AC_CHECK_LIB(wx_gtk2u_core-2.8, main, [wxwin=true; wx_gtk=true; AC_DEFINE(HAVE_WXWINDOWS,1,[wxwindows library])], [], [-L/usr/lib64 -L/usr/lib ${GTK_LIBS} ${GLIB_LIBS} ])
+AC_CHECK_LIB(wx_mac-2.8, main, [wxwin=true; wx_mac=true; AC_DEFINE(HAVE_WXWINDOWS,1,[wxwindows library])])
 AC_CHECK_LIB(fftw3, fftw_malloc, [fftw=true; AC_DEFINE(HAVE_FFTW,1,[FFTW library])], [fftw=false], [-L/usr/lib64 -L/usr/lib])
 AC_CHECK_LIB(GL, main, [libgl=true], [libgl=false], [-L/usr/X11R6/lib -L/usr/X11R6/lib64])
 AC_CHECK_LIB(pthread, main, [pthread=true], [pthread=false])
@@ -103,10 +108,10 @@ AC_MSG_CHECKING([debug])
 AC_ARG_ENABLE(debug,
 [  --enable-debug          Turn on debugging],
 [case "${enableval}" in
-  yes) debug=true 
+  yes) debug="true" 
        AC_MSG_RESULT(yes)
        ;;
-  no)  debug=false 
+  no)  debug="false" 
        AC_MSG_RESULT(no)
        ;;
   *) AC_MSG_RESULT([bad value ${enableval} for --enable-debug]) 
@@ -273,20 +278,20 @@ AC_ARG_WITH(webdata-url, [  --with-webdata-url=PATH Set URL path of webdata],
 [ webdataurl=$withval ; AC_SUBST(webdataurl) ] )
 
 AC_ARG_WITH(html-dir, [  --with-html-dir=PATH    Set directory of html files], 
-[ htmldir=$withval ; AC_SUBST(htmldir) ] )
+[ html_%dir=$withval ; AC_SUBST(htmldir) ] )
 
 if test -n "$cgibindir" -o -n "$cgibinurl" ; then
   cgiprograms="ctsim.cgi ctsim.conf"
   AC_SUBST(cgiprograms)
 fi
 
-if test -n "$htmldir" ; then
+if test -n "$html_dir" ; then
   htmldata=simulate.html
   AC_SUBST(htmldata)
 fi
-AM_CONDITIONAL(USE_HTML, test -n "$htmldir")
+AM_CONDITIONAL(USE_HTML, test -n "$html_dir")
 
-if test -n "$cgibindir" -o -n "$cgibinurl" -o -n "$webdatadir" -o -n "$webdataurl" -o -n "$htmldir" ; then
+if test -n "$cgibindir" -o -n "$cgibinurl" -o -n "$webdatadir" -o -n "$webdataurl" -o -n "$html_dir" ; then
   webenabled=true
   AC_SUBST(webenabled)
   AC_MSG_RESULT([yes])
@@ -298,7 +303,7 @@ if test -n "$cgibindir" -o -n "$cgibinurl" -o -n "$webdatadir" -o -n "$webdataur
     AC_MSG_ERROR([--with-webdata-dir not set for web access])
   elif test -z "$webdataurl" ; then
     AC_MSG_ERROR([--with-webdata-url not set for web access])
-  elif test -z "$htmldir" ; then
+  elif test -z "$html_dir" ; then
     AC_MSG_ERROR([--with-html-dir not set for web access])
   fi
 else
@@ -337,10 +342,14 @@ if test "$with_x" != "no" && test "$wxwin" = "true"; then
     # Removed "-lglut" for Mac OS X compilation
     ctlib_graphics="$ctlib_graphics -lGL -lGLU"
     if test "$wxwin" = "true" ; then
+       wxdebug=""
+       if test "$debug" = "true"; then
+         wxdebug="--debug"
+       fi  
       if [ "$wx_gtk" ]; then 
-        ctlib_graphics="$ctlib_graphics `wx-config --libs` -lwx_gtk_gl-2.4 `gtk-config --libs` `glib-config --libs glib gmodule gthread`"
+       ctlib_graphics="$ctlib_graphics `$wxconfig $wxdebug --libs --version=2.8` -lwx_gtk2u_gl-2.8 ${GTK_LIBS} ${GLIB_LIBS}"
       elif [ "$wx_mac" ]; then
-        ctlib_graphics="$ctlib_graphics -lwx_mac_gl-2.4"
+        ctlib_graphics="$ctlib_graphics -lwx_mac_gl-2.8"
       fi
     fi
   fi
@@ -413,9 +422,9 @@ if test "$efence" = "true" -a "$useefence" = "true" ; then
 fi
 
 if test "$wxwin" = "true" ; then
-  if [ "$wx_gtk" = "true" ] || [ "$wx_mac" == "true" ] ; then  
-    wxcflags=`$wxconfig --cflags`
-    wxlibs=`$wxconfig --libs`
+  if [ "$wx_gtk" = "true" ] || [ "$wx_mac" = "true" ] ; then   
+    wxcflags=`$wxconfig $wxdebug --cxxflags --version=2.8`
+    #wxlibs=`$wxconfig --libs`
   else
        wxcflags="-D__WXMSW__ -D__WIN32__ -D__GNUWIN32__"
         wxlibs="-lwx -lglui -ljpeg -lxpm -lzlib -ltiff"