Blame conf/acinclude.m4

Packit a4aae4
Packit a4aae4
# m4 macros from the Unidata netcdf 2.3.2 pl4 distribution. Modified for use
Packit a4aae4
# with GNU Autoconf 2.1. I renamed these from UC_* to DODS_* so that there
Packit a4aae4
# will not be confusion when porting future versions of netcdf into the DODS
Packit a4aae4
# source distribution. Unidata, Inc. wrote the text of these macros and holds
Packit a4aae4
# a copyright on them.
Packit a4aae4
#
Packit a4aae4
# jhrg 3/27/95
Packit a4aae4
#
Packit a4aae4
# Added some of my own macros (don't blame Unidata for them!) starting with
Packit a4aae4
# DODS_PROG_LEX and down in the file. jhrg 2/11/96
Packit a4aae4
#
Packit a4aae4
# I've added a table of contents for this file. jhrg 2/2/98
Packit a4aae4
# 
Packit a4aae4
# 1. Unidata-derived macros. 
Packit a4aae4
# 2. Macros for finding libraries used by the core software.
Packit a4aae4
# 3. Macros used to test things about the compiler
Packit a4aae4
# 4. Macros for locating various systems (Matlab, etc.)
Packit a4aae4
# 5. Macros used to test things about the computer/OS/hardware
Packit a4aae4
#
Packit a4aae4
# $Id$
Packit a4aae4
Packit a4aae4
# 1. Unidata's macros
Packit a4aae4
#-------------------------------------------------------------------------
Packit a4aae4
Packit a4aae4
# 2. Finding libraries 
Packit a4aae4
#
Packit a4aae4
# To use these in DODS software, in the Makefile.in use LIBS XTRALIBS for 
Packit a4aae4
# non-gui and LIBS GUILIBS XTRALIBS for the clients that link with the 
Packit a4aae4
# gui DAP++ library. These should be set by a line like LIBS=@LIBS@, etc.
Packit a4aae4
# Then the group should be used on the link line. 10/16/2000 jhrg
Packit a4aae4
#--------------------------------------------------------------------------
Packit a4aae4
Packit a4aae4
# Electric fence and dbnew are used to debug malloc/new and free/delete.
Packit a4aae4
# I assume that if you use these switches you know enough to build the 
Packit a4aae4
# libraries. 2/3/98 jhrg
Packit a4aae4
Packit a4aae4
AC_DEFUN([DODS_EFENCE], [dnl
Packit a4aae4
    AC_ARG_ENABLE(efence,
Packit a4aae4
		  [  --enable-efence         Runtime memory checks (malloc)],
Packit a4aae4
		  EFENCE=$enableval, EFENCE=no)
Packit a4aae4
Packit a4aae4
    case "$EFENCE" in
Packit a4aae4
    yes)
Packit a4aae4
      AC_MSG_RESULT(Configuring dynamic memory checks on malloc/free calls)
Packit a4aae4
      LIBS="$LIBS -lefence"
Packit a4aae4
      ;;
Packit a4aae4
    *)
Packit a4aae4
      ;;
Packit a4aae4
    esac])
Packit a4aae4
Packit a4aae4
AC_DEFUN([DODS_DBNEW], [dnl
Packit a4aae4
    AC_ARG_ENABLE(dbnew,
Packit a4aae4
	          [  --enable-dbnew          Runtime memory checks (new)],
Packit a4aae4
		  DBNEW=$enableval, DBNEW=no)
Packit a4aae4
Packit a4aae4
    case "$DBNEW" in
Packit a4aae4
    yes)
Packit a4aae4
      AC_MSG_RESULT(Configuring dynamic memory checks on new/delete calls)
Packit a4aae4
      AC_DEFINE(TRACE_NEW, , [Use the dbnew library to trace bew/delete calls])
Packit a4aae4
      LIBS="$LIBS -ldbnew"
Packit a4aae4
      ;;
Packit a4aae4
    *)
Packit a4aae4
      ;;
Packit a4aae4
    esac])
Packit a4aae4
Packit a4aae4
# check for hdf libraries
Packit a4aae4
# cross-compile problem with test option -d
Packit a4aae4
AC_DEFUN([DODS_HDF_LIBRARY], [dnl
Packit a4aae4
    AC_ARG_WITH(hdf,
Packit a4aae4
        [  --with-hdf=ARG          Where is the HDF library (directory)],
Packit a4aae4
        HDF_PATH=${withval}, HDF_PATH="$HDF_PATH")
Packit a4aae4
    if test ! -d "$HDF_PATH"
Packit a4aae4
    then
Packit a4aae4
        HDF_PATH="/usr/local/hdf"
Packit a4aae4
    fi
Packit a4aae4
    if test "$HDF_PATH"
Packit a4aae4
    then
Packit a4aae4
            LDFLAGS="$LDFLAGS -L${HDF_PATH}/lib"
Packit a4aae4
            INCS="$INCS -I${HDF_PATH}/include"
Packit a4aae4
            AC_SUBST(INCS)
Packit a4aae4
    fi
Packit a4aae4
Packit a4aae4
dnl None of this works with HDF 4.1 r1. jhrg 8/2/97
Packit a4aae4
Packit a4aae4
    AC_CHECK_LIB(z, deflate, LIBS="-lz $LIBS", nohdf=1)
Packit a4aae4
    AC_CHECK_LIB(jpeg, jpeg_start_compress, LIBS="-ljpeg $LIBS", nohdf=1)
Packit a4aae4
    AC_CHECK_LIB(df, Hopen, LIBS="-ldf $LIBS" , nohdf=1)
Packit a4aae4
    AC_CHECK_LIB(mfhdf, SDstart, LIBS="-lmfhdf $LIBS" , nohdf=1)])
Packit a4aae4
Packit a4aae4
# 3. Compiler test macros
Packit a4aae4
#--------------------------------------------------------------------------
Packit a4aae4
Packit a4aae4
AC_DEFUN([DODS_GCC_VERSION], [dnl
Packit a4aae4
    AC_MSG_CHECKING(for gcc/g++ 2.8 or greater)
Packit a4aae4
Packit a4aae4
    GCC_VER=`gcc -v 2>&1 | awk '/version/ {print}'`
Packit a4aae4
Packit a4aae4
    dnl We need the gcc version number as a number, without `.'s and limited
Packit a4aae4
    dnl to three digits. The old version below was replaced by Andy Jacobson's 
Packit a4aae4
    dnl patch which works with gcc 3, including the pre-release versions.
Packit a4aae4
Packit a4aae4
    dnl GCC_VER=`echo $GCC_VER | sed 's@[[a-z ]]*\([[0-9.]]\)@\1@'`
Packit a4aae4
    GCC_VER=`echo $GCC_VER | sed 's@.*gcc version \([[0-9\.]]*\).*@\1@'`
Packit a4aae4
Packit a4aae4
    case $GCC_VER in
Packit a4aae4
        *egcs*) AC_MSG_RESULT(Found egcs version ${GCC_VER}.) ;;
Packit a4aae4
	2.[[7-9]]*)   AC_MSG_RESULT(Found gcc/g++ version ${GCC_VER}) ;;
Packit a4aae4
	3.[[0-9]]*)   AC_MSG_RESULT(Found gcc/g++ version ${GCC_VER}) ;;
Packit a4aae4
        *)      AC_MSG_ERROR(must be at least version 2.7.x) ;;
Packit a4aae4
    esac])
Packit a4aae4
Packit a4aae4
# 4. Macros to locate various programs/systems used by parts of DODS
Packit a4aae4
#---------------------------------------------------------------------------
Packit a4aae4
Packit a4aae4
# Added by Ethan, 1999/06/21
Packit a4aae4
# Look for perl.
Packit a4aae4
# 
Packit a4aae4
# I modified the regexp below to remove any text that follows the version
Packit a4aae4
# number. This extra text was hosing the test. 7/15/99 jhrg
Packit a4aae4
Packit a4aae4
AC_DEFUN([DODS_PROG_PERL], [dnl
Packit a4aae4
    AC_CHECK_PROG(PERL, perl, `which perl`)
Packit a4aae4
    case "$PERL" in
Packit a4aae4
	*perl*)
Packit a4aae4
	    perl_ver=`$PERL -v 2>&1 | awk '/This is perl/ {print}'`
Packit a4aae4
	    perl_ver=`echo $perl_ver | sed 's/This is perl,[[^0-9]]*\([[0-9._]]*\).*/\1/'`
Packit a4aae4
            perl_ver_main=`echo $perl_ver | sed 's/\([[0-9]]*\).*/\1/'`
Packit a4aae4
	    if test -n "$perl_ver" && test $perl_ver_main -ge 5
Packit a4aae4
	    then
Packit a4aae4
		AC_MSG_RESULT(Found perl version ${perl_ver}.)
Packit a4aae4
	    else
Packit a4aae4
		AC_MSG_ERROR(perl version: found ${perl_ver} should be at least 5.000.)
Packit a4aae4
	    fi
Packit a4aae4
	    ;;
Packit a4aae4
	*)
Packit a4aae4
	    AC_MSG_WARN(perl is required.)
Packit a4aae4
	    ;;
Packit a4aae4
    esac
Packit a4aae4
Packit a4aae4
    AC_SUBST(PERL)])
Packit a4aae4
Packit a4aae4
# Added by Ethan, 1999/06/21
Packit a4aae4
# Look for GNU tar.
Packit a4aae4
# 
Packit a4aae4
# I modified the regexp below but it still does not work exactly correctly; 
Packit a4aae4
# the variable tar_ver should have only the version number in it. However,
Packit a4aae4
# my version (1.12) spits out a multi-line thing. The regexp below gets the
Packit a4aae4
# version number from the first line but does not remove the subsequent lines
Packit a4aae4
# of garbage. 7/15/99 jhrg
Packit a4aae4
# Added awk line to handle multiline output. 1999/07/22 erd
Packit a4aae4
Packit a4aae4
AC_DEFUN([DODS_PROG_GTAR], [dnl
Packit a4aae4
    AC_CHECK_PROGS(TAR,gtar tar,tar)
Packit a4aae4
    case "$TAR" in
Packit a4aae4
	*tar)
Packit a4aae4
	    tar_ver=`$TAR --version 2>&1 | awk '/G[[Nn]][[Uu]] tar/ {print}'`
Packit a4aae4
	    tar_ver=`echo $tar_ver | sed 's/.*GNU tar[[^0-9.]]*\([[0-9._]]*\)/\1/'`
Packit a4aae4
	    if test -n "$tar_ver"
Packit a4aae4
	    then
Packit a4aae4
		AC_MSG_RESULT(Found Gnu tar version ${tar_ver}.)
Packit a4aae4
	    else
Packit a4aae4
		AC_MSG_WARN(GNU tar is required for some Makefile targets.)
Packit a4aae4
	    fi
Packit a4aae4
	    ;;
Packit a4aae4
	*)
Packit a4aae4
	    AC_MSG_WARN(GNU tar is required for some Makefile targets.)
Packit a4aae4
	    ;;
Packit a4aae4
    esac
Packit a4aae4
Packit a4aae4
    AC_SUBST(TAR)])
Packit a4aae4
Packit a4aae4
# Find the matlab root directory
Packit a4aae4
# cross-compile problem with test option -d
Packit a4aae4
Packit a4aae4
AC_DEFUN([DODS_MATLAB], [dnl
Packit a4aae4
    AC_ARG_WITH(matlab,
Packit a4aae4
        [  --with-matlab=ARG       Where is the Matlab root directory],
Packit a4aae4
        MATLAB_ROOT=${withval}, MATLAB_ROOT="$MATLAB_ROOT")
Packit a4aae4
    if test "$MATLAB_ROOT" = no; then
Packit a4aae4
        MATLAB_ROOT="$MATLAB_ROOT"
Packit a4aae4
    elif test ! -d "$MATLAB_ROOT"
Packit a4aae4
    then
Packit a4aae4
        MATLAB_ROOT=""
Packit a4aae4
    fi
Packit a4aae4
    if test -z "$MATLAB_ROOT"
Packit a4aae4
    then
Packit a4aae4
        AC_MSG_CHECKING(for matlab root)
Packit a4aae4
Packit a4aae4
	MATLAB_ROOT=`mex -v 2>&1 | awk '/MATLAB *= / {print}'`
Packit a4aae4
	MATLAB_ROOT=`echo $MATLAB_ROOT | sed 's@[[^/]]*\(/.*\)@\1@'`
Packit a4aae4
Packit a4aae4
	if test -z "$MATLAB_ROOT"
Packit a4aae4
	then
Packit a4aae4
	    AC_MSG_ERROR(Matlab not found! Run configure --help)
Packit a4aae4
        else
Packit a4aae4
	    AC_SUBST(MATLAB_ROOT)
Packit a4aae4
	    AC_MSG_RESULT($MATLAB_ROOT)
Packit a4aae4
        fi
Packit a4aae4
    else
Packit a4aae4
        AC_SUBST(MATLAB_ROOT)
Packit a4aae4
        AC_MSG_RESULT("Set Matlab root to $MATLAB_ROOT")
Packit a4aae4
    fi
Packit a4aae4
Packit a4aae4
    dnl Find the lib directory (which is named according to machine type).
Packit a4aae4
    dnl The test was using -z; I changed it to -n to fix a problem withthe 
Packit a4aae4
    dnl matlab server build. The build did not find the libraries with the
Packit a4aae4
    dnl env var MATLAB_LIB was not set. 04/12/04 jhrg
Packit a4aae4
    AC_MSG_CHECKING(for matlab library dir)
Packit a4aae4
    if test -n "$MATLAB_LIB"
Packit a4aae4
    then
Packit a4aae4
        matlab_lib_dir=${MATLAB_LIB}
Packit a4aae4
    else
Packit a4aae4
        matlab_lib_dir=`find ${MATLAB_ROOT}/extern/lib -name 'libmat*' -print | sed '1q'`
Packit a4aae4
        matlab_lib_dir=`echo $matlab_lib_dir | sed 's@\(.*\)/libmat.*@\1@'`
Packit a4aae4
    fi
Packit a4aae4
    AC_MSG_RESULT($matlab_lib_dir)
Packit a4aae4
Packit a4aae4
    if test "$matlab_lib_dir"
Packit a4aae4
    then
Packit a4aae4
	LDFLAGS="$LDFLAGS -L$matlab_lib_dir"
Packit a4aae4
	dnl This is used by the nph script to set LD_LIBRARY_PATH
Packit a4aae4
	AC_SUBST(matlab_lib_dir)
Packit a4aae4
    fi
Packit a4aae4
    
Packit a4aae4
    dnl sleazy test for version 5; look for the version 4 compat flag
Packit a4aae4
Packit a4aae4
    if grep V4_COMPAT ${MATLAB_ROOT}/extern/include/mat.h > /dev/null 2>&1
Packit a4aae4
    then
Packit a4aae4
	dnl if we're here, we're linking under ML 5 or 6. 02/10/03 jhrg
Packit a4aae4
	MAT_VERSION_FLAG="-V4"
Packit a4aae4
	dnl ML 6 lacks libmi.a/.so. 02/10/03 jhrg
Packit a4aae4
	if access -r ${matlab_lib_dir}/libmi.*
Packit a4aae4
	then
Packit a4aae4
	    MATLIBS="-lmat -lmi -lmx -lut"
Packit a4aae4
	else
Packit a4aae4
	    MATLIBS="-lmat -lmx -lut"
Packit a4aae4
	fi
Packit a4aae4
    else
Packit a4aae4
       MAT_VERSION_FLAG=""
Packit a4aae4
       MATLIBS="-lmat"
Packit a4aae4
    fi
Packit a4aae4
Packit a4aae4
    AC_CHECK_LIB(ots, _OtsDivide64Unsigned, MATLIBS="$MATLIBS -lots", )
Packit a4aae4
    AC_SUBST(MATLIBS)
Packit a4aae4
    AC_SUBST(MAT_VERSION_FLAG)])
Packit a4aae4
Packit a4aae4
# cross-compile problem with test option -d
Packit a4aae4
AC_DEFUN([DODS_DSP_ROOT], [dnl
Packit a4aae4
Packit a4aae4
    AC_ARG_WITH(dsp,
Packit a4aae4
		[  --with-dsp=DIR          Directory containing DSP software from U of Miami],
Packit a4aae4
		DSP_ROOT=${withval}, DSP_ROOT="$DSP_ROOT")
Packit a4aae4
Packit a4aae4
    if test ! -d "$DSP_ROOT"
Packit a4aae4
    then
Packit a4aae4
        DSP_ROOT=""
Packit a4aae4
    fi
Packit a4aae4
    if test -z "$DSP_ROOT"
Packit a4aae4
    then
Packit a4aae4
	AC_MSG_CHECKING(for the DSP library root directory)
Packit a4aae4
Packit a4aae4
	for p in /usr/local/src/DSP /usr/local/DSP \
Packit a4aae4
		 /usr/local/src/dsp /usr/local/dsp \
Packit a4aae4
		 /usr/contrib/src/dsp /usr/contrib/dsp \
Packit a4aae4
		 $DODS_ROOT/third-party/dsp /usr/dsp /data1/dsp
Packit a4aae4
	do
Packit a4aae4
	    if test -z "$DSP_ROOT"
Packit a4aae4
	    then
Packit a4aae4
	    	for d in `ls -dr ${p}* 2>/dev/null`
Packit a4aae4
		do
Packit a4aae4
		    if test -f ${d}/inc/dsplib.h
Packit a4aae4
		    then
Packit a4aae4
		        DSP_ROOT=${d}
Packit a4aae4
		        break
Packit a4aae4
		    fi
Packit a4aae4
	        done
Packit a4aae4
	    fi
Packit a4aae4
	done
Packit a4aae4
    fi
Packit a4aae4
Packit a4aae4
    if test "$DSP_ROOT"
Packit a4aae4
    then
Packit a4aae4
	AC_SUBST(DSP_ROOT)
Packit a4aae4
	dnl Only add this path to gcc's options... jhrg 11/15/96
Packit a4aae4
	INCS="$INCS -I\$(DSP_ROOT)/inc"
Packit a4aae4
	AC_SUBST(INCS) 		# 09/20/02 jhrg
Packit a4aae4
	LDFLAGS="$LDFLAGS -L\$(DSP_ROOT)/lib -L\$(DSP_ROOT)/shlib"
Packit a4aae4
	AC_MSG_RESULT(Set DSP root directory to $DSP_ROOT) 
Packit a4aae4
    else
Packit a4aae4
        AC_MSG_ERROR(not found! see configure --help)
Packit a4aae4
    fi])
Packit a4aae4
Packit a4aae4
# Find IDL. 9/23/99 jhrg
Packit a4aae4
Packit a4aae4
AC_DEFUN([DODS_IDL], [dnl
Packit a4aae4
    AC_ARG_WITH(idl,
Packit a4aae4
        [  --with-idl=ARG       Where is the IDL root directory],
Packit a4aae4
        IDL_ROOT=${withval}, IDL_ROOT="$IDL_ROOT")
Packit a4aae4
    AC_REQUIRE([AC_CANONICAL_HOST])
Packit a4aae4
Packit a4aae4
    AC_MSG_CHECKING(for the IDL root directory)
Packit a4aae4
    if test -z "$IDL_ROOT"
Packit a4aae4
    then
Packit a4aae4
        # Find IDL's root directory by looking at the exectuable and then 
Packit a4aae4
        # finding where that symbolic link points.
Packit a4aae4
        # !!! Doesn't work if idl isn't a symbolic link - erd !!!
Packit a4aae4
	# I think that the following 'if' fixes the symbolic link problem. 
Packit a4aae4
	# 05/02/03 jhrg 
Packit a4aae4
        idl_loc=`which idl`
Packit a4aae4
	if echo `ls -l $idl_loc` | grep '.*->.*' > /dev/null 2>&1
Packit a4aae4
	then
Packit a4aae4
            idl_loc=`ls -l $idl_loc | sed 's/.*->[ ]*\(.*\)$/\1/'`
Packit a4aae4
	fi
Packit a4aae4
        IDL_ROOT=`echo $idl_loc | sed 's/\(.*\)\/bin.*/\1/'`
Packit a4aae4
    fi
Packit a4aae4
Packit a4aae4
    AC_MSG_RESULT($IDL_ROOT)
Packit a4aae4
    AC_SUBST(IDL_ROOT)
Packit a4aae4
Packit a4aae4
    # Now find where the IDL 5.2 or later sharable libraries live.
Packit a4aae4
    # NB: This won't work if libraries for several architecutures are 
Packit a4aae4
    # installed for several machines.
Packit a4aae4
    AC_MSG_CHECKING(for the IDL sharable library directory)
Packit a4aae4
    # cd to the IDL root because it is likely a symbolic link and find 
Packit a4aae4
    # won't normally follow symbolic links.
Packit a4aae4
    IDL_LIBS=`(cd $IDL_ROOT; find . -name 'libidl.so' -print)`
Packit a4aae4
    # Strip off the leading `.' (it's there because we ran find in the CWD) 
Packit a4aae4
    # and the name of the library used to find the directory.
Packit a4aae4
    IDL_LIBS=`echo $IDL_LIBS | sed 's/\.\(.*\)\/libidl.so/\1/' | sed '1q'`
Packit a4aae4
    IDL_LIBS=${IDL_ROOT}${IDL_LIBS}
Packit a4aae4
    AC_MSG_RESULT($IDL_LIBS)
Packit a4aae4
    AC_SUBST(IDL_LIBS)])
Packit a4aae4
Packit a4aae4
Packit a4aae4
# 5. Misc stuff
Packit a4aae4
#---------------------------------------------------------------------------
Packit a4aae4
Packit a4aae4
AC_DEFUN([DODS_DEBUG_OPTION], [dnl
Packit a4aae4
    AC_ARG_ENABLE(debug, 
Packit a4aae4
		  [  --enable-debug=ARG      Program instrumentation (1,2)],
Packit a4aae4
		  DEBUG=$enableval, DEBUG=no)
Packit a4aae4
Packit a4aae4
    case "$DEBUG" in
Packit a4aae4
    no) 
Packit a4aae4
      ;;
Packit a4aae4
    1)
Packit a4aae4
      AC_MSG_RESULT(Setting debugging to level 1)
Packit a4aae4
      AC_DEFINE(DODS_DEBUG)
Packit a4aae4
      ;;
Packit a4aae4
    2) 
Packit a4aae4
      AC_MSG_RESULT(Setting debugging to level 2)
Packit a4aae4
      AC_DEFINE(DODS_DEBUG, , [Set instrumentation to level 1 (see debug.h)])
Packit a4aae4
      AC_DEFINE(DODS_DEBUG2, , [Set instrumentation to level 2])
Packit a4aae4
      ;;
Packit a4aae4
    *)
Packit a4aae4
      AC_MSG_ERROR(Bad debug value)
Packit a4aae4
      ;;
Packit a4aae4
    esac])
Packit a4aae4
Packit a4aae4
AC_DEFUN([DODS_OS], [dnl
Packit a4aae4
    AC_MSG_CHECKING(type of operating system)
Packit a4aae4
    # I have removed the following test because some systems (e.g., SGI)
Packit a4aae4
    # define OS in a way that breaks this code but that is close enough
Packit a4aae4
    # to also be hard to detect. jhrg 3/23/97
Packit a4aae4
    #  if test -z "$OS"; then
Packit a4aae4
    #  fi 
Packit a4aae4
    OS=`uname -s | tr '[[A-Z]]' '[[a-z]]' | sed 's;/;;g'`
Packit a4aae4
    if test -z "$OS"; then
Packit a4aae4
        AC_MSG_WARN(OS unknown!)
Packit a4aae4
    fi
Packit a4aae4
    case $OS in
Packit a4aae4
        aix)
Packit a4aae4
            ;;
Packit a4aae4
        hp-ux)
Packit a4aae4
            OS=hpux`uname -r | sed 's/[[A-Z.0]]*\([[0-9]]*\).*/\1/'`
Packit a4aae4
            ;;
Packit a4aae4
        irix)
Packit a4aae4
            OS=${OS}`uname -r | sed 's/\..*//'`
Packit a4aae4
            ;;
Packit a4aae4
        # I added the following case because the `tr' command above *seems* 
Packit a4aae4
	# to fail on Irix 5. I can get it to run just fine from the shell, 
Packit a4aae4
	# but not in the configure script built using this macro. jhrg 8/27/97
Packit a4aae4
        IRIX)
Packit a4aae4
            OS=irix`uname -r | sed 's/\..*//'`
Packit a4aae4
	    ;;
Packit a4aae4
        osf*)
Packit a4aae4
            ;;
Packit a4aae4
        sn*)
Packit a4aae4
            OS=unicos
Packit a4aae4
            ;;
Packit a4aae4
        sunos)
Packit a4aae4
            OS_MAJOR=`uname -r | sed 's/\..*//'`
Packit a4aae4
            OS=$OS$OS_MAJOR
Packit a4aae4
            ;;
Packit a4aae4
        ultrix)
Packit a4aae4
            case `uname -m` in
Packit a4aae4
            VAX)
Packit a4aae4
                OS=vax-ultrix
Packit a4aae4
                ;;
Packit a4aae4
            esac
Packit a4aae4
            ;;
Packit a4aae4
        *)
Packit a4aae4
            # On at least one UNICOS system, 'uname -s' returned the
Packit a4aae4
            # hostname (sigh).
Packit a4aae4
            if uname -a | grep CRAY >/dev/null; then
Packit a4aae4
                OS=unicos
Packit a4aae4
            fi
Packit a4aae4
            ;;
Packit a4aae4
    esac
Packit a4aae4
Packit a4aae4
    # Adjust OS for CRAY MPP environment.
Packit a4aae4
    #
Packit a4aae4
    case "$OS" in
Packit a4aae4
    unicos)
Packit a4aae4
Packit a4aae4
        case "$CC$TARGET$CFLAGS" in
Packit a4aae4
        *cray-t3*)
Packit a4aae4
            OS=unicos-mpp
Packit a4aae4
            ;;
Packit a4aae4
        esac
Packit a4aae4
        ;;
Packit a4aae4
    esac
Packit a4aae4
Packit a4aae4
    AC_SUBST(OS)
Packit a4aae4
Packit a4aae4
    AC_MSG_RESULT($OS)])
Packit a4aae4
Packit a4aae4
Packit a4aae4
AC_DEFUN([DODS_MACHINE], [dnl
Packit a4aae4
    AC_MSG_CHECKING(type of machine)
Packit a4aae4
Packit a4aae4
    if test -z "$MACHINE"; then
Packit a4aae4
    MACHINE=`uname -m | tr '[[A-Z]]' '[[a-z]]'`
Packit a4aae4
    case $OS in
Packit a4aae4
        aix*)
Packit a4aae4
            MACHINE=rs6000
Packit a4aae4
            ;;
Packit a4aae4
        hp*)
Packit a4aae4
            MACHINE=hp`echo $MACHINE | sed 's%/.*%%'`
Packit a4aae4
            ;;
Packit a4aae4
        sunos*)
Packit a4aae4
            case $MACHINE in
Packit a4aae4
                sun4*)
Packit a4aae4
                    MACHINE=sun4
Packit a4aae4
                    ;;
Packit a4aae4
            esac
Packit a4aae4
            ;;
Packit a4aae4
        irix*)
Packit a4aae4
            case $MACHINE in
Packit a4aae4
                ip2?)
Packit a4aae4
                    MACHINE=sgi
Packit a4aae4
                    ;;
Packit a4aae4
            esac
Packit a4aae4
            ;;
Packit a4aae4
	ultrix*)
Packit a4aae4
	    case $MACHINE in
Packit a4aae4
		vax*)
Packit a4aae4
		     case "$CC" in
Packit a4aae4
        		/bin/cc*|cc*)
Packit a4aae4
echo "changing C compiler to \`vcc' because \`cc' floating-point is broken"
Packit a4aae4
            		CC=vcc
Packit a4aae4
            		;;
Packit a4aae4
		     esac
Packit a4aae4
		     ;;
Packit a4aae4
	    esac
Packit a4aae4
	    ;;
Packit a4aae4
Packit a4aae4
    esac
Packit a4aae4
    fi
Packit a4aae4
Packit a4aae4
    AC_SUBST(MACHINE)
Packit a4aae4
    AC_MSG_RESULT($MACHINE)])
Packit a4aae4
Packit a4aae4
AC_DEFUN([DODS_CHECK_SIZES], [dnl
Packit a4aae4
    # Ignore the errors about AC_TRY_RUN missing an argument. jhrg 5/2/95
Packit a4aae4
Packit a4aae4
    AC_REQUIRE([AC_PROG_CC])
Packit a4aae4
Packit a4aae4
    AC_CHECK_SIZEOF(int)
Packit a4aae4
    AC_CHECK_SIZEOF(long)
Packit a4aae4
    AC_CHECK_SIZEOF(char)
Packit a4aae4
    AC_CHECK_SIZEOF(double)
Packit a4aae4
    AC_CHECK_SIZEOF(float)
Packit a4aae4
Packit a4aae4
    # check for C99 types, headers and functions
Packit a4aae4
    AC_CHECK_HEADER([inttypes.h],[dap_inttypes_header=yes],,)
Packit a4aae4
    # DINT32 4
Packit a4aae4
    AC_CHECK_SIZEOF([int32_t])
Packit a4aae4
    # DUINT32
Packit a4aae4
    AC_CHECK_SIZEOF([uint32_t])
Packit a4aae4
    # DINT16 short
Packit a4aae4
    AC_CHECK_SIZEOF([int16_t])
Packit a4aae4
    # DUINT16 unsigned short
Packit a4aae4
    AC_CHECK_SIZEOF([uint16_t])
Packit a4aae4
    # DBYTE 1
Packit a4aae4
    AC_CHECK_SIZEOF([uint8_t])
Packit a4aae4
    if test x"$dap_inttypes_header" = x'yes' -a $ac_cv_sizeof_int32_t -eq 4 -a $ac_cv_sizeof_int16_t -eq 2 -a $ac_cv_sizeof_uint8_t -eq 1 -a $ac_cv_sizeof_double -eq 8; then
Packit a4aae4
        dap_use_c99_types=yes
Packit a4aae4
    fi
Packit a4aae4
    AM_CONDITIONAL([USE_C99_TYPES],[test x"$dap_use_c99_types" = 'xyes'])
Packit a4aae4
Packit a4aae4
    # I've separated the typedefs from the config.h header because other
Packit a4aae4
    # projects which use the DAP were getting conflicts with their includes,
Packit a4aae4
    # or the includes of still other libraries, and config.h. The
Packit a4aae4
    # config.h header is now included only by .cc and .c files and headers
Packit a4aae4
    # that need the typedefs use dods-datatypes.h.
Packit a4aae4
    # there are 2 possibilities for the definition of dods_int32, ...,
Packit a4aae4
    # types. First possibility is that the C99 types are used and
Packit a4aae4
    # dods-datatypes-static.h is copied. In that case the following
Packit a4aae4
    # definitions are not really usefull. In case the C99 types are
Packit a4aae4
    # not available, dods-datatypes-config.h.in is used to generate
Packit a4aae4
    # dods-datatypes.h.
Packit a4aae4
    # The code below makes dods-datatypes-config.h stand on its own.
Packit a4aae4
    # 8/2/2000 jhrg
Packit a4aae4
Packit a4aae4
    # DMH: Divide into two sets of tests: one for DODS and one for XDR
Packit a4aae4
    if test x"$dap_use_c99_types" = 'xyes'; then
Packit a4aae4
        DODS_INT64=int64_t
Packit a4aae4
        DODS_UINT64=uint64_t
Packit a4aae4
        DODS_INT32=int32_t
Packit a4aae4
        DODS_UINT32=uint32_t
Packit a4aae4
        DODS_INT16=int16_t
Packit a4aae4
        DODS_UINT16=uint16_t
Packit a4aae4
        DODS_INT8=int8_t
Packit a4aae4
        DODS_BYTE=uint8_t
Packit a4aae4
    else
Packit a4aae4
        DODS_INT64="long long"
Packit a4aae4
        DODS_UINT64="unsigned long long"
Packit a4aae4
        DODS_INT16=short
Packit a4aae4
        DODS_UINT16="unsigned short"
Packit a4aae4
	DODS_INT32=int
Packit a4aae4
	DODS_UINT32="unsigned int"
Packit a4aae4
	DODS_INT8=char
Packit a4aae4
	DODS_BYTE="unsigned char"
Packit a4aae4
    fi
Packit a4aae4
    DODS_FLOAT64=double
Packit a4aae4
    DODS_FLOAT32=float
Packit a4aae4
Packit a4aae4
    # I'm using the three arg form of AC_DEFINE_UNQUOTED because autoheader
Packit a4aae4
    # needs the third argument (although I don't quite get the specifics...
Packit a4aae4
    # 2/15/2001 jhrg
Packit a4aae4
    AC_DEFINE_UNQUOTED(DINT64, $DODS_INT64, [64-bit integer type])
Packit a4aae4
    AC_DEFINE_UNQUOTED(DUINT64, $DODS_UINT64, [64-bit unsigned integer type])
Packit a4aae4
    AC_DEFINE_UNQUOTED(DINT32, $DODS_INT32, [32-bit integer type])
Packit a4aae4
    AC_DEFINE_UNQUOTED(DUINT32, $DODS_UINT32, [32-bit unsigned integer type])
Packit a4aae4
    AC_DEFINE_UNQUOTED(DINT16, $DODS_INT16, [16-bit integer type])
Packit a4aae4
    AC_DEFINE_UNQUOTED(DUINT16, $DODS_UINT16, [16-bit unsigned integer type])
Packit a4aae4
    AC_DEFINE_UNQUOTED(DFLOAT64, $DODS_FLOAT64, [64-bit real type])
Packit a4aae4
    AC_DEFINE_UNQUOTED(DFLOAT32, $DODS_FLOAT32, [32-bit real type])
Packit a4aae4
    AC_DEFINE_UNQUOTED(DINT8, $DODS_INT8, [8-bit integer type])
Packit a4aae4
    AC_DEFINE_UNQUOTED(DBYTE, $DODS_BYTE, [unsigned bytes/chars])
Packit a4aae4
Packit a4aae4
    # XDR INTEGER TYPES
Packit a4aae4
    #
Packit a4aae4
    # Since DAP4 does not use XDR, there are no defines for the int8 or the
Packit a4aae4
    # 64-bit integer types used by DAP4. jhrg  6/26/12
Packit a4aae4
    #
Packit a4aae4
    # Unfortunately, there is little commonality about xdr
Packit a4aae4
Packit Service 9fa520
    # First, we need to see if the xdr routines are in libtirpc, libc, librpc,
Packit a4aae4
    # or librpcsvc or libnsl
Packit a4aae4
    dap_xdrlib=
Packit Service 9fa520
	PKG_PROG_PKG_CONFIG([0.9.0])
Packit Service 9fa520
	PKG_CHECK_MODULES([TIRPC], [libtirpc >= 0.2.4],
Packit Service 9fa520
		[dap_xdrlib=`echo "${TIRPC_LIBS}" | sed -e 's/^-l//'`
Packit Service 9fa520
		AC_SUBST([TIRPC_CFLAGS])
Packit Service 9fa520
		AC_SUBST([TIRPC_LIBS])
Packit Service 9fa520
		AC_DEFINE([HAVE_LIBTIRPC], [1], [Define to 1 to use libtirpc.])],
Packit Service 9fa520
		[dap_xdrlib=""]
Packit Service 9fa520
	)
Packit Service 9fa520
	AS_IF(
Packit Service 9fa520
	[test "$dap_xdrlib" = ""],
Packit Service 9fa520
    	[AC_SEARCH_LIBS([xdr_void],[c rpc nsl rpcsvc],[
Packit Service 9fa520
    	  dap_xdrlib=`echo $ac_res|sed -e 's/^-l//'`],[
Packit Service 9fa520
    	  AC_MSG_WARN(Cannot locate library containing xdr functions.)])])
Packit Service 9fa520
Packit a4aae4
    # Added for autoconf 2.59 which appears to not use/set $ac_res. jhrg
Packit a4aae4
    if test -z "$dap_xdrlib" ; then dap_xdrlib=c; fi
Packit a4aae4
    if test "$dap_xdrlib" = "none required" ; then dap_xdrlib=c; fi
Packit a4aae4
    # I don't think this is needed for autoconf 2.61 but I have no idea about
Packit a4aae4
    # 2.59 - it doesn't seem to be hurting anything with 2.61. jhrg
Packit a4aae4
    if test "$dap_xdrlib" != "c" ; then
Packit a4aae4
       # Add to library list
Packit a4aae4
       AC_CHECK_LIB($dap_xdrlib,xdr_void)
Packit a4aae4
    fi
Packit a4aae4
    # Now figure out what integer functions to use
Packit a4aae4
    dap_xdrint=0
Packit a4aae4
    AC_CHECK_LIB($dap_xdrlib,[xdr_uint32_t],[dap_xdrint=1],[
Packit a4aae4
      AC_CHECK_LIB($dap_xdrlib,[xdr_u_int32_t],[dap_xdrint=2],[
Packit a4aae4
        AC_CHECK_LIB($dap_xdrlib,[xdr_uint],[dap_xdrint=3],[
Packit a4aae4
          AC_CHECK_LIB($dap_xdrlib,[xdr_u_int],[dap_xdrint=4],[])])])])
Packit a4aae4
    case "$dap_xdrint" in
Packit a4aae4
    1) # uint32_t
Packit a4aae4
	XDR_INT32=xdr_int32_t
Packit a4aae4
	XDR_UINT32=xdr_uint32_t
Packit a4aae4
        XDR_INT16=xdr_int16_t
Packit a4aae4
        XDR_UINT16=xdr_uint16_t
Packit a4aae4
        ;;
Packit a4aae4
    2) # u_int32_t
Packit a4aae4
	XDR_INT32=xdr_int32_t
Packit a4aae4
	XDR_UINT32=xdr_u_int32_t
Packit a4aae4
        XDR_INT16=xdr_int16_t
Packit a4aae4
        XDR_UINT16=xdr_u_int16_t
Packit a4aae4
        ;;
Packit a4aae4
    3) # uint
Packit a4aae4
	XDR_INT32=xdr_int
Packit a4aae4
	XDR_UINT32=xdr_uint
Packit a4aae4
        XDR_INT16=xdr_short
Packit a4aae4
        XDR_UINT16=xdr_ushort
Packit a4aae4
        ;;
Packit a4aae4
    4) # u_int
Packit a4aae4
	XDR_INT32=xdr_int
Packit a4aae4
	XDR_UINT32=xdr_u_int
Packit a4aae4
        XDR_INT16=xdr_short
Packit a4aae4
        XDR_UINT16=xdr_u_short
Packit a4aae4
        ;;
Packit a4aae4
    *)
Packit a4aae4
	AC_MSG_ERROR(Cannot determine DODS XDR integer sizes)
Packit a4aae4
        ;;
Packit a4aae4
    esac
Packit a4aae4
    XDR_FLOAT64=xdr_double
Packit a4aae4
    XDR_FLOAT32=xdr_float
Packit a4aae4
Packit a4aae4
    AC_DEFINE_UNQUOTED([XDR_INT16], [$XDR_INT16], [xdr int16])
Packit a4aae4
    AC_DEFINE_UNQUOTED([XDR_UINT16], [$XDR_UINT16], [xdr uint16])
Packit a4aae4
    AC_DEFINE_UNQUOTED([XDR_INT32], [$XDR_INT32], [xdr int32])
Packit a4aae4
    AC_DEFINE_UNQUOTED([XDR_UINT32], [$XDR_UINT32], [xdr uint32])
Packit a4aae4
    AC_DEFINE_UNQUOTED([XDR_FLOAT64], [$XDR_FLOAT64], [xdr float64])
Packit a4aae4
    AC_DEFINE_UNQUOTED([XDR_FLOAT32], [$XDR_FLOAT32], [xdr float32])])