grassgis/configure.in

1940 lines
44 KiB
Plaintext

#############################################################################
#
# MODULE: Grass Compilation
# AUTHOR(S): Original author unknown - probably CERL
# Eric G. Miller - egm2 jps.net
# Justin Hickey - Thailand - jhickey hpcc.nectec.or.th
# Markus Neteler - Germany/Italy - neteler itc.it
# PURPOSE: This configure runs all the tests to determine what components
# are installed on the current system. It also defines certain
# configuration variables for compilation and installation.
# COPYRIGHT: (C) 2000-2009, 2011-2012 by the GRASS Development Team
#
# This program is free software under the GNU General
# Public License (>=v2). Read the file COPYING that
# comes with GRASS for details.
#
# MANUAL: http://www.gnu.org/software/autoconf/manual/autoconf.html
# http://savannah.gnu.org/projects/autoconf/
# Website for config.guess, config.sub:
# wget http://git.savannah.gnu.org/cgit/config.git/plain/config.guess
# wget http://git.savannah.gnu.org/cgit/config.git/plain/config.sub
# Note: use autoconf-2.13
#############################################################################
define([AC_CACHE_LOAD], )
define([AC_CACHE_SAVE], )
define([AC_CACHE_VAL], [
$2
])
AC_INIT(configure.in)
AC_PREREQ(2.13)
AC_PREFIX_DEFAULT(/usr/local)
AC_CONFIG_HEADER(include/config.h)
AC_CANONICAL_HOST
AC_PROG_CC
LOC_EXEEXT
AC_SUBST(MINGW32)
# Check for full floating-point support, including Infinity and NaN
IEEEFLAG=
LOC_CHECK_FP_INF_NAN([],
[],
[ ac_save_cflags=${CFLAGS}
CFLAGS=-mieee
LOC_CHECK_FP_INF_NAN([ with -mieee],
[IEEEFLAG="-mieee"],
[AC_MSG_WARN([*** Incomplete floating-point support.])],
[AC_MSG_ERROR([*** INTERNAL CONFIGURE ERROR])])
CFLAGS=${ac_save_cflags}],
[ LOC_CHECK_CC_MIEEE ])
CFLAGS="$CFLAGS $IEEEFLAG"
# Set BINDIR
if test -n "${bindir}"; then
BINDIR="${bindir}"
else
BINDIR=/usr/local/bin
fi
AC_SUBST(BINDIR)
# Set SRCDIR and DSTDIR
AC_PATH_PROG(pwd, pwd, pwd)
if test "$MINGW32" = yes ; then
winpwd="pwd -W"
else
winpwd="$pwd"
fi
AC_MSG_CHECKING(for source directory)
if test -z "$srcdir" ; then
SRCDIR=`$pwd`
else
SRCDIR=`(cd "$srcdir" ; $pwd)`
fi
AC_MSG_RESULT("$SRCDIR")
AC_MSG_CHECKING(for build directory)
DSTDIR=`$pwd`
WINDSTDIR=`$winpwd`
AC_MSG_RESULT("$DSTDIR")
AC_SUBST(SRCDIR)
AC_SUBST(DSTDIR)
# Set ARCH
ARCH=
if test -z "${host}"; then
ARCH="unknown"
else
ARCH="${host}"
fi
AC_SUBST(ARCH)
# Use absolute path for aux directory so that install-sh works
AC_CONFIG_AUX_DIR("$SRCDIR")
# Set GISBASE and GRASS_BIN
GISBASE="${WINDSTDIR}/dist.${ARCH}"
GRASS_BIN="${DSTDIR}/bin.${ARCH}"
AC_SUBST(GISBASE)
AC_SUBST(GRASS_BIN)
# Set GRASS_VERSION_*
GRASS_VERSION_FILE=include/VERSION
GRASS_VERSION_MAJOR=`sed -n 1p "${GRASS_VERSION_FILE}"`
GRASS_VERSION_MINOR=`sed -n 2p "${GRASS_VERSION_FILE}"`
GRASS_VERSION_RELEASE=`sed -n 3p "${GRASS_VERSION_FILE}"`
GRASS_VERSION_DATE=`sed -n 4p "${GRASS_VERSION_FILE}"`
GRASS_VERSION_NUMBER=`echo ${GRASS_VERSION_MAJOR}.${GRASS_VERSION_MINOR}.${GRASS_VERSION_RELEASE}`
NAME_VER=`echo ${GRASS_VERSION_NUMBER} | sed 's/\..*//'`
changequote(,)
LIB_VER=`echo ${GRASS_VERSION_NUMBER} | sed 's/^\([0-9.]*\).*$/\1/'`
changequote([,])
GRASS_VERSION_SVN="exported"
AC_PATH_PROG(SVN_VERSION, svnversion, no)
if test "$SVN_VERSION" != "no" ; then
GRASS_VERSION_SVN=`$SVN_VERSION -c | cut -f2 -d:`
if test "$GRASS_VERSION_SVN" = "exported" -o "$GRASS_VERSION_SVN" = "Unversioned directory" ; then
GRASS_VERSION_SVN="exported"
else
GRASS_VERSION_SVN="r$GRASS_VERSION_SVN"
fi
fi
AC_SUBST(GRASS_VERSION_FILE)
AC_SUBST(GRASS_VERSION_MAJOR)
AC_SUBST(GRASS_VERSION_MINOR)
AC_SUBST(GRASS_VERSION_RELEASE)
AC_SUBST(GRASS_VERSION_NUMBER)
AC_SUBST(GRASS_VERSION_DATE)
AC_SUBST(GRASS_VERSION_SVN)
AC_SUBST(NAME_VER)
AC_SUBST(LIB_VER)
# Check for MacOSX App
AC_ARG_ENABLE(macosx-app,
[ --enable-macosx-app create a MacOSX application],,
[enable_macosx_app=no])
AC_MSG_CHECKING(for MacOSX App)
case "$enable_macosx_app" in
yes) MACOSX_APP=1 ;;
no) MACOSX_APP= ;;
*) AC_MSG_ERROR([*** You must answer yes or no.]) ;;
esac
AC_MSG_RESULT("$enable_macosx_app")
AC_SUBST(MACOSX_APP)
# Check for MacOSX archs
AC_MSG_CHECKING(for MacOSX architectures)
MACOSX_ARCHS=
if test -z "$with_macosx_archs" ; then
AC_MSG_RESULT(no)
else
for a in $with_macosx_archs
do
# check if valid arch?
case "$a" in
i386|ppc|x86_64|ppc64)
MACOSX_ARCHS="$MACOSX_ARCHS -arch $a"
;;
esac
done
AC_MSG_RESULT([$MACOSX_ARCHS])
LDFLAGS="$LDFLAGS $MACOSX_ARCHS"
CFLAGS="$CFLAGS $MACOSX_ARCHS"
CXXFLAGS="$CXXFLAGS $MACOSX_ARCHS"
fi
AC_SUBST(MACOSX_ARCHS)
# Done checking MacOSX archs
# Check for MacOSX SDK
AC_MSG_CHECKING(for MacOSX SDK)
MACOSX_SDK=
if test -z "$with_macosx_sdk" ; then
AC_MSG_RESULT(no)
else
AC_CHECK_FILE($with_macosx_sdk/SDKSettings.plist, [
MACOSX_SDK="-isysroot $with_macosx_sdk"],[
AC_MSG_ERROR([*** specified SDK does not exist or is not a SDK])])
LDFLAGS="$LDFLAGS $MACOSX_SDK"
CFLAGS="$CFLAGS $MACOSX_SDK"
CXXFLAGS="$CXXFLAGS $MACOSX_SDK"
fi
AC_SUBST(MACOSX_SDK)
# Done checking MacOSX SDK
# Set INST_DIR
if test -n "$MACOSX_APP" ; then
INSTDIR='${prefix}'"/GRASS-${GRASS_VERSION_MAJOR}.${GRASS_VERSION_MINOR}.app/Contents/MacOS"
else
INSTDIR='${prefix}'"/grass-${GRASS_VERSION_MAJOR}.${GRASS_VERSION_MINOR}.${GRASS_VERSION_RELEASE}"
fi
AC_SUBST(INSTDIR)
# Get flags for building shared libraries
SC_ENABLE_SHARED
ac_save_ldflags="$LDFLAGS"
SC_CONFIG_CFLAGS
LDFLAGS="${ac_save_ldflags} $LDFLAGS"
# Enable options
AC_ARG_ENABLE(w11,
[ --enable-w11 use W11 library for Windows X11 emulation],,
[enable_w11=no])
# With options
LOC_ARG_WITH(cxx, C++)
#LOC_ARG_WITH(g77, GNU Fortran 77, no)
AC_ARG_WITH(macosx-archs,
[ --with-macosx-archs[=arch list]
compile multiple architectures on MacOSX, ie.
universal. Valid architectures are i386, ppc,
x86_64 and ppc64. (default: no [native])],, with_macosx_archs="no")
AC_ARG_WITH(macosx-sdk,
[ --with-macosx-sdk[=path/sdk]
compile with a system SDK on MacOSX. (default: no)],, with_macosx_sdk="no")
LOC_ARG_WITH(tiff, TIFF)
LOC_ARG_WITH(png, PNG)
LOC_ARG_WITH(postgres, PostgreSQL, no)
LOC_ARG_WITH(mysql, MySQL, no)
LOC_ARG_WITH(sqlite, SQLite)
LOC_ARG_WITH(opengl, OpenGL)
LOC_ARG_WITH(odbc, ODBC, no)
LOC_ARG_WITH(fftw, FFTW)
LOC_ARG_WITH(blas, BLAS, no)
LOC_ARG_WITH(lapack, LAPACK, no)
LOC_ARG_WITH(cairo, Cairo)
LOC_ARG_WITH(freetype, FreeType)
LOC_ARG_WITH(nls, NLS, no)
LOC_ARG_WITH(readline, Readline, no)
LOC_ARG_WITH(opendwg, openDWG, no)
LOC_ARG_WITH(regex, regex)
LOC_ARG_WITH(pthread, POSIX threads, no)
LOC_ARG_WITH(openmp, OpenMP, no)
LOC_ARG_WITH(opencl, OpenCL, no)
LOC_ARG_WITH(bzlib, BZIP2, no)
AC_ARG_WITH(gdal,
[ --with-gdal[=path/gdal-config]
enable GDAL/OGR support (gdal-config with path,
e.g. '--with-gdal=/usr/local/bin/gdal-config')])
AC_ARG_WITH(liblas,
[ --with-liblas[=path/liblas-config]
enable libLAS support (liblas-config with path,
e.g. '--with-liblas=/usr/local/bin/liblas-config',
default: no)],, with_liblas="no")
AC_ARG_WITH(pdal,
[ --with-pdal[=path/pdal-config]
enable PDAL support (pdal-config with path,
e.g. '--with-pdal=/usr/local/bin/pdal-config',
default: no)],, with_pdal="no")
AC_ARG_WITH(wxwidgets,
[ --with-wxwidgets[=path/wx-config]
enable wxWidgets support (wx-config with path,
e.g. '--with-wxwidgets=/usr/local/bin/wx-config',
default: no)],, with_wxwidgets="no")
AC_ARG_WITH(netcdf,
[ --with-netcdf[=path/nc-config]
enable NetCDF support (nc-config with path,
e.g. '--with-nc=/usr/local/bin/nc-config',
default: no)],, with_netcdf="no")
# With includes and libs options
AC_ARG_WITH(geos,
[ --with-geos[=path/geos-config]
enable GEOS support (geos-config with path,
e.g. '--with-geos=/usr/local/bin/geos-config',
default: no)],, with_geos="no")
AC_ARG_WITH(includes,
[ --with-includes=DIRS site include files are in DIRS])
AC_ARG_WITH(libs,
[ --with-libs=DIRS site library files are in DIRS])
LOC_ARG_WITH_INC(zlib, zlib)
LOC_ARG_WITH_LIB(zlib, zlib)
LOC_ARG_WITH_INC(bzlib, BZIP2)
LOC_ARG_WITH_LIB(bzlib, BZIP2)
LOC_ARG_WITH_INC(readline, Readline)
LOC_ARG_WITH_LIB(readline, Readline)
LOC_ARG_WITH_INC(tiff, TIFF)
LOC_ARG_WITH_LIB(tiff, TIFF)
LOC_ARG_WITH_INC(png, PNG)
LOC_ARG_WITH_LIB(png, PNG)
LOC_ARG_WITH_INC(postgres, PostgreSQL)
LOC_ARG_WITH_LIB(postgres, PostgreSQL)
LOC_ARG_WITH_INC(mysql, MySQL)
LOC_ARG_WITH_LIB(mysql, MySQL)
LOC_ARG_WITH_INC(sqlite, SQLite)
LOC_ARG_WITH_LIB(sqlite, SQLite)
LOC_ARG_WITH_INC(opengl, OpenGL)
LOC_ARG_WITH_LIB(opengl, OpenGL)
LOC_ARG_WITH_FRAMEWORK(opengl, OpenGL)
LOC_ARG_WITH_INC(odbc, ODBC)
LOC_ARG_WITH_LIB(odbc, ODBC)
LOC_ARG_WITH_INC(fftw, FFTW)
LOC_ARG_WITH_LIB(fftw, FFTW)
LOC_ARG_WITH_INC(blas, BLAS)
LOC_ARG_WITH_LIB(blas, BLAS)
LOC_ARG_WITH_INC(lapack, LAPACK)
LOC_ARG_WITH_LIB(lapack, LAPACK)
LOC_ARG_WITH_INC(cairo, cairo)
LOC_ARG_WITH_LIB(cairo, cairo)
LOC_ARG_WITH_LDFLAGS(cairo, cairo)
LOC_ARG_WITH_INC(freetype, FreeType)
LOC_ARG_WITH_LIB(freetype, FreeType)
LOC_ARG_WITH_INC(proj, External PROJ.4)
LOC_ARG_WITH_LIB(proj, External PROJ.4)
LOC_ARG_WITH_SHARE(proj, External PROJ.4)
LOC_ARG_WITH_INC(opendwg, openDWG)
LOC_ARG_WITH_LIB(opendwg, openDWG)
LOC_ARG_WITH_INC(regex, regex)
LOC_ARG_WITH_LIB(regex, regex)
LOC_ARG_WITH_INC(pthread, POSIX threads)
LOC_ARG_WITH_LIB(pthread, POSIX threads)
LOC_ARG_WITH_INC(openmp, OpenMP)
LOC_ARG_WITH_LIB(openmp, OpenMP)
LOC_ARG_WITH_INC(opencl, OpenCL)
LOC_ARG_WITH_LIB(opencl, OpenCL)
#LOC_ARG_WITH_FRAMEWORK(opencl, OpenCL)
# Put this early on so CPPFLAGS and LDFLAGS have any additional dirs
# With includes option
# Handle Fortran compiler choice
#LOC_CHECK_USE(g77, GNU Fortran 77, USE_G77)
# Done checking fortran
AC_MSG_CHECKING(for additional include dirs)
case "$with_includes" in
y | ye | yes | n | no)
AC_MSG_ERROR([*** You must supply a directory to list --with-includes.])
;;
esac
AC_MSG_RESULT($with_includes)
if test -n "$with_includes"; then
for dir in $with_includes; do
if test -d "$dir"; then
INCLUDE_DIRS="$INCLUDE_DIRS -I$dir"
else
AC_MSG_ERROR([*** Include directory $dir does not exist.])
fi
done
CPPFLAGS="$CPPFLAGS $INCLUDE_DIRS"
fi
AC_SUBST(INCLUDE_DIRS)
# With libs option
AC_MSG_CHECKING(for additional library dirs)
case "$with_libs" in
y | ye | yes | n | no)
AC_MSG_ERROR([*** You must supply a directory list to --with-libs.])
;;
esac
AC_MSG_RESULT($with_libs)
if test -n "$with_libs"; then
for dir in $with_libs; do
if test -d "$dir"; then
LIBRARY_DIRS="$LIBRARY_DIRS -L$dir"
else
AC_MSG_ERROR([*** Library directory $dir does not exist.])
fi
done
LDFLAGS="$LDFLAGS $LIBRARY_DIRS"
fi
AC_SUBST(LIBRARY_DIRS)
# Programs and standard headers, libraries, functions
AC_PROG_INSTALL
AC_PROG_LEX
if test "$LEX" = "lex"; then
AC_PATH_PROG(LEXPATH, lex, no)
if test "$LEXPATH" = "no"; then
AC_MSG_ERROR([*** Unable to locate lex.])
fi
fi
AC_PROG_YACC
if test "$YACC" = "yacc"; then
AC_PATH_PROG(YACCPATH, yacc, no)
if test "$YACCPATH" = "no"; then
AC_MSG_ERROR([*** Unable to locate yacc.])
fi
fi
AC_PROG_RANLIB
AC_CHECK_PROGS(AR, ar)
AC_CHECK_PROGS(ENV, env)
AC_PATH_PROG(PERL, perl, no)
AC_HEADER_STDC
#AC_CHECK_HEADERS(curses.h limits.h termio.h termios.h unistd.h values.h)
AC_CHECK_HEADERS(limits.h termio.h termios.h unistd.h values.h f2c.h g2c.h)
AC_CHECK_HEADERS(sys/ioctl.h sys/mtio.h sys/resource.h sys/time.h)
AC_CHECK_HEADERS(sys/timeb.h sys/types.h sys/utsname.h)
AC_CHECK_HEADERS(libintl.h iconv.h)
AC_CHECK_HEADERS(langinfo.h)
AC_HEADER_TIME
AC_TYPE_OFF_T
AC_TYPE_UID_T
AC_TYPE_SIGNAL
AC_CYGWIN
AC_CHECK_FUNCS(ftime gethostname gettimeofday lseek nice time uname)
AC_CHECK_FUNCS(seteuid setpriority setreuid setruid)
AC_CHECK_FUNCS(drand48)
AC_CHECK_FUNCS(putenv setenv)
AC_CHECK_FUNCS(nanosleep)
if test "$cross_compiling" != "yes" ; then
AC_FUNC_SETPGRP
else
CROSS_COMPILING=1
AC_SUBST(CROSS_COMPILING)
fi
AC_MSG_CHECKING(for long long int)
AC_TRY_COMPILE(,[long long int x;],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LONG_LONG_INT)
],[
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING(for W11)
case "$enable_w11" in
yes|no) AC_MSG_RESULT("$enable_w11") ;;
*) AC_MSG_ERROR([*** You must answer yes or no.]) ;;
esac
USE_X11=
USE_W11=
XLIB=
XTLIB=
if test "$enable_w11" = "yes" ; then
X_CFLAGS=-I${SRCDIR}/display/drivers/windows/libW11
X_LIBS='-L$(LIBDIR)'
AC_SUBST(X_CFLAGS)
AC_SUBST(X_LIBS)
USE_W11="1"
USE_X11="1"
XLIB=-lX11
CFLAGS="$CFLAGS -D__W98__"
else
AC_PATH_XTRA
if test "$no_x" != "yes"; then
USE_X11="1"
XLIB=-lX11
XTLIB=-lXt
fi
fi
AC_SUBST(XLIB)
AC_SUBST(XTLIB)
AC_SUBST(USE_X11)
# Note that some systems (FreeBSD for example) need an extra library for
# cuserid
ac_save_libs="$LIBS"
LIBS=""
AC_SEARCH_LIBS(cuserid,[compat])
DBMIEXTRALIB="$LIBS"
LIBS="$ac_save_libs"
AC_SUBST(DBMIEXTRALIB)
AC_CHECK_FUNCS(asprintf)
AC_SUBST(HAVE_ASPRINTF)
# Test if mathlib needs -lm flag or is included with libc
AC_CHECK_FUNC(atan, MATHLIB=, [
AC_CHECK_LIB(m, atan, MATHLIB=-lm, [
AC_MSG_ERROR([*** Failed check for math library.])
])])
AC_SUBST(MATHLIB)
AC_CHECK_FUNC(dlsym, DLLIB=, [
AC_CHECK_LIB(dl, dlsym, DLLIB=-ldl, [
DLLIB=
])])
AC_SUBST(DLLIB)
AC_CHECK_FUNC(iconv, ICONVLIB=, [
AC_CHECK_LIB(iconv, iconv, ICONVLIB=-liconv, [
AC_CHECK_LIB(giconv, iconv, ICONVLIB=-lgiconv, [
AC_CHECK_FUNC(libiconv, ICONVLIB=, [
AC_CHECK_LIB(iconv, libiconv, ICONVLIB=-liconv, [
AC_CHECK_LIB(giconv, libiconv, ICONVLIB=-lgiconv, [
AC_MSG_WARN([*** Unable to locate iconv() function.])
ICONVLIB=
])])])])])])
AC_SUBST(ICONVLIB)
have_socket=1
AC_CHECK_FUNC(socket, SOCKLIB=, [
AC_CHECK_LIB(socket, socket, SOCKLIB=-lsocket, [
have_socket=0
AC_MSG_WARN([*** Unable to locate socket() function.])
])])
AC_SUBST(SOCKLIB)
if test "$have_socket" = 1 ; then
HAVE_SOCKET=1
AC_DEFINE(HAVE_SOCKET)
else
HAVE_SOCKET=
fi
AC_SUBST(HAVE_SOCKET)
# Mandatory zlib dependency
ZLIBLIBPATH=
ZLIBINCPATH=
ZLIB=
# With zlib includes directory
LOC_CHECK_INC_PATH(zlib,zlib,ZLIBINCPATH)
LOC_CHECK_INCLUDES(zlib.h,zlib,$ZLIBINCPATH)
# With zlib library directory
LOC_CHECK_LIB_PATH(zlib,zlib,ZLIBLIBPATH)
LOC_CHECK_LIBS(z,deflate,zlib,$ZLIBLIBPATH,ZLIB,,,)
#
AC_SUBST(ZLIBINCPATH)
AC_SUBST(ZLIBLIBPATH)
AC_SUBST(ZLIB)
# Done checking zlib
# bzip2 support
LOC_CHECK_USE(bzlib,bzlib,USE_BZIP2)
if test -n "$USE_BZIP2"; then
BZLIBLIBPATH=
BZLIBINCPATH=
BZLIB=
# With bzip2 includes directory
LOC_CHECK_INC_PATH(bzlib,bzlib,BZLIBINCPATH)
LOC_CHECK_INCLUDES(bzlib.h,bzlib,$BZLIBINCPATH)
# With bzip2 library directory
LOC_CHECK_LIB_PATH(bzlib,bzlib,BZLIBLIBPATH)
LOC_CHECK_LIBS(bz2,BZ2_bzBuffToBuffCompress,bzlib,$BZLIBLIBPATH,BZLIB,,,)
#
fi # $USE_BZIP2
AC_SUBST(BZLIBINCPATH)
AC_SUBST(BZLIBLIBPATH)
AC_SUBST(BZLIB)
# Done checking bzip2
# Mandatory PROJ dependency
PROJINC=
PROJLIB=
PROJSHARE=
# With PROJ includes directory
LOC_CHECK_INC_PATH(proj,External PROJ.4,PROJINC)
LOC_CHECK_INCLUDES(proj_api.h,External PROJ.4,$PROJINC)
# PROJ version check
if test "$cross_compiling" = yes; then
AC_MSG_WARN([*** Cannot check PROJ.4 version (cross-compiling).])
else
LOC_CHECK_VERSION_INT(proj_api.h,PJ_VERSION,External PROJ.4,proj_ver,$PROJINC,0)
if test `expr "$proj_ver" \< 446` = 1 ; then
AC_MSG_ERROR([*** PROJ.4.4.6 or later is required.])
fi
fi
# With PROJ library directory
LOC_CHECK_LIB_PATH(proj,External PROJ.4,PROJLIB)
LOC_CHECK_LIBS(proj,pj_get_def,External PROJ.4,$PROJLIB,PROJLIB,,,)
# With PROJ share directory
LOC_CHECK_SHARE_PATH(proj,External PROJ.4,PROJSHARE)
if test -z "$PROJSHARE" ; then
AC_MSG_WARN([*** External PROJ.4 directory not specified; default will be used])
PROJSHARE=/usr/share/proj
fi
# LOC_CHECK_SHARE does not work when cross compiling
if test "$cross_compiling" = "yes" ; then
AC_MSG_CHECKING([for epsg])
AC_MSG_RESULT([unknown (cross-compiling)])
else
LOC_CHECK_SHARE(epsg,External PROJ.4,$PROJSHARE,[
AC_MSG_WARN([*** Unable to locate PROJ data files.])
])
fi
AC_SUBST(PROJINC)
AC_SUBST(PROJLIB)
AC_SUBST(PROJSHARE)
# nad2bin needs to be in path for installing datum gridshift files
AC_PATH_PROG(NAD2BIN, nad2bin, no)
if test "$NAD2BIN" = "no"; then
AC_MSG_ERROR([*** Unable to locate nad2bin (needs to be in PATH).])
fi
# Done checking PROJ
# Enable regex option
LOC_CHECK_USE(regex,regex,USE_REGEX)
REGEXINCPATH=
REGEXLIBPATH=
REGEXLIB=
if test -n "$USE_REGEX"; then
# With regex includes directory
LOC_CHECK_INC_PATH(regex,regex,REGEXINCPATH)
LOC_CHECK_INCLUDES(regex.h,regex,$REGEXINCPATH)
# With regex library directory
LOC_CHECK_LIB_PATH(regex,regex,REGEXLIBPATH)
LOC_CHECK_FUNC(regcomp,regex functions,REGEXLIB,,,,,[
LOC_CHECK_LIBS(regex,regcomp,regex,$REGEXLIBPATH,REGEXLIB,,,)
])
fi # $USE_REGEX
AC_SUBST(REGEXINCPATH)
AC_SUBST(REGEXLIBPATH)
AC_SUBST(REGEXLIB)
AC_SUBST(USE_REGEX)
# Done checking regex
# Enable Readline option
LOC_CHECK_USE(readline,Readline,USE_READLINE)
READLINEINCPATH=
READLINELIBPATH=
READLINELIB=
HISTORYLIB=
if test -n "$USE_READLINE"; then
# With Readline includes directory
LOC_CHECK_INC_PATH(readline,Readline,READLINEINCPATH)
LOC_CHECK_INCLUDES(readline/readline.h,Readline,$READLINEINCPATH)
LOC_CHECK_INCLUDES(readline/history.h,Readline,$READLINEINCPATH)
# With Readline library directory
LOC_CHECK_LIB_PATH(readline,Readline,READLINELIBPATH)
LOC_CHECK_LIBS(readline,readline,Readline,$READLINELIBPATH,READLINELIB,,,)
LOC_CHECK_LIBS(history,add_history,History,$READLINELIBPATH,HISTORYLIB,,,)
fi # $USE_READLINE
AC_SUBST(READLINEINCPATH)
AC_SUBST(READLINELIBPATH)
AC_SUBST(READLINELIB)
AC_SUBST(HISTORYLIB)
# Done checking Readline
# GDAL option
AC_MSG_CHECKING(whether to use GDAL)
GDAL_LIBS=
GDAL_CFLAGS=
USE_GDAL=
USE_OGR=
if test "`basename xx/$with_gdal`" = "gdal-config" ; then
GDAL_CONFIG="$with_gdal"
fi
if test "$with_gdal" = "no" ; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
AC_PATH_PROG(GDAL_CONFIG, gdal-config, no)
if test "$GDAL_CONFIG" = "no" ; then
AC_MSG_ERROR([*** couldn't find gdal-config])
fi
if test "$GDAL_CONFIG" != "" ; then
GDAL_LIBS=`"$GDAL_CONFIG" --libs`
GDAL_DEP_LIBS=`"$GDAL_CONFIG" --dep-libs`
GDAL_CFLAGS=`"$GDAL_CONFIG" --cflags`
USE_GDAL=1
if test `"$GDAL_CONFIG" --ogr-enabled` = "yes" ; then
AC_DEFINE(HAVE_OGR)
USE_OGR=1
fi
fi
GDAL=
ac_save_libs="$LIBS"
ac_save_cflags="$CFLAGS"
LIBS="$LIBS $GDAL_LIBS"
CFLAGS="$CFLAGS $GDAL_CFLAGS"
AC_TRY_LINK([#include <gdal.h>],[GDALOpen("foo", GA_ReadOnly);],,[
LIBS="$LIBS $GDAL_DEP_LIBS"
AC_TRY_LINK([#include <gdal.h>],[GDALOpen("foo", GA_ReadOnly);],GDAL_LIBS="$GDAL_LIBS $GDAL_DEP_LIBS",[
AC_MSG_ERROR([*** Unable to locate GDAL library.])
])
])
LIBS=${ac_save_libs}
CFLAGS=${ac_save_cflags}
AC_DEFINE(HAVE_GDAL)
fi
AC_SUBST(GDAL_LIBS)
AC_SUBST(GDAL_CFLAGS)
AC_SUBST(USE_GDAL)
AC_SUBST(USE_OGR)
# libLAS option
AC_MSG_CHECKING(whether to use libLAS)
LIBLAS_LIBS=
LIBLAS_CFLAGS=
USE_LIBLAS=
if test "`basename xx/$with_liblas`" = "liblas-config" ; then
LIBLAS_CONFIG="$with_liblas"
fi
if test "$with_liblas" = "no" ; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
AC_PATH_PROG(LIBLAS_CONFIG, liblas-config, no)
if test "$LIBLAS_CONFIG" = "no" ; then
AC_MSG_ERROR([*** couldn't find liblas-config])
fi
if test "$LIBLAS_CONFIG" != "" ; then
LIBLAS_LIBS=`"$LIBLAS_CONFIG" --libs`
LIBLAS_CFLAGS=`"$LIBLAS_CONFIG" --cflags`
LIBLAS_INC=`"$LIBLAS_CONFIG" --includes`
USE_LIBLAS=1
fi
LIBLAS=
ac_save_libs="$LIBS"
ac_save_cflags="$CFLAGS"
ac_save_cppflags="$CPPFLAGS"
LIBS="$LIBS $LIBLAS_LIBS"
CFLAGS="$CFLAGS $LIBLAS_CFLAGS"
CPPFLAGS="$CPPFLAGS $LIBLAS_INC"
AC_TRY_LINK([#include <liblas/capi/liblas.h>],[LASReader_Create("foo");],,[
AC_TRY_LINK([#include <liblas/capi/liblas.h>],[LASReader_Create("foo");],LAS_LIBS="$LAS_LIBS",[
AC_MSG_ERROR([*** Unable to locate libLAS library.])
])
])
LIBS=${ac_save_libs}
CFLAGS=${ac_save_cflags}
CPPFLAGS=${ac_save_cppflags}
AC_DEFINE(HAVE_LIBLAS)
fi
AC_SUBST(LIBLAS_LIBS)
AC_SUBST(LIBLAS_CFLAGS)
AC_SUBST(LIBLAS_INC)
AC_SUBST(USE_LIBLAS)
# PDAL option
AC_MSG_CHECKING(whether to use PDAL)
# new and currently used way to switch language to C++
# AC_LANG_PUSH(C++)
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
PDAL_LIBS=
PDAL_CPPFLAGS=
USE_PDAL=
if test "`basename xx/$with_pdal`" = "pdal-config" ; then
PDAL_CONFIG="$with_pdal"
fi
if test "$with_pdal" = "no" ; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
AC_PATH_PROG(PDAL_CONFIG, pdal-config, no)
if test "$PDAL_CONFIG" = "no" ; then
AC_MSG_ERROR([*** could not find pdal-config])
fi
if test "$PDAL_CONFIG" != "" ; then
PDAL_LIBS=`"$PDAL_CONFIG" --libs`
PDAL_CPPFLAGS=`"$PDAL_CONFIG" --cxxflags`
PDAL_INC=`"$PDAL_CONFIG" --includes`
USE_PDAL=1
fi
PDAL=
ac_save_libs="$LIBS"
ac_save_cflags="$CFLAGS"
ac_save_cppflags="$CPPFLAGS"
LIBS="$LIBS $PDAL_LIBS"
CFLAGS="$CFLAGS $PDAL_CFLAGS"
CPPFLAGS="$CPPFLAGS $PDAL_CPPFLAGS $PDAL_INC"
AC_TRY_LINK([#include <pdal/PointTable.hpp>],[pdal::PointTable table;],,[
AC_TRY_LINK([#include <pdal/PointTable.hpp>],[pdal::PointTable table;],PDAL_LIBS="$PDAL_LIBS",[
AC_MSG_ERROR([*** Unable to locate PDAL library.])
])
])
LIBS=${ac_save_libs}
CFLAGS=${ac_save_cflags}
CPPFLAGS=${ac_save_cppflags}
AC_DEFINE(HAVE_PDAL)
fi
AC_SUBST(PDAL_LIBS)
AC_SUBST(PDAL_CPPFLAGS)
AC_SUBST(PDAL_INC)
AC_SUBST(USE_PDAL)
# new and currently used way to switch language back to C
# AC_LANG_POP(C++)
AC_LANG_C
AC_LANG_RESTORE
# NetCDF option
AC_MSG_CHECKING(whether to use NetCDF)
NETCDF_LIBS=
NETCDF_CFLAGS=
USE_NETCDF=
if test "`basename xx/$with_netcdf`" = "nc-config" ; then
NETCDF_CONFIG="$with_netcdf"
fi
if test "$with_netcdf" = "no" ; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
AC_PATH_PROG(NETCDF_CONFIG, nc-config, no)
if test "$NETCDF_CONFIG" = "no" ; then
AC_MSG_ERROR([*** couldn't find nc-config])
fi
if test "$NETCDF_CONFIG" != "" ; then
NETCDF_LIBS=`"$NETCDF_CONFIG" --libs`
NETCDF_CFLAGS=`"$NETCDF_CONFIG" --cflags`
USE_NETCDF=1
fi
NETCDF=
ac_save_libs="$LIBS"
ac_save_cflags="$CFLAGS"
LIBS="$LIBS $NETCDF_LIBS"
CFLAGS="$CFLAGS $NETCDF_CFLAGS"
AC_TRY_LINK([#include <netcdf.h>],[nc_create("foo", NC_CLOBBER, NULL);],,[
AC_TRY_LINK([#include <netcdf.h>],[nc_create("foo", NC_CLOBBER, NULL);],NETCDF_LIBS="$NETCDF_LIBS",[
AC_MSG_ERROR([*** Unable to locate NetCDF library.])
])
])
LIBS=${ac_save_libs}
CFLAGS=${ac_save_cflags}
AC_DEFINE(HAVE_NETCDF)
fi
AC_SUBST(NETCDF_LIBS)
AC_SUBST(NETCDF_CFLAGS)
AC_SUBST(USE_NETCDF)
# GEOS option
AC_MSG_CHECKING(whether to use GEOS)
GEOS_LIBS=
GEOS_CFLAGS=
USE_GEOS=
# FIXME: "quote" $with_geos ?
if test "`basename xx/$with_geos`" = "geos-config" ; then
GEOS_CONFIG="$with_geos"
fi
if test "$with_geos" = "no" ; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
AC_PATH_PROG(GEOS_CONFIG, geos-config, no)
if test "$GEOS_CONFIG" = "no" ; then
AC_MSG_ERROR([*** couldn't find geos-config])
fi
if test "$GEOS_CONFIG" != "" ; then
GEOS_LIBS=`"$GEOS_CONFIG" --libs`
GEOS_CFLAGS=`"$GEOS_CONFIG" --cflags`
USE_GEOS=1
fi
LOC_CHECK_INCLUDES(geos_c.h,GEOS,$GEOS_CFLAGS)
### geos 3.3.6 installs geos_c.lib, see http://osgeo-org.1560.n6.nabble.com/osgeo4w-329-update-geos-to-3-3-6-td5024605.html
# if test "$MINGW32" = yes ; then
# LOC_CHECK_LIBS(geos_c_i,initGEOS,GEOS,$GEOS_LIBS,GEOS_LIBS)
# else
LOC_CHECK_LIBS(geos_c,initGEOS,GEOS,$GEOS_LIBS,GEOS_LIBS)
# fi
AC_DEFINE(HAVE_GEOS)
fi
AC_SUBST(GEOS_LIBS)
AC_SUBST(GEOS_CFLAGS)
AC_SUBST(USE_GEOS)
# Enable TIFF option
LOC_CHECK_USE(tiff,TIFF,USE_TIFF)
TIFF_INCLUDE_DIRS=
TIFF_LIBRARY_DIRS=
TIFFLIB=
if test -n "$USE_TIFF"; then
# With TIFF includes directory
LOC_CHECK_INC_PATH(tiff,TIFF,TIFF_INCLUDE_DIRS)
LOC_CHECK_INCLUDES(tiffio.h,TIFF,$TIFF_INCLUDE_DIRS)
# With TIFF library directory
LOC_CHECK_LIB_PATH(tiff,TIFF,TIFF_LIBRARY_DIRS)
LOC_CHECK_LIBS(tiff,TIFFOpen,TIFF,$TIFF_LIBRARY_DIRS,TIFFLIB,,,,-ljpeg,$ZLIB,$MATHLIB)
fi # $USE_TIFF
AC_SUBST(TIFF_INCLUDE_DIRS)
AC_SUBST(TIFF_LIBRARY_DIRS)
AC_SUBST(TIFFLIB)
# Done checking TIFF
# Enable PNG option
LOC_CHECK_USE(png,PNG,USE_PNG)
PNGINC=
PNGLIB=
if test -n "$USE_PNG"; then
# With PNG includes directory
LOC_CHECK_INC_PATH(png,PNG,PNGINC)
LOC_CHECK_INCLUDES(png.h,PNG,$PNGINC)
# With PNG library directory
LOC_CHECK_LIB_PATH(png,PNG,PNGLIB)
LOC_CHECK_LIBS(png,png_read_image,PNG,$PNGLIB,PNGLIB,,$ZLIB $MATHLIB,)
fi # $USE_PNG
AC_SUBST(PNGINC)
AC_SUBST(PNGLIB)
AC_SUBST(USE_PNG)
# Done checking PNG
# Enable PostgreSQL option
LOC_CHECK_USE(postgres,PostgreSQL,USE_POSTGRES)
if test -n "$USE_POSTGRES"; then
AC_DEFINE(HAVE_POSTGRES)
fi # $USE_POSTGRES
PQINCPATH=
PQLIBPATH=
PQLIB=
if test -n "$USE_POSTGRES"; then
# With PostgreSQL includes directory
LOC_CHECK_INC_PATH(postgres,PostgreSQL,PQINCPATH)
LOC_CHECK_INCLUDES(libpq-fe.h,PostgreSQL,$PQINCPATH)
fi # $USE_POSTGRES
if test -n "$USE_POSTGRES"; then
# With PostgreSQL library directory
LOC_CHECK_LIB_PATH(postgres,PostgreSQL,PQLIBPATH)
LOC_CHECK_LIBS(pq,PQsetdbLogin,PostgreSQL,$PQLIBPATH,PQLIB,,,,-lcrypt,-lssl -lcrypto)
ac_save_ldflags="$LDFLAGS"
LDFLAGS="$LDFLAGS $PQLIBPATH"
AC_CHECK_LIB(pq,PQcmdTuples, [AC_DEFINE(HAVE_PQCMDTUPLES)], [
AC_CHECK_LIB(pq,PQcmdTuples, [AC_DEFINE(HAVE_PQCMDTUPLES)], [
], -lcrypt)
])
LDFLAGS="${ac_save_ldflags}"
fi # $USE_POSTGRES
AC_SUBST(USE_POSTGRES)
AC_SUBST(PQINCPATH)
AC_SUBST(PQLIBPATH)
AC_SUBST(PQLIB)
# Done checking PostgreSQL
# Enable MySQL option
LOC_CHECK_USE(mysql,MySQL,USE_MYSQL)
MYSQLINCPATH=
MYSQLLIBPATH=
MYSQLLIB=
if test -n "$USE_MYSQL"; then
# With MySQL includes directory
LOC_CHECK_INC_PATH(mysql,MySQL,MYSQLINCPATH)
LOC_CHECK_INCLUDES(mysql.h,MySQL,$MYSQLINCPATH)
fi # $USE_MYSQL
if test -n "$USE_MYSQL"; then
# With MySQL library directory
LOC_CHECK_LIB_PATH(mysql,MySQL,MYSQLLIBPATH)
LOC_CHECK_LIBS(mysqlclient,mysql_query,MySQL,$MYSQLLIBPATH,MYSQLLIB,,,,$ZLIB,$SOCKLIB,$MATHLIB)
# Check for libmysqld (for embeded version of the driver)
AC_PATH_PROG(MYSQLD_CONFIG, mysql_config, no)
if test "$MYSQLD_CONFIG" = "no" ; then
AC_MSG_ERROR([*** couldn't find mysql_config])
fi
if test "$MYSQLD_CONFIG" != "" ; then
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
ac_save_libs="$LIBS"
MYSQLDLIB=`"$MYSQLD_CONFIG" --libmysqld-libs`
LIBS="$MYSQLDLIB $LIBS"
AC_CHECK_FUNC(mysql_server_init,,[MYSQLDLIB="";
AC_MSG_WARN([libmysqld not found])] )
LIBS=$ac_save_libs
AC_LANG_C
AC_LANG_RESTORE
fi
fi # $USE_MYSQL
AC_SUBST(USE_MYSQL)
AC_SUBST(MYSQLINCPATH)
AC_SUBST(MYSQLLIBPATH)
AC_SUBST(MYSQLLIB)
AC_SUBST(MYSQLDLIB)
# Done checking MySQL
# Enable SQLite option
LOC_CHECK_USE(sqlite,SQLite,USE_SQLITE)
SQLITEINCPATH=
SQLITELIBPATH=
SQLITELIB=
if test -n "$USE_SQLITE"; then
# With SQLite includes directory
LOC_CHECK_INC_PATH(sqlite,SQLite,SQLITEINCPATH)
LOC_CHECK_INCLUDES(sqlite3.h,SQLite,$SQLITEINCPATH)
AC_DEFINE(HAVE_SQLITE)
fi # $USE_SQLITE
if test -n "$USE_SQLITE"; then
# With SQLite library directory
LOC_CHECK_LIB_PATH(sqlite,SQLite,SQLITELIBPATH)
LOC_CHECK_LIBS(sqlite3,sqlite3_open,SQLite,$SQLITELIBPATH,SQLITELIB,,,,$MATHLIB,$DLLIB)
fi # $USE_SQLITE
AC_SUBST(USE_SQLITE)
AC_SUBST(SQLITEINCPATH)
AC_SUBST(SQLITELIBPATH)
AC_SUBST(SQLITELIB)
# Done checking SQLite
# Enable OpenGL option
OPENGLINC=
OPENGLLIB=
OPENGLULIB=
USE_OPENGL=
OPENGL_X11=
OPENGL_AQUA=
OPENGL_WINDOWS=
AC_MSG_CHECKING(whether to use OpenGL)
AC_MSG_RESULT("$with_opengl")
case "$with_opengl" in
n|no)
OPENGL_TYPE=none
;;
y|yes|x|x11|glx)
OPENGL_TYPE=X11
USE_OPENGL=1
OPENGL_X11=1
;;
aqua|mac|osx|macosx|agl)
OPENGL_TYPE=Aqua
USE_OPENGL=1
OPENGL_AQUA=1
;;
win|windows|mswin|wgl)
OPENGL_TYPE=Windows
USE_OPENGL=1
OPENGL_WINDOWS=1
;;
*)
AC_MSG_ERROR([*** Valid arguments for --with-opengl= are yes,no,x11,aqua,windows.])
;;
esac
if test -n "$USE_OPENGL" ; then
if test "$OPENGL_X11" = 1 ; then
# With OpenGL includes directory
LOC_CHECK_INC_PATH(opengl,OpenGL,OPENGLINC)
LOC_CHECK_INCLUDES(GL/gl.h GL/glu.h,OpenGL,$OPENGLINC $X_CFLAGS)
# With OpenGL library directory
LOC_CHECK_LIB_PATH(opengl,OpenGL,OPENGL_LIB_PATH)
LOC_CHECK_LIBS(GL,glBegin,OpenGL,$OPENGL_LIB_PATH,OPENGLLIB,$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $MATHLIB,,,-lpthread,-lXext)
LOC_CHECK_LIBS(GLU,gluBeginCurve,GLU,$OPENGL_LIB_PATH,OPENGLULIB,$OPENGLLIB $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $MATHLIB,,,-lstdc++)
OPENGLLIB="$OPENGL_LIB_PATH $OPENGLLIB"
OPENGLULIB="$OPENGL_LIB_PATH $OPENGLULIB"
LOC_CHECK_FUNC(glXCreatePbuffer,,,,,$OPENGLLIB,[AC_DEFINE(HAVE_PBUFFERS)])
LOC_CHECK_FUNC(glXCreateGLXPixmap,,,,,$OPENGLLIB,[AC_DEFINE(HAVE_PIXMAPS)])
AC_DEFINE(OPENGL_X11)
fi # $OPENGL_X11
if test "$OPENGL_AQUA" = 1 ; then
LOC_CHECK_FRAMEWORK_PATH(opengl,OpenGL,OPENGLPATH)
LOC_CHECK_INCLUDES(OpenGL/gl.h OpenGL/glu.h,OpenGL,$OPENGLPATH)
LOC_CHECK_FUNC(glBegin,OpenGL library,OPENGLLIB,-framework OpenGL -framework AGL -framework ApplicationServices,$OPENGLPATH)
LOC_CHECK_FUNC(gluBeginCurve,GLU library,OPENGLLIB,,$OPENGLPATH,$OPENGLLIB)
OPENGLINC="$OPENGLPATH"
OPENGLLIBPATH="$OPENGLPATH"
AC_DEFINE(OPENGL_AQUA)
fi # $OPENGL_AQUA
if test "$OPENGL_WINDOWS" = 1 ; then
# With OpenGL includes directory
LOC_CHECK_INC_PATH(opengl,OpenGL,OPENGLINC)
LOC_CHECK_INCLUDES(GL/gl.h GL/glu.h,OpenGL,$OPENGLINC)
# With OpenGL library directory
LOC_CHECK_LIB_PATH(opengl,OpenGL,OPENGL_LIB_PATH)
ac_save_cflags="$CFLAGS"
CFLAGS="$CFLAGS $OPENGLINC"
LOC_CHECK_LINK(opengl32,[#include <GL/gl.h>],[glEnd();],OpenGL,$OPENGL_LIB_PATH,OPENGLLIB)
LOC_CHECK_LINK(glu32,[#include <GL/glu.h>],[gluNewQuadric();],GLU,$OPENGL_LIB_PATH,OPENGLULIB,$OPENGLLIB)
CFLAGS="${ac_save_cflags}"
OPENGLLIB="$OPENGL_LIB_PATH $OPENGLLIB"
OPENGLULIB="$OPENGL_LIB_PATH $OPENGLULIB"
AC_DEFINE(OPENGL_WINDOWS)
fi # $OPENGL_WINDOWS
fi # $USE_OPENGL
AC_SUBST(USE_OPENGL)
AC_SUBST(OPENGL_X11)
AC_SUBST(OPENGL_AQUA)
AC_SUBST(OPENGL_WINDOWS)
AC_SUBST(OPENGLINC)
AC_SUBST(OPENGLLIB)
AC_SUBST(OPENGLULIB)
# Done checking OpenGL
# Enable ODBC option
LOC_CHECK_USE(odbc,ODBC,USE_ODBC)
ODBCINC=
ODBCLIB=
if test -n "$USE_ODBC"; then
# With ODBC includes directory
LOC_CHECK_INC_PATH(odbc,ODBC,ODBCINC)
LOC_CHECK_INCLUDES(sql.h,ODBC,$ODBCINC)
# With ODBC library directory
LOC_CHECK_LIB_PATH(odbc,ODBC,ODBCLIB)
LOC_CHECK_LIBS(odbc,SQLConnect,ODBC,$ODBCLIB,ODBCLIB,$ICONVLIB,,[
LOC_CHECK_LIBS(iodbc,SQLConnect,ODBC,$ODBCLIB,ODBCLIB,,,[
ac_save_cflags="$CFLAGS"
CFLAGS="$CFLAGS $ODBCINC"
LOC_CHECK_LINK(odbc32,[#include <windows.h>
#include <sql.h>],[SQLAllocEnv((SQLHENV *)0);],ODBC,$ODBCLIB,ODBCLIB)
CFLAGS="${ac_save_cflags}"
])
])
fi # $USE_ODBC
AC_SUBST(ODBCINC)
AC_SUBST(ODBCLIB)
# Done checking ODBC
# Enable FFTW option
LOC_CHECK_USE(fftw,FFTW,USE_FFTW)
FFTWINC=
FFTWLIB=
if test -n "$USE_FFTW"; then
# With FFTW includes directory
LOC_CHECK_INC_PATH(fftw,FFTW,FFTWINC)
LOC_CHECK_INCLUDES(fftw3.h,FFTW,$FFTWINC,[
LOC_CHECK_INCLUDES(fftw.h,FFTW,,[
LOC_CHECK_INCLUDES(dfftw.h,FFTW,,)
])
])
# With FFTW library directory
LOC_CHECK_LIB_PATH(fftw,FFTW,FFTWLIB)
LOC_CHECK_LIBS(fftw3, fftw_execute,FFTW,$FFTWLIB,FFTWLIB,,$MATHLIB,[
LOC_CHECK_LIBS(fftw, fftwnd_one,FFTW,$FFTWLIB,FFTWLIB,,$MATHLIB,[
LOC_CHECK_LIBS(dfftw,fftwnd_one,FFTW,$FFTWLIB,FFTWLIB,,$MATHLIB,)
])
])
fi # $USE_FFTW
AC_SUBST(FFTWINC)
AC_SUBST(FFTWLIB)
# Done checking FFTW
# Enable BLAS option
LOC_CHECK_USE(blas,BLAS,USE_BLAS)
BLASLIB=
BLASINC=
if test -n "$USE_BLAS"; then
# With BLAS includes directory
# BLAS doesn't have includes (FORTRAN library)
# With BLAS library directory
LOC_CHECK_INC_PATH(blas, BLAS, BLASINC)
LOC_CHECK_LIB_PATH(blas, BLAS, BLASLIB)
# See if cblas.h exists (CBLAS,ATLAS,others)
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$BLASINC $CPPFLAGS"
AC_CHECK_HEADERS(cblas.h)
CPPFLAGS="$save_CPPFLAGS"
LOC_CHECK_LIBS(blas,dnrm2_,BLAS,$BLASLIB,BLASLIB,$MATHLIB,,,-lg2c)
blas_ok=no
# Check for ATLAS
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$BLASLIB $LDFLAGS"
AC_CHECK_LIB(atlas, ATL_xerbla,
[AC_CHECK_LIB(f77blas, sgemm_,
[AC_CHECK_LIB(cblas, cblas_dgemm,
[blas_ok=yes; BLASLIB="-lcblas -lf77blas -latlas"],
[],[-lf77blas -latlas])],
[],[-latlas])]
)
LDFLAGS="$save_LDFLAGS"
# Do we have ATLAS?
if test $blas_ok = yes; then
AC_DEFINE(HAVE_LIBATLAS)
fi
# BLAS in Apple vecLib framework? (Mac OS-X)
# not dependent on APP build
#if test -n "$MACOSX_APP"; then
if test $blas_ok = no; then
vlib_flags="-framework vecLib"
save_LIBS="$LIBS"
LIBS="$vlib_flags $LIBS"
AC_MSG_CHECKING([for sgemm in $vlib_flags])
AC_TRY_LINK([], [sgemm], [blas_ok=yes; BLASLIB="$vlib_flags"], [BLASLIB=""])
AC_MSG_RESULT($blas_ok)
LIBS="$save_LIBS"
fi
#fi # $MACOSX_APP
# BLAS in PhiPACK libraries? (requires generic BLAS, too)
if test $blas_ok = no; then
AC_CHECK_LIB(blas, sgemm_,
[AC_CHECK_LIB(dgemm, dgemm_,
[AC_CHECK_LIB(sgemm, sgemm_,
[blas_ok=yes; BLASLIB="-lsgemm -ldgemm -lblas"],
[], [-lblas])],
[], [-lblas])]
)
fi
# BLAS in Sun Performance library?
if test $blas_ok = no; then
if test "x$GCC" != xyes; then # only works with Sun CC
AC_CHECK_LIB(sunmath, acosp,
[AC_CHECK_LIB(sunperf, sgemm_,
[blas_ok=yes; BLASLIB="-xlic_lib=sunperf -lsunmath"],
[], [-lsunmath])]
)
fi
fi
# Generic BLAS library
if test $blas_ok = no; then
AC_CHECK_LIB(blas, sgemm_, [blas_ok=yes; BLASLIB="-lblas"])
fi
if test $blas_ok = yes; then
AC_DEFINE(HAVE_LIBBLAS)
fi
fi # $USE_BLAS
AC_SUBST(BLASLIB)
AC_SUBST(BLASINC)
# Done checking BLAS
# Enable LAPACK option
LOC_CHECK_USE(lapack,LAPACK,USE_LAPACK)
LAPACKLIB=
LAPACKINC=
# LAPACK is useless without BLAS
if test -n "$USE_BLAS"; then
if test -n "$USE_LAPACK"; then
# With LAPACK includes directory
# LAPACK doesn't have includes (FORTRAN library)
# With LAPACK library directory
lapack_ok=no
LOC_CHECK_INC_PATH(lapack, LAPACK, LAPACKINC)
LOC_CHECK_LIB_PATH(lapack, LAPACK, LAPACKLIB)
# See if clapack.h exists (ATLAS)
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$LAPACKINC $CPPFLAGS"
AC_CHECK_HEADERS(clapack.h)
CPPFLAGS="$save_CPPFLAGS"
# LAPACK linked to by default?
if test lapack_ok=no; then
save_LIBS="$LIBS"; LIBS="$LIBS $BLASLIB $MATHLIB $FLIBS"
save_LDFLAGS="$LDFLAGS"; LDFLAGS="$LAPACKLIB $LDFLAGS"
AC_CHECK_FUNC(dsegv_, [lapack_ok=yes])
LIBS="$save_LIBS"
LDFLAGS="$save_LDFLAGS"
fi
# Generic LAPACK library?
if test $lapack_ok = no; then
save_libs="$LIBS"; LIBS="$BLASLIB $MATHLIB $LIBS"
save_LDFLAGS="$LDFLAGS"; LDFLAGS="$LAPACKLIB $LDFLAGS"
AC_CHECK_LIB(lapack, desgv_,
[lapack_ok=yes; LAPACKLIB="-llapack"], [], [$FLIBS])
LIBS="$save_LIBS"
LDFLAGS="$save_LDFLAGS"
fi
if test $lapack_ok = no; then
LOC_CHECK_LIBS(lapack,dgesv_,LAPACK,$LAPACKLIB,LAPACKLIB,$BLASLIB $MATHLIB,,,-lg2c)
fi
AC_DEFINE(HAVE_LIBLAPACK)
fi # $USE_LAPACK
fi # $USE_BLAS
AC_SUBST(LAPACKLIB)
AC_SUBST(LAPACKINC)
# Done checking LAPACK
# Enable Cairo display driver option
LOC_CHECK_USE(cairo,Cairo,USE_CAIRO)
CAIROINC=
CAIROLIB=
if test -n "$USE_CAIRO"; then
cairo="cairo"
pkgs="cairo-ft cairo-fc cairo-pdf cairo-ps cairo-svg fontconfig"
if test -n "$USE_X11"; then
pkgs="$pkgs cairo-xlib cairo-xlib-xrender"
fi
for pkg in $pkgs ; do
if pkg-config --exists $pkg ; then
cairo="$cairo $pkg"
fi
done
# With Cairo includes directory
#FIXME: somehow quote dirs with spaces in $cairo ?
CAIROINC=`pkg-config --cflags $cairo`
LOC_CHECK_INC_PATH(cairo,cairo,CAIROINC)
LOC_CHECK_INCLUDES(cairo.h,Cairo,$CAIROINC)
# With Cairo library directory
CAIROLIB=`pkg-config --libs $cairo`
LOC_CHECK_LIB_PATH(cairo,cairo,CAIROLIB)
LOC_CHECK_LDFLAGS(cairo,cairo,CAIROLIB)
LOC_CHECK_FUNC(cairo_create,,,,,$CAIROLIB,[:])
LOC_CHECK_FUNC(cairo_xlib_surface_create_with_xrender_format,,,,,$CAIROLIB,
[CAIRO_HAS_XRENDER=1],[CAIRO_HAS_XRENDER=])
AC_SUBST(CAIRO_HAS_XRENDER)
LOC_CHECK_FUNC(cairo_xlib_surface_get_xrender_format,,,,,$CAIROLIB,
[CAIRO_HAS_XRENDER_SURFACE=1],[CAIRO_HAS_XRENDER_SURFACE=])
AC_SUBST(CAIRO_HAS_XRENDER_SURFACE)
CAIROLIB="$CAIROLIB $CAIROLDFLAGS"
fi # $USE_CAIRO
AC_SUBST(CAIROINC)
AC_SUBST(CAIROLIB)
AC_SUBST(USE_CAIRO)
# Done checking Cairo
# Enable FreeType option
LOC_CHECK_USE(freetype,FreeType,USE_FREETYPE)
FTINC=
FTLIB=
if test -n "$USE_FREETYPE"; then
# With FreeType includes directory
LOC_CHECK_INC_PATH(freetype,FreeType,FTINC)
LOC_CHECK_INCLUDES(ft2build.h,FreeType,$FTINC)
# With FreeType library directory
LOC_CHECK_LIB_PATH(freetype,FreeType,FTLIB)
LOC_CHECK_LIBS(freetype,FT_Init_FreeType,FreeType,$FTLIB,FTLIB,,,)
fi # $USE_FREETYPE
AC_SUBST(FTINC)
AC_SUBST(FTLIB)
# Done checking FreeType
# Enable NLS option
LOC_CHECK_USE(nls,NLS,USE_NLS)
INTLLIB=
HAVE_NLS=
if test -n "${USE_NLS}" ; then
AC_DEFINE(USE_NLS)
AC_CHECK_FUNC(gettext, INTLLIB=, [
AC_CHECK_LIB(intl, gettext, INTLLIB=-lintl, [
AC_MSG_ERROR([*** Unable to locate gettext() function.])
])])
HAVE_NLS=1
fi
AC_SUBST(INTLLIB)
AC_SUBST(HAVE_NLS)
# Enable C++ option
LOC_CHECK_USE(cxx,C++,USE_CXX)
if test -n "$USE_CXX"; then
AC_PROG_CXX
else
CXX=
CXXFLAGS=
AC_SUBST(CXX)
AC_SUBST(CXXFLAGS)
fi
# Done checking C++
# Enable openDWG option
LOC_CHECK_USE(opendwg,openDWG,USE_OPENDWG)
OPENDWGINCPATH=
OPENDWGLIBPATH=
OPENDWGLIB=
if test -n "${USE_OPENDWG}"; then
# With OPENDWG includes directory
LOC_CHECK_INC_PATH(opendwg,openDGW,OPENDWGINCPATH)
LOC_CHECK_INCLUDES(ad2.h,openDWG,$OPENDWGINCPATH)
# With OPENDWG library directory
LOC_CHECK_LIB_PATH(opendwg,openDWG,OPENDWGLIBPATH)
#search for ad2.a, ad3.a ... in openDWG toolkit directory:
#FIX ME how to program this test??
#LOC_CHECK_LIBS(ad?.a,adSeekLayer,openDWG,$OPENDWGLIBPATH,OPENDWGLIB,,)
#
#for now hack (but working):
TRUEOPENDWGLIBPATH=`echo "$OPENDWGLIBPATH" | cut -b3-`
adlib=`ls -1 "$TRUEOPENDWGLIBPATH"/ad?.a | tail -1`
OPENDWGLIB="$adlib"
fi # $USE_OPENDWG
AC_SUBST(OPENDWGINCPATH)
AC_SUBST(OPENDWGLIBPATH)
AC_SUBST(OPENDWGLIB)
AC_SUBST(USE_OPENDWG)
# Done checking OPENDWG
# Enable pthread option
LOC_CHECK_USE(pthread,POSIX threads,USE_PTHREAD)
PTHREADINCPATH=
PTHREADLIBPATH=
PTHREADLIB=
if test -n "$USE_PTHREAD"; then
# With pthread includes directory
LOC_CHECK_INC_PATH(pthread,POSIX threads,PTHREADINCPATH)
LOC_CHECK_INCLUDES(pthread.h,POSIX threads,$PTHREADINCPATH)
# With pthread library directory
LOC_CHECK_LIB_PATH(pthread,POSIX threads,PTHREADLIBPATH)
LOC_CHECK_FUNC(pthread_create,POSIX threads functions,PTHREADLIB,,,,,[
LOC_CHECK_LIBS(pthread,pthread_create,POSIX threads,$PTHREADLIBPATH,PTHREADLIB,,,)
])
fi # $USE_PTHREAD
AC_SUBST(PTHREADINCPATH)
AC_SUBST(PTHREADLIBPATH)
AC_SUBST(PTHREADLIB)
AC_SUBST(USE_PTHREAD)
# Done checking pthread
# Enable OpenMP option
LOC_CHECK_USE(openmp,OpenMP,USE_OPENMP)
OMPINCPATH=
OMPLIBPATH=
OMPLIB=
OMPCFLAGS=
if test -n "$USE_OPENMP"; then
# With OpenMP includes directory
LOC_CHECK_INC_PATH(openmp,OpenMP,OMPINCPATH)
LOC_CHECK_INCLUDES(omp.h,OpenMP,$OMPINCPATH)
# With OpenMP library directory
# GCC et al.: -lgomp
# Solaris cc: -lmtsk
# AIX xlc: -lxlsmp
# SGI IRIX 6.5 MIPSpro C/C++: -lmp
LOC_CHECK_LIB_PATH(openmp,OpenMP,OMPLIBPATH)
LOC_CHECK_FUNC(GOMP_parallel_start,OpenMP functions,OMPLIB,,,,,[
LOC_CHECK_LIBS(gomp,GOMP_parallel_start,OpenMP,$OMPLIBPATH,OMPLIB,,,)
])
# compiler dependent
#if test ${CC} = "gcc" ; then
if test x$GCC = xyes ; then
# GNU C compiler (>= 4.2.1)
OMPCFLAGS=-fopenmp
elif test ${CC} = "icc" ; then
# Intel compiler
OMPCFLAGS=-openmp
elif test ${CC} = "opencc" ; then
# AMD's x86 Open64 compiler
OMPCFLAGS=-mp
elif test ${CC} = "pgcc" ; then
# Portland Group's compiler
OMPCFLAGS=-mp
# ... anybody else?
fi
# try to build a test program with "$CC $OMPCLFAGS" to confirm it works
#...how?
#echo "int main() {return 0;}" > test.c
#$CC $OMPCLFAGS test.c -o test
fi # $USE_OPENMP
AC_SUBST(OMPINCPATH)
AC_SUBST(OMPLIBPATH)
AC_SUBST(OMPLIB)
AC_SUBST(OMPCFLAGS)
AC_SUBST(USE_OPENMP)
# Done checking OpenMP
# Enable OpenCL option
LOC_CHECK_USE(opencl,OpenCL,USE_OPENCL)
OCLINCPATH=
OCLLIBPATH=
OCLLIB=
if test -n "$USE_OPENCL"; then
# With OpenCL includes directory
LOC_CHECK_INC_PATH(opencl,OpenCL,OCLINCPATH)
if test -n "$MACOSX_APP" ; then
LOC_CHECK_INCLUDES(OpenCL/opencl.h,OpenCL,$OCLINCPATH)
# With OpenCL library directory
### FIXME: ###
#LOC_CHECK_FRAMEWORK_PATH(opencl,OpenCL,OPENCLPATH)
# last term in following would become ',$OPENCLPATH)' if above is uncommented
LOC_CHECK_FUNC(clGetPlatformInfo,OpenCL library,OCLLIB,-framework OpenCL,)
else
LOC_CHECK_INCLUDES(CL/cl.h,OpenCL,$OCLINCPATH)
# With OpenCL library directory
LOC_CHECK_LIB_PATH(opencl,OpenCL,OCLLIBPATH)
LOC_CHECK_LIBS(OpenCL,clGetPlatformInfo,OpenCL,$OCLLIBPATH,OCLLIB,,,)
# expanded symbol check: yes? no?
#LOC_CHECK_FUNC(clGetPlatformInfo,OpenCL functions,OCLLIB,,,,,[
#LOC_CHECK_LIBS(OpenCL,clGetPlatformInfo,OpenCL,$OCLLIBPATH,OCLLIB,,,)
#])
fi
fi # $USE_OPENCL
AC_SUBST(OCLINCPATH)
AC_SUBST(OCLLIBPATH)
AC_SUBST(OCLLIB)
AC_SUBST(USE_OPENCL)
# Done checking OpenCL
# Enable LFS (from cdr-tools, tar, and autoconf 2.68)
dnl Check for large file support
dnl Do this last to make sure that no large file definition
dnl in confdefs.h will modify our results
AC_SYS_LARGEFILE
ac_save_cflags=${CFLAGS}
CFLAGS="$LFS_CFLAGS ${ac_save_cflags}"
dnl Warning do not run this test. it interferes with the test
dnl AC_CHECK_FUNCS(fseeko ftello) from above.
dnl The test AC_HAVE_LARGEFILES will check whether ftello/fseeko
dnl are available in Large File mode
AC_FUNC_FSEEKO
AC_HAVE_LARGEFILES
CFLAGS=${ac_save_cflags}
# Done large file support
USE_TERMIO=
AC_SUBST(USE_TERMIO)
STRIPFLAG=
AC_SUBST(STRIPFLAG)
GRASS_HOME="${DSTDIR}"
AC_SUBST(GRASS_HOME)
AC_OUTPUT(include/Make/Platform.make include/Make/Doxyfile_arch_html include/Make/Doxyfile_arch_latex include/version.h grass.pc)
LOC_MSG([Copying config.status to config.status.${ARCH}])
cp -f config.status config.status.${ARCH}
# Display configuration status
LOC_MSG()
LOC_MSG([GRASS is now configured for: ${host}])
LOC_MSG()
LOC_MSG([ Source directory: ${SRCDIR}])
LOC_MSG([ Build directory: ${DSTDIR}])
LOC_MSG([ Installation directory: ${INSTDIR}])
LOC_MSG([ Startup script in directory:${bindir}])
LOC_MSG([ C compiler: ${CC} ${CFLAGS}])
LOC_MSG([ C++ compiler: ${CXX} ${CXXFLAGS}])
LOC_MSG([ Building shared libraries: ${shared_ok}])
LOC_MSG([ OpenGL platform: ${OPENGL_TYPE}])
LOC_MSG()
LOC_MSG_USE(MacOSX application,MACOSX_APP)
LOC_MSG([ MacOSX architectures: ${MACOSX_ARCHS}])
LOC_MSG([ MacOSX SDK: ${MACOSX_SDK}])
LOC_MSG()
LOC_MSG_USE(BLAS support,USE_BLAS)
LOC_MSG_USE(BZIP2 support,USE_BZIP2)
LOC_MSG_USE(C++ support,USE_CXX)
LOC_MSG_USE(Cairo support,USE_CAIRO)
LOC_MSG_USE(DWG support,USE_OPENDWG)
LOC_MSG_USE(FFTW support,USE_FFTW)
LOC_MSG_USE(FreeType support,USE_FREETYPE)
LOC_MSG_USE(GDAL support,USE_GDAL)
LOC_MSG_USE(GEOS support,USE_GEOS)
LOC_MSG_USE(LAPACK support,USE_LAPACK)
LOC_MSG_USE(Large File support (LFS), USE_LARGEFILES)
LOC_MSG_USE(libLAS support,USE_LIBLAS)
LOC_MSG_USE(MySQL support,USE_MYSQL)
LOC_MSG_USE(NetCDF support,USE_NETCDF)
LOC_MSG_USE(NLS support,USE_NLS)
LOC_MSG_USE(ODBC support,USE_ODBC)
LOC_MSG_USE(OGR support,USE_OGR)
LOC_MSG_USE(OpenCL support,USE_OPENCL)
LOC_MSG_USE(OpenGL support,USE_OPENGL)
LOC_MSG_USE(OpenMP support,USE_OPENMP)
LOC_MSG_USE(PDAL support,USE_PDAL)
LOC_MSG_USE(PNG support,USE_PNG)
LOC_MSG_USE(POSIX thread support,USE_PTHREAD)
LOC_MSG_USE(PostgreSQL support,USE_POSTGRES)
LOC_MSG_USE(Readline support,USE_READLINE)
LOC_MSG_USE(Regex support,USE_REGEX)
LOC_MSG_USE(SQLite support,USE_SQLITE)
LOC_MSG_USE(TIFF support,USE_TIFF)
LOC_MSG_USE(X11 support,USE_X11)
LOC_MSG()