############################################################################# # # $Id$ # # 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 - neteler@geog.uni-hannover.de # 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 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/manual/autoconf/html_mono/autoconf.html ############################################################################# AC_INIT(README) AC_PREFIX_DEFAULT(/usr/local) AC_CONFIG_HEADER(src/include/config.h) AC_CANONICAL_HOST AC_PROG_CC AC_MSG_CHECKING(whether ld -s works) STRIPFLAG= ac_save_ldflags=${LDFLAGS} LDFLAGS=-s AC_TRY_LINK(,,STRIPFLAG=-s; AC_MSG_RESULT(yes),AC_MSG_RESULT(no)) LDFLAGS=${ac_save_ldflags} AC_SUBST(STRIPFLAG) # Put this early on so CPPFLAGS and LDFLAGS have any additional dirs AC_ARG_WITH(includes, [ --with-includes=DIR site header files in DIR], [ case "$withval" in "" | y | ye | yes | n | no) AC_MSG_ERROR([*** You must supply an argument to the --with-includes option.]) ;; esac INC_DIRS="$withval" ]) # For SGI's add /usr/freeware/include if test "$host_vendor" = "sgi" ; then INC_DIRS="$INC_DIRS /usr/freeware/include" fi if test "$INC_DIRS"; then for dir in $INC_DIRS; do if test -d "$dir"; then INCLUDE_DIRS="$INCLUDE_DIRS -I$dir" else AC_MSG_WARN([*** Include directory $dir does not exist.]) fi done AC_MSG_CHECKING(additional include dirs) AC_MSG_RESULT($INCLUDE_DIRS) CPPFLAGS="$CPPFLAGS $INCLUDE_DIRS" fi AC_SUBST(INCLUDE_DIRS) AC_ARG_WITH(libs, [ --with-libs=DIR also search for libraries in DIR], [ case "$withval" in "" | y | ye | yes | n | no) AC_MSG_ERROR([*** You must supply an argument to the --with-libs option.]) ;; esac LIB_DIRS="$withval" ]) # For SGI's add /usr/lib32 and /usr/freeware/lib32 if test "$host_vendor" = "sgi" ; then LIB_DIRS="$LIB_DIRS /usr/freeware/lib32 /usr/lib32" fi if test "$LIB_DIRS"; then for dir in $LIB_DIRS; do if test -d "$dir"; then LIBRARY_DIRS="$LIBRARY_DIRS -L$dir" else AC_MSG_WARN([*** Library directory $dir does not exist.]) fi done AC_MSG_CHECKING(additional library dirs) AC_MSG_RESULT($LIBRARY_DIRS) LDFLAGS="$LDFLAGS $LIBRARY_DIRS" fi AC_SUBST(LIBRARY_DIRS) AC_PROG_INSTALL AC_PROG_LEX if test "$LEX" != "flex"; then AC_MSG_WARN(Consider installation of flex (replacement of lex).) else if test "$LEX" != "flex"; then echo "checking for lex... flex" fi fi AC_SUBST(LEX) AC_PROG_YACC if test "$YACC" != "bison -y"; then if test "$YACC" != "byacc" && test "$YACC" != "yacc"; then AC_MSG_WARN(You will need bison/yacc as required for various GRASS modules.) else if test "$YACC" != "byacc"; then echo "checking for yacc... yacc" fi fi fi AC_SUBST(YACC) AC_PROG_RANLIB AC_CHECK_PROGS(ENV, env) AC_CHECK_PROGS(F77, g77 f77) AC_PATH_XTRA AC_HEADER_STDC AC_CHECK_HEADERS(curses.h limits.h termio.h termios.h unistd.h values.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_HEADER_TIME AC_TYPE_OFF_T AC_TYPE_UID_T AC_TYPE_SIGNAL AC_CYGWIN AC_PATH_PROG(PERL, perl, no) AC_SUBST(PERL) AC_MSG_CHECKING(curses.h WINDOW structure component) CURSES_MAXY=NONE AC_TRY_COMPILE([ #include WINDOW w; ],[w.maxy = 0;], CURSES_MAXY=maxy) AC_TRY_COMPILE([ #include WINDOW w; ],[w._maxy = 0;], CURSES_MAXY=_maxy) AC_DEFINE_UNQUOTED(CURSES_MAXY,$CURSES_MAXY) AC_SUBST(CURSES_MAXY) AC_MSG_RESULT($CURSES_MAXY) AC_CHECK_FUNCS(ftime gethostname gettimeofday lseek nice time uname) AC_CHECK_FUNCS(seteuid setpriority setreuid setruid) AC_FUNC_SETPGRP CURSESLIB= if test -z "${CURSESLIB}"; then AC_CHECK_LIB(ncurses, initscr, CURSESLIB=-lncurses) fi if test -z "${CURSESLIB}"; then AC_CHECK_LIB(curses, initscr, CURSESLIB=-lcurses) fi AC_SUBST(CURSESLIB) COMPATLIB= if test -z "${COMPATLIB}"; then AC_CHECK_LIB(compat, gtty, COMPATLIB=-lcompat) fi AC_SUBST(COMPATLIB) TERMLIB= if test -z "${TERMLIB}"; then AC_CHECK_LIB(termlib, tgetent, TERMLIB=-ltermlib) fi AC_SUBST(TERMLIB) XDRLIB= if test -z "${XDRLIB}"; then AC_CHECK_LIB(sun, xdrmem_create, XDRLIB=-lsun) fi if test -z "${XDRLIB}"; then AC_CHECK_LIB(nsl, xdrmem_create, XDRLIB=-lnsl) fi if test -z "${XDRLIB}"; then AC_CHECK_LIB(rpclib, xdrmem_create, XDRLIB=-lrpclib) fi # IRIX and glibc2.2 have this in C lib as well, so check if test "${XDRLIB}"; then AC_CHECK_LIB(c, xdrmem_create, XDRLIB="") fi AC_SUBST(XDRLIB) # Test if mathlib needs -lm flag or is included with libc MATHLIB="-lm" AC_CHECK_LIB(c, atan, MATHLIB="") if test "$MATHLIB"; then AC_CHECK_LIB(m, atan, MATHLIB=-lm, MATHLIB="") if test -z "$MATHLIB"; then AC_MSG_WARN([*** Failed check for math library.]) fi fi AC_SUBST(MATHLIB) # Handle this the same BINDIR=/usr/local/bin #if test -z "${exec_prefix}" || test "${exec_prefix}" = "NONE"; then #exec_prefix="/usr/local" #fi if test "${bindir}"; then BINDIR="${bindir}" fi AC_SUBST(BINDIR) DLLIB= AC_CHECK_LIB(dl, dlsym, DLLIB=-ldl) AC_SUBST(DLLIB) # Some search directories to use as the base for other searches when not specified my_inc_dirs="/usr/include /usr/local/include /usr/X11R6/include /opt/include /usr/freeware/include /usr/X11r6/include" my_lib_dirs="/usr/lib /usr/local/lib /usr/X11R6/lib /opt/lib /usr/freeware/lib /usr/X11r6/lib" ZLIB= # With zlib includes directory: AC_MSG_CHECKING(for location of zlib includes) AC_ARG_WITH(zlib-includes, [ --with-zlib-includes=DIR Specify includes directory for zlib], [ case "$withval" in "" | "y" | "ye" | "yes" | "n" | "no") AC_MSG_ERROR([*** You must supply a directory to --with-zlib-includes.]) ;; esac zlib_inc_dirs="$withval" ]) ZLIBINCPATH= if test "$zlib_inc_dirs"; then for dir in $zlib_inc_dirs; do # if test -d "$dir" && test -f "$dir/zlib.h"; then if test -d "$dir"; then ZLIBINCPATH="$ZLIBINCPATH -I${dir}" else AC_MSG_WARN([*** zlib includes directory $dir does not exist.]) fi done else for dir in $my_inc_dirs; do if test -d "$dir" && test -f "$dir/zlib.h"; then ZLIBINCPATH="$ZLIBINCPATH -I$dir" break fi done fi AC_MSG_RESULT($ZLIBINCPATH) AC_SUBST(ZLIBINCPATH) ac_save_cppflags="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $ZLIBINCPATH" AC_CHECK_HEADERS(zlib.h) CPPFLAGS=${ac_save_cppflags} # With zlib library directory: AC_MSG_CHECKING(for location of zlib lib) AC_ARG_WITH(zlib-libs, [ --with-zlib-libs=DIR Specify library directory for zlib], [ case "$withval" in "" | "y" | "ye" | "yes" | "n" | "no") AC_MSG_ERROR([*** You must supply a directory to --with-zlib-libs.]) ;; esac zlib_dirs="$withval" ]) ZLIBLIBPATH= if test "$zlib_dirs"; then for dir in $zlib_dirs; do # if test -d "$dir" && ( test -f "$dir/libz.a" || test -f "$dir/libz.so" ) ; then if test -d "$dir"; then ZLIBLIBPATH="$ZLIBLIBPATH -L${dir}" else AC_MSG_WARN([*** zlib lib directory $dir does not exist.]) fi done else for dir in $my_lib_dirs; do if test -d "$dir" && ( test -f "$dir/libz.a" || test -f "$dir/libz.so" ) ; then ZLIBLIBPATH="$ZLIBLIBPATH -L$dir" break fi done fi AC_MSG_RESULT($ZLIBLIBPATH) AC_SUBST(ZLIBLIBPATH) if test -z "$ZLIBINCPATH" || test -z "$ZLIBLIBPATH" ; then AC_MSG_ERROR([*** Could not find zlib library. This lib is required.]) fi if test -z "${ZLIB}"; then AC_CHECK_LIB(z, deflate, ZLIB=-lz) ZLIB=-lz fi AC_SUBST(ZLIB) # TIFF includes and library checks.... AC_ARG_WITH(tiff-includes, [ --with-tiff-includes=DIR site header files for TIFF in DIR], [ case "$withval" in "" | y | ye | yes | n | no) AC_MSG_ERROR([*** You must supply an argument to the --with-tiff-includes option.]) ;; esac tiff_inc_dirs="$withval" ]) TIFF_INCLUDE_DIRS= if test "$tiff_inc_dirs"; then for dir in $tiff_inc_dirs; do if test -d "$dir"; then TIFF_INCLUDE_DIRS="$TIFF_INCLUDE_DIRS -I$dir" else AC_MSG_WARN([*** TIFF include directory $dir does not exist.]) fi done AC_MSG_CHECKING(TIFF include dirs) AC_MSG_RESULT($TIFF_INCLUDE_DIRS) fi if test -z "$TIFF_INCLUDE_DIRS"; then AC_MSG_CHECKING(TIFF include dirs) for dir in $my_inc_dirs; do if test -z "$TIFF_INCLUDE_DIRS" && test -d "$dir" && test -f "$dir/tiffio.h"; then TIFF_INCLUDE_DIRS="-I$dir" break fi done AC_MSG_RESULT($TIFF_INCLUDE_DIRS) fi if test -z "$TIFF_INCLUDE_DIRS"; then AC_MSG_WARN([*** Could not find 'tiffio.h'.]) fi AC_SUBST(TIFF_INCLUDE_DIRS) AC_ARG_WITH(tiff-libs, [ --with-tiff-libs=DIR also search for TIFF libraries in DIR], [ case "$withval" in "" | y | ye | yes | n | no) AC_MSG_ERROR([*** You must supply an argument to the --with-tiff-libs option.]) ;; esac tiff_lib_dirs="$withval" ]) TIFF_LIBRARY_DIRS= if test "$tiff_lib_dirs"; then for dir in $tiff_lib_dirs; do if test -d "$dir"; then TIFF_LIBRARY_DIRS="$TIFF_LIBRARY_DIRS -L$dir" else AC_MSG_WARN([*** TIFF library directory $dir does not exist.]) fi done AC_MSG_CHECKING(additional TIFF library dirs) AC_MSG_RESULT($TIFF_LIBRARY_DIRS) fi if test -z "$TIFF_LIBRARY_DIRS"; then AC_MSG_CHECKING(TIFF library dirs) for dir in $my_lib_dirs; do if test -z "$TIFF_LIBRARY_DIRS" && test -d "$dir" && (test -f "$dir/libtiff.a" || test -f "$dir/libtiff.so"); then TIFF_LIBRARY_DIRS="-L$dir" break fi done AC_MSG_RESULT($TIFF_LIBRARY_DIRS) fi if test -z "$TIFF_LIBRARY_DIRS"; then AC_MSG_WARN([*** Could not find 'libtiff.a'.]) fi AC_SUBST(TIFF_LIBRARY_DIRS) ldflags_save="$LDFLAGS" LDFLAGS="$LDFLAGS $MATHLIB $TIFF_LIBRARY_DIRS" AC_CHECK_LIB(tiff, TIFFOpen, has_tiff_lib=1) LDFLAGS="$ldflags_save" if test -z "$has_tiff_lib"; then AC_MSG_WARN([*** Failed to find TIFF library]) fi AC_SUBST(TIFF_LIBRARY_DIRS) # TCL/TK includes and library tests... AC_ARG_WITH(tcltk-includes, [ --with-tcltk-includes=DIR site header files for Tcl and Tk in DIR], [ case "$withval" in "" | y | ye | yes | n | no) AC_MSG_ERROR([*** You must supply an argument to the --with-tcltk-includes option.]) ;; esac tclincdir="$withval" tkincdir="$withval" ]) tcltk_ver= TCLINCDIR= if test "$tclincdir" ; then for dir in $tclincdir; do if test -d "$dir"; then TCLINCDIR="$TCLINCDIR -I${dir}" if test -f "$dir/tcl.h"; then grep_cmd="grep TCL_VERSION ${dir}/tcl.h" tcltk_ver=`$grep_cmd | sed -e 's/^\(.*\)\"\(.*\)\"$/\2/'` fi else AC_MSG_WARN([*** Tcl include directory $dir does not exist.]) fi done AC_MSG_CHECKING(Tcl include dirs) AC_MSG_RESULT($TCLINCDIR) fi # NEEDS else check known places ... if test -z "$TCLINCDIR" ; then AC_MSG_CHECKING(Tcl include dirs) tk_try="tcl8.3 tcl8.2 tcl8.1 tcl8.0" for my_dir in $my_inc_dirs; do if test -z "$TCLINCDIR" && test -d $my_dir; then if test -z "$TCLINCDIR" && test -f "$my_dir/tcl.h"; then grep_cmd="grep TCL_VERSION ${my_dir}/tcl.h" tcltk_ver=`$grep_cmd | sed -e 's/^\(.*\)\"\(.*\)\"$/\2/'` TCLINCDIR="-I${my_dir}" fi for dir in $tk_try; do if test -z "$TCLINCDIR" && test -d "$my_dir/$dir" && test -f "$my_dir/$dir/tcl.h"; then grep_cmd="grep TCL_VERSION ${my_dir}/${dir}/tcl.h" tcltk_ver=`$grep_cmd | sed -e 's/^\(.*\)\"\(.*\)\"$/\2/'` TCLINCDIR="-I${my_dir}/${dir}" fi done fi done AC_MSG_RESULT($TCLINCDIR) fi if test -z "$TCLINCDIR" ; then AC_MSG_WARN([*** Did not find tcl.h, maybe okay...]) fi AC_SUBST(TCLINCDIR) TKINCDIR= if test $tkincdir ; then for dir in $tkincdir; do if test -d "${dir}"; then TKINCDIR="$TKINCDIR -I${dir}" if test -f "${dir}/tk.h"; then grep_cmd="grep TK_VERSION ${dir}/tk.h" tcltk_ver=`$grep_cmd | sed -e 's/^\(.*\)\"\(.*\)\"$/\2/'` fi else AC_MSG_WARN([*** Tk include directory $dir does not exist.]) fi done AC_MSG_CHECKING(Tk include dirs) AC_MSG_RESULT($TKINCDIR) fi if test -z "$TKINCDIR" ; then AC_MSG_CHECKING(Tk include dirs) tk_try="tk8.3 tk8.2 tk8.1 tk8.0" for my_dir in $my_inc_dirs; do if test -z "$TKINCDIR" && test -d $my_dir; then if test -z "$TKINCDIR" && test -f "$my_dir/tk.h"; then grep_cmd="grep TK_VERSION ${my_dir}/tk.h" tcltk_ver=`$grep_cmd | sed -e 's/^\(.*\)\"\(.*\)\"$/\2/'` TKINCDIR="-I${my_dir}" fi for dir in $tk_try; do if test -z "$TKINCDIR" && test -d "$my_dir/$dir" && test -f "$my_dir/$dir/tk.h"; then grep_cmd="grep TK_VERSION ${my_dir}/${dir}/tk.h" tcltk_ver=`$grep_cmd | sed -e 's/^\(.*\)\"\(.*\)\"$/\2/'` TKINCDIR="-I${my_dir}/${dir}" fi done fi done AC_MSG_RESULT($TKINCDIR) fi if test -z "$TKINCDIR" ; then AC_MSG_WARN([*** Did not find tk.h, maybe okay...]) fi AC_SUBST(TKINCDIR) # FreeBSD and CygWin don't have a "dot" between major/minor version number if test `uname -s` = FreeBSD || test "$CYGWIN"; then tcltk_ver=`echo $tcltk_ver | sed 's/\.//g'` fi AC_ARG_WITH(tcltk-libs, [ --with-tcltk-libs=DIR also search for Tcl and Tk libraries in DIR], [ case "$withval" in "" | y | ye | yes | n | no) AC_MSG_ERROR([*** You must supply an argument to the --with-tcltk-libs option.]) ;; esac tcltk_lib_dirs="$withval" ]) TCLTKLIBS= TCLTKLIBPATH= if test "$tcltk_lib_dirs"; then for dir in $tcltk_lib_dirs; do if test -d "$dir"; then TCLTKLIBPATH="$TCLTKLIBPATH -L${dir}" else AC_MSG_WARN([*** Tcl/Tk library directory $dir does not exist.]) fi done AC_MSG_CHECKING(additional Tcl and Tk library dirs) AC_MSG_RESULT($TCLTKLIBPATH) fi if test -z "$TCLTKLIBPATH"; then AC_MSG_CHECKING(Tcl/Tk library dirs) for dir in $my_lib_dirs; do if test -z "$TCLTKLIBPATH" && test -d "$dir" && ((test -f "$dir/libtcl$tcltk_ver.a" && test -f "$dir/libtk$tcltk_ver.a") || (test -f "$dir/libtcl$tcltk_ver.so" && test -f "$dir/libtk$tcltk_ver.so")) ; then TCLTKLIBPATH="-L$dir" break fi done AC_MSG_RESULT($TCLTKLIBPATH) fi if test -z "$TCLTKLIBPATH"; then AC_MSG_WARN([*** Could not find tcl/tk library.]) fi AC_SUBST(TCLTKLIBPATH) if test "$tcltk_ver"; then ac_save_ldflags="$LDFLAGS" LDFLAGS="$LDFLAGS $TCLTKLIBPATH $X_LIBS -lXt -ltcl$tcltk_ver" AC_CHECK_LIB("tk$tcltk_ver", Tk_MainWindow, has_tk_lib="1") if test "$has_tk_lib"; then TCLTKLIBS="$TCLTKLIBS -ltk$tcltk_ver -ltcl$tcltk_ver" else AC_MSG_WARN([*** Failed to find Tcl/Tk libraries]) fi LDFLAGS=${ac_save_ldflags} AC_SUBST(TCLTKLIBS) else AC_MSG_WARN([*** Unable to find Tcl/Tk libraries and headers]) fi AC_SUBST(TCLTKLIBPATH) SYSV= AC_ARG_WITH(SYSV, [ --with-SYSV define the compiler macro SYSV], [ case "$withval" in "" | y | ye | yes) SYSV=-DSYSV AC_MSG_CHECKING(for SYSV) AC_MSG_RESULT($SYSV) ;; n | no) SYSV= ;; *) AC_MSG_ERROR([*** Invalid argument $withval supplied to the --with-SYSV option.]) ;; esac ]) AC_SUBST(SYSV) USE_TERMIO= AC_ARG_WITH(USE_TERMIO, [ --with-USE_TERMIO define the compiler macro USE_TERMIO], [ case "$withval" in "" | y | ye | yes) USE_TERMIO=-DUSE_TERMIO AC_MSG_CHECKING(for USE_TERMIO) AC_MSG_RESULT($USE_TERMIO) ;; n | no) USE_TERMIO= ;; *) AC_MSG_ERROR([*** Invalid argument $withval supplied to the --with-USE_TERMIO option.]) ;; esac ]) AC_SUBST(USE_TERMIO) # Make sure this is set correctly SRCDIR=`pwd` AC_SUBST(SRCDIR) ARCH= if test -z "${host}"; then ARCH="unknown" else ARCH="${host}" fi AC_SUBST(ARCH) # Add VERSION, GISBASE, and GRASS_BIN VERSION=`cat ${SRCDIR}/src/CMD/VERSION | head -1` NAME_VER=`echo ${VERSION} | sed 's/\..*//'` GISBASE=${SRCDIR}/dist.${ARCH} GRASS_BIN=${SRCDIR}/bin.${ARCH} AC_SUBST(VERSION) AC_SUBST(NAME_VER) AC_SUBST(GISBASE) AC_SUBST(GRASS_BIN) # Enable PostgreSQL always ... USE_POSTGRES= AC_ARG_ENABLE(postgres, [ --enable-postgres=yes/no Support PostgreSQL functionality (default: yes)], [ case "$enableval" in "n" | "no") USE_POSTGRES= ;; *) USE_POSTGRES="1" ;; esac ], [ USE_POSTGRES="1" ] ) # With/Without PostgreSQL root: AC_ARG_WITH(postgres-root, [ --with-postgres-root=DIR Specify root directory for PostgreSQL], [ case "$withval" in "" | "y" | "ye" | "yes" | "n" | "no") AC_MSG_ERROR([*** You must supply a directory to --with-postgres-root.]) ;; esac pg_root="$withval" ]) # With Postgresql includes directory: AC_ARG_WITH(postgres-includes, [ --with-postgres-includes=DIR Specify includes directory for PostgreSQL], [ case "$withval" in "" | "y" | "ye" | "yes" | "n" | "no") AC_MSG_ERROR([*** You must supply a directory to --with-postgres-includes.]) ;; esac pg_includes="$withval" ]) # With Postgresql library directory: AC_ARG_WITH(postgres-libs, [ --with-postgres-libs=DIR Specify library directory for PostgreSQL], [ case "$withval" in "" | "y" | "ye" | "yes" | "n" | "no") AC_MSG_ERROR([*** You must supply a directory to --with-postgres-libs.]) ;; esac pg_libs="$withval" ]) # If a --with-postgres option was given, turn on enable-postgres if test "$pg_root" -o "$pg_includes" -o "$pg_libs"; then USE_POSTGRES="1" fi # Process PostgreSQL --with directives PQLIB= PQINCPATH= PQLIBPATH= if test "$pg_root"; then if test -z "$pg_includes"; then pg_includes="$pg_root/include" fi if test -z "$pg_libs"; then pg_libs="$pg_root/lib" fi fi if test "$pg_includes"; then AC_MSG_CHECKING(libpq-fe.h) for dir in $pg_includes; do if test -d "$dir" && test -f "$dir/libpq-fe.h"; then PQINCPATH="$PQINCPATH -I$dir" fi done AC_MSG_RESULT($PQINCPATH) fi if test "$pg_libs"; then AC_MSG_CHECKING(libpq path) for dir in $pg_libs; do if test -d "$dir"; then PQLIBPATH="$PQLIBPATH -L$dir" fi done AC_MSG_RESULT($PQLIBPATH) fi # If enabled but no paths given, look in our search paths if test -n "$USE_POSTGRES"; then if test -z "$PQINCPATH"; then my_pginc_path="/usr/include /usr/include/pgsql /usr/include/postgresql /usr/local/include /usr/local/pgsql/include /opt/pgsql/include" AC_MSG_CHECKING(libpq-fe.h) for dir in $my_pginc_path; do if test -d "$dir" && test -f "$dir/libpq-fe.h"; then PQINCPATH="$PQINCPATH -I$dir" break fi done AC_MSG_RESULT($PQINCPATH) if test -z "$PQINCPATH"; then AC_MSG_WARN([*** libpq-fe.h not found, but needed for PostgreSQL support]) fi fi if test -z "$PQLIBPATH"; then my_pglib_path="/usr/lib /usr/local/lib /usr/local/pgsql/lib /usr/lib/pgsql /usr/lib/postgres /opt/pgsql/lib" AC_MSG_CHECKING(libpq paths) for dir in $my_pglib_path; do if test -d "$dir" && ( test -f "$dir/libpq.a" || test -f "$dir/libpq.so" ) ; then PQLIBPATH="$PQLIBPATH -L$dir" break fi done AC_MSG_RESULT($PQLIBPATH) fi fi if test -n "$USE_POSTGRES"; then ac_save_ldflags=${LDFLAGS} LDFLAGS="$LDFLAGS $PQLIBPATH" AC_CHECK_LIB(pq,PQcmdTuples, [ AC_DEFINE(HAVE_PQCMDTUPLES) PQLIB=-lpq ]) LDFLAGS=${ac_save_ldflags} fi # Done with PostgreSQL AC_SUBST(PQINCPATH) AC_SUBST(PQLIBPATH) AC_SUBST(PQLIB) # OpenGL # Allow OpenGL to be disabled USE_OPENGL= AC_ARG_ENABLE(opengl, [ --enable-opengl=yes/no Enable or disable OpenGL programs (default: yes)], [ case "$enableval" in "n" | "no") USE_OPENGL= ;; *) USE_OPENGL="1" ;; esac ], [ USE_OPENGL="1" ] ) AC_ARG_WITH(opengl-includes, [ --with-opengl-includes=DIR Specify the directory for OpenGL (or Mesa) headers], [ case "$withval" in "" | "y" | "ye" | "yes" | "n" | "no") AC_MSG_ERROR([*** You must supply a directory to --with-opengl-includes.]) ;; esac opengl_includes="$withval" ]) AC_ARG_WITH(opengl-libs, [ --with-opengl-libs=DIR Specify the directory for OpenGL (or Mesa) libraries], [ case "$withval" in "" | "y" | "ye" | "yes" | "n" | "no") AC_MSG_ERROR([*** You must supply a directory to --with-opengl-libs.]) ;; esac opengl_libs="$withval" ]) if test -n "$opengl_libs" || test -n "opengl_includes" ; then if test -z "$USE_OPENGL"; then USE_OPENGL="1" fi fi OPENGLINC= OPENGLwINC= OPENGLLIB= OPENGLULIB= LGLWM= if test -z "$opengl_includes" && test -n "$USE_OPENGL"; then opengl_includes="/usr/include /usr/local/include \ /usr/include/Mesa /usr/local/include/Mesa \ /usr/local/Mesa/include /opt/include /opt/Mesa/include \ /usr/X11R6/include /usr/X11r6/include" fi if test -n "$opengl_includes"; then AC_MSG_CHECKING(GL/gl.h and GL/GLwMDrawA.h) for dir in $opengl_includes; do if test -d "$dir" && test -f "$dir/GL/gl.h"; then OPENGLINC="$OPENGLINC -I$dir" fi if test -d "$dir" && test -f "$dir/GL/GLwMDrawA.h"; then OPENGLwINC="$OPENGLwINC -I$dir" fi done if test -z "$OPENGLINC"; then AC_MSG_WARN([*** Did not find GL/gl.h]) fi if test -z "$OPENGLwINC"; then AC_MSG_WARN([*** Did not find GL/GLwMDrawA.h]) fi if test -n "$OPENGLINC" && test -n "$OPENGLwINC"; then AC_MSG_RESULT($OPENGLINC and $OPENGLwINC) elif test -n "$OPENGLINC"; then AC_MSG_RESULT($OPENGLINC) elif test -n "$OPENGLwINC"; then AC_MSG_RESULT($OPENGLwINC) fi fi if test -z "$opengl_libs" && test -n "$USE_OPENGL"; then opengl_libs="/usr/lib /usr/local/lib /usr/lib/X11 \ /usr/local/Mesa/lib /usr/X11R6/lib /usr/local/X11/lib \ /usr/local/X11R6/lib /usr/lib/Mesa /opt/lib /opt/Mesa \ /opt/Mesa/lib /usr/X11r6/lib" fi if test -n "$opengl_libs"; then for dir in $opengl_libs; do if test -d "$dir"; then OPENGLLIB="$OPENGLLIB -L$dir" fi done fi if test -n "$USE_OPENGL"; then ac_save_ldflags="$LDFLAGS" LDFLAGS="$LDFLAGS $MATHLIB $OPENGLLIB" AC_CHECK_LIB(GL,glBegin,OPENGLLIB="$OPENGLLIB -lGL") LDFLAGS=${ac_save_ldflags} ac_save_ldflags="$LDFLAGS" LDFLAGS="$LDFLAGS $MATHLIB $OPENGLLIB" AC_CHECK_LIB(GLU,gluBeginCurve, OPENGLULIB="-lGLU") LDFLAGS=${ac_save_ldflags} ac_save_ldflags="$LDFLAGS" LDFLAGS="$LDFLAGS $MATHLIB $OPENGLLIB $OPENGLULIB $X_LIBS -lXt -lXm" AC_CHECK_LIB(GLw,GLwDrawingAreaMakeCurrent,LGLWM=-lGLw) AC_CHECK_LIB(GLwM,GLwCreateMDrawingArea,LGLWM="$LGLWM -lGLwM") LDFLAGS=${ac_save_ldflags} fi AC_SUBST(OPENGLINC) AC_SUBST(OPENGLwINC) AC_SUBST(OPENGLLIB) AC_SUBST(OPENGLULIB) AC_SUBST(LGLWM) AC_SUBST(USE_OPENGL) #tests for Windows openGL: AC_SUBST(OPENGL32) #End of OpenGL tests # ODBC include paths.. ODBCINC= ODBCLIB= AC_ARG_WITH(odbc-includes, [ --with-odbc-includes=DIR Specify path for ODBC library headers], [ case "$withval" in "" | "y" | "ye" | "yes" | "n" | "no") AC_MSG_ERROR([*** You must supply a directory to --with-odbc-includes.]) ;; esac odbc_includes="$withval" ]) AC_ARG_WITH(odbc-libs, [ --with-odbc-libs=DIR Specify path for ODBC library], [ case "$withval" in "" | "y" | "ye" | "yes" | "n" | "no") AC_MSG_ERROR([*** You must supply a directory to --with-odbc-libs.]) ;; esac odbc_libs="$withval" ]) if test "$odbc_includes"; then for dir in $odbc_includes; do if test -d "$dir" && test -f "$dir/sql.h"; then ODBCINC="$ODBCINC -I$dir" fi done else for dir in $my_inc_dirs; do if test -d "$dir" && test -f "$dir/sql.h"; then ODBCINC="$ODBCINC -I$dir" break elif test -d "$dir/odbc" && test -f "$dir/odbc/sql.h"; then ODBCINC="$ODBCINC -I$dir/odbc" break fi done fi ac_save_cppflags="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $ODBCINC" AC_CHECK_HEADER(sql.h,HAVE_SQL_H=1 ,ODBCINC="") CPPFLAGS=${ac_save_cppflags} AC_MSG_CHECKING(for location of odbc lib) if test "$odbc_libs"; then for dir in $odbc_libs; do if test -d "$dir" && test -f "$dir/sql.h"; then ODBCLIB="$ODBCLIB -I$dir" fi done else for dir in $my_lib_dirs; do if test -d "$dir" && ( test -f "$dir/libodbc.a" || test -f "$dir/libodbc.so" ) ; then ODBCLIB="$ODBCLIB -L$dir" break elif test -d "$dir/odbc" && ( test -f "$dir/odbc/libodbc.a" || test -f "$dir/odbc/libodbc.so" ) ; then ODBCLIB="$ODBCLIB -L$dir/odbc" break fi done fi AC_MSG_RESULT($ODBCLIB) AC_SUBST(ODBCINC) AC_SUBST(ODBCLIB) # JPEG library checking # Function to test for jpeg_start_compress JPEGLIB= JPEGLIBPATH= JPEGINCPATH= AC_ARG_WITH(jpeg-includes, [ --with-jpeg-includes=DIR Specify directory for jpeg library headers], [ case "$withval" in "" | "y" | "ye" | "yes" | "n" | "no") AC_MSG_ERROR([*** you must supply a directory to --with-jpeg-includes.]) ;; esac jpeg_includes="$withval" ]) AC_ARG_WITH(jpeg-libs, [ --with-jpeg-libs=DIR Specify directory for jpeg library], [ case "$withval" in "" | "y" | "ye" | "yes" | "n" | "no") AC_MSG_ERROR([*** You must supply a directory to --with-jpeg-lib.]) ;; esac jpeg_libs="$withval" ]) if test "$jpeg_includes"; then for dir in $jpeg_includes; do if test -d "$dir"; then JPEGINCPATH="$JPEGINCPATH -I$dir" else AC_MSG_WARN([*** Directory $dir does not exist]) fi done else for dir in $my_inc_dirs; do if test -d "$dir" && test -f "$dir/jpeglib.h"; then JPEGINCPATH="$JPEGINCPATH -I$dir" break fi done fi if test "$jpeg_libs"; then for dir in $jpeg_libs ; do if test -d "$dir" ; then JPEGLIBPATH="$JPEGLIBPATH -L$dir" else AC_MSG_WARN([*** Directory $dir does not exist]) fi done else for dir in $my_lib_dirs; do if test -d "$dir" && test -f "$dir/libjpeg.a"; then JPEGLIBPATH="$JPEGLIBPATH -L$dir" break fi done fi ac_save_cppflags="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $JPEGINCPATH" AC_CHECK_HEADERS(jpeglib.h) CPPFLAGS=${ac_save_cppflags} ac_save_ldflags="$LDFLAGS" LDFLAGS="$LDFLAGS $JPEGLIBPATH" AC_CHECK_LIB(jpeg,jpeg_start_compress,JPEGLIB=-ljpeg) LDFLAGS=${ac_save_ldflags} AC_SUBST(JPEGLIB) AC_SUBST(JPEGLIBPATH) AC_SUBST(JPEGINCPATH) # Done with JPEG library XDRIVER=socket AC_ARG_WITH(fifo, [ --with-fifo use fifo XDriver instead of sockets], [ case "$withval" in "" | y | ye | yes) XDRIVER=fifo ;; esac ]) AC_ARG_WITH(socket, [ --with-socket use socket XDriver instead of fifo (default)], [ case "$withval" in "" | y | ye | yes) XDRIVER=socket ;; esac ]) if test "$XDRIVER" = "socket"; then AC_DEFINE(USE_G_SOCKS) fi AC_MSG_CHECKING(for XDriver) AC_MSG_RESULT($XDRIVER) AC_SUBST(XDRIVER) # for asian characters ASIAN_CHARS=no AC_ARG_WITH(asian-chars, [ --with-asian-chars use asian characters in v.digit or etc], [ case "$withval" in "" | y | ye | yes) ASIAN_CHARS=yes ;; esac ]) if test "$ASIAN_CHARS" = "yes"; then AC_DEFINE(ASIAN_CHARS) fi AC_MSG_CHECKING(for asian characters) AC_MSG_RESULT($ASIAN_CHARS) AC_SUBST(ASIAN_CHARS) # for two button mouse ANOTHER_BUTTON=no AC_ARG_WITH(another-button, [ --with-another-button use two button mouse conveniently], [ case "$withval" in "" | y | ye | yes) ANOTHER_BUTTON=yes ;; esac ]) if test "$ANOTHER_BUTTON" = "yes"; then AC_DEFINE(ANOTHER_BUTTON) fi AC_MSG_CHECKING(for another button) AC_MSG_RESULT($ANOTHER_BUTTON) AC_SUBST(ANOTHER_BUTTON) AC_OUTPUT(Makefile src/CMD/head/head)