X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=configure.ac;h=d3d612cb9bf505f9c0367407357f0166124c6ed9;hp=a9e407dde35068fc67d2e1b48c88113ec16f1edf;hb=a6e29202a775a5641c7d299cf10ecfa93519a578;hpb=a1d1b6fcaa983c7f5832436effebeaf0c8068fb8 diff --git a/configure.ac b/configure.ac index a9e407d..d3d612c 100644 --- a/configure.ac +++ b/configure.ac @@ -3,8 +3,9 @@ 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_INIT_AUTOMAKE(ctsim,3.5.4) AM_CONFIG_HEADER(config.h) dnl Checks for programs. @@ -13,18 +14,12 @@ 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 +29,24 @@ 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(wx_gtk-2.2, main, [wxwin=true; wx_gtk=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(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]) fi dnl Checks for header files. @@ -79,14 +74,9 @@ else AC_CHECK_FUNC(getopt_long, [ getopt_long=true ], [ getopt_long=false ]) fi -if test "${pthread}" = "true" ; then - AC_ADD_GCC_CFLAGS([-pthread -D_REENTRANT]) - AC_DEFINE(HAVE_WXTHREADS) -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) @@ -118,26 +108,35 @@ 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 -dnl AC_ADD_GCC_CFLAGS([-g -DDEBUG]) - CFLAGS="-g -DDEBUG" - AC_DEFINE(DEBUG) + CFLAGS="$CFLAGS -g -DDEBUG" + AC_DEFINE(DEBUG,1,[turn on debugging]) else -dnl AC_ADD_GCC_CFLAGS([-O2 -fexpensive-optimizations -DNDEBUG]) - CFLAGS="-O3 -DNDEBUG -fomit-frame-pointer" - AC_DEFINE(NDEBUG) + CFLAGS="$CFLAGS -O3 -DNDEBUG -fomit-frame-pointer -funroll-loops" + AC_DEFINE(NDEBUG,1,[no debugging]) +fi + +if test "${pthread}" = "true" ; then + CFLAGS="$CFLAGS -pthread -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_DEFINE(HAVE_SSTREAM,1,[sstream header]) AC_MSG_RESULT(yes) fi AC_MSG_RESULT(no) -AC_ADD_GCC_CFLAGS([-Wall]) +CFLAGS="$CFLAGS -Wall" AC_MSG_CHECKING(whether to enable verbose warnings) AC_ARG_ENABLE(verbose-warnings, [ --enable-verbose-warnings @@ -145,13 +144,7 @@ AC_ARG_ENABLE(verbose-warnings, [ case "$enableval" in yes) AC_MSG_RESULT(yes) - AC_ADD_GCC_CFLAGS([-W]) - AC_ADD_GCC_CFLAGS([-Wshadow -Wpointer-arith -Wbad-function-cast]) - AC_ADD_GCC_CFLAGS([-Wcast-align -Wwrite-strings -Waggregate-return]) - AC_ADD_GCC_CFLAGS([-Wmissing-prototypes -Wstrict-prototypes]) - AC_ADD_GCC_CFLAGS([-pedantic]) - AC_ADD_GCC_CFLAGS([-Wredundant-decls]) - + CFLAGS="$CFLAGS -W -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Waggregate-return -Wmissing-prototypes -Wstrict-prototypes -pedantic -Wredundant-decls" ;; *) AC_MSG_RESULT(no) @@ -166,7 +159,7 @@ AC_ARG_ENABLE(static, [ case "$enableval" in yes) AC_MSG_RESULT(yes) - AC_ADD_GCC_CFLAGS([--static]) + CFLAGS="$CFLAGS --static" ;; *) AC_MSG_RESULT(no) @@ -216,30 +209,34 @@ AC_ARG_WITH(ctn, 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 - 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 ], @@ -316,21 +313,8 @@ 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") +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" -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. @@ -343,7 +327,7 @@ LDFLAGS="$LDFLAGS -L/usr/local/lib" AC_MSG_CHECKING([for X]) if test "$no_x" != "yes" ; then - AC_DEFINE(HAVE_X11) + AC_DEFINE(HAVE_X11,1,[X11 system]) LDFLAGS="$LDFLAGS -L../libctgraphics -L/usr/X11R6/lib" ctlib_graphics="$ctlibs_base -lctgraphics" AC_MSG_RESULT(yes) @@ -355,7 +339,7 @@ if test "$no_x" != "yes" ; then fi fi if test "$wxwin" = "true" ; then - AC_DEFINE(HAVE_SGP) + AC_DEFINE(HAVE_SGP,1,[use sgp library]) AM_CONDITIONAL(HAVE_SGP, test 1==1) fi else @@ -394,7 +378,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 @@ -417,7 +401,7 @@ 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 @@ -450,4 +434,5 @@ 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 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