r7920: changes to compile on new automake and xfree_4.3.0_0pre1v1
[ctsim.git] / configure.ac
index 68784fcedbaf31a242e692fb4fb32fceb37cff52..e9f4c40389fa97e3115bb88eedd10303a38062fc 100644 (file)
@@ -5,7 +5,8 @@ dnl CDPATH=
 
 AC_INIT
 AC_CONFIG_SRCDIR([src/ctsim.cpp])
-AM_INIT_AUTOMAKE(ctsim,4.0.0)
+AM_MAINTAINER_MODE
+AM_INIT_AUTOMAKE(ctsim,4.2.6)
 AM_CONFIG_HEADER(config.h)
 
 dnl Checks for programs.
@@ -68,6 +69,7 @@ AC_CHECK_FUNC(setjmp)
 AC_CHECK_FUNC(setpriority)
 AC_CHECK_FUNC(time)
 AC_CHECK_FUNC(gettimeofday)
+AC_CHECK_FUNC(getopt, [ getopt=true ], [ getopt=false ])
 
 if test "${OSTYPE}" = "cygwin" ; then
   getopt_long=false
@@ -80,8 +82,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"
@@ -119,7 +122,7 @@ if test "$debug" = "true" ; then
   CFLAGS="$CFLAGS -g -DDEBUG"
   AC_DEFINE(DEBUG,1,[turn on debugging])
 else
-  CFLAGS="$CFLAGS -O3 -DNDEBUG -fomit-frame-pointer -funroll-loops"
+  CFLAGS="$CFLAGS -O2 -DNDEBUG -fomit-frame-pointer"
   AC_DEFINE(NDEBUG,1,[no debugging])
 fi
 
@@ -132,10 +135,11 @@ 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 ||
      test -f /usr/include/gcc/darwin/3.1/g++-v3/sstream ]; then
-  AC_DEFINE(HAVE_SSTREAM,1,[sstream header])
-  AC_MSG_RESULT(yes)
-fi
-AC_MSG_RESULT(no)
+   AC_DEFINE(HAVE_SSTREAM,1,[sstream header])
+   AC_MSG_RESULT(yes)
+  else
+   AC_MSG_RESULT(no)
+ fi
 
 
 CFLAGS="$CFLAGS -Wall"
@@ -157,7 +161,7 @@ AC_ARG_ENABLE(verbose-warnings,
 AC_MSG_CHECKING(static executables)
 AC_ARG_ENABLE(static,
 [  --enable-static
-                          Enable static executables.],
+                            Enable static executables.],
 [ case "$enableval" in
   yes)
     AC_MSG_RESULT(yes)
@@ -171,7 +175,7 @@ AC_ARG_ENABLE(static,
 
 dnl Set LAM path
 AC_ARG_WITH(lam,
-[  --with-lam[=PATH]       Set path of LAM MPI ],
+[  --with-lam[=PATH]         Set path of LAM MPI ],
 [    if test "$withval" != "no" ; then
          trylamdir=$withval
      fi ]
@@ -205,7 +209,7 @@ fi
 
 dnl Set CTN path
 AC_ARG_WITH(ctn,
-[  --with-ctn[=PATH]       Set path of CTN DICOM library ],
+[  --with-ctn[=PATH]         Set path of CTN DICOM library ],
 [    if test "$withval" != "no" ; then
          tryctndir=$withval
      fi ]
@@ -239,6 +243,18 @@ else
   fi
 fi
 
+dnl Set CPU
+AC_MSG_CHECKING([for CPU specification])
+AC_ARG_WITH(mcpu,
+[  --with-mcpu[=CPU]         Set name of CPU for gcc -mcpu])
+
+if test "$withval" == "no" -o "$withval" == "yes" -o "$withval" == ""; then
+  AC_MSG_RESULT([no])
+else
+  AC_MSG_RESULT([$withval])
+  CFLAGS="$CFLAGS -mcpu=$withval"
+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 ],