[m-rev.] for review: Fix three hwloc related build system problems.
Paul Bone
pbone at csse.unimelb.edu.au
Thu Nov 3 14:02:09 AEDT 2011
For post-commit review by Julien, this is a resubmission of my previous attempt
to fix hwloc related changes.
---
Fix three hwloc related build system problems, these were raised in code
reviews.
The configure script now supports the --without-hwloc option to disable the use
of hwloc, even if it is installed.
configure.in:
Allow the use of libhwloc to be disabled with the --without-hwloc option.
Distribute the autoconf macros for pkg-config with Mercury.
This allows mercury to be compiled from CVS on hosts that don't have these
macros in their autoconf installation.
acinclude.m4:
m4/mercury.m4:
Moved acinclude.m4 to m4/mercury.m4. This file contains mercury-specific
macros.
m4/pkg.m4:
Copied pkg.m4 from the autoconf installation on taura. This file contains
pkg-config macros.
INSTALL_CVS:
Mmakefile:
tools/test_mercury:
When calling aclocal pass the -I m4 option.
tools/bootcheck:
Create a link to the m4 directory when setting up stage directories.
Fix static linking with mmc --make and hwloc.
compiler/compile_target_code.m:
Conform to changes in scripts/ml.in (where static linking and hwloc is
already handled correctly).
compiler/options.m:
Create new options so that Mercury.config can tell mmc what options are
needed for linking to hwloc.
scripts/Mercury.config:
Pass hwloc linking options to the compiler.
Index: INSTALL_CVS
===================================================================
RCS file: /home/mercury1/repository/mercury/INSTALL_CVS,v
retrieving revision 1.10
diff -u -p -b -r1.10 INSTALL_CVS
--- INSTALL_CVS 13 Oct 2011 02:42:19 -0000 1.10
+++ INSTALL_CVS 3 Nov 2011 02:56:32 -0000
@@ -40,7 +40,7 @@
parallel=-j3
-aclocal &&
+aclocal -I m4 &&
autoconf &&
./configure &&
touch Mmake.params &&
Index: Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmakefile,v
retrieving revision 1.146
diff -u -p -b -r1.146 Mmakefile
--- Mmakefile 13 Oct 2011 02:42:19 -0000 1.146
+++ Mmakefile 3 Nov 2011 02:56:32 -0000
@@ -370,8 +370,8 @@ cleanint:
#-----------------------------------------------------------------------------#
-aclocal.m4: configure.in acinclude.m4
- aclocal
+aclocal.m4: configure.in $(wildcard m4/*.m4)
+ aclocal -I m4
configure: configure.in aclocal.m4
autoconf
Index: acinclude.m4
===================================================================
RCS file: acinclude.m4
diff -N acinclude.m4
--- acinclude.m4 31 Oct 2011 05:09:35 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,680 +0,0 @@
-#-----------------------------------------------------------------------------#
-# Copyright (C) 1999,2001-2004, 2006-2011 The University of Melbourne.
-# This file may only be copied under the terms of the GNU General
-# Public Licence - see the file COPYING in the Mercury distribution.
-#-----------------------------------------------------------------------------#
-#
-# aclocal.m4
-#
-# This file contains Mercury-specific autoconf tests.
-#
-# We ought to move most of the code in configure.in into this file...
-#
-#-----------------------------------------------------------------------------#
-AC_DEFUN(MERCURY_CHECK_FOR_HEADERS,
-[
- for mercury_cv_header in $1; do
- mercury_cv_header_define="MR_HAVE_`echo $mercury_cv_header | \
- tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"
- AC_CHECK_HEADER($mercury_cv_header, [
- AC_DEFINE_UNQUOTED($mercury_cv_header_define)
- eval "$mercury_cv_header_define=1"
- ])
- done
-])
-#-----------------------------------------------------------------------------#
-AC_DEFUN(MERCURY_CHECK_FOR_IEEEFP_H,
-[
- MERCURY_CHECK_FOR_HEADERS(ieeefp.h)
-])
-
-AC_DEFUN(MERCURY_CHECK_FOR_IEEE_FUNC,
-[
-AC_REQUIRE([MERCURY_CHECK_FOR_IEEEFP_H])
-AC_MSG_CHECKING(for $1 function)
-mercury_cv_ieee_func_define="MR_HAVE_`echo $1 | \
- tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"
-
-AC_TRY_LINK([
- #include <math.h>
-#ifdef MR_HAVE_IEEEFP_H
- #include <ieeefp.h>
-#endif
-],[
- float f;
- $1(f);
-],[mercury_cv_have_ieee_func=yes],[mercury_cv_have_ieee_func=no])
-
-if test "$mercury_cv_have_ieee_func" = yes; then
- AC_MSG_RESULT(yes)
- AC_DEFINE_UNQUOTED($mercury_cv_ieee_func_define)
-else
- AC_MSG_RESULT(no)
-fi
-])
-
-#-----------------------------------------------------------------------------#
-
-# Test for C99 fp environment functions in the math library.
-# The second argument to this macro should be the flags required by the
-# C compiler to link against the math library. This is needed because
-# some OSs, e.g. Mac OS X, don't have a separate math library.
-
-AC_DEFUN([MERCURY_CHECK_FOR_FENV_FUNC],
-[
-AC_MSG_CHECKING(for $1 function)
-mercury_cv_math_func_define="MR_HAVE_`echo $1 | \
- tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"
-
-save_libs="$LIBS"
-LIBS="$2 $LIBS"
-
-AC_TRY_LINK([
-#ifdef MR_HAVE_FENV_H
- #include <fenv.h>
-#endif
-],[
-
- int i = 0;
- $1(i);
-],[mercury_cv_have_math_func=yes],[mercury_cv_have_math_func=no])
-
-LIBS="$save_libs"
-
-if test "$mercury_cv_have_math_func" = "yes"
-then
- AC_MSG_RESULT([yes])
- AC_DEFINE_UNQUOTED([$mercury_cv_math_func_define])
-else
- AC_MSG_RESULT([no])
-fi
-])
-
-#-----------------------------------------------------------------------------#
-#
-# Turn off MacOS's so-called "smart" C preprocessor, if present,
-# since it causes lots of spurious warning messages,
-# and furthermore it takes way too long and uses way too much memory
-# when preprocessing the C code generated by the Mercury compiler's LLDS
-# back-end.
-#
-AC_DEFUN(MERCURY_CHECK_CC_NEEDS_TRAD_CPP,
-[
-AC_REQUIRE([AC_PROG_CC])
-AC_MSG_CHECKING(whether C compiler needs -no-cpp-precomp)
-AC_CACHE_VAL(mercury_cv_cpp_precomp, [
- >conftest.c
- if test "$GCC" = yes &&
- $CC -v -c conftest.c 2>&1 | \
- grep "cpp-precomp.*-smart" > /dev/null
- then
- mercury_cv_cpp_precomp=yes
- else
- mercury_cv_cpp_precomp=no
- fi
-])
-AC_MSG_RESULT($mercury_cv_cpp_precomp)
-if test $mercury_cv_cpp_precomp = yes; then
- CC="$CC -no-cpp-precomp"
-fi
-])
-#-----------------------------------------------------------------------------#
-#
-# Check whether we need to add any extra directories to the search path for
-# header files, and set ALL_LOCAL_C_INCL_DIRS to the -I option(s) needed
-# for this, if any.
-#
-# GNU C normally searches /usr/local/include by default;
-# to keep things consistent, we do the same for other C compilers.
-#
-AC_DEFUN(MERCURY_CHECK_LOCAL_C_INCL_DIRS,
-[
-AC_REQUIRE([AC_PROG_CC])
-AC_MSG_CHECKING(whether to pass -I/usr/local/include to C compiler)
-ALL_LOCAL_C_INCL_DIRS=""
-ALL_LOCAL_C_INCL_DIR_MMC_OPTS=""
-
-if test "$GCC" = yes -o "$USING_MICROSOFT_CL_COMPILER" = yes; then
- # Don't add -I/usr/local/include, since it causes a warning
- # with gcc 3.1, and gcc already searches /usr/local/include.
- # Microsoft compilers don't understand Unix pathnames.
- AC_MSG_RESULT(no)
-else
- # It's some other compiler. We don't know if it searches
- # /usr/local/include by default, so add it.
- if test -d /usr/local/include/.; then
- AC_MSG_RESULT(yes)
- ALL_LOCAL_C_INCL_DIRS="-I/usr/local/include "
- ALL_LOCAL_C_INCL_DIR_MMC_OPTS="--c-include-directory /usr/local/include "
- else
- AC_MSG_RESULT(no)
- fi
-fi
-AC_SUBST(ALL_LOCAL_C_INCL_DIRS)
-AC_SUBST(ALL_LOCAL_C_INCL_DIR_MMC_OPTS)
-])
-#-----------------------------------------------------------------------------#
-#
-# Set ALL_LOCAL_C_LIB_DIRS to any extra directories we need to add to the
-# search path for libraries.
-#
-AC_DEFUN(MERCURY_CHECK_LOCAL_C_LIB_DIRS,
-[
-AC_MSG_CHECKING(whether to pass -L/usr/local/lib to the linker)
-
-# Microsoft compilers don't understand Unix pathnames.
-if test "$USING_MICROSOFT_CL_COMPILER" = no -a -d /usr/local/lib/.; then
- AC_MSG_RESULT(yes)
- ALL_LOCAL_C_LIB_DIRS=/usr/local/lib
- ALL_LOCAL_C_LIB_DIR_MMC_OPTS="-L/usr/local/lib -R/usr/local/lib"
-else
- AC_MSG_RESULT(no)
- ALL_LOCAL_C_LIB_DIRS=
- ALL_LOCAL_C_LIB_DIR_MMC_OPTS=
-fi
-AC_SUBST(ALL_LOCAL_C_LIB_DIRS)
-AC_SUBST(ALL_LOCAL_C_LIB_DIR_MMC_OPTS)
-])
-
-#-----------------------------------------------------------------------------#
-#
-# Check for readline and related header files and libraries
-#
-AC_DEFUN(MERCURY_CHECK_READLINE,
-[
-AC_ARG_WITH(readline,
-[ --without-readline Don't use the GPL'd GNU readline library],
-mercury_cv_with_readline="$withval", mercury_cv_with_readline=yes)
-
-if test "$mercury_cv_with_readline" = yes; then
-
- # check for the readline header files
- MERCURY_CHECK_FOR_HEADERS(readline/readline.h readline/history.h)
-
- # check for the libraries that readline depends on
- MERCURY_MSG('looking for termcap or curses (needed by readline)...')
- AC_CHECK_LIB(termcap, tgetent, mercury_cv_termcap_lib=-ltermcap,
- [AC_CHECK_LIB(curses, tgetent, mercury_cv_termcap_lib=-lcurses,
- [AC_CHECK_LIB(ncurses, tgetent, mercury_cv_termcap_lib=-lncurses,
- mercury_cv_termcap_lib='')])])
-
- # check for the readline library
- AC_CHECK_LIB(readline, readline, mercury_cv_have_readline=yes,
- mercury_cv_have_readline=no, $mercury_cv_termcap_lib)
-else
- mercury_cv_have_readline=no
-fi
-
-# Now figure out whether we can use readline, and define variables according.
-# Note that on most systems, we don't actually need the header files in
-# order to use readline. (Ain't C grand? ;-).
-
-if test $mercury_cv_have_readline = no; then
- TERMCAP_LIBRARY=""
- READLINE_LIBRARIES=""
- AC_DEFINE(MR_NO_USE_READLINE)
-else
- TERMCAP_LIBRARY="$mercury_cv_termcap_lib"
- READLINE_LIBRARIES="-lreadline $TERMCAP_LIBRARY"
-fi
-AC_SUBST(TERMCAP_LIBRARY)
-AC_SUBST(READLINE_LIBRARIES)
-
-])
-
-#-----------------------------------------------------------------------------#
-#
-# Microsoft.NET configuration
-#
-AC_DEFUN(MERCURY_CHECK_DOTNET,
-[
-AC_PATH_PROG(ILASM, ilasm)
-AC_PATH_PROG(GACUTIL, gacutil)
-
-AC_MSG_CHECKING(for Microsoft.NET Framework SDK)
-AC_CACHE_VAL(mercury_cv_microsoft_dotnet, [
-if test "$ILASM" != ""; then
- changequote(<<,>>)
- MS_DOTNET_SDK_DIR=`expr "$ILASM" : '\(.*\)[/\\]*[bB]in[/\\]*ilasm'`
- changequote([,])
- mercury_cv_microsoft_dotnet="yes"
-else
- MS_DOTNET_SDK_DIR=""
- mercury_cv_microsoft_dotnet="no"
-fi
-])
-AC_MSG_RESULT($mercury_cv_microsoft_dotnet)
-ILASM=`basename "$ILASM"`
-GACUTIL=`basename "$GACUTIL"`
-
-# Check for the C# (C sharp) compiler.
-# gmcs is the Mono C# compiler targeting the 2.0 runtime (with generics).
-# cscc is the DotGNU C# compiler.
-AC_PATH_PROGS(CSC, csc gmcs cscc)
-CSC=`basename "$CSC"`
-
-# We default to the Beta 2 version of the library
-mercury_cv_microsoft_dotnet_library_version=1.0.2411.0
-if test $mercury_cv_microsoft_dotnet = "yes" &&
- test "$CSC" != "";
-then
- AC_MSG_CHECKING(version of .NET libraries)
- cat > conftest.cs << EOF
- using System;
- using System.Reflection;
- public class version {
- public static void Main()
- {
- Assembly asm = Assembly.Load("mscorlib");
- AssemblyName name = asm.GetName();
- Version version = name.Version;
- Console.Write(version);
- Console.Write("\n");
- }
- }
-EOF
- if
- echo $CSC conftest.cs >&AC_FD_CC 2>&1 && \
- $CSC conftest.cs >&AC_FD_CC 2>&1 && \
- ./conftest > conftest.out 2>&1
- then
- mercury_cv_microsoft_dotnet_library_version=`cat conftest.out`
- AC_MSG_RESULT($mercury_cv_microsoft_dotnet_library_version)
- rm -f conftest*
- else
- rm -f conftest*
- if test "$enable_dotnet_grades" = "yes"; then
- AC_MSG_ERROR(unable to determine version)
- exit 1
- else
- AC_MSG_WARN(unable to determine version)
- fi
- fi
-fi
-MS_DOTNET_LIBRARY_VERSION=$mercury_cv_microsoft_dotnet_library_version
-
-# Check for the assembly linker.
-# ilalink is the DotGNU assembly linker.
-AC_PATH_PROGS(MS_AL, al ilalink)
-MS_AL=`basename "$MS_AL"`
-
-# Check for an implementation of the Common Language Infrastructure.
-AC_PATH_PROGS(CLI_INTERPRETER, mono)
-MONO=`basename "$CLI_INTERPRETER"`
-
-AC_SUBST(ILASM)
-AC_SUBST(GACUTIL)
-AC_SUBST(CSC)
-AC_SUBST(MS_AL)
-AC_SUBST(MS_DOTNET_SDK_DIR)
-AC_SUBST(MS_DOTNET_LIBRARY_VERSION)
-AC_SUBST(MS_VISUALCPP_DIR)
-AC_SUBST(CLI_INTERPRETER)
-])
-
-#-----------------------------------------------------------------------------#
-#
-# Java configuration
-#
-AC_DEFUN(MERCURY_CHECK_JAVA,
-[
-# jikes requires the usual Java SDK to run, so if we checked for javac first,
-# then that's what we'd get. If the user has jikes installed, then that
-# probably means that they want to use it, so we check for jikes before javac.
-# On Windows, the Java SDK has a high chance of being installed in a path
-# containing spaces. The simplest solution is to keep only the basename.
-# Everything will still work so long as the executables can be found on the
-# PATH later.
-AC_PATH_PROGS(JAVAC, jikes javac gcj)
-case "$JAVAC" in
- *" "*)
- JAVAC=`basename "$JAVAC"`
- ;;
-esac
-case "$JAVAC" in
- *gcj)
- JAVAC="$JAVAC -C"
- ;;
-esac
-AC_PATH_PROG(JAVA_INTERPRETER, java gij)
-case "$JAVA_INTERPRETER" in
- *" "*)
- JAVA_INTERPRETER=`basename "$JAVA_INTERPRETER"`
- ;;
-esac
-AC_PATH_PROG(JAR, jar)
-case "$JAR" in
- *" "*)
- JAR=`basename "$JAR"`
- ;;
-esac
-
-AC_CACHE_VAL(mercury_cv_java, [
-if test "$JAVAC" != "" -a "$JAVA_INTERPRETER" != "" -a "$JAR" != ""; then
- AC_MSG_CHECKING(if the above Java SDK works and is sufficiently recent)
- cat > conftest.java << EOF
- // This program simply retrieves the constant
- // specifying the version number of the Java SDK and
- // checks it is at least 1.5, printing "Hello, world"
- // if successful.
- public class conftest {
- public static void main (String[[]] args) {
- float version;
- String strVer = System.getProperty(
- "java.specification.version");
-
- try {
- version = Float.valueOf(strVer).floatValue();
- }
- catch (NumberFormatException e) {
- System.out.println("ERROR: \"java." +
- "specification.version\" " +
- "constant has incorrect " +
- "format.\nGot \"" + strVer +
- "\", expected a number.");
- version = 0f;
- }
-
- if (version >= 1.5f) {
- System.out.println("Hello, world\n");
- } else {
- System.out.println("Nope, sorry.\n");
- }
- }
- }
-EOF
- if
- echo "$JAVAC" conftest.java >&AC_FD_CC 2>&1 &&
- "$JAVAC" conftest.java >&AC_FD_CC 2>&1 &&
- echo "$JAVA_INTERPRETER" conftest > conftest.out 2>&AC_FD_CC &&
- CLASSPATH=. "$JAVA_INTERPRETER" conftest > conftest.out 2>&AC_FD_CC &&
- test "`tr -d '\015' < conftest.out`" = "Hello, world"
- then
- mercury_cv_java="yes"
- else
- mercury_cv_java="no"
- fi
- AC_MSG_RESULT($mercury_cv_java)
-else
- if test "$JAVAC" = ""; then
- JAVAC="javac"
- fi
- if test "$JAVA_INTERPRETER" = ""; then
- JAVA_INTERPRETER="java"
- fi
- if test "$JAR" = ""; then
- JAR="jar"
- fi
- mercury_cv_java="no"
-fi
-])
-
-AC_SUBST(JAVAC)
-AC_SUBST(JAVA_INTERPRETER)
-AC_SUBST(JAR)
-])
-
-AC_DEFUN(MERCURY_CHECK_JAVAC_HEAP_SIZE,
-[
-# The default maximum heap size is too small to build the standard library and
-# other programs so we need to increase it. The option to do that is
-# non-standard so we have to check that it is accepted.
-AC_CACHE_VAL(mercury_cv_javac_flags_for_heap_size, [
-if test "$mercury_cv_java" = "yes"; then
- AC_MSG_CHECKING(if the Java compiler accepts the max heap size option)
- mercury_cv_javac_flags_for_heap_size="-J-Xmx256m"
- if "$JAVAC" "$mercury_cv_javac_flags_for_heap_size" -version \
- 2> /dev/null
- then
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- mercury_cv_javac_flags_for_heap_size=
- fi
-else
- mercury_cv_javac_flags_for_heap_size=
-fi
-])
-])
-
-#-----------------------------------------------------------------------------#
-#
-# Erlang configuration
-#
-
-# copy of AC_ERLANG_PATH_ERLC from autoconf-2.60
-AC_DEFUN([MERCURY_ERLANG_PATH_ERLC],
-[AC_ARG_VAR([ERLC], [Erlang/OTP compiler command [autodetected]])dnl
-if test -n "$ERLC"; then
- AC_MSG_CHECKING([for erlc])
- AC_MSG_RESULT([$ERLC])
-else
- AC_PATH_TOOL(ERLC, erlc, [$1], [$2])
-fi
-AC_ARG_VAR([ERLCFLAGS], [Erlang/OTP compiler flags [none]])dnl
-])
-
-# copy of AC_ERLANG_PATH_ERL from autoconf-2.60
-AC_DEFUN([MERCURY_ERLANG_PATH_ERL],
-[AC_ARG_VAR([ERL], [Erlang/OTP interpreter command [autodetected]])dnl
-if test -n "$ERL"; then
- AC_MSG_CHECKING([for erl])
- AC_MSG_RESULT([$ERL])
-else
- AC_PATH_TOOL(ERL, erl, [$1], [$2])[]dnl
-fi
-])
-
-AC_DEFUN(MERCURY_CHECK_ERLANG,
-[
-MERCURY_ERLANG_PATH_ERLC
-MERCURY_ERLANG_PATH_ERL
-
-if test "$ERLC" != "" -a "$ERL" != ""; then
- mercury_cv_erlang="yes"
-else
- mercury_cv_erlang="no"
-fi
-
-AC_SUBST(ERLC)
-AC_SUBST(ERL)
-])
-
-#-----------------------------------------------------------------------------#
-
-# NOTE: updates to this macro may need to be reflected in compiler/globals.m.
-
-AC_DEFUN([MERCURY_GCC_VERSION], [
-AC_REQUIRE([AC_PROG_CC])
-
-cat > conftest.c << EOF
-
-#include <stdio.h>
-
-int main(int argc, char **argv)
-{
-
-#if defined(__GNUC__)
- printf("%d_", __GNUC__);
- #if defined(__GNUC_MINOR__)
- printf("%d_", __GNUC_MINOR__);
- #else
- printf("u_");
- #endif /* ! __GNUC_MINOR__ */
- #if defined(__GNUC_PATCHLEVEL__)
- printf("%d", __GNUC_PATCHLEVEL__);
- #else
- printf("u");
- #endif /* ! __GNUC_PATCHLEVEL__ */
-#endif /* __GNUC__ */
-
- return 0;
-}
-EOF
-
-echo "$CC -o conftest contest.c" >&AC_FD_CC 2>&1
-if
- $CC -o conftest conftest.c
-then
- mercury_cv_gcc_version=`./conftest`
-else
- # This shouldn't happen as we have already checked for this.
- AC_MSG_ERROR([unexpected: $CC cannot create executable])
-fi
-])
-
-#-----------------------------------------------------------------------------#
-
-# Work out the C compiler type using a stronger test than AC_PROG_CC to
-# distinguish between clang and gcc.
-# (We don't handle lcc here - I don't think that it's possible to.)
-
-AC_DEFUN([MERCURY_CC_TYPE], [
-AC_REQUIRE([AC_PROG_CC])
-AC_MSG_CHECKING([what the C compiler type really is])
-
-# MSVC uses different command line options to most other C compilers.
-# Try to determine whether CC is MSVC based on the usage message.
-#
-$CC 2>&1 | grep -q "^Microsoft"
-if test $? -eq 0
-then
- cc_out_opt="-Fe"
- nologo_opt="-nologo"
-else
- cc_out_opt="-o "
- nologo_opt=
-fi
-
-cat > conftest.c << EOF
-
-#include <stdio.h>
-
-int main(int argc, char **argv)
-{
- #if defined(__clang__)
- printf("clang");
- #elif defined(__GNUC__)
- printf("gcc");
- #elif defined(_MSC_VER)
- printf("msvc");
- #else
- printf("unknown");
- #endif
-
- return 0;
-}
-EOF
-
-echo "$CC $nologo_opt ${cc_out_opt}conftest conftest.c" >&AC_FD_CC 2>&1
-if
- # We direct the output to /dev/null because it's appears to be the
- # only way to shut some C compilers up.
- $CC $nologo_opt ${cc_out_opt}conftest conftest.c 2>&1 > /dev/null
-then
- mercury_cv_cc_type=`./conftest`
-else
- # This shouldn't happen as we have already checked for this.
- AC_MSG_ERROR([unexpected: $CC cannot create executable])
-fi
-
-AC_MSG_RESULT([$mercury_cv_cc_type])
-])
-
-#-----------------------------------------------------------------------------#
-
-AC_DEFUN([MERCURY_CLANG_VERSION], [
-AC_REQUIRE([AC_PROG_CC])
-
-cat > conftest.c << EOF
-
-#include <stdio.h>
-
-int main(int argc, char **argv)
-{
-
- printf("%d_%d_%d", __clang_major__, __clang_minor__, __clang_patchlevel__);
- return 0;
-}
-EOF
-
-echo "$CC -o conftest contest.c" >&AC_FD_CC 2>&1
-if
- $CC -o conftest conftest.c
-then
- mercury_cv_clang_version=`./conftest`
-else
- # This shouldn't happen as we have already checked for this.
- AC_MSG_ERROR([unexpected: $CC cannot create executable])
-fi
-])
-
-#-----------------------------------------------------------------------------#
-
-AC_DEFUN([MERCURY_MSVC_VERSION], [
-AC_REQUIRE([AC_PROG_CC])
-
-cat > conftest.c << EOF
-
-#include <stdio.h>
-
-int main(int argc, char **argv)
-{
-
- printf("%d", _MSC_VER);
- return 0;
-}
-EOF
-
-echo "$CC conftest.c -Fecontest" >&AC_FD_CC 2>&1
-if
- $CC conftest.c -Feconftest > /dev/null
-then
- mercury_cv_msvc_version=`./conftest`
-else
- # This shouldn't happen as we have already checked for this.
- AC_MSG_ERROR([unexpected: $CC cannot create executable])
-fi
-])
-
-#-----------------------------------------------------------------------------#
-#
-# Check if the POSIX threads library is pthreads-win32.
-#
-
-AC_DEFUN([MERCURY_HAVE_PTHREADS_WIN32], [
-
-AC_MSG_CHECKING([if we are using pthreads-win32])
-
-cat > conftest.c << EOF
-
-#include <pthread.h>
-#include <stdio.h>
-
-int main(int argc, char **argv)
-{
-
-#if defined(PTW32_VERSION)
- return 0;
-#else
- return 1;
-#endif
-
-}
-
-EOF
-
-echo "$CC -o conftest contest.c" >&AC_FD_CC 2>&1
-if
- $CC -o conftest conftest.c
-then
- mercury_cv_have_pthreads_win32="yes"
-else
- mercury_cv_have_pthreads_win32="no"
-fi
-
-AC_MSG_RESULT($mercury_cv_have_pthreads_win32)
-
-])
-
-#-----------------------------------------------------------------------------#
Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.601
diff -u -p -b -r1.601 configure.in
--- configure.in 25 Oct 2011 13:57:01 -0000 1.601
+++ configure.in 3 Nov 2011 02:56:31 -0000
@@ -5111,7 +5111,16 @@ MERCURY_CHECK_READLINE
# Check for libhwloc, http://www.open-mpi.org/projects/hwloc/
#
PKG_PROG_PKG_CONFIG
-PKG_CHECK_MODULES(libhwloc, hwloc >= 1.0,
+
+AC_ARG_WITH([hwloc],
+ [AS_HELP_STRING([--without-hwloc],
+ [Do not use libhwloc to detect the processors available in low-level C
+ parallel grades.])],
+ [],
+ [with_hwloc=check])
+
+if test "$with_hwloc" != "no"; then
+ PKG_CHECK_MODULES(libhwloc, hwloc >= 1.0,
[
AC_DEFINE(MR_HAVE_HWLOC)
hwloc_static_libs="`pkg-config --libs --static hwloc`"
@@ -5127,6 +5136,12 @@ PKG_CHECK_MODULES(libhwloc, hwloc >= 1.0
esac
hwloc_static_libs=""
])
+else
+ libhwloc_LIBS=""
+ libhwloc_CFLAGS=""
+ libhwloc_static_libs=""
+fi
+
HWLOC_LIBS="$libhwloc_LIBS"
HWLOC_CFLAGS="$libhwloc_CFLAGS"
HWLOC_STATIC_LIBS="$hwloc_static_libs"
Index: compiler/compile_target_code.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/compile_target_code.m,v
retrieving revision 1.177
diff -u -p -b -r1.177 compile_target_code.m
--- compiler/compile_target_code.m 25 Oct 2011 13:57:02 -0000 1.177
+++ compiler/compile_target_code.m 3 Nov 2011 02:56:32 -0000
@@ -1894,10 +1894,29 @@ link_exe_or_shared_lib(Globals, ErrorStr
use_thread_libs(Globals, UseThreadLibs),
(
UseThreadLibs = yes,
- globals.lookup_string_option(Globals, ThreadFlagsOpt, ThreadOpts)
+ globals.lookup_string_option(Globals, ThreadFlagsOpt, ThreadOpts),
+
+ % Determine which options are needed to link to libhwloc, if libhwloc
+ % is used at all.
+ globals.lookup_bool_option(Globals, highlevel_code, HighLevelCode),
+ (
+ HighLevelCode = yes,
+ HwlocOpts = ""
+ ;
+ HighLevelCode = no,
+ ( Linkage = "shared" ->
+ HwlocFlagsOpt = hwloc_libs
+ ; Linkage = "static" ->
+ HwlocFlagsOpt = hwloc_static_libs
+ ;
+ unexpected($module, $pred, "Invalid linkage")
+ ),
+ globals.lookup_string_option(Globals, HwlocFlagsOpt, HwlocOpts)
+ )
;
UseThreadLibs = no,
- ThreadOpts = ""
+ ThreadOpts = "",
+ HwlocOpts = ""
),
% Find the Mercury standard libraries.
@@ -2014,6 +2033,7 @@ link_exe_or_shared_lib(Globals, ErrorStr
LDFlags, " ",
LinkLibraries, " ",
MercuryStdLibs, " ",
+ HwlocOpts, " ",
SystemLibs], LinkCmd),
globals.lookup_bool_option(Globals, demangle, Demangle),
Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.705
diff -u -p -b -r1.705 options.m
--- compiler/options.m 24 Oct 2011 14:09:23 -0000 1.705
+++ compiler/options.m 3 Nov 2011 02:56:32 -0000
@@ -915,6 +915,8 @@
; filtercc_command
; trace_libs
; thread_libs
+ ; hwloc_libs
+ ; hwloc_static_libs
; shared_libs
; math_lib
; readline_libs
@@ -1795,6 +1797,8 @@ option_defaults_2(link_option, [
filtercc_command - string("mfiltercc"),
trace_libs - string(""),
thread_libs - string(""),
+ hwloc_libs - string(""),
+ hwloc_static_libs - string(""),
shared_libs - string(""),
math_lib - string(""),
readline_libs - string(""),
@@ -2739,6 +2743,8 @@ long_option("demangle-command", dema
long_option("filtercc-command", filtercc_command).
long_option("trace-libs", trace_libs).
long_option("thread-libs", thread_libs).
+long_option("hwloc-libs", hwloc_libs).
+long_option("hwloc-static-libs", hwloc_static_libs).
long_option("shared-libs", shared_libs).
long_option("math-lib", math_lib).
long_option("readline-libs", readline_libs).
@@ -5569,6 +5575,7 @@ options_help_link -->
% --mkinit-command, --demangle-command, --filtercc-command,
% --trace-libs,
% --thread-libs, --shared-libs, --math-lib, --readline-libs,
+ % --hwloc-libs, --hwloc-static-libs,
% --linker-opt-separator,
% --linker-debug-flags, --shlib-linker-debug-flags,
% --linker-trace-flags, --shlib-linker-trace-flags,
Index: m4/mercury.m4
===================================================================
RCS file: m4/mercury.m4
diff -N m4/mercury.m4
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ m4/mercury.m4 3 Nov 2011 02:56:32 -0000
@@ -0,0 +1,680 @@
+#-----------------------------------------------------------------------------#
+# Copyright (C) 1999,2001-2004, 2006-2011 The University of Melbourne.
+# This file may only be copied under the terms of the GNU General
+# Public Licence - see the file COPYING in the Mercury distribution.
+#-----------------------------------------------------------------------------#
+#
+# aclocal.m4
+#
+# This file contains Mercury-specific autoconf tests.
+#
+# We ought to move most of the code in configure.in into this file...
+#
+#-----------------------------------------------------------------------------#
+AC_DEFUN(MERCURY_CHECK_FOR_HEADERS,
+[
+ for mercury_cv_header in $1; do
+ mercury_cv_header_define="MR_HAVE_`echo $mercury_cv_header | \
+ tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"
+ AC_CHECK_HEADER($mercury_cv_header, [
+ AC_DEFINE_UNQUOTED($mercury_cv_header_define)
+ eval "$mercury_cv_header_define=1"
+ ])
+ done
+])
+#-----------------------------------------------------------------------------#
+AC_DEFUN(MERCURY_CHECK_FOR_IEEEFP_H,
+[
+ MERCURY_CHECK_FOR_HEADERS(ieeefp.h)
+])
+
+AC_DEFUN(MERCURY_CHECK_FOR_IEEE_FUNC,
+[
+AC_REQUIRE([MERCURY_CHECK_FOR_IEEEFP_H])
+AC_MSG_CHECKING(for $1 function)
+mercury_cv_ieee_func_define="MR_HAVE_`echo $1 | \
+ tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"
+
+AC_TRY_LINK([
+ #include <math.h>
+#ifdef MR_HAVE_IEEEFP_H
+ #include <ieeefp.h>
+#endif
+],[
+ float f;
+ $1(f);
+],[mercury_cv_have_ieee_func=yes],[mercury_cv_have_ieee_func=no])
+
+if test "$mercury_cv_have_ieee_func" = yes; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE_UNQUOTED($mercury_cv_ieee_func_define)
+else
+ AC_MSG_RESULT(no)
+fi
+])
+
+#-----------------------------------------------------------------------------#
+
+# Test for C99 fp environment functions in the math library.
+# The second argument to this macro should be the flags required by the
+# C compiler to link against the math library. This is needed because
+# some OSs, e.g. Mac OS X, don't have a separate math library.
+
+AC_DEFUN([MERCURY_CHECK_FOR_FENV_FUNC],
+[
+AC_MSG_CHECKING(for $1 function)
+mercury_cv_math_func_define="MR_HAVE_`echo $1 | \
+ tr abcdefghijklmnopqrstuvwxyz./ ABCDEFGHIJKLMNOPQRSTUVWXYZ__`"
+
+save_libs="$LIBS"
+LIBS="$2 $LIBS"
+
+AC_TRY_LINK([
+#ifdef MR_HAVE_FENV_H
+ #include <fenv.h>
+#endif
+],[
+
+ int i = 0;
+ $1(i);
+],[mercury_cv_have_math_func=yes],[mercury_cv_have_math_func=no])
+
+LIBS="$save_libs"
+
+if test "$mercury_cv_have_math_func" = "yes"
+then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE_UNQUOTED([$mercury_cv_math_func_define])
+else
+ AC_MSG_RESULT([no])
+fi
+])
+
+#-----------------------------------------------------------------------------#
+#
+# Turn off MacOS's so-called "smart" C preprocessor, if present,
+# since it causes lots of spurious warning messages,
+# and furthermore it takes way too long and uses way too much memory
+# when preprocessing the C code generated by the Mercury compiler's LLDS
+# back-end.
+#
+AC_DEFUN(MERCURY_CHECK_CC_NEEDS_TRAD_CPP,
+[
+AC_REQUIRE([AC_PROG_CC])
+AC_MSG_CHECKING(whether C compiler needs -no-cpp-precomp)
+AC_CACHE_VAL(mercury_cv_cpp_precomp, [
+ >conftest.c
+ if test "$GCC" = yes &&
+ $CC -v -c conftest.c 2>&1 | \
+ grep "cpp-precomp.*-smart" > /dev/null
+ then
+ mercury_cv_cpp_precomp=yes
+ else
+ mercury_cv_cpp_precomp=no
+ fi
+])
+AC_MSG_RESULT($mercury_cv_cpp_precomp)
+if test $mercury_cv_cpp_precomp = yes; then
+ CC="$CC -no-cpp-precomp"
+fi
+])
+#-----------------------------------------------------------------------------#
+#
+# Check whether we need to add any extra directories to the search path for
+# header files, and set ALL_LOCAL_C_INCL_DIRS to the -I option(s) needed
+# for this, if any.
+#
+# GNU C normally searches /usr/local/include by default;
+# to keep things consistent, we do the same for other C compilers.
+#
+AC_DEFUN(MERCURY_CHECK_LOCAL_C_INCL_DIRS,
+[
+AC_REQUIRE([AC_PROG_CC])
+AC_MSG_CHECKING(whether to pass -I/usr/local/include to C compiler)
+ALL_LOCAL_C_INCL_DIRS=""
+ALL_LOCAL_C_INCL_DIR_MMC_OPTS=""
+
+if test "$GCC" = yes -o "$USING_MICROSOFT_CL_COMPILER" = yes; then
+ # Don't add -I/usr/local/include, since it causes a warning
+ # with gcc 3.1, and gcc already searches /usr/local/include.
+ # Microsoft compilers don't understand Unix pathnames.
+ AC_MSG_RESULT(no)
+else
+ # It's some other compiler. We don't know if it searches
+ # /usr/local/include by default, so add it.
+ if test -d /usr/local/include/.; then
+ AC_MSG_RESULT(yes)
+ ALL_LOCAL_C_INCL_DIRS="-I/usr/local/include "
+ ALL_LOCAL_C_INCL_DIR_MMC_OPTS="--c-include-directory /usr/local/include "
+ else
+ AC_MSG_RESULT(no)
+ fi
+fi
+AC_SUBST(ALL_LOCAL_C_INCL_DIRS)
+AC_SUBST(ALL_LOCAL_C_INCL_DIR_MMC_OPTS)
+])
+#-----------------------------------------------------------------------------#
+#
+# Set ALL_LOCAL_C_LIB_DIRS to any extra directories we need to add to the
+# search path for libraries.
+#
+AC_DEFUN(MERCURY_CHECK_LOCAL_C_LIB_DIRS,
+[
+AC_MSG_CHECKING(whether to pass -L/usr/local/lib to the linker)
+
+# Microsoft compilers don't understand Unix pathnames.
+if test "$USING_MICROSOFT_CL_COMPILER" = no -a -d /usr/local/lib/.; then
+ AC_MSG_RESULT(yes)
+ ALL_LOCAL_C_LIB_DIRS=/usr/local/lib
+ ALL_LOCAL_C_LIB_DIR_MMC_OPTS="-L/usr/local/lib -R/usr/local/lib"
+else
+ AC_MSG_RESULT(no)
+ ALL_LOCAL_C_LIB_DIRS=
+ ALL_LOCAL_C_LIB_DIR_MMC_OPTS=
+fi
+AC_SUBST(ALL_LOCAL_C_LIB_DIRS)
+AC_SUBST(ALL_LOCAL_C_LIB_DIR_MMC_OPTS)
+])
+
+#-----------------------------------------------------------------------------#
+#
+# Check for readline and related header files and libraries
+#
+AC_DEFUN(MERCURY_CHECK_READLINE,
+[
+AC_ARG_WITH(readline,
+[ --without-readline Don't use the GPL'd GNU readline library],
+mercury_cv_with_readline="$withval", mercury_cv_with_readline=yes)
+
+if test "$mercury_cv_with_readline" = yes; then
+
+ # check for the readline header files
+ MERCURY_CHECK_FOR_HEADERS(readline/readline.h readline/history.h)
+
+ # check for the libraries that readline depends on
+ MERCURY_MSG('looking for termcap or curses (needed by readline)...')
+ AC_CHECK_LIB(termcap, tgetent, mercury_cv_termcap_lib=-ltermcap,
+ [AC_CHECK_LIB(curses, tgetent, mercury_cv_termcap_lib=-lcurses,
+ [AC_CHECK_LIB(ncurses, tgetent, mercury_cv_termcap_lib=-lncurses,
+ mercury_cv_termcap_lib='')])])
+
+ # check for the readline library
+ AC_CHECK_LIB(readline, readline, mercury_cv_have_readline=yes,
+ mercury_cv_have_readline=no, $mercury_cv_termcap_lib)
+else
+ mercury_cv_have_readline=no
+fi
+
+# Now figure out whether we can use readline, and define variables according.
+# Note that on most systems, we don't actually need the header files in
+# order to use readline. (Ain't C grand? ;-).
+
+if test $mercury_cv_have_readline = no; then
+ TERMCAP_LIBRARY=""
+ READLINE_LIBRARIES=""
+ AC_DEFINE(MR_NO_USE_READLINE)
+else
+ TERMCAP_LIBRARY="$mercury_cv_termcap_lib"
+ READLINE_LIBRARIES="-lreadline $TERMCAP_LIBRARY"
+fi
+AC_SUBST(TERMCAP_LIBRARY)
+AC_SUBST(READLINE_LIBRARIES)
+
+])
+
+#-----------------------------------------------------------------------------#
+#
+# Microsoft.NET configuration
+#
+AC_DEFUN(MERCURY_CHECK_DOTNET,
+[
+AC_PATH_PROG(ILASM, ilasm)
+AC_PATH_PROG(GACUTIL, gacutil)
+
+AC_MSG_CHECKING(for Microsoft.NET Framework SDK)
+AC_CACHE_VAL(mercury_cv_microsoft_dotnet, [
+if test "$ILASM" != ""; then
+ changequote(<<,>>)
+ MS_DOTNET_SDK_DIR=`expr "$ILASM" : '\(.*\)[/\\]*[bB]in[/\\]*ilasm'`
+ changequote([,])
+ mercury_cv_microsoft_dotnet="yes"
+else
+ MS_DOTNET_SDK_DIR=""
+ mercury_cv_microsoft_dotnet="no"
+fi
+])
+AC_MSG_RESULT($mercury_cv_microsoft_dotnet)
+ILASM=`basename "$ILASM"`
+GACUTIL=`basename "$GACUTIL"`
+
+# Check for the C# (C sharp) compiler.
+# gmcs is the Mono C# compiler targeting the 2.0 runtime (with generics).
+# cscc is the DotGNU C# compiler.
+AC_PATH_PROGS(CSC, csc gmcs cscc)
+CSC=`basename "$CSC"`
+
+# We default to the Beta 2 version of the library
+mercury_cv_microsoft_dotnet_library_version=1.0.2411.0
+if test $mercury_cv_microsoft_dotnet = "yes" &&
+ test "$CSC" != "";
+then
+ AC_MSG_CHECKING(version of .NET libraries)
+ cat > conftest.cs << EOF
+ using System;
+ using System.Reflection;
+ public class version {
+ public static void Main()
+ {
+ Assembly asm = Assembly.Load("mscorlib");
+ AssemblyName name = asm.GetName();
+ Version version = name.Version;
+ Console.Write(version);
+ Console.Write("\n");
+ }
+ }
+EOF
+ if
+ echo $CSC conftest.cs >&AC_FD_CC 2>&1 && \
+ $CSC conftest.cs >&AC_FD_CC 2>&1 && \
+ ./conftest > conftest.out 2>&1
+ then
+ mercury_cv_microsoft_dotnet_library_version=`cat conftest.out`
+ AC_MSG_RESULT($mercury_cv_microsoft_dotnet_library_version)
+ rm -f conftest*
+ else
+ rm -f conftest*
+ if test "$enable_dotnet_grades" = "yes"; then
+ AC_MSG_ERROR(unable to determine version)
+ exit 1
+ else
+ AC_MSG_WARN(unable to determine version)
+ fi
+ fi
+fi
+MS_DOTNET_LIBRARY_VERSION=$mercury_cv_microsoft_dotnet_library_version
+
+# Check for the assembly linker.
+# ilalink is the DotGNU assembly linker.
+AC_PATH_PROGS(MS_AL, al ilalink)
+MS_AL=`basename "$MS_AL"`
+
+# Check for an implementation of the Common Language Infrastructure.
+AC_PATH_PROGS(CLI_INTERPRETER, mono)
+MONO=`basename "$CLI_INTERPRETER"`
+
+AC_SUBST(ILASM)
+AC_SUBST(GACUTIL)
+AC_SUBST(CSC)
+AC_SUBST(MS_AL)
+AC_SUBST(MS_DOTNET_SDK_DIR)
+AC_SUBST(MS_DOTNET_LIBRARY_VERSION)
+AC_SUBST(MS_VISUALCPP_DIR)
+AC_SUBST(CLI_INTERPRETER)
+])
+
+#-----------------------------------------------------------------------------#
+#
+# Java configuration
+#
+AC_DEFUN(MERCURY_CHECK_JAVA,
+[
+# jikes requires the usual Java SDK to run, so if we checked for javac first,
+# then that's what we'd get. If the user has jikes installed, then that
+# probably means that they want to use it, so we check for jikes before javac.
+# On Windows, the Java SDK has a high chance of being installed in a path
+# containing spaces. The simplest solution is to keep only the basename.
+# Everything will still work so long as the executables can be found on the
+# PATH later.
+AC_PATH_PROGS(JAVAC, jikes javac gcj)
+case "$JAVAC" in
+ *" "*)
+ JAVAC=`basename "$JAVAC"`
+ ;;
+esac
+case "$JAVAC" in
+ *gcj)
+ JAVAC="$JAVAC -C"
+ ;;
+esac
+AC_PATH_PROG(JAVA_INTERPRETER, java gij)
+case "$JAVA_INTERPRETER" in
+ *" "*)
+ JAVA_INTERPRETER=`basename "$JAVA_INTERPRETER"`
+ ;;
+esac
+AC_PATH_PROG(JAR, jar)
+case "$JAR" in
+ *" "*)
+ JAR=`basename "$JAR"`
+ ;;
+esac
+
+AC_CACHE_VAL(mercury_cv_java, [
+if test "$JAVAC" != "" -a "$JAVA_INTERPRETER" != "" -a "$JAR" != ""; then
+ AC_MSG_CHECKING(if the above Java SDK works and is sufficiently recent)
+ cat > conftest.java << EOF
+ // This program simply retrieves the constant
+ // specifying the version number of the Java SDK and
+ // checks it is at least 1.5, printing "Hello, world"
+ // if successful.
+ public class conftest {
+ public static void main (String[[]] args) {
+ float version;
+ String strVer = System.getProperty(
+ "java.specification.version");
+
+ try {
+ version = Float.valueOf(strVer).floatValue();
+ }
+ catch (NumberFormatException e) {
+ System.out.println("ERROR: \"java." +
+ "specification.version\" " +
+ "constant has incorrect " +
+ "format.\nGot \"" + strVer +
+ "\", expected a number.");
+ version = 0f;
+ }
+
+ if (version >= 1.5f) {
+ System.out.println("Hello, world\n");
+ } else {
+ System.out.println("Nope, sorry.\n");
+ }
+ }
+ }
+EOF
+ if
+ echo "$JAVAC" conftest.java >&AC_FD_CC 2>&1 &&
+ "$JAVAC" conftest.java >&AC_FD_CC 2>&1 &&
+ echo "$JAVA_INTERPRETER" conftest > conftest.out 2>&AC_FD_CC &&
+ CLASSPATH=. "$JAVA_INTERPRETER" conftest > conftest.out 2>&AC_FD_CC &&
+ test "`tr -d '\015' < conftest.out`" = "Hello, world"
+ then
+ mercury_cv_java="yes"
+ else
+ mercury_cv_java="no"
+ fi
+ AC_MSG_RESULT($mercury_cv_java)
+else
+ if test "$JAVAC" = ""; then
+ JAVAC="javac"
+ fi
+ if test "$JAVA_INTERPRETER" = ""; then
+ JAVA_INTERPRETER="java"
+ fi
+ if test "$JAR" = ""; then
+ JAR="jar"
+ fi
+ mercury_cv_java="no"
+fi
+])
+
+AC_SUBST(JAVAC)
+AC_SUBST(JAVA_INTERPRETER)
+AC_SUBST(JAR)
+])
+
+AC_DEFUN(MERCURY_CHECK_JAVAC_HEAP_SIZE,
+[
+# The default maximum heap size is too small to build the standard library and
+# other programs so we need to increase it. The option to do that is
+# non-standard so we have to check that it is accepted.
+AC_CACHE_VAL(mercury_cv_javac_flags_for_heap_size, [
+if test "$mercury_cv_java" = "yes"; then
+ AC_MSG_CHECKING(if the Java compiler accepts the max heap size option)
+ mercury_cv_javac_flags_for_heap_size="-J-Xmx256m"
+ if "$JAVAC" "$mercury_cv_javac_flags_for_heap_size" -version \
+ 2> /dev/null
+ then
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ mercury_cv_javac_flags_for_heap_size=
+ fi
+else
+ mercury_cv_javac_flags_for_heap_size=
+fi
+])
+])
+
+#-----------------------------------------------------------------------------#
+#
+# Erlang configuration
+#
+
+# copy of AC_ERLANG_PATH_ERLC from autoconf-2.60
+AC_DEFUN([MERCURY_ERLANG_PATH_ERLC],
+[AC_ARG_VAR([ERLC], [Erlang/OTP compiler command [autodetected]])dnl
+if test -n "$ERLC"; then
+ AC_MSG_CHECKING([for erlc])
+ AC_MSG_RESULT([$ERLC])
+else
+ AC_PATH_TOOL(ERLC, erlc, [$1], [$2])
+fi
+AC_ARG_VAR([ERLCFLAGS], [Erlang/OTP compiler flags [none]])dnl
+])
+
+# copy of AC_ERLANG_PATH_ERL from autoconf-2.60
+AC_DEFUN([MERCURY_ERLANG_PATH_ERL],
+[AC_ARG_VAR([ERL], [Erlang/OTP interpreter command [autodetected]])dnl
+if test -n "$ERL"; then
+ AC_MSG_CHECKING([for erl])
+ AC_MSG_RESULT([$ERL])
+else
+ AC_PATH_TOOL(ERL, erl, [$1], [$2])[]dnl
+fi
+])
+
+AC_DEFUN(MERCURY_CHECK_ERLANG,
+[
+MERCURY_ERLANG_PATH_ERLC
+MERCURY_ERLANG_PATH_ERL
+
+if test "$ERLC" != "" -a "$ERL" != ""; then
+ mercury_cv_erlang="yes"
+else
+ mercury_cv_erlang="no"
+fi
+
+AC_SUBST(ERLC)
+AC_SUBST(ERL)
+])
+
+#-----------------------------------------------------------------------------#
+
+# NOTE: updates to this macro may need to be reflected in compiler/globals.m.
+
+AC_DEFUN([MERCURY_GCC_VERSION], [
+AC_REQUIRE([AC_PROG_CC])
+
+cat > conftest.c << EOF
+
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+
+#if defined(__GNUC__)
+ printf("%d_", __GNUC__);
+ #if defined(__GNUC_MINOR__)
+ printf("%d_", __GNUC_MINOR__);
+ #else
+ printf("u_");
+ #endif /* ! __GNUC_MINOR__ */
+ #if defined(__GNUC_PATCHLEVEL__)
+ printf("%d", __GNUC_PATCHLEVEL__);
+ #else
+ printf("u");
+ #endif /* ! __GNUC_PATCHLEVEL__ */
+#endif /* __GNUC__ */
+
+ return 0;
+}
+EOF
+
+echo "$CC -o conftest contest.c" >&AC_FD_CC 2>&1
+if
+ $CC -o conftest conftest.c
+then
+ mercury_cv_gcc_version=`./conftest`
+else
+ # This shouldn't happen as we have already checked for this.
+ AC_MSG_ERROR([unexpected: $CC cannot create executable])
+fi
+])
+
+#-----------------------------------------------------------------------------#
+
+# Work out the C compiler type using a stronger test than AC_PROG_CC to
+# distinguish between clang and gcc.
+# (We don't handle lcc here - I don't think that it's possible to.)
+
+AC_DEFUN([MERCURY_CC_TYPE], [
+AC_REQUIRE([AC_PROG_CC])
+AC_MSG_CHECKING([what the C compiler type really is])
+
+# MSVC uses different command line options to most other C compilers.
+# Try to determine whether CC is MSVC based on the usage message.
+#
+$CC 2>&1 | grep -q "^Microsoft"
+if test $? -eq 0
+then
+ cc_out_opt="-Fe"
+ nologo_opt="-nologo"
+else
+ cc_out_opt="-o "
+ nologo_opt=
+fi
+
+cat > conftest.c << EOF
+
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+ #if defined(__clang__)
+ printf("clang");
+ #elif defined(__GNUC__)
+ printf("gcc");
+ #elif defined(_MSC_VER)
+ printf("msvc");
+ #else
+ printf("unknown");
+ #endif
+
+ return 0;
+}
+EOF
+
+echo "$CC $nologo_opt ${cc_out_opt}conftest conftest.c" >&AC_FD_CC 2>&1
+if
+ # We direct the output to /dev/null because it's appears to be the
+ # only way to shut some C compilers up.
+ $CC $nologo_opt ${cc_out_opt}conftest conftest.c 2>&1 > /dev/null
+then
+ mercury_cv_cc_type=`./conftest`
+else
+ # This shouldn't happen as we have already checked for this.
+ AC_MSG_ERROR([unexpected: $CC cannot create executable])
+fi
+
+AC_MSG_RESULT([$mercury_cv_cc_type])
+])
+
+#-----------------------------------------------------------------------------#
+
+AC_DEFUN([MERCURY_CLANG_VERSION], [
+AC_REQUIRE([AC_PROG_CC])
+
+cat > conftest.c << EOF
+
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+
+ printf("%d_%d_%d", __clang_major__, __clang_minor__, __clang_patchlevel__);
+ return 0;
+}
+EOF
+
+echo "$CC -o conftest contest.c" >&AC_FD_CC 2>&1
+if
+ $CC -o conftest conftest.c
+then
+ mercury_cv_clang_version=`./conftest`
+else
+ # This shouldn't happen as we have already checked for this.
+ AC_MSG_ERROR([unexpected: $CC cannot create executable])
+fi
+])
+
+#-----------------------------------------------------------------------------#
+
+AC_DEFUN([MERCURY_MSVC_VERSION], [
+AC_REQUIRE([AC_PROG_CC])
+
+cat > conftest.c << EOF
+
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+
+ printf("%d", _MSC_VER);
+ return 0;
+}
+EOF
+
+echo "$CC conftest.c -Fecontest" >&AC_FD_CC 2>&1
+if
+ $CC conftest.c -Feconftest > /dev/null
+then
+ mercury_cv_msvc_version=`./conftest`
+else
+ # This shouldn't happen as we have already checked for this.
+ AC_MSG_ERROR([unexpected: $CC cannot create executable])
+fi
+])
+
+#-----------------------------------------------------------------------------#
+#
+# Check if the POSIX threads library is pthreads-win32.
+#
+
+AC_DEFUN([MERCURY_HAVE_PTHREADS_WIN32], [
+
+AC_MSG_CHECKING([if we are using pthreads-win32])
+
+cat > conftest.c << EOF
+
+#include <pthread.h>
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+
+#if defined(PTW32_VERSION)
+ return 0;
+#else
+ return 1;
+#endif
+
+}
+
+EOF
+
+echo "$CC -o conftest contest.c" >&AC_FD_CC 2>&1
+if
+ $CC -o conftest conftest.c
+then
+ mercury_cv_have_pthreads_win32="yes"
+else
+ mercury_cv_have_pthreads_win32="no"
+fi
+
+AC_MSG_RESULT($mercury_cv_have_pthreads_win32)
+
+])
+
+#-----------------------------------------------------------------------------#
Index: m4/pkg.m4
===================================================================
RCS file: m4/pkg.m4
diff -N m4/pkg.m4
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ m4/pkg.m4 3 Nov 2011 02:56:32 -0000
@@ -0,0 +1,157 @@
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 1 (pkg-config-0.24)
+#
+# Copyright © 2004 Scott James Remnant <scott at netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+ AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=m4_default([$1], [0.9.0])
+ AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ PKG_CONFIG=""
+ fi
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists. Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+# only at the first occurence in configure.ac, so if the first place
+# it's called might be skipped (such as if it is within an "if", you
+# have to call PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+ m4_default([$2], [:])
+m4_ifvaln([$3], [else
+ $3])dnl
+fi])
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+ pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+ PKG_CHECK_EXISTS([$3],
+ [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+ [pkg_failed=yes])
+ else
+ pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+ AC_MSG_RESULT([no])
+ _PKG_SHORT_ERRORS_SUPPORTED
+ if test $_pkg_short_errors_supported = yes; then
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
+ else
+ $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+ m4_default([$4], [AC_MSG_ERROR(
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT])dnl
+ ])
+elif test $pkg_failed = untried; then
+ AC_MSG_RESULT([no])
+ m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl
+ ])
+else
+ $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+ $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+ AC_MSG_RESULT([yes])
+ $3
+fi[]dnl
+])# PKG_CHECK_MODULES
Index: scripts/Mercury.config.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/Mercury.config.in,v
retrieving revision 1.26
diff -u -p -b -r1.26 Mercury.config.in
--- scripts/Mercury.config.in 14 Dec 2010 07:01:55 -0000 1.26
+++ scripts/Mercury.config.in 3 Nov 2011 02:56:32 -0000
@@ -85,6 +85,8 @@ DEFAULT_MCFLAGS=\
--link-shared-lib-command "@LINK_SHARED_OBJ@" \
--trace-libs "@TRACE_BASE_LIBS_SYSTEM@" \
--thread-libs "@THREAD_LIBS@" \
+ --hwloc-libs "@HWLOC_LIBS@" \
+ --hwloc-static-libs "@HWLOC_STATIC_LIBS@" \
--shared-libs "@SHARED_LIBS@" \
--math-lib "@MATH_LIB@" \
--readline-libs "@READLINE_LIBRARIES@" \
Index: tools/bootcheck
===================================================================
RCS file: /home/mercury1/repository/mercury/tools/bootcheck,v
retrieving revision 1.211
diff -u -p -b -r1.211 bootcheck
--- tools/bootcheck 14 Oct 2011 00:55:17 -0000 1.211
+++ tools/bootcheck 3 Nov 2011 02:56:32 -0000
@@ -835,7 +835,8 @@ then
$LN_S $root/deep_profiler .
fi
$LN_S $root/conf* .
- $LN_S $root/ac*.m4 .
+ $LN_S $root/aclocal.m4 .
+ $LN_S $root/m4 .
$LN_S $root/VERSION .
$LN_S $root/install-sh .
$LN_S $root/.*.in .
@@ -1235,7 +1236,8 @@ then
$LN_S $root/$stage2dir/profiler .
$LN_S $root/$stage2dir/deep_profiler .
$LN_S $root/conf* .
- $LN_S $root/ac*.m4 .
+ $LN_S $root/aclocal.m4 .
+ $LN_S $root/m4 .
$LN_S $root/VERSION .
$LN_S $root/install-sh .
$LN_S $root/.*.in .
Index: tools/test_mercury
===================================================================
RCS file: /home/mercury1/repository/mercury/tools/test_mercury,v
retrieving revision 1.395
diff -u -p -b -r1.395 test_mercury
--- tools/test_mercury 13 Oct 2011 02:42:21 -0000 1.395
+++ tools/test_mercury 3 Nov 2011 02:56:32 -0000
@@ -735,7 +735,7 @@ esac
# XXX building the depend target in parallel sometimes fails so we don't
# do that at the moment - it's probably not worth doing anyway.
#
-aclocal || { false; exit 1; }
+aclocal -I m4 || { false; exit 1; }
autoconf || { false; exit 1; }
rm -f config.cache
./configure --prefix=$INSTALL_DIR $CONFIG_OPTS || { false; exit 1; }
@@ -863,7 +863,7 @@ case $HOST in $ROTD_HOST)
: > Mmake.params &&
rm -f so_locations &&
rm -f .enable_lib_grades &&
- aclocal &&
+ aclocal -I m4 &&
autoconf &&
mercury_cv_low_tag_bits=2 \
mercury_cv_bits_per_word=32 \
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20111103/888a819f/attachment.sig>
More information about the reviews
mailing list