dnl --- dnl $Id$ dnl --- dnl --- dnl User defined functions start here... dnl --- dnl Check for mpi package. AC_DEFUN(OSSIM_CHECK_MPI, [ AC_ARG_WITH(mpi,[ --with-mpi[=ARG] Include mpi support (ARG=yes or no or directory to install location)],,) MPI_TOP= MPI_SETTING= MPI_INCLUDES= MPI_LIBS= MPI_LIB_PATH= MPI_DEFINES=-DMPI_SETTING=0 if test "$with_mpi" = "yes" -o "$with_mpi" = ""; then if test -f "/usr/bin/lamboot" ; then MPI_TOP=/usr elif test -f "/usr/local/bin/lamboot" ; then MPI_TOP=/usr/local elif test -f "/usr/local/ossim/bin/lamboot" ; then MPI_TOP=/usr/local/ossim elif test -f "/opt/local/bin/lamboot" ; then MPI_TOP="/opt/local elif test -f "/sw/local/bin/lamboot" ; then MPI_TOP="/sw/local fi elif test "$with_mpi" != "no" ; then if test -f "$with_mpi/bin/lamboot" ; then MPI_TOP="$with_mpi" fi fi if test "$MPI_TOP" = "/usr" ; then MPI_SETTING=1 MPI_INCLUDES= MPI_LIB_PATH= MPI_LIBS="-llammpi++ -lmpi -llam -llammpio" MPI_DEFINES="-DMPI_SETTING=$MPI_SETTING" elif test "$MPI_TOP" != "" ; then MPI_SETTING=1 MPI_INCLUDES="-I$with_mpi/include" MPI_LIB_PATH="-L$with_mpi/lib" MPI_LIBS="-llammpi++ -lmpi -llam -llammpio" MPI_DEFINES="-DMPI_SETTING=$MPI_SETTING" fi dnl If an mpi directory was not specified try looking parallel to dnl the ossim (this) package. echo "MPI_INCLUDES = $MPI_INCLUDES" echo "MPI_LIB_PATH = $MPI_LIB_PATH" echo "MPI_LIBS = $MPI_LIBS" echo "MPI_DEFINES = $MPI_DEFINES" AC_SUBST(MPI_INCLUDES, $MPI_INCLUDES) AC_SUBST(MPI_LIB_PATH, $MPI_LIB_PATH) AC_SUBST(MPI_LIBS, $MPI_LIBS) AC_SUBST(MPI_DEFINES, $MPI_DEFINES) dnl Added to base defines. BASE_DEFINES="${BASE_DEFINES} ${MPI_DEFINES}" ]) dnl End of MPI package... dnl Check for OpenThreads package. AC_DEFUN(OSSIM_CHECK_OPEN_THREADS, [ AC_ARG_WITH(openthreads, [ --with-openthreads[=ARG] open threads support , ARG=yes or no or directory to install location],,) OPEN_THREADS_INCLUDES= OPEN_THREADS_LIBS= OPEN_THREADS_LIB_PATH= OPEN_THREADS_DEFINES= OPEN_THREADS_TOP= if test "$with_openthreads" = "yes" ; then if test -f "/usr/local/include/OpenThreads/Mutex" ; then OPEN_THREADS_TOP="/usr/local" elif test -f "/opt/local/include/OpenThreads/Mutex" ; then OPEN_THREADS_TOP="/opt/local" elif test -f "/sw/local/include/OpenThreads/Mutex" ; then OPEN_THREADS_TOP="/sw/local" elif test -f "/usr/include/OpenThreads/Mutex" ; then OPEN_THREADS_TOP="/usr" fi elif test "$with_openthreads" = "no" ; then OPEN_THREADS_DEFINES=-DHAS_OPEN_THREADS=0 else dnl User passed in OpenThreads top. OPEN_THREADS_TOP=$with_openthreads fi if test "$OPEN_THREADS_TOP" != "" ; then OPEN_THREADS_INCLUDES="-I$OPEN_THREADS_TOP/include" OPEN_THREADS_LIBS="-lOpenThreads" OPEN_THREADS_LIB_PATH="-L$OPEN_THREADS_TOP/lib" OPEN_THREADS_DEFINES="-DHAS_OPEN_THREADS=1" AC_DEFINE(HAS_OPEN_THREADS, 1) else AC_DEFINE(HAS_OPEN_THREADS, 0) fi echo "OPEN_THREADS_INCLUDES = $OPEN_THREADS_INCLUDES" echo "OPEN_THREADS_LIBS = $OPEN_THREADS_LIBS" echo "OPEN_THREADS_LIB_PATH = $OPEN_THREADS_LIB_PATH" echo "OPEN_THREADS_DEFINES = $OPEN_THREADS_DEFINES" ]) dnl End of OpenThread package... dnl Check for freetype package. AC_DEFUN(OSSIM_CHECK_FREETYPE, [ AC_ARG_WITH(freetype,[ --with-freetype[=ARG] Include freetype support (ARG=no or full_path_to_free)],,) FREETYPE_TOP="" FREETYPE_SETTING=0 FREETYPE_INCLUDES= FREETYPE_LIBS= FREETYPE_LIB_PATH= FREETYPE_DEFINES= if test "$with_freetype" = "" ; then if test -f "/usr/bin/freetype-config" ; then FREETYPE_CONFIG_FOUND=1 FREETYPE_SETTING=1 FREETYPE_INCLUDES=`freetype-config --cflags` FREETYPE_LIBS=`freetype-config --libs` FREETYPE_LIB_PATH=-L`freetype-config --prefix`/lib FREETYPE_DEFINES="-DFREETYPE_SETTING=1" elif test -d "/usr/include/freetype2" ; then FREETYPE_TOP="/usr" elif test -d "/usr/local/include/freetype2" ; then FREETYPE_TOP="/usr/local" elif test -d "/usr/X11R6/include/freetype2" ; then FREETYPE_TOP="/usr/X11R6" fi elif test "$with_freetype" = "no" ; then FREETYPE_SETTING=0 else FREETYPE_TOP=$with_freetype fi if test "$FREETYPE_TOP" != "" ; then if test -d "$FREETYPE_TOP/include/freetype2" ; then FREETYPE_INCLUDES="-I$FREETYPE_TOP/include -I$FREETYPE_TOP/include/freetype2 -I$FREETYPE_TOP/include/freetype2/freetype" FREETYPE_LIB_PATH="-L$FREETYPE_TOP/lib" FREETYPE_LIBS="-lfreetype" FREETYPE_DEFINES="-DFREETYPE_SETTING=1" FREETYPE_SETTING=1 else FREETYPE_DEFINES="-DFREETYPE_SETTING=0" FREETYPE_SETTING=0 fi fi if test "$FREETYPE_LIB_PATH" = "-L/usr/lib" ; then FREETYPE_LIB_PATH="" fi echo "FREETYPE_INCLUDES = $FREETYPE_INCLUDES" echo "FREETYPE_LIB_PATH = $FREETYPE_LIB_PATH" echo "FREETYPE_LIBS = $FREETYPE_LIBS" echo "FREETYPE_DEFINES = $FREETYPE_DEFINES" echo "FREETYPE_SETTING = $FREETYPE_SETTING" AC_SUBST(FREETYPE_INCLUDES, $FREETYPE_INCLUDES) AC_SUBST(FREETYPE_LIB_PATH, $FREETYPE_LIB_PATH) AC_SUBST(FREETYPE_LIBS, $FREETYPE_LIBS) AC_SUBST(FREETYPE_DEFINES, $FREETYPE_DEFINES) AC_SUBST(FREETYPE_SETTING, $FREETYPE_SETTING) dnl Added to base defines. BASE_DEFINES="${BASE_DEFINES} ${FREETYPE_DEFINES}" ]) dnl Check for geotif package. AC_DEFUN(OSSIM_CHECK_GEOTIFF, [ AC_ARG_WITH(geotiff,[ --with-geotiff[=ARG] Include geotiff support (ARG=no or full_path_to_geotiff)],,) GEOTIFF_TOP= GEOTIFF_INCLUDE_PATH= GEOTIFF_LIB_PATH= GEOTIFF_LIBS= GEOTIFF_DEFINES= if test "$with_geotiff" = "no" ; then dnl User does not want to use geotiff so do nothing... echo "Geotiff support option = no" elif test "$with_geotiff" = "" ; then dnl No args, look in standard intall location as default. dnl Look in parallel directory. if test -d "$OSSIM_TOP/../geotiff" ; then if test -f "$OSSIM_TOP/../geotiff/include/geotiff.h" ; then dnl User did a make install to top. GEOTIFF_TOP="$OSSIM_TOP/../geotiff" else GEOTIFF_TOP="$OSSIM_TOP/../geotiff/libgeotiff" fi elif test -f "/usr/local/include/geotiff.h" ; then GEOTIFF_TOP="/usr/local" elif test -f "/usr/include/geotiff.h" ; then GEOTIFF_TOP="/usr" elif test -f "/opt/local/include/geotiff.h" ; then GEOTIFF_TOP="/opt/local" fi else dnl User passed in geotiff top. GEOTIFF_TOP=$with_geotiff fi if test -d $GEOTIFF_TOP && test "$GEOTIFF_TOP" != ""; then dnl Set the include path. if test -f "$GEOTIFF_TOP/include/geotiff.h" ; then GEOTIFF_INCLUDE_PATH="-I$GEOTIFF_TOP/include" else GEOTIFF_INCLUDE_PATH="-I$GEOTIFF_TOP" fi dnl Set the lib path. if test -d "$GEOTIFF_TOP/lib" ; then GEOTIFF_LIB_PATH="-L$GEOTIFF_TOP/lib" else GEOTIFF_LIB_PATH="-L$GEOTIFF_TOP" fi GEOTIFF_LIBS=-lgeotiff GEOTIFF_DEFINES=-DGEOTIFF_ENABLED echo "GEOTIFF_INCLUDE_PATH = $GEOTIFF_INCLUDE_PATH" echo "GEOTIFF_LIB_PATH = $GEOTIFF_LIB_PATH" echo "GEOTIFF_LIBS = $GEOTIFF_LIBS" echo "GEOTIFF_DEFINES = $GEOTIFF_DEFINES" else echo "Geotiff support disabled." fi AC_SUBST(GEOTIFF_INCLUDE_PATH, $GEOTIFF_INCLUDE_PATH) AC_SUBST(GEOTIFF_LIB_PATH, $GEOTIFF_LIB_PATH) AC_SUBST(GEOTIFF_LIBS, $GEOTIFF_LIBS) AC_SUBST(GEOTIFF_DEFINES, $GEOTIFF_DEFINES) ]) dnl End of Geotiff package... dnl Check for libtiff package. AC_DEFUN(OSSIM_CHECK_LIBTIFF, [ AC_ARG_WITH(libtiff,[ --with-libtiff[=ARG] Include libtiff support (ARG=no or full_path_to_libtiff)],,) LIBTIFF_TOP= LIBTIFF_INCLUDE_PATH= LIBTIFF_LIB_PATH= LIBTIFF_LIBS= if test "$with_libtiff" = "no" ; then dnl User does not want to use libtiff so do nothing... AC_MSG_ERROR([libtiff support required!]) elif test "$with_libtiff" = "" ; then dnl No args, look in standard intall location as default. if test -d "$OSSIM_TOP/../libtiff" ; then LIBTIFF_TOP="$OSSIM_TOP/../libtiff" elif test -f "/usr/local/include/tiff.h" ; then LIBTIFF_TOP="/usr/local" elif test -f "/usr/include/tiff.h" ; then LIBTIFF_TOP="/usr" elif test -f "/opt/local/include/tiff.h" ; then LIBTIFF_TOP="/opt/local" else echo "Libtiff support disabled." fi else dnl User passed in libtiff top. LIBTIFF_TOP=$with_libtiff fi if test -d "$LIBTIFF_TOP" ; then dnl Set the include path. if test -f "$LIBTIFF_TOP/include/tiff.h" ; then LIBTIFF_INCLUDE_PATH="-I$LIBTIFF_TOP/include" elif test -f "$LIBTIFF_TOP/libtiff/tiff.h" ; then LIBTIFF_INCLUDE_PATH="-I$LIBTIFF_TOP/libtiff" else LIBTIFF_INCLUDE_PATH="-I$LIBTIFF_TOP" fi dnl Set the lib path if test -f "$LIBTIFF_TOP/lib/libtiff.a" ; then LIBTIFF_LIB_PATH="-L$LIBTIFF_TOP/lib" elif test -f "$LIBTIFF_TOP/lib/libtiff.so" ; then LIBTIFF_LIB_PATH="-L$LIBTIFF_TOP/lib" elif test -f "$LIBTIFF_TOP/libtiff/libtiff.a" ; then LIBTIFF_LIB_PATH="-L$LIBTIFF_TOP/libtiff" elif test -f "$LIBTIFF_TOP/libtiff/libtiff.so" ; then LIBTIFF_LIB_PATH="-L$LIBTIFF_TOP/libtiff" elif test -f "$LIBTIFF_TOP/libtiff/.libs/libtiff.a" ; then LIBTIFF_LIB_PATH="-L$LIBTIFF_TOP/libtiff/.libs" elif test -f "$LIBTIFF_TOP/libtiff/.libs/libtiff.so" ; then LIBTIFF_LIB_PATH="-L$LIBTIFF_TOP/libtiff/.libs" elif test -f "$LIBTIFF_TOP/.libs/libtiff.a" ; then LIBTIFF_LIB_PATH="-L$LIBTIFF_TOP/.libs" elif test -f "$LIBTIFF_TOP/.libs/libtiff.so" ; then LIBTIFF_LIB_PATH="-L$LIBTIFF_TOP/.libs" else LIBTIFF_LIB_PATH=-L$LIBTIFF_TOP fi LIBTIFF_LIBS=-ltiff echo "LIBTIFF_INCLUDE_PATH = $LIBTIFF_INCLUDE_PATH" echo "LIBTIFF_LIB_PATH = $LIBTIFF_LIB_PATH" echo "LIBTIFF_LIBS = $LIBTIFF_LIBS" else AC_MSG_ERROR([libtiff support required!]) fi AC_SUBST(LIBTIFF_INCLUDE_PATH, $LIBTIFF_INCLUDE_PATH) AC_SUBST(LIBTIFF_LIB_PATH, $LIBTIFF_LIB_PATH) AC_SUBST(LIBTIFF_LIBS, $LIBTIFF_LIBS) ]) dnl End of Libtiff package... dnl this macro checks for a command line argument and caches the result dnl usage: OSSIM_ARG_WITH(option, helpmessage, variable-name) AC_DEFUN([OSSIM_ARG_WITH], [ AC_MSG_CHECKING([for --with-$1]) no_cache=0 AC_ARG_WITH($1, [$2], [ if test "$withval" = yes; then ac_cv_use_$1='$3=yes' elif test "$withval" = "" ; then ac_cv_use_$1='$3=no' else ac_cv_use_$1='$3=$withval' fi ], [ ac_cv_use_$1='$3=no' dnl LINE=`grep "$3" ${wx_arg_cache_file}` dnl if test "x$LINE" != x ; then dnl eval "DEFAULT_$LINE" dnl else dnl no_cache=1 dnl fi dnl ac_cv_use_$1='$3='$DEFAULT_$3 ]) eval "$ac_cv_use_$1" dnl if test "$no_cache" != 1; then dnl echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp dnl fi if test "$$3" = yes; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi ] ) dnl like OSSIM_ARG_WITH but uses AC_ARG_ENABLE instead of AC_ARG_WITH dnl usage: OSSIM_ARG_ENABLE(option, helpmessage, variable-name, enablestring) dnl dnl enablestring is a hack and allows to show "checking for --disable-foo" dnl message when running configure instead of the default "checking for dnl --enable-foo" one whih is useful for the options enabled by default AC_DEFUN([OSSIM_ARG_ENABLE], [ enablestring=$4 AC_MSG_CHECKING([for --${enablestring:-enable}-$1]) no_cache=0 AC_ARG_ENABLE($1, [$2], [ if test "$enableval" = yes; then ac_cv_use_$1='$3=yes' else ac_cv_use_$1='$3=no' fi ], [ ac_cv_use_$1='$3=$$3' dnl LINE=`grep "$3" ${wx_arg_cache_file}` dnl if test "x$LINE" != x ; then dnl eval "DEFAULT_$LINE" dnl else dnl no_cache=1 dnl fi dnl ac_cv_use_$1='$3='$DEFAULT_$3 ]) eval "$ac_cv_use_$1" dnl if test "$no_cache" != 1; then dnl echo $ac_cv_use_$1 >> ${wx_arg_cache_file}.tmp dnl fi if test "$$3" = yes; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi ] ) define(OSSIM_SYS_LARGEFILE_TEST, [typedef struct { unsigned int field: sizeof(off_t) == 8; } wxlf; ]) dnl OSSIM_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR) define(OSSIM_SYS_LARGEFILE_MACRO_VALUE, [ AC_CACHE_CHECK([for $1 value needed for large files], [$3], [ AC_TRY_COMPILE([#define $1 $2 #include ], OSSIM_SYS_LARGEFILE_TEST, [$3=$2], [$3=no]) ] ) if test "$$3" != no; then ossim_largefile=yes AC_DEFINE_UNQUOTED([$1], [$$3]) fi ]) dnl AC_SYS_LARGEFILE dnl ---------------- dnl By default, many hosts won't let programs access large files; dnl one must use special compiler options to get large-file access to work. dnl For more details about this brain damage please see: dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html AC_DEFUN([AC_SYS_LARGEFILE], [AC_ARG_ENABLE(largefile, [ --disable-largefile omit support for large files]) if test "$enable_largefile" != no; then dnl _FILE_OFFSET_BITS==64 is needed for Linux, Solaris, ... dnl _LARGE_FILES -- for AIX ossim_largefile=no OSSIM_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, ac_cv_sys_file_offset_bits) if test "x$ossim_largefile" != "xyes"; then OSSIM_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, ac_cv_sys_large_files) fi AC_MSG_CHECKING(if large file support is available) if test "x$ossim_largefile" = "xyes"; then AC_DEFINE(HAVE_LARGEFILE_SUPPORT) fi AC_MSG_RESULT($ossim_largefile) fi ])