[m-rev.] for review: Modify configure.in to do less pattern matching on the $CC variable.
Paul Bone
pbone at csse.unimelb.edu.au
Tue Aug 26 18:23:01 AEST 2008
For review by anyone.
Estimated hours taken: 0.2
Branches: main
Modify configure.in to use the $GCC variable to test if the compiler is the
Gnu C Compiler rather than pattern match on the $CC variable.
configure.in:
As above.
Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.523
diff -u -r1.523 configure.in
--- configure.in 9 Apr 2008 02:45:38 -0000 1.523
+++ configure.in 26 Aug 2008 08:18:46 -0000
@@ -4005,65 +4005,67 @@
# compiler/compile_target_code.m.
#
-# XXX we should not just rely on pattern matching against the executable
-# name to determine the C compiler type.
-
-case "$CC" in
- *gcc*)
- C_COMPILER_TYPE=gcc
- CFLAGS_FOR_ANSI="-ansi"
-
- # For a full list of the other gcc warnings that we don't
- # enable, and why, see scripts/mgnuc.in.
- CFLAGS_FOR_WARNINGS="-Wall -Wwrite-strings -Wshadow -Wmissing-prototypes -Wno-unused -Wno-uninitialized -Wstrict-prototypes"
- CFLAGS_FOR_OPT="-O2 -fomit-frame-pointer"
- CFLAGS_FOR_DEBUG="-g"
- MCFLAGS_FOR_CC=
- ;;
-
- *lcc*)
- C_COMPILER_TYPE=lcc
- CFLAGS_FOR_ANSI=
-
- # Turn off all warnings due to spurious warnings.
- CFLAGS_FOR_WARNINGS="-w"
-
- CFLAGS_FOR_OPT=
- CFLAGS_FOR_DEBUG="-g"
- MCFLAGS_FOR_CC=
- ;;
-
- *cl* | *CL*)
- C_COMPILER_TYPE=cl
- CFLAGS_FOR_ANSI=
- CFLAGS_FOR_WARNINGS=
- CFLAGS_FOR_OPT=
- CFLAGS_FOR_DEBUG="/Zi"
-
- # Using the MSVC compiler implies that we must use
- # a maximum jump table size of 512 to avoid a fixed limit
- # in the compiler.
- MCFLAGS_FOR_CC="--max-jump-table-size 512"
- ;;
-
- cc* | */cc*)
- C_COMPILER_TYPE=unknown
- CFLAGS_FOR_ANSI=
- CFLAGS_FOR_OPT="-O"
- CFLAGS_FOR_WARNINGS=
- CFLAGS_FOR_DEBUG="-g"
- MCFLAGS_FOR_CC=
- ;;
-
- *)
- C_COMPILER_TYPE=unknown
- CFLAGS_FOR_ANSI=
- CFLAGS_FOR_OPT="-O"
- CFLAGS_FOR_WARNINGS=
- CFLAGS_FOR_DEBUG="-g"
- MCFLAGS_FOR_CC=
- ;;
-esac
+# AC_PROG_CC sets GCC to yes if $CC is GNU C.
+if test "$GCC" = "yes"; then
+ C_COMPILER_TYPE=gcc
+ CFLAGS_FOR_ANSI="-ansi"
+
+ # For a full list of the other gcc warnings that we don't
+ # enable, and why, see scripts/mgnuc.in.
+ CFLAGS_FOR_WARNINGS="-Wall -Wwrite-strings -Wshadow -Wmissing-prototypes -Wno-unused -Wno-uninitialized -Wstrict-prototypes"
+ CFLAGS_FOR_OPT="-O2 -fomit-frame-pointer"
+ CFLAGS_FOR_DEBUG="-g"
+ MCFLAGS_FOR_CC=
+else
+
+ # XXX we should not rely on pattern matching against the executable name to
+ # determine the C compiler type.
+
+ case "$CC" in
+ *lcc*)
+ C_COMPILER_TYPE=lcc
+ CFLAGS_FOR_ANSI=
+
+ # Turn off all warnings due to spurious warnings.
+ CFLAGS_FOR_WARNINGS="-w"
+
+ CFLAGS_FOR_OPT=
+ CFLAGS_FOR_DEBUG="-g"
+ MCFLAGS_FOR_CC=
+ ;;
+
+ *cl* | *CL*)
+ C_COMPILER_TYPE=cl
+ CFLAGS_FOR_ANSI=
+ CFLAGS_FOR_WARNINGS=
+ CFLAGS_FOR_OPT=
+ CFLAGS_FOR_DEBUG="/Zi"
+
+ # Using the MSVC compiler implies that we must use
+ # a maximum jump table size of 512 to avoid a fixed limit
+ # in the compiler.
+ MCFLAGS_FOR_CC="--max-jump-table-size 512"
+ ;;
+
+ cc* | */cc*)
+ C_COMPILER_TYPE=unknown
+ CFLAGS_FOR_ANSI=
+ CFLAGS_FOR_OPT="-O"
+ CFLAGS_FOR_WARNINGS=
+ CFLAGS_FOR_DEBUG="-g"
+ MCFLAGS_FOR_CC=
+ ;;
+
+ *)
+ C_COMPILER_TYPE=unknown
+ CFLAGS_FOR_ANSI=
+ CFLAGS_FOR_OPT="-O"
+ CFLAGS_FOR_WARNINGS=
+ CFLAGS_FOR_DEBUG="-g"
+ MCFLAGS_FOR_CC=
+ ;;
+ esac
+fi
CFLAGS_FOR_OPT="$CFLAGS_FOR_OPT $CFLAGS_FOR_NO_STRICT_ALIASING"
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list