CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 418344
AC_INIT(configure)

#if test "x$CFLAGS" = "x" ;  then
#  CFLAGS=${COPTS}
#fi
AC_SUBST(COPTS)

AC_CHECK_SIZEOF(void *, 4)

AC_ARG_VAR(ABI, [Set this equal to 32 or 64 to build GAP (and GMP provided you
 		 do not deselect it) in 32- or 64-bit mode. The default value
		 for this option is determined by testing the behaviour of your
		 compiler, so should be 32 on a 32-bit system and 64 on one
		 which is 64-bit. If this is unset, the build system will set
		 a value of 64 or 32 depending of the pointer size of the host.])

AC_MSG_CHECKING([ABI bit size])
if test "x$ABI" = "x" ;  then
  if test $ac_cv_sizeof_void_p = 8; then
    ABI="64"
  else
    ABI="32"
  fi
  ABI_CFLAGS=""
elif test "$ABI" = "64"; then
  if test $ac_cv_sizeof_void_p = 4; then
    AC_MSG_ERROR([ ABI=64 cannot be used on a 32-bit system.
                   Please replace this value with 32 and retry configure.
                   If you think this error is wrong, email
                   [email protected] with full details.])
  else
    ABI_CFLAGS="-m64"
  fi
elif test "$ABI" = "32"; then
  ABI_CFLAGS="-m32"
else
  AC_MSG_WARN([ $ABI is not a supported value for ABI. The supported values are ABI=64
                 or 32.])
fi

AC_MSG_RESULT([$ABI])

AC_SUBST(ABI)
AC_SUBST(ABI_CFLAGS)

gp_configure_options=$ac_configure_args
AC_SUBST(gp_configure_options)
AC_CONFIG_AUX_DIR(cnf)
AC_CANONICAL_TARGET
AC_PROG_CC
BASECC=`basename ${CC}`
AC_SUBST(BASECC)
AC_PROG_MAKE_SET
AC_SUBST(gapdir)
gapdir=`pwd`

case $target_os in
  cygwin*)
    AC_SUBST(wingapdir)
    wingapdir=$(cygpath -w $(pwd))
    AC_SUBST(wincygbin)
    wincygbin=$(cygpath -w /bin)
    gapdir=$(echo /proc/cygdrive/"$(cygpath -am $(pwd))" | sed -e 's/:\//\//g')
esac

AC_ARG_VAR(CONFIGNAME,[Supply a (meaningful) name for the configuration you are building.
    This name will be appended to the architecture-dependent named
    sub-directory of bin/. Allows for multiple configurations side by
    side. Default value is "defaultXX" where "XX" is 32 or 64.])

AC_MSG_CHECKING([GAP config name])
if test "x$CONFIGNAME" = "x"; then
  CONFIGNAME="default${ABI}"
fi
AC_MSG_RESULT([$CONFIGNAME])
AC_SUBST(CONFIGNAME)

GAPARCH=$target-$BASECC-${CONFIGNAME}
AC_SUBST(GAPARCH)

AC_ARG_WITH(gmp,
  AC_HELP_STRING( [--with-gmp],
    [ Use GMP library.
      If the argument you supply is "yes" or <empty>, then the version of GMP bundled with this GAP will be used (default).
      If the argument is "system" that means the library is reachable with the standard
      search path "/usr" or "/usr/local".
      Otherwise you give the <path> to the directory which contains the library.
      If the argument is no, use original GAP large integers instead of GMP.
      [[default=yes]]
    ]),
  [ ],
  [ with_gmp=yes ]
)

USE_GMP=yes
case "$with_gmp" in
  no)
    GMP_CFLAGS=""
    GMP_LIBS=""
    MAKE_GMP=""
    USE_GMP=no
    ;;
  yes | 6.0.0a | 5.0.5 | 5.0.4)
    if test "$with_gmp" = "yes" ; then
      with_gmp="6.0.0a"
    fi;
    GMP_HOME="`pwd`/bin/$GAPARCH/extern/gmp"
    GMP_CFLAGS="-I${GMP_HOME}/include"
    GMP_LIBS="${GMP_HOME}/lib/libgmp.a"
    MAKE_GMP="gmp"
    GMP_VER="$with_gmp"
    ;;
  system)
    GMP_CFLAGS="${ABI_CFLAGS}"
    GMP_LIBS="-lgmp"
    MAKE_GMP=""
    ;;
  *)
    # user specified directory
    GMP_HOME="$with_gmp"
	if test -d ${GMP_HOME}/include && test -f ${GMP_HOME}/lib/libgmp.a ; then
      GMP_CFLAGS="-I${GMP_HOME}/include"
      GMP_LIBS="${GMP_HOME}/lib/libgmp.a"
    else
      AC_MSG_ERROR([Could not locate GMP in the specified location])
    fi;
    MAKE_GMP=""
    ;;
esac

if test "$MAKE_GMP" = "gmp" ; then
  if ! test $ac_cv_sizeof_void_p = 4; then
    if test "$ac_cv_prog_ac_ct_CC" = gcc ; then
      if test `gcc -dumpversion` = "4.3.2" ; then
        AC_MSG_ERROR([The version of gcc found on your system is known to
                       miscompile GMP on 64-bit machines. Please use another
                       compiler or build GAP without GMP.])
      fi
    fi
  fi
  AC_CHECK_PROG(m4_PRESENT,m4,yes,no)
  if test "$m4_PRESENT" = "no"; then
    AC_MSG_ERROR([You have requested that GAP be built with GMP but this
                   requires m4, which has not been detected on your system.
                   Please install m4 or build without GMP.])
  fi
  case "$target" in
    arm*)
      ABI="standard"
      ABI_CFLAGS=""
      ;;
  esac
fi

# Enabling/disabling readline is handled by the "inner" configure
# script in cnf/, so we do nothing here (the command line flag
# is automatically passed on to the "inner" configure script anyway.
AC_ARG_WITH(readline,[ --with-readline=yes|no|<path>
   Use readline library for command line editing.
 ],[],[])

AC_SUBST(GMP_CFLAGS)
AC_SUBST(GMP_LIBS)
AC_SUBST(MAKE_GMP)
AC_SUBST(USE_GMP)
AC_SUBST(GMP_VER)

mkdir -p bin
AC_CONFIG_FILES([Makefile-${CONFIGNAME}:Makefile.in
                 sysinfo.gap-${CONFIGNAME}:sysinfo.in
                 bin/gap-${CONFIGNAME}.sh:gap.shi])

case $target_os in
  cygwin*)
    AC_CONFIG_FILES([bin/gap.bat:cnf/gap.bai
                     bin/gapcmd.bat:cnf/gapcmd.bai
                     bin/gaprxvt.bat:cnf/gaprxvt.bai])
esac

AC_OUTPUT

ln -sf gap-${CONFIGNAME}.sh bin/gap.sh
ln -sf Makefile-${CONFIGNAME} Makefile
ln -sf sysinfo.gap-${CONFIGNAME} sysinfo.gap