AC_INIT AC_PREREQ(2.52) AC_REVISION($Revision: 1.36.2.2 $) AC_CONFIG_SRCDIR([src/v5d.c]) AM_INIT_AUTOMAKE(vis5d+, 1.2.1) AM_CONFIG_HEADER(config.h src/api-config.h) AC_ARG_ENABLE(gtk, [ --enable-gtk compile gtk user interface (NEW)], usegtk=$enableval, usegtk=no) ########################################################################## AC_ARG_ENABLE(debug, [ --enable-debug compile for debugging], ok=$enableval, ok=no) if test "$ok" = "yes"; then CFLAGS="-g" # should we define DEBUG too? enable_shared=no fi # should we build shared libraries by default? AM_ENABLE_SHARED(yes) # This is the version info according to the libtool versioning system. # It does *not* correspond to the release number, and has a technical # meaning (CURRENT:REVISION:AGE) that indicates the compatibility of # different library versions (see the libtool manual): SHARED_VERSION_INFO="2:0:0" AC_SUBST(SHARED_VERSION_INFO) ########################################################################## # Use native cc if present AC_MSG_CHECKING([for vendor's cc to be used instead of gcc]) AC_CHECK_PROG(CC, cc, cc) # Checks for programs. AC_PROG_CC # c++ is needed for src/decimate.C AC_PROG_CXX AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_LN_S AM_PROG_LIBTOOL # Because of autogen.sh pickiness, lines inside the if cannot be indented ALL_LINGUAS="pt_BR es" # # we need libintl.h to use NLS # AC_CHECK_HEADERS(libintl.h,[], enable_nls="no") AM_GNU_GETTEXT(use-libtool, need-ngettext) GTK_DIRS= if test "$usegtk" = "yes"; then AM_PATH_GTK(1.2.9, GTK_DIRS="gtk ", [AC_MSG_ERROR([Cannot find GTK: Is gtk-config in path?])]) fi AC_SUBST(GTK_DIRS) # Set VIS5D_LOCALE_DIR in config.h. if test "x${prefix}" = "xNONE"; then AC_DEFINE_UNQUOTED(VIS5D_LOCALE_DIR, "${ac_default_prefix}/${DATADIRNAME}/locale",[directory containing message catalogs]) else AC_DEFINE_UNQUOTED(VIS5D_LOCALE_DIR, "${prefix}/${DATADIRNAME}/locale") fi # Set VIS5D_SOURCE_DIR in config.h. packagesrcdir=`cd $srcdir && pwd` AC_DEFINE_UNQUOTED(VIS5D_SOURCE_DIR, "${packagesrcdir}",[where the source was built]) # Use -Wall if we have gcc. if test "x$GCC" = "xyes"; then CFLAGS="$CFLAGS -Wall" fi AC_CHECK_PROG(DB2HTML, db2html, db2html, ../missing db2html) AC_CHECK_PROG(DB2DVI, db2dvi, db2dvi, ../missing db2dvi) AC_CHECK_PROG(DB2PS, db2ps, db2ps, ../missing db2ps) AC_CHECK_PROG(DB2PDF, db2pdf, db2pdf, ../missing db2pdf) AC_CHECK_PROG(DB2RTF, db2rtf, db2rtf, ../missing db2rtf) # check for ImageMagick convert program AC_PATH_PROG(IMCONVERT, convert) if test -z "$IMCONVERT"; then AC_MSG_WARN(ImageMagick convert program not found in path. Convert can be used to save vis5d pictures to a variety of output formats.) else AC_DEFINE_UNQUOTED(IMCONVERT,"$IMCONVERT",[path to Image Magick convert program] ) fi AC_ARG_ENABLE(fortran, [ --disable-fortran don't use any Fortran], enable_fortran=$enableval, enable_fortran=yes) if test "$enable_fortran" = "yes"; then AC_CHECK_PROGS(F77, f77 xlf xlf77 cf77 fl32 g77 fort77 f90 xlf90) AC_PROG_F77 if test -n "$F77"; then AC_F77_LIBRARY_LDFLAGS # Call AC_F77_DUMMY_MAIN explicitly, since it otherwise # will cause configure to fail if C-F77 linking fails. AC_F77_DUMMY_MAIN([], skip_f77=yes) if test "x$skip_f77" != xyes; then AC_F77_WRAPPERS # enable Fortran packages in util/ subdirectory: OPT_UTILS="$OPT_UTILS \$(FPROGS)" fi else AC_MSG_WARN([didn't find any Fortran compiler]) fi fi ACX_PROG_CC_MAXOPT ########################################################################## # more optional arguments to the configure script: AC_ARG_ENABLE(threads, [ --enable-threads use parallel threads], enable_threads=$enableval, enable_threads=no) AC_ARG_WITH(mesa, [ --with-mesa force the use of Mesa instead of other graphics libs], with_mesa=$withval, with_mesa=maybe) AC_ARG_WITH(netcdf, [ --with-netcdf= specify NetCDF library file], with_netcdf=$withval, with_netcdf=yes) AC_ARG_WITH(mcidas, [ --with-mcidas= specify McIDAS library file], with_mcidas=$withval, with_mcidas=yes) AC_ARG_WITH(mixkit, [ --with-mixkit= specify mixkit library file], with_mixkit=$withval, with_mixkit=yes) AC_ARG_WITH(memory, [ --with-memory= max. memory to use, 0 for none [default: 32]], VIS5D_MAX_MEM=$withval, VIS5D_MAX_MEM=32) AC_DEFINE_UNQUOTED(VIS5D_MAX_MEM, $VIS5D_MAX_MEM, [max. memory to use (MB), 0 for no maximum]) ########################################################################## # hardware characteristics: AC_CHECK_SIZEOF(float, 0) AC_CHECK_SIZEOF(int, 0) AC_CHECK_SIZEOF(signed char, 0) AC_C_BIGENDIAN ########################################################################## # Checks for libraries. AC_CHECK_LIB(m, sqrt) AC_CHECK_FUNCS(strcasecmp strncasecmp strdup) # Find X11 libs and flags: AC_PATH_X AC_PATH_XTRA CFLAGS="$CFLAGS $X_CFLAGS" XLIBS="$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS" AC_SUBST(XLIBS) ########################################################################## # Find 3D graphics libs: GLLIBS="" # First, look for OpenGL or Mesa: if test "$with_mesa" != "yes"; then AC_CHECK_LIB(GL, glBegin, AC_CHECK_LIB(GLU, gluProject, GLLIBS="-lGLU -lGL", :, -lGL $XLIBS), :, $XLIBS) fi if test -z "$GLLIBS" -a "$with_mesa" != "no"; then AC_CHECK_LIB(MesaGL, glBegin, AC_CHECK_LIB(MesaGLU, gluProject, GLLIBS="-lMesaGLU -lMesaGL", :, -lMesaGL $XLIBS), :, $XLIBS) fi if test "$with_mesa" = "yes"; then AC_CHECK_LIB(GL, glBegin, AC_CHECK_LIB(GLU, gluProject, GLLIBS="-lGLU -lGL", :, -lGL $XLIBS), :, $XLIBS) fi if test -n "$GLLIBS"; then AC_DEFINE(HAVE_OPENGL,1,[Define if we have OpenGL libraries.]) AC_CHECK_HEADERS(GL/gl.h,[], [AC_MSG_ERROR([Couldn't include header file ; you may need to specify the path to OpenGL include files in CPPFLAGS.])]) else echo "couldn't find OpenGL libraries!" if test "$with_mesa" = "yes"; then AC_MSG_ERROR([couldn't find Mesa library]) fi fi # Next, look for SGI IrisGL: if test -z "$GLLIBS"; then AC_CHECK_LIB(gl_s, bgnqstrip, ok=yes,ok=no, $XLIBS) if test "$ok" = "yes"; then AC_CHECK_LIB(fm, fminit, GLLIBS="-lfm -lgl_s",:,-lgl_s $XLIBS) if test -z "$GLLIBS"; then AC_CHECK_LIB(fm_s, fminit, GLLIBS="-lfm_s -lgl_s",:,-lgl_s $XLIBS) fi fi if test -n "$GLLIBS"; then AC_DEFINE(HAVE_SGI_GL,1,[Define if we have SGI GL libraries.]) OPT_UTILS="$OPT_UTILS listfonts" fi fi # Finally, look for PEX (crufty old 3d extensions for X): # (do these even work in Vis5d anymore?) if test -z "$GLLIBS"; then # first, check for possible include & lib directory locations: if test -d /usr/lib/PEX5/utilities; then CPPFLAGS="$CPPFLAGS -I/usr/lib/PEX5/utilities" elif test -d /opt/graphics/PEX5/include/X11R6; then CPPFLAGS="$CPPFLAGS -I/opt/graphics/PEX5/include/X11R6" fi if test -d /opt/graphics/PEX5/lib; then LDFLAGS="$LDFLAGS -L/opt/graphics/PEX5/lib" fi # now, check for the actual library: save_LDFLAGS="$LDFLAGS"; LDFLAGS="$LDFLAGS $X_LIBS" AC_CHECK_LIB(PEX5, PEXInitialize, GLLIBS="$X_LIBS -lPEX5", :, $XLIBS) LDFLAGS="$save_LDFLAGS" if test -n "$GLLIBS"; then # finally, look for the pexut.a library AC_MSG_CHECKING([for pexut.a library]) if test -z "$PEXUT_LIB"; then if test -r /usr/lib/PEX5/utilities/pexut.a; then PEXUT_LIB="/usr/lib/PEX5/utilities/pexut.a" elif test -r /var/opt/PEX5/pexut.a; then PEXUT_LIB="/var/opt/PEX5/pexut.a" fi fi AC_MSG_RESULT(${PEXUT_LIB-no}) if test -z "$PEXUT_LIB"; then AC_MSG_WARN([pexut.a is required when using PEX]) GLLIBS="" elif test -r "$PEXUT_LIB"; then GLLIBS="$PEXUT_LIB $GLLIBS" else # this could happen if the user specified a bogus # PEXUT_LIB environment variable: AC_MSG_ERROR($PEXUT_LIB is not readable) fi fi if test -n "$GLLIBS"; then AC_DEFINE(HAVE_PEX,1,[Define if we have PEX (GL-like) libs.]) fi fi if test -z "$GLLIBS"; then echo "****************************************************" echo "You need to install a 3D graphics library, preferably" echo "the free OpenGL replacement, Mesa. You can download" echo "Mesa from the Mesa home page:" echo " http://www.mesa3d.org/" echo "and install it by running:" echo " ./configure && make && su -c 'make install'" echo "in the Mesa directory." if test -r /sbin/ldconfig; then echo "You may also need to run /sbin/ldconfig as root" echo "to update the system after installing Mesa." if test -r /etc/ld.so.conf; then if test -z "`grep /usr/local/lib /etc/ld.so.conf`"; then echo "(First, add '/usr/local/lib' to /etc/ld.so.conf if" echo "you installed Mesa under /usr/local, the default.)" fi fi fi echo "****************************************************" AC_MSG_ERROR([couldn't find 3D graphics library]) fi AC_SUBST(GLLIBS) # Check for any particular functions in the GL libs: save_LIBS="$LIBS" LIBS="$GLLIBS $XLIBS $LIBS" AC_CHECK_FUNCS(XMesaGetBackBuffer) LIBS="$save_LIBS" ########################################################################## V5D_LIBS_AUX="" # any extra libs we need to link Vis5d # Find Tcl (Linux systems need -ldl as well): AC_CHECK_LIB(dl, dlopen, V5D_LIBS_AUX="-ldl $V5D_LIBS_AUX") AC_CHECK_LIB(tcl, Tcl_Eval, [V5D_LIBS_AUX="-ltcl $V5D_LIBS_AUX" AC_DEFINE(HAVE_LIBTCL,1,[Have Tcl library?])], [:],$V5D_LIBS_AUX) # check if we have setrlimit function: AC_CHECK_FUNCS(setrlimit) # check if we have the Fortran (sigh) idate function: if test -n "$F77"; then AC_LANG_PUSH(Fortran 77)dnl AC_MSG_CHECKING([for Fortran idate function]) AC_TRY_LINK([],[ idate(imon,iday,iyear)], [AC_DEFINE(HAVE_IDATE,1,[Do we have Fortran idate function?]) AC_MSG_RESULT(yes)],AC_MSG_RESULT(no)) AC_LANG_POP(Fortran 77)dnl fi AC_CHECK_LIB(image, iopen, OPT_UTILS="$OPT_UTILS fromxwd") ########################################################################## # Find NetCDF if test "$with_netcdf" != "no"; then # first, check a couple common locations for the netcdf libs: if test "$with_netcdf" != "yes"; then netcdf_dir=`dirname $with_netcdf` case $netcdf_dir in /*) ;; # already an absolute path *) netcdf_dir="`pwd`/$netcdf_dir" ;; esac LDFLAGS="-L$netcdf_dir $LDFLAGS" elif test -r $srcdir/libnetcdf.a; then LDFLAGS="-L`pwd`/$srcdir $LDFLAGS" elif test -r $srcdir/src/libnetcdf.a; then LDFLAGS="-L`pwd`/$srcdir/src $LDFLAGS" elif test -d /usr/netcdf/lib; then LDFLAGS="-L/usr/netcdf/lib $LDFLAGS" if test -d /usr/netcdf/include; then CPPFLAGS="-I/usr/netcdf/include $CPPFLAGS" fi elif test -d /usr/local/netcdf/lib; then LDFLAGS="-L/usr/local/netcdf/lib $LDFLAGS" if test -d /usr/local/netcdf/include; then CPPFLAGS="-I/usr/local/netcdf/include $CPPFLAGS" fi fi # now, look for the actual library: AC_CHECK_LIB(netcdf, nc_inq_dimlen, [AC_DEFINE(HAVE_LIBNETCDF,1,[Do we have NetCDF library?]) V5D_LIBS_AUX="-lnetcdf $V5D_LIBS_AUX"],:, $V5D_LIBS_AUX) case $V5D_LIBS_AUX in *netcdf*) # Look for the header; AC_CHECK_HEADERS(netcdf.h) ;; *) echo "****************************************************" echo "Didn't find the NetCDF library; irregular data features" echo "will be disabled. You can download the NetCDF source" echo "code from the NetCDF home page:" echo " http://www.unidata.ucar.edu/packages/netcdf/" echo "and/or use --with-netcdf= to specify the location" echo "of libnetcdf.a." echo "****************************************************" ;; esac fi ########################################################################## # Find mixkit if test "$with_mixkit" != "no"; then # first, check a couple common locations for mixkit lib: if test "$with_mixkit" != "yes"; then mixkit_dir=`dirname $with_mixkit` case $mixkit_dir in /*) ;; # already an absolute path *) mixkit_dir="`pwd`/$mixkit_dir" ;; esac LDFLAGS="-L$mixkit_dir $LDFLAGS" V5D_LIBS_AUX="-lmix $V5D_LIBS_AUX" elif test -r $srcdir/libmix.a; then LDFLAGS="-L`pwd`/$srcdir $LDFLAGS" V5D_LIBS_AUX="-lmix $V5D_LIBS_AUX" elif test -r $srcdir/src/libmix.a; then LDFLAGS="-L`pwd`/$srcdir/src $LDFLAGS" V5D_LIBS_AUX="-lmix $V5D_LIBS_AUX" elif test -d /usr/mixkit/lib; then LDFLAGS="-L/usr/mixkit/lib $LDFLAGS" if test -d /usr/mixkit/include; then CPPFLAGS="-I/usr/mixkit/include $CPPFLAGS" fi V5D_LIBS_AUX="-lmix $V5D_LIBS_AUX" elif test -d /usr/local/mixkit/lib; then LDFLAGS="-L/usr/local/mixkit/lib $LDFLAGS" if test -d /usr/local/mixkit/include; then CPPFLAGS="-I/usr/local/mixkit/include $CPPFLAGS" fi V5D_LIBS_AUX="-lmix $V5D_LIBS_AUX" fi case $V5D_LIBS_AUX in *mix*) # Look for the header; AC_LANG_PUSH(C++) AC_CHECK_HEADERS(mixkit/mixio.h, [AC_DEFINE(HAVE_MIXKIT,1,[Do we have mixkit library?])]) AC_LANG_POP(C++) ;; *) echo "****************************************************" echo "Didn't find the mixkit library;" echo "You can download the Mixkit source" echo "code from the Qslim home page:" echo " http://graphics.cs.uiuc.edu/~garland/software/qslim.html" echo "and/or use --with-mixkit= to specify the location" echo "of libmix.a." echo "****************************************************" ;; esac fi AM_CONDITIONAL(MIXKIT,test "x$ac_cv_header_mixkit_mixio_h" = "xyes") ########################################################################## # Find MCIDAS MCIDAS_LIBS="" if test "$with_mcidas" != "no" -a -n "$F77"; then mcidas_lib=mcidas5 using_included_mcidas=no # first, check a couple common locations for the mcidas libs: if test "$with_mcidas" != "yes"; then mcidas_dir=`dirname $with_mcidas` mcidas_lib=`basename $with_mcidas | sed 's/\.a$//;s/^lib//'` case $mcidas_dir in /*) ;; # already an absolute path *) mcidas_dir="`pwd`/$mcidas_dir" ;; esac MCIDAS_LDFLAGS="-L$mcidas_dir" elif test -r $srcdir/libmcidas5.a; then MCIDAS_LDFLAGS="-L`pwd`/$srcdir" elif test -r $srcdir/src/libmcidas5.a; then MCIDAS_LDFLAGS="-L`pwd`/$srcdir/src" using_included_mcidas=yes fi MCIDAS_LIBS="$MCIDAS_LDFLAGS -l$mcidas_lib $FLIBS" save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $MCIDAS_LDFLAGS" AC_F77_FUNC(readd) AC_CHECK_LIB(mcidas_lib, $readd, [], [MCIDAS_LIBS=""], $FLIBS) LDFLAGS="$save_LDFLAGS" if test -n "$MCIDAS_LIBS"; then MCIDAS_LIBS="kltwin.o $MCIDAS_LIBS" AC_DEFINE(HAVE_MCIDAS,1,[Do we have McIDAS library?]) if test "$using_included_mcidas" = "no"; then AC_DEFINE(MCIDAS_SIDECAR,1,[Have McIDAS sidecar?]) fi fi fi AC_SUBST(MCIDAS_LIBS) AM_CONDITIONAL(MCIDAS, test -n "$MCIDAS_LIBS") ########################################################################## # Checks for header files. AC_CHECK_HEADERS(X11/Xm/MwmUtil.h sys/types.h sys/prctl.h sys/sysmp.h sysmp.h sys/lock.h sys/stat.h fcntl.h) # Checks for typedefs, structures, and compiler characteristics. ########################################################################## # Check for POSIX threads library. # (taken from FFTW configure.in, www.fftw.org) # Eventually, we should also check for the other threads models that # Vis5d supports. THREADLIBS="" if test "$enable_threads" = "yes"; then # First, check for SGI sproc fork variant: # (should we prefer POSIX threads to this?) if test -z "$THREADLIBS"; then AC_CHECK_FUNC(sproc, [THREADLIBS=" " AC_DEFINE(HAVE_SGI_SPROC,1,[Have SGI sproc?])]) fi # Check for POSIX threads: sinclude(acx_pthread.m4) if test -z "$THREADLIBS"; then ACX_PTHREAD([THREADLIBS=" $PTHREAD_LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" CC="$PTHREAD_CC" AC_DEFINE(HAVE_PTHREADS,1,[Have POSIX threads?])]) fi # Solaris threads: # (we prefer the more-standard POSIX threads, right?) if test -z "$THREADLIBS"; then AC_CHECK_LIB(thread, thr_create, [THREADLIBS="-lthread" AC_DEFINE(HAVE_SUNOS_THREADS,1,[Have SunOS threads?])]) fi if test -z "$THREADLIBS"; then echo "no threads libraries found...compiling as single-threaded" fi fi # if enable_threads = yes if test -z "$THREADLIBS"; then AC_DEFINE(SINGLE_TASK,1,[Define to disable multi-threading.]) fi AC_SUBST(THREADLIBS) ########################################################################## # define a preprocessor symbol for where the Vis5d data files # (e.g. EARTH.TOPO) go: if test "$datadir" != '${prefix}/share'; then AC_DEFINE_UNQUOTED(DATA_PREFIX, "$datadir/$PACKAGE/", [Define to installed location of Vis5d data files.]) elif test "$prefix" = "NONE"; then AC_DEFINE_UNQUOTED(DATA_PREFIX, "$ac_default_prefix/share/$PACKAGE/") else AC_DEFINE_UNQUOTED(DATA_PREFIX, "$prefix/share/$PACKAGE/") fi ########################################################################## AC_SUBST(V5D_LIBS_AUX) AC_SUBST(OPT_UTILS) AC_CONFIG_FILES([gtk/gradients/Makefile gtk/Makefile intl/Makefile po/Makefile.in Makefile src/Makefile doc/Makefile lui5/Makefile util/Makefile]) AC_OUTPUT