OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [itcl/] [itcl/] [win/] [configure.in] - Rev 578

Go to most recent revision | Compare with Previous | Blame | View Log

dnl This whole file is CYGNUS LOCAL
dnl     This file is an input file used by the GNU "autoconf" program to
dnl     generate the file "configure", which is run during [incr Tcl]
dnl installation to configure the system for the local environment.

AC_PREREQ(2.5)

AC_INIT(../generic/itcl.h)

AC_CONFIG_AUX_DIR(../../../)
AC_CANONICAL_HOST

AC_PROG_RANLIB

AC_PROG_CC
AC_OBJEXT
NM=${NM-nm}
AC_SUBST(NM)
AS=${AS-as}
AC_SUBST(AS)
LD=${LD-ld}
AC_SUBST(LD)
DLLTOOL=${DLLTOOL-dlltool}
AC_SUBST(DLLTOOL)
WINDRES=${WINDRES-windres}
AC_SUBST(WINDRES)

AC_PROG_INSTALL

# needed for the subtle differences between cygwin and mingw32
case "${host}" in
*-*-cygwin*)
        TCL_ALLOC_OBJ=
        DLL_LDLIBS=-lcygwin
        DLL_LDFLAGS='-nostartfiles -Wl,--dll'
        ;;
*-*-mingw32*)
        TCL_ALLOC_OBJ='$(TMPDIR)/tclAlloc.o'
        DLL_LDLIBS=
        DLL_LDFLAGS='-mdll'
        ;;
esac
AC_SUBST(DLL_LDFLAGS)
AC_SUBST(DLL_LDLIBS)

ITCL_VERSION=3.0
ITCL_MAJOR_VERSION=3
ITCL_MINOR_VERSION=0
VERSION=${ITCL_MAJOR_VERSION}${ITCL_MINOR_VERSION}


if test "${prefix}" = "NONE"; then
    prefix=/usr/local
fi
if test "${exec_prefix}" = "NONE"; then
    exec_prefix=$prefix
fi

# -----------------------------------------------------------------------
#   Set up a new default --prefix.  If a previous installation of
#   [incr Tcl] can be found searching $PATH use that directory.
# -----------------------------------------------------------------------

AC_PREFIX_DEFAULT(/usr/local)
AC_PREFIX_PROGRAM(itkwish)

if test "${prefix}" = "NONE"; then
    prefix=/usr/local
fi
if test "${exec_prefix}" = "NONE"; then
    exec_prefix=$prefix
fi

# -----------------------------------------------------------------------
BUILD_DIR=`pwd`
ITCL_SRC_DIR=`cd $srcdir/..; pwd`

if ! test "$GCC" = yes; then
    tmp="`cygpath --windows $ITCL_SRC_DIR`"
    ITCL_SRC_DIR="`echo $tmp | sed -e s#\\\\\\\\#/#g`"
fi

cd ${BUILD_DIR}

AC_ARG_ENABLE(gcc, [  --enable-gcc            allow use of gcc if available],
    [itcl_ok=$enableval], [itcl_ok=no])
if test "$itcl_ok" = "yes"; then
    AC_PROG_CC
else
    CC=${CC-cc}
AC_SUBST(CC)
fi
AC_HAVE_HEADERS(unistd.h limits.h)

#--------------------------------------------------------------------
#   See if there was a command-line option for where Tcl is;  if
#   not, assume that its top-level directory is a sibling of ours.
# CYGNUS LOCAL - Actually, tcl is one level higher - a sibling of the
# itcl directory that contains itcl proper, itk & iwidgets.
#--------------------------------------------------------------------

AC_ARG_WITH(tcl, [  --with-tcl=DIR          use Tcl 8.0 binaries from DIR],
        TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd ../../../tcl/win; pwd`)

if test ! -f $TCL_BIN_DIR/../unix/tclConfig.sh; then
    TCL_BIN_DIR=`cd ../../../tcl8.1/win;pwd`
fi

if test ! -f $TCL_BIN_DIR/../unix/tclConfig.sh; then
    AC_MSG_ERROR(There's no tclConfig.sh in $TCL_BIN_DIR;  perhaps you didn't specify the Tcl *build* directory (not the toplevel Tcl directory) or you forgot to configure Tcl?)
fi

#--------------------------------------------------------------------
#   Read in configuration information generated by Tcl for shared
#   libraries, and arrange for it to be substituted into our
#   Makefile.
#--------------------------------------------------------------------

file=$TCL_BIN_DIR/../unix/tclConfig.sh
. $file

dnl CFLAGS=$TCL_CFLAGS
SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
SHLIB_LD=$TCL_SHLIB_LD
SHLIB_LD_LIBS=$TCL_SHLIB_LD_LIBS
SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
SHLIB_VERSION=$TCL_SHLIB_VERSION
DL_LIBS=$TCL_DL_LIBS
LD_FLAGS=$TCL_LD_FLAGS
ITCL_LD_SEARCH_FLAGS=$TCL_LD_SEARCH_FLAGS

AC_MSG_CHECKING([whether C compiler is gcc])
AC_CACHE_VAL(itcl_cv_prog_gcc, [
    AC_EGREP_CPP(_cc_is_gcc_, [
#ifdef __GNUC__
_cc_is_gcc_
#endif
],      [itcl_cv_prog_gcc=yes], [itcl_cv_prog_gcc=no])])
AC_MSG_RESULT([$itcl_cv_prog_gcc])

if test -z "$CFLAGS" ; then
    CFLAGS="-O"
fi
if test "$itcl_cv_prog_gcc" = "yes" ; then
    CFLAGS="$CFLAGS -Wshadow -Wtraditional -Wall"
fi

AC_MSG_CHECKING([default compiler flags])
AC_ARG_WITH(cflags, [  --with-cflags=FLAGS     set compiler flags to FLAGS],
    [CFLAGS="$with_cflags"])

AC_MSG_RESULT([$CFLAGS])

#--------------------------------------------------------------------
#   Supply a substitute for stdlib.h if it doesn't define strtol,
#   strtoul, or strtod (which it doesn't in some versions of SunOS).
#--------------------------------------------------------------------

AC_MSG_CHECKING(stdlib.h)
AC_HEADER_EGREP(strtol, stdlib.h, itcl_ok=yes, itcl_ok=no)
AC_HEADER_EGREP(strtoul, stdlib.h, , itcl_ok=no)
AC_HEADER_EGREP(strtod, stdlib.h, , itcl_ok=no)
if test $itcl_ok = no; then
    AC_DEFINE(NO_STDLIB_H)
fi
AC_MSG_RESULT($itcl_ok)

#--------------------------------------------------------------------
#   Check for various typedefs and provide substitutes if
#   they don't exist.
#--------------------------------------------------------------------

AC_MODE_T
AC_PID_T
AC_SIZE_T
AC_UID_T

#--------------------------------------------------------------------
#   Check for the existence of various libraries.  The order here
#   is important, so that then end up in the right order in the
#   command line generated by make.  The -lsocket and -lnsl libraries
#   require a couple of special tricks:
#   1. Use "connect" and "accept" to check for -lsocket, and
#      "gethostbyname" to check for -lnsl.
#   2. Use each function name only once:  can't redo a check because
#      autoconf caches the results of the last check and won't redo it.
#   3. Use -lnsl and -lsocket only if they supply procedures that
#      aren't already present in the normal libraries.  This is because
#      IRIX 5.2 has libraries, but they aren't needed and they're
#      bogus:  they goof up name resolution if used.
#   4. On some SVR4 systems, can't use -lsocket without -lnsl too.
#      To get around this problem, check for both libraries together
#      if -lsocket doesn't work by itself.
#--------------------------------------------------------------------

itcl_checkBoth=0
AC_CHECK_FUNC(connect, itcl_checkSocket=0, itcl_checkSocket=1)
if test "$itcl_checkSocket" = 1; then
    AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", itcl_checkBoth=1)
fi
if test "$itcl_checkBoth" = 1; then
    itcl_oldLibs=$LIBS
    LIBS="$LIBS -lsocket -lnsl"
    AC_CHECK_FUNC(accept, itcl_checkNsl=0, [LIBS=$itcl_oldLibs])
fi
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))

#--------------------------------------------------------------------
#   On a few very rare systems, all of the libm.a stuff is
#   already in libc.a.  Set compiler flags accordingly.
#   Also, Linux requires the "ieee" library for math to
#   work right (and it must appear before "-lm").
#--------------------------------------------------------------------

MATH_LIBS=""
AC_CHECK_FUNC(sin, , MATH_LIBS="-lm")
AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])

#--------------------------------------------------------------------
#   If this system doesn't have a memmove procedure, use memcpy
#   instead.
#--------------------------------------------------------------------

AC_CHECK_FUNC(memmove, , [AC_DEFINE(memmove, memcpy)])

#--------------------------------------------------------------------
#   Figure out whether "char" is unsigned.  If so, set a
#   #define for __CHAR_UNSIGNED__.
#--------------------------------------------------------------------

#AC_C_CHAR_UNSIGNED

#--------------------------------------------------------------------
#   Under Solaris 2.4, strtod returns the wrong value for the
#   terminating character under some conditions.  Check for this
#   and if the problem exists use a substitute procedure
#   "fixstrtod" (provided by Tcl) that corrects the error.
#--------------------------------------------------------------------

AC_CHECK_FUNC(strtod, itcl_strtod=1, itcl_strtod=0)
if test "$itcl_strtod" = 1; then
    AC_MSG_CHECKING([for Solaris 2.4 strtod bug])
    AC_TRY_RUN([
        extern double strtod();
        int main()
        {
            char *string = "NaN";
            char *term;
            strtod(string, &term);
            if ((term != string) && (term[-1] == 0)) {
                exit(1);
            }
            exit(0);
        }], itcl_ok=1, itcl_ok=0, itcl_ok=0)
    if test "$itcl_ok" = 1; then
        AC_MSG_RESULT(ok)
    else
        AC_MSG_RESULT(buggy)
        AC_DEFINE(strtod, fixstrtod)
    fi
fi

#--------------------------------------------------------------------
# If we are building with cygwin, we need one set of library names,
# otherwise, we need the Source-Navigator set.
#--------------------------------------------------------------------

if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
    CYGITCLLIBSPEC=itcl${VERSION}
else
    CYGITCLLIBSPEC="itcl`echo ${VERSION} | tr -d .`"
fi
CYGITCLLIB=lib${CYGITCLLIBSPEC}.a
CYGITCLDLL=cygitcl${VERSION}.dll
CYGITCLSH=cygitclsh${VERSION}.exe
CYGITCLDEF=itclcyg.def
CYGITCLTEST=cygitcltest.exe
CYGIMPORTLIB=cygitcl${VERSION}.lib
CYGITCLRES=cygitcl.o
CYGITCLSHRES=cygitclsh.o

SNITCLLIBSPEC=itcl30.lib
SNITCLLIB=${SNITCLLIBSPEC}
SNITCLDLL=snitcl30.dll
SNITCLSH=snitclsh30.exe
SNITCLDEF=itclsn.def
SNITCLTEST=snitcltest.exe
SNIMPORTLIB=snitcl30.lib
SNITCLRES=snitcl.obj
SNITCLSHRES=snitclsh.obj

if test "$GCC" = yes; then
ITCLLIBSPEC=${CYGITCLLIBSPEC}
ITCLLIB=${CYGITCLLIB}
ITCLDLL=${CYGITCLDLL}
ITCLSH=${CYGITCLSH}
ITCLDEF=${CYGITCLDEF}
ITCLTEST=${CYGITCLTEST}
ITCLIMPORTLIB=${CYGIMPORTLIB}
ITCLRES=${CYGITCLRES}
ITCLSHRES=${CYGITCLSHRES}
else
ITCLLIBSPEC=${SNITCLLIBSPEC}
ITCLLIB=${SNITCLLIB}
ITCLDLL=${SNITCLDLL}
ITCLSH=${SNITCLSH}
ITCLDEF=${SNITCLDEF}
ITCLTEST=${SNITCLTEST}
ITCLIMPORTLIB=${SNIMPORTLIB}
ITCLRES=${SNITCLRES}
ITCLSHRES=${SNITCLSHRES}
fi

ITCL_SH="`pwd`/${ITCLSH}"
if ! test "$GCC" = yes; then
    tmp="`cygpath --windows $ITCL_SH`"
    ITCL_SH="`echo $tmp | sed -e s#\\\\\\\\#/#g`"
fi


#--------------------------------------------------------------------
#   The statements below define a collection of symbols related to
#   building libitcl as a shared library instead of a static library.
#--------------------------------------------------------------------

AC_ARG_ENABLE(shared,
    [  --enable-shared         build libitcl as a shared library],
    [ok=$enableval], [ok=no])
if test "$ok" = "yes" -a "${SHLIB_SUFFIX}" != ""; then
    ITCL_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
    eval "ITCL_LIB_FILE=libitcl${VERSION}${SHLIB_SUFFIX}"
    ITCL_PKG_FILE="[[file join [file dirname \$dir] ${ITCL_LIB_FILE}]]"
    MAKE_LIB="\${SHLIB_LD} -o ${ITCL_LIB_FILE} \${OBJS} ${SHLIB_LD_LIBS}"
    RANLIB=":"
else
    ITCL_SHLIB_CFLAGS=""
    eval "ITCL_LIB_FILE=libitcl${VERSION}.a"
    ITCL_PKG_FILE=""
    MAKE_LIB="ar cr ${ITCL_LIB_FILE} \${OBJS}"
fi

# Note:  in the following variable, it's important to use the absolute
# path name of the Tcl directory rather than "..":  this is because
# AIX remembers this path and will attempt to use it at run-time to look
# up the Tcl library.

if test "$GCC" = yes; then
    ITCL_BUILD_LIB_SPEC="-L`pwd` -l${ITCLLIBSPEC}"
    ITCL_LIB_SPEC="-L${exec_prefix}/lib/itcl -l{ITCLLIBSPEC}"
    ITCL_LIB_FULL_PATH="`pwd`/${ITCLLIB}"
else
    tmp="`pwd`/${ITCLLIB}"
    tmp2="`cygpath --windows $tmp`"
    ITCL_BUILD_LIB_SPEC="`echo $tmp2 | sed -e s#\\\\\\\\#/#g`"
    ITCL_LIB_FULL_PATH=${ITCL_BUILD_LIB_SPEC}
    tmp="${exec_prefix}/lib/itcl/${ITCLLIB}"
    tmp2="`cygpath --windows $tmp`"
    ITCL_LIB_SPEC="`echo $tmp2 | sed -e s#\\\\\\\\#/#g`"
fi

#-------------------------------------------------------------------
# Set up the libraries to link with.
#-------------------------------------------------------------------
if test "$GCC" = yes; then
    BASELIBS="-lkernel32 $(optlibs) -ladvapi32 -luser32"
    WINLIBS="-lgdi32 -lcomdlg32 -lwinspool"
    LIBCDLL=
else
    BASELIBS="kernel32.lib advapi32.lib user32.lib"
    WINLIBS="gdi32.lib comdlg32.lib winspool.lib"
    LIBCDLL="msvcrt.lib oldnames.lib"
fi

AC_SUBST(CFLAGS)
AC_SUBST(DL_LIBS)
AC_SUBST(LD_FLAGS)
AC_SUBST(MATH_LIBS)
AC_SUBST(MAKE_LIB)
AC_SUBST(SHLIB_CFLAGS)
AC_SUBST(SHLIB_LD)
AC_SUBST(SHLIB_LD_LIBS)
AC_SUBST(SHLIB_SUFFIX)
AC_SUBST(SHLIB_VERSION)
AC_SUBST(TCL_BIN_DIR)
AC_SUBST(TCL_BUILD_LIB_SPEC)
AC_SUBST(TCL_SRC_DIR)
AC_SUBST(TCL_VERSION)
AC_SUBST(TCL_LIB_FILE)
AC_SUBST(TCL_LIB_FULL_PATH)
AC_SUBST(ITCL_BUILD_LIB_SPEC)
AC_SUBST(ITCL_LD_SEARCH_FLAGS)
AC_SUBST(ITCL_LIB_FILE)
AC_SUBST(ITCL_LIB_FULL_PATH)
AC_SUBST(ITCL_LIB_SPEC)
AC_SUBST(ITCL_MAJOR_VERSION)
AC_SUBST(ITCL_MINOR_VERSION)
AC_SUBST(ITCL_PKG_FILE)
AC_SUBST(ITCL_SHLIB_CFLAGS)
AC_SUBST(ITCL_SRC_DIR)
AC_SUBST(ITCL_VERSION)
AC_SUBST(CYGITCLLIB)
AC_SUBST(CYGITCLDLL)
AC_SUBST(CYGITCLSH)
AC_SUBST(CYGITCLDEF)
AC_SUBST(CYGITCLTEST)
AC_SUBST(CYGIMPORTLIB)
AC_SUBST(CYGITCLRES)
AC_SUBST(CYGITCLSHRES)
AC_SUBST(SNITCLLIB)
AC_SUBST(SNITCLDLL)
AC_SUBST(SNITCLSH)
AC_SUBST(SNITCLDEF)
AC_SUBST(SNITCLTEST)
AC_SUBST(SNIMPORTLIB)
AC_SUBST(SNITCLRES)
AC_SUBST(SNITCLSHRES)
AC_SUBST(ITCLLIB)
AC_SUBST(ITCLDLL)
AC_SUBST(ITCLSH)
AC_SUBST(ITCLDEF)
AC_SUBST(ITCLTEST)
AC_SUBST(ITCLIMPORTLIB)
AC_SUBST(ITCLRES)
AC_SUBST(ITCL_SH)
AC_SUBST(BASELIBS)
AC_SUBST(WINLIBS)
AC_SUBST(LIBCDLL)

AC_OUTPUT(Makefile ../unix/pkgIndex.tcl ../itclConfig.sh)

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.