head	1.1;
branch	1.1.1;
access;
symbols
	ZIP_2_3:1.1.1.2
	NET:1.1.1
	libgcj-2_95_1-release:1.1.1.1
	libgcj-2_95-release:1.1.1.1
	libgcj-2_95-branch:1.1.1.1.0.2
	libgcj-2_95-branchpoint:1.1.1.1
	LIBGCJ_0_1:1.1.1.1
	CYGNUS:1.1.1;
locks; strict;
comment	@# @;


1.1
date	99.04.07.14.52.46;	author tromey;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	99.04.07.14.52.46;	author tromey;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	2000.06.15.00.57.53;	author bryce;	state Exp;
branches;
next	;


desc
@@


1.1
log
@Initial revision
@
text
@:
#!/bin/sh
# The above : is necessary on some buggy systems.

# configure: Guess values for system-dependent variables
# Output the flag definitions to the file "flags".
# Parameters: $1 = $CC, $2 = $CFLAGS
# To construct zip automatically using this file, type
# "make -f unix/Makefile generic".
# If this fails, then type "make list" to get a list of special targets.


trap "rm -f conftest* core a.out; exit 1" 1 2 3 15

CC=${1-cc}
CFLAGS=${2-"-O -I. -DUNIX"}
LFLAGS1="-s"

# This one is needed for the ultrix and OSF/1 optimizer
echo Check for -Olimit option
echo "int main() { return 0;}" > conftest.c
$CC -Olimit 1000 conftest.c >/dev/null 2>/dev/null
[ $? -eq 0 ] && CFLAGS="${CFLAGS} -Olimit 1000"

echo Check for the C preprocessor
# on SVR4, cc -E does not produce correct assembler files. Need /lib/cpp.
CPP="${CC} -E"
# solaris as(1) needs -P, maybe others as well ?
[ -f /usr/ccs/lib/cpp ] && CPP="/usr/ccs/lib/cpp -P"
[ -f /usr/lib/cpp ] && CPP=/usr/lib/cpp
[ -f /lib/cpp ] && CPP=/lib/cpp
[ -f /usr/bin/cpp ] && CPP=/usr/bin/cpp

echo Check if we can use asm code
OBJA=""
if eval "$CPP match.S > _match.s 2>/dev/null"; then
  if test ! -s _match.s || grep error < _match.s > /dev/null; then
    :
  elif eval "$CC -c _match.s >/dev/null 2>/dev/null" && test -f _match.o; then
    CFLAGS="${CFLAGS} -DASMV"
    OBJA=match.o
    echo "int foo() { return 0;}" > conftest.c
    $CC -c conftest.c >/dev/null 2>/dev/null
    echo Check if compiler generates underlines
    nm conftest.o | egrep "(^|[^_])foo" >/dev/null 2>/dev/null
    [ $? -eq 0 ] && CPP="${CPP} -DNO_UNDERLINE"
  fi
fi
rm -f _match.s _match.o

# Ansi options for systems that don't have __STDC__ defined by default
# Currently HPUX, pyramid, dnix, AIX, OSF/1 and ultrix

echo Check for Ansi options
cat > conftest.c << _EOF_
int main()
{
#ifndef __STDC__
   forget it
#endif
   return 0;
}
_EOF_
$CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
if [ $? -ne 0 ]; then
  for OPT in "-Aa -D_HPUX_SOURCE" -Xa -qlanglvl=ansi -std1 -std
  do
    $CC $CFLAGS $OPT -c conftest.c > /dev/null 2>/dev/null
    [ $? -eq 0 ] && CFLAGS="${CFLAGS} ${OPT}" && break
  done
fi

echo Check for prototypes
echo "int main(int argc, char *argv[]) { return 0; }" > conftest.c
$CC $CFLAGS -c conftest.c > /dev/null 2>/dev/null
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_PROTO"

# const check currently handles mips cc and non ANSI compilers.
# does it need more ?
echo Check the handling of const
cat > conftest.c << _EOF_
typedef int charset[2];
int main()
{
  const charset x;
  const char *foo;
  return 0;
}  
_EOF_
$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_CONST"

echo Check for time_t
cat > conftest.c << _EOF_
#include <sys/types.h>
#include <time.h>
int main()
{
  time_t t;
  return 0;
}
_EOF_
$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_TIME_T"
  
echo Check for size_t
cat > conftest.c << _EOF_
#include <sys/types.h>
int main()
{
  size_t s;
  return 0;
}
_EOF_
$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_SIZE_T"

# Check for missing functions
# add NO_'function_name' to flags if missing
for func in rmdir strrchr rename mktemp mktime
do
  echo Check for $func
  echo "int main(){ $func(); return 0; }" > conftest.c
  $CC conftest.c >/dev/null 2>/dev/null
  [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $func | tr '[a-z]' '[A-Z]'`"
done

echo Check for memset
echo "int main(){ memset(); return 0; }" > conftest.c
$CC conftest.c >/dev/null 2>/dev/null
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DZMEM"

echo Check for errno declaration
cat > conftest.c << _EOF_
#include <errno.h>
main()
{
  errno = 0;
  return 0;
}
_EOF_
$CC $CFLAGS -c conftest.c >/dev/null 2>/dev/null
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_ERRNO"

echo Check for directory libraries
cat > conftest.c << _EOF_
int main() { return closedir(opendir(".")); }
_EOF_

$CC conftest.c >/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
  OPT=""
  for lib in ndir dir ucb bsd BSD PW x
  do
    $CC conftest.c -l$lib >/dev/null 2>/dev/null
    [ $? -eq 0 ] && OPT=$lib && break
  done
  if [ ${OPT} ]; then
    LFLAGS2="${LFLAGS2} -l${OPT}"
  else
    CFLAGS="${CFLAGS} -DNO_DIR"
  fi
fi

# Dynix/ptx 1.3 needed this
echo Check for readlink
echo "int main(){ return readlink(); }" > conftest.c
$CC conftest.c >/dev/null 2>/dev/null
if [ $? -ne 0 ]; then 
  $CC conftest.c -lseq >/dev/null 2>/dev/null
  [ $? -eq 0 ] && LFLAGS2="${LFLAGS2} -lseq"
fi

echo Check for directory include file
OPT=""
for inc in sys/ndir.h ndir.h sys/dir.h dirent.h
do
   echo "#include <$inc>" > conftest.c
   $CPP conftest.c > /dev/null 2>/dev/null
   [ $? -eq 0 ] && OPT="HAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`"
done
CFLAGS="${CFLAGS} -D${OPT}"

echo Check for non existing include files
for inc in stdlib.h stddef.h unistd.h fcntl.h string.h
do
   echo "#include <$inc>" > conftest.c
   $CPP conftest.c >/dev/null 2>/dev/null
   [ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_`echo $inc | tr '[a-z]./' '[A-Z]__'`"
done

echo Check for term i/o include file
OPT=""
for inc in sys/termio.h termio.h termios.h
do
   echo "#include <$inc>" > conftest.c
   $CPP conftest.c > /dev/null 2>/dev/null
   [ $? -eq 0 ] && OPT="HAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`"
done
CFLAGS="${CFLAGS} -D${OPT}"

echo Check for /usr/local/bin and /usr/local/man
BINDIR=$HOME/bin
[ -d /usr/local/bin ] && BINDIR=/usr/local/bin

MANDIR=manl
[ -d /usr/man/manl ]       && MANDIR=/usr/man/manl
[ -d /usr/local/man/manl ] && MANDIR=/usr/local/man/manl
[ -d /usr/local/man/man1 ] && MANDIR=/usr/local/man/man1

echo Check for NeXT
if test -f /usr/bin/hostinfo; then
  if /usr/bin/hostinfo | grep NeXT > /dev/null; then
    CFLAGS="${CFLAGS} -posix"
    LFLAGS1="${LFLAGS1} -posix -object"
  fi
fi

rm -f conftest.c conftest.o a.out

echo CC=\"${CC}\" CFLAGS=\"${CFLAGS}\"  CPP=\"${CPP}\" OBJA=\"${OBJA}\" \
       BINDIR=${BINDIR} MANDIR=${MANDIR} LFLAGS1=\"${LFLAGS1}\" \
       LFLAGS2=\"${LFLAGS2}\" > flags
@


1.1.1.1
log
@Initial import of libgcj
@
text
@@


1.1.1.2
log
@Imported zip 2.3
@
text
@d12 1
d16 1
a16 1
CFLAGS=${2-"-O2 -I. -DUNIX"}
d18 6
a23 1
LN="ln -s"
a32 2
[ -f /xenix ] && CPP="${CC} -E"
[ -f /lynx.os ] && CPP="${CC} -E"
d39 1
a39 1
  elif eval "$CC -c _match.s >/dev/null 2>/dev/null" && [ -f _match.o ]; then
d41 1
a41 1
    OBJA="match.o"
d45 1
a45 1
    nm conftest.o | grep "(^|[^_])foo" >/dev/null 2>/dev/null
a46 7
    if eval "$CPP crc_i386.S > _crc_i386.s 2>/dev/null"; then
      if eval "$CC -c _crc_i386.s >/dev/null 2>/dev/null" && [ -f _crc_i386.o ]
      then
        OBJA="$OBJA crc_i386.o"
        CFLAGS="${CFLAGS} -DASM_CRC"
      fi
    fi
d49 1
a49 1
rm -f _match.s _match.o _crc_i386.s _crc_i386.o
d51 2
a52 2
# ANSI options for compilers that don't have __STDC__ defined by default
# Currently HPUX, pyramid, Dynix, AIX, OSF/1 and ultrix
d54 1
a54 1
echo Check for ANSI options
d88 1
a88 1
}
d105 1
a105 1

d120 1
a120 1
for func in rmdir strchr strrchr rename mktemp mktime
d124 1
a124 1
  $CC -o conftest conftest.c >/dev/null 2>/dev/null
d129 2
a130 2
echo "int main(){ char k; memset(&k,0,0); return 0; }" > conftest.c
$CC -o conftest conftest.c >/dev/null 2>/dev/null
d150 1
a150 1
$CC -o conftest conftest.c >/dev/null 2>/dev/null
d153 1
a153 1
  for lib in ndir dir ucb bsd BSD PW x dirent
d155 2
a156 2
    $CC -o conftest conftest.c -l$lib >/dev/null 2>/dev/null
    [ $? -eq 0 ] && OPT=-l$lib && break
d159 1
a159 1
    LFLAGS2="${LFLAGS2} ${OPT}"
d168 3
a170 3
$CC -o conftest conftest.c >/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
  $CC -o conftest conftest.c -lseq >/dev/null 2>/dev/null
d176 1
a176 1
for inc in dirent.h sys/ndir.h ndir.h sys/dir.h
d180 1
a180 1
   [ $? -eq 0 ] && OPT="-DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`" && break
d182 1
a182 1
CFLAGS="${CFLAGS} ${OPT}"
d184 1
a184 1
echo Check for non existent include files
d192 1
a192 1
echo Check for term I/O include file
d194 1
a194 1
for inc in termios.h termio.h sgtty.h
d198 1
a198 1
   [ $? -eq 0 ] && OPT="-DHAVE_`echo $inc | tr '[a-z]./' '[A-Z]__'`" && break
d200 1
a200 14
CFLAGS="${CFLAGS} ${OPT}"

# needed for AIX (and others ?) when mmap is used
echo Check for valloc
cat > conftest.c << _EOF_
main()
{
#ifdef MMAP
    valloc();
#endif
}
_EOF_
$CC ${CFLAGS} conftest.c > /dev/null 2>/dev/null
[ $? -ne 0 ] && CFLAGS="${CFLAGS} -DNO_VALLOC"
d211 2
a212 2
echo Checking for OS specialties
if [ -f /usr/bin/hostinfo ]; then
a216 26
# XXX ATT6300, Cray
elif [ -f /xenix ]; then
  if uname -p | grep 286 > /dev/null; then
    CFLAGS="${CFLAGS} -LARGE -Mel2 -DMEDIUM_MEM -DWSIZE=16384 -DNO_VOID"
    LFLAGS1="${LFLAGS1} -LARGE -Mel2"
  fi
elif uname -X >/dev/null 2>/dev/null; then
# SCO shared library check
  echo "int main() { return 0;}" > conftest.c
  $CC -o conftest conftest.c -lc_s -nointl >/dev/null 2> /dev/null
  [ $? -eq 0 ] && LFLAGS2="-lc_s -nointl"
else
  SYSTEM=`uname -s 2>/dev/null` || SYSTEM="unknown"
  echo "int main() { return 0;}" > conftest.c
  case $SYSTEM in
     OSF1|ULTRIX)
        echo Check for -Olimit option
        $CC ${CFLAGS} -Olimit 1000 -o conftest conftest.c >/dev/null 2>/dev/null
        [ $? -eq 0 ] && CFLAGS="${CFLAGS} -Olimit 1000"
        ;;
     HP-UX)
        echo Check for +Onolimit option
        $CC ${CFLAGS} +Onolimit -o conftest conftest.c >/dev/null 2>/dev/null
        [ $? -eq 0 ] && CFLAGS="${CFLAGS} +Onolimit"
        ;;
  esac
d219 1
a219 4
echo Check for symbolic links
ln -s /dev/null null > /dev/null 2>/dev/null || LN=ln

rm -f a.out conftest.c conftest.o conftest null
d223 1
a223 1
       LFLAGS2=\"${LFLAGS2}\" LN=\"${LN}\" > flags
@


