X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=configure.ac;h=230c87534c26949a1da72918722e8d6140471678;hp=6bfbe85ea25052596105d96f3c5c026903d8cc06;hb=42d20f563d4d4dcf4a34b450031acc853ffb8183;hpb=fa77d1e726c67424f8df3b974db0641d78da2a43 diff --git a/configure.ac b/configure.ac index 6bfbe85..230c875 100644 --- a/configure.ac +++ b/configure.ac @@ -3,28 +3,32 @@ dnl Process this file with autoconf to produce a configure script. dnl Must reset CDPATH so that bash's cd does not print to stdout dnl CDPATH= -AC_INIT(src/ctsim.cpp) -AM_INIT_AUTOMAKE(ctsim,3.5.0) +AC_INIT +AC_CONFIG_SRCDIR([src/ctsim.cpp]) +AM_MAINTAINER_MODE +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 AC_PROG_MAKE_SET AC_PROG_RANLIB -CPPFLAGS='$(CPPFLAGS) -DDATADIR="$(datadir)"' -CFLAGS="$CFLAGS -I/usr/local/include" -LDFLAGS="$LDFLAGS -L/usr/local/lib" AC_PROG_CC AC_PROG_CXX AC_C_BIGENDIAN AC_PATH_PROG(wxconfig,wx-config) -dnl AC_MSG_CHECKING([that the compiler works]) -dnl AC_TRY_RUN([ main(int ac, char **av) { return 0; } ], AC_MSG_RESULT(yes), AC_MSG_RESULT(no) AC_MSG_ERROR(Could not compile and run even a trivial ANSI C program - check CC.), AC_MSG_ERROR(Could not compile and run even a trivial ANSI C program - check CC.)) - dnl Check for C operation AC_CANONICAL_HOST AC_C_INLINE @@ -34,24 +38,25 @@ AC_CHECK_SIZEOF(long, 4) AC_CHECK_SIZEOF(float, 4) AC_CHECK_SIZEOF(double, 8) +dnl Add define templates + dnl Checks for libraries. AC_CHECK_LIB(z, deflate, [ zlib="true" ], [ zlib="false" ; AC_MSG_WARN([zlib missing. Will need zlib for PNG support])]) 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(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]) +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.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(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(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]) if test "$zlib" = "true" ; then - AC_CHECK_LIB(png, main, [png=true ; AC_DEFINE(HAVE_PNG)], [png=false]) + AC_CHECK_LIB(png, main, [png=true ; AC_DEFINE(HAVE_PNG,1,[PNG library])], [png=false], [-lz -lm]) fi dnl Checks for header files. @@ -66,12 +71,13 @@ 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) AC_CHECK_FUNC(time) AC_CHECK_FUNC(gettimeofday) +AC_CHECK_FUNC(getopt, [ getopt=true ], [ getopt=false ]) if test "${OSTYPE}" = "cygwin" ; then getopt_long=false @@ -81,11 +87,12 @@ fi if test "${getopt_long}" = "false" ; then my_includes="$my_includes -I../getopt" - AC_DEFINE(HAVE_GETOPT_LONG) + 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" @@ -101,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]) @@ -113,26 +120,34 @@ esac], [debug=false; AC_MSG_RESULT(no)]) AM_CONDITIONAL(DEBUG, test "$debug" = "true") +if test "$datadir" != "" ; then + CPPFLAGS="$CPPFLAGS -DDATADIR=\"\\\"$datadir\\\"\"" +fi +dnl CFLAGS="$CFLAGS -I/usr/local/include" +dnl LDFLAGS="$LDFLAGS -L/usr/local/lib" + if test "$debug" = "true" ; then - CFLAGS="-g -DDEBUG" - AC_DEFINE(DEBUG) + CFLAGS="$CFLAGS -g -DDEBUG" + AC_DEFINE(DEBUG,1,[turn on debugging]) else - CFLAGS="-O3 -DNDEBUG -fomit-frame-pointer" - AC_DEFINE(NDEBUG) + CFLAGS="$CFLAGS -O2 -DNDEBUG -fomit-frame-pointer" + AC_DEFINE(NDEBUG,1,[no debugging]) fi if test "${pthread}" = "true" ; then - CFLAGS="$FLAGS -pthread -D_REENTRANT" - AC_DEFINE(HAVE_WXTHREADS) +dnl CFLAGS="$CFLAGS -D_REENTRANT" + AC_DEFINE(HAVE_WXTHREADS,1,[have wxthreads library]) 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) + 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) + else + AC_MSG_RESULT(no) + fi CFLAGS="$CFLAGS -Wall" @@ -154,7 +169,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) @@ -168,7 +183,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 ] @@ -202,35 +217,51 @@ 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 ] ) -if test "$withval" != "no" ; then - if test "$prefix" != "NONE" ; then - tryctndir="$tryctndir $prefix" - fi - +if test "$withval" == "no" -o "$withval" == "NONE" ; then 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) + AC_MSG_RESULT([disabled]) +else + AC_MSG_CHECKING([for CTN DICOM installation]) + for testctndir in $tryctndir/lib /usr/local/lib /usr/local/ctn/lib /usr/lib /usr/ctn/lib /usr/lib/ctn /opt/ctn/lib ; do + if test -f "$testctndir/libctn.a" ; then + LDFLAGS="$LDFLAGS -L$testctndir" + ctnlib="true" break fi done - AC_MSG_RESULT($ctndir) -else - AC_MSG_RESULT([no]) + for testctndir in $tryctndir/include /usr/local/include /usr/local/ctn/include /usr/include /usr/include/ctn /usr/ctn/include /opt/ctn/include ; do + if test -f "$testctndir/ctn_os.h" ; then + CFLAGS="$CFLAGS -I$testctndir" + ctninclude="true" + break + fi + done + if test "$ctnlib" == "true" -a "$ctninclude" == "true" ; then + ctn="true" + AC_DEFINE(HAVE_CTN_DICOM,1,[ctn dicom library]) + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + 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 @@ -247,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]) @@ -272,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 @@ -281,17 +312,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. @@ -301,32 +321,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), , $X_PRE_LIBS $X_BASIC_LIBS $X_EXTRA_LIBS) -LDFLAGS="$our_saved_LDFLAGS" - -dnl Check in -lXext for double buffering extensions to X11, and check -dnl whether appropriate header files are present. (Some systems have one -dnl but not the other.) -our_saved_LDFLAGS="$LDFLAGS" -LDFLAGS="$X_LIBS $LDFLAGS" -AC_CHECK_LIB(Xext, XdbeQueryExtension, AC_DEFINE(HAVE_DBE_SUPPORT), , -lX11 "$X_EXTRA_LIBS") -AC_CHECK_LIB(Xext, XmbufQueryExtension, AC_DEFINE(HAVE_MBX_SUPPORT), , -lX11 "$X_EXTRA_LIBS") -LDFLAGS="$our_saved_LDFLAGS" -our_saved_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$X_CFLAGS $CPPFLAGS" -AC_CHECK_HEADERS(X11/extensions/Xdbe.h X11/extensions/multibuf.h) -CPPFLAGS="$our_saved_CPPFLAGS" - 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) @@ -334,26 +331,37 @@ AC_SUBST(my_includes) LDFLAGS="$LDFLAGS -L/usr/local/lib" AC_MSG_CHECKING([for X]) -if test "$no_x" != "yes" ; then - AC_DEFINE(HAVE_X11) - LDFLAGS="$LDFLAGS -L../libctgraphics -L/usr/X11R6/lib" +if test "$with_x" != "no" && test "$wxwin" = "true"; then + AC_DEFINE(HAVE_X11,1,[X11 system]) + 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) ctlib_graphics="$ctlib_graphics $X_BASIC_LIBS $X_TOOLKIT_LIBS" if test "$libgl" = "true" ; then - ctlib_graphics="$ctlib_graphics -lglut -lGL -lGLU" + # Removed "-lglut" for Mac OS X compilation + ctlib_graphics="$ctlib_graphics -lGL -lGLU" if test "$wxwin" = "true" ; then - ctlib_graphics="$ctlib_graphics -lwx_gtk_gl-2.2" + wxdebug="" + if test "$debug" = "true"; then + wxdebug="--debug" + fi + if [ "$wx_gtk" ]; then + 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.8" + fi fi fi if test "$wxwin" = "true" ; then - AC_DEFINE(HAVE_SGP) - AM_CONDITIONAL(HAVE_SGP, test 1==1) + AC_DEFINE(HAVE_SGP,1,[use sgp library]) 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 @@ -361,7 +369,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" @@ -386,7 +394,7 @@ esac], if test "$dmallocxx" = "true" -a "$usedmalloc" = "true" ; then ctlibs_tools="$ctlibs_tools -ldmallocxx" - AC_DEFINE(HAVE_DMALLOC) + AC_DEFINE(HAVE_DMALLOC,1,[dmalloc library]) AC_MSG_RESULT(Using dmalloc) fi @@ -409,24 +417,24 @@ esac], if test "$efence" = "true" -a "$useefence" = "true" ; then ctlibs_tools="$ctlibs_tools -lefence" - AC_DEFINE(HAVE_EFENCE) + AC_DEFINE(HAVE_EFENCE,1,[efence library]) AC_MSG_RESULT(Using efence) fi if test "$wxwin" = "true" ; then - if test "$wx_gtk" = "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" + wxlibs="-lwx -lglui -ljpeg -lxpm -lzlib -ltiff" 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" @@ -442,4 +450,6 @@ fi CXXFLAGS="$CFLAGS" -AC_OUTPUT(Makefile libctgraphics/Makefile libctsupport/Makefile libctsim/Makefile Makefile man/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) +AC_CONFIG_FILES([Makefile libctgraphics/Makefile libctsupport/Makefile libctsim/Makefile man/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]) + +AC_OUTPUT