r11602: Apr 1, 2007 Version 4.5.3
[ctsim.git] / configure.ac
index 6dfa7cef68d18d36e6b21b85f23afda63a8cd5ad..f0c72fefd4cbeac126fcfdc4c9faa8b5ae481142 100644 (file)
@@ -6,7 +6,7 @@ dnl CDPATH=
 AC_INIT
 AC_CONFIG_SRCDIR([src/ctsim.cpp])
 AM_MAINTAINER_MODE
-AM_INIT_AUTOMAKE(ctsim,4.2.3)
+AM_INIT_AUTOMAKE(ctsim,4.5.2)
 AM_CONFIG_HEADER(config.h)
 
 dnl Checks for programs.
@@ -19,7 +19,10 @@ AC_PROG_CC
 AC_PROG_CXX
 AC_C_BIGENDIAN
 
-AC_PATH_PROG(wxconfig,wx-config)
+AC_PATH_PROG(wxconfig,wxgtk-2.4-config)
+if [ ! "$wxconfig" ]; then
+  AC_PATH_PROG(wxconfig,wx-config)
+fi
 
 dnl Check for C operation
 AC_CANONICAL_HOST 
@@ -41,10 +44,10 @@ 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])])
+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(fftw, fftw_one, [fftw=true; AC_DEFINE(HAVE_FFTW,1,[FFTW library])], [fftw=false])
-AC_CHECK_LIB(GL, main, [libgl=true], [libgl=false], [-L/usr/X11R6/lib -lXt -lXext])
+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])
 
 if test "$zlib" = "true" ; then
@@ -63,7 +66,7 @@ AC_STRUCT_TM
 
 dnl Checks for library functions.
 AC_FUNC_VPRINTF
-AC_CHECK_FUNCS(strtod strtol snprintf htonl usleep vsprintf vsnprintf)
+AC_CHECK_FUNCS(strtod strtol snprintf htonl usleep vsprintf vsnprintf basename setjmp setpriority time gettimeofday getenv)
 AC_CHECK_FUNC(basename)
 AC_CHECK_FUNC(setjmp)
 AC_CHECK_FUNC(setpriority)
@@ -82,8 +85,9 @@ if test "${getopt_long}" = "false" ; then
   AC_DEFINE(HAVE_GETOPT_LONG,1,[getopt_long library])
   ctlibs_base="$ctlibs_base -lgetopt"
   LDFLAGS="$LDFLAGS -L../getopt"
-  AM_CONDITIONAL(INCLUDED_GETOPT_LONG, test 1==1)
+  GETOPTLONG=1
 fi
+AM_CONDITIONAL(INCLUDED_GETOPT_LONG, test "$GETOPTLONG"="1")
 
 if test "${readline}" = "true" ; then
   ctlibs_base="$ctlibs_base -lreadline"
@@ -269,20 +273,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])
@@ -294,7 +298,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
@@ -303,17 +307,6 @@ fi
 
 AM_CONDITIONAL(USE_LAM, test -n "$lamdir")
 
-dnl Prepare to support X.  If the user gave the command-line option
-dnl --without-x, AC_PATH_XTRA will set no_x to "yes".  Otherwise, it will
-dnl add appropriate preprocessor flags to X_CFLAGS, and appropriate linker
-dnl flags to X_LIBS.  It also checks for system-specific X libraries, and
-dnl adds them to X_PRE_LIBS or X_EXTRA_LIBS, as appropriate.  (The former
-dnl is where "-lSM -lICE" goes, in X11R6.)  We define the X_TOOLKIT_LIBS
-dnl and X_BASIC_LIBS argument vectors ourselves, and if X is to be
-dnl supported, we'll concatenate the whole lot of these into a command line
-dnl for libtool.  See, e.g., the libplot_la_LIBADD line in
-dnl libplot/Makefile.am.
-
 AC_PATH_XTRA
 AC_SUBST(X_CFLAGS)
 dnl Following five are concatenated together into a linker specification.
@@ -323,19 +316,9 @@ AC_SUBST(X_PRE_LIBS)
 AC_SUBST(X_BASIC_LIBS)
 AC_SUBST(X_EXTRA_LIBS)
 
-X_TOOLKIT_LIBS="-lXt"
-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.
-our_saved_LDFLAGS="$LDFLAGS"
-LDFLAGS="$X_LIBS $LDFLAGS"
-AC_CHECK_LIB(Xt, XtToolkitThreadInitialize, AC_DEFINE(X_THREAD_SUPPORT,1,[x thread supported]), , $X_PRE_LIBS $X_BASIC_LIBS $X_EXTRA_LIBS)
-LDFLAGS="$our_saved_LDFLAGS"
-
 dnl Our Makefile.am files test the automake variable NO_X to determine
 dnl whether X should be supported.
-AM_CONDITIONAL(NO_X, test "x$no_x" = "xyes")
+AM_CONDITIONAL(NO_X, test "x$with_x" = "xno")
 
 my_includes="$my_includes -I../include -I.. -I/usr/local/include"
 AC_SUBST(my_includes)
@@ -343,9 +326,9 @@ AC_SUBST(my_includes)
 LDFLAGS="$LDFLAGS -L/usr/local/lib"
 
 AC_MSG_CHECKING([for X])
-if test "$no_x" != "yes" ; then
+if test "$with_x" != "no" && test "$wxwin" = "true"; then
   AC_DEFINE(HAVE_X11,1,[X11 system])
-  LDFLAGS="$LDFLAGS -L../libctgraphics -L/usr/X11R6/lib"
+  LDFLAGS="$LDFLAGS -L../libctgraphics -L/usr/X11R6/lib -L/usr/X11R6/lib64"
   my_includes="$my_includes -I/usr/X11R6/include"
   ctlib_graphics="$ctlibs_base -lctgraphics"
   AC_MSG_RESULT(yes)
@@ -355,7 +338,7 @@ if test "$no_x" != "yes" ; then
     ctlib_graphics="$ctlib_graphics -lGL -lGLU"
     if test "$wxwin" = "true" ; then
       if [ "$wx_gtk" ]; then 
-        ctlib_graphics="$ctlib_graphics -lwx_gtk_gl-2.4"
+        ctlib_graphics="$ctlib_graphics `wx-config --libs` -lwx_gtk_gl-2.4 `gtk-config --libs` `glib-config --libs glib gmodule gthread`"
       elif [ "$wx_mac" ]; then
         ctlib_graphics="$ctlib_graphics -lwx_mac_gl-2.4"
       fi
@@ -363,12 +346,13 @@ if test "$no_x" != "yes" ; then
   fi
   if test "$wxwin" = "true" ; then
     AC_DEFINE(HAVE_SGP,1,[use sgp library])
-    AM_CONDITIONAL(HAVE_SGP, test 1==1)
   fi
 else
   AC_MSG_RESULT(no)
 fi
 
+AM_CONDITIONAL(HAVE_SGP, test "$wxwin" = "true")
+
 if test "$png" = "true" ; then
   ctlibs_tools="$ctlibs_tools -lpng"
 fi
@@ -376,7 +360,7 @@ if test "$zlib" = "true" ; then
   ctlibs_tools="$ctlibs_tools -lz"
 fi
 if test "$fftw" = "true" ; then
-  ctlibs_tools="$ctlibs_tools -lrfftw -lfftw"
+  ctlibs_tools="$ctlibs_tools -lfftw3"
 fi
 if test "$ctn" = "true"; then
   ctlibs_tools="$ctlibs_tools -lctn"
@@ -438,10 +422,10 @@ if test "$wxwin" = "true" ; then
   fi
   CFLAGS="$CFLAGS -I../include $wxcflags"
   ctlib_graphics="$ctlib_graphics $wxlibs"
-  AM_CONDITIONAL(HAVE_WXWINDOWS, test 1==1 )
 fi
 AC_SUBST(wxcflags)
 AC_SUBST(wxlibs)
+AM_CONDITIONAL(HAVE_WXWINDOWS, test "$wxwin"="true")
 
 dnl Setting projet libraries and includes
 LDFLAGS="$LDFLAGS -L../libctsupport -L../libctsim"