| 1 |
# -*- shell-script -*- |
| 2 |
# |
| 3 |
# This file is part of the HDF4 build script. It is processed shortly |
| 4 |
# after configure starts and defines, among other things, flags for |
| 5 |
# the various compilation modes. |
| 6 |
|
| 7 |
# Choosing C and Fortran Compilers |
| 8 |
# -------------------------------------- |
| 9 |
# |
| 10 |
# The user should be able to specify the compiler by setting the CC |
| 11 |
# and F77 environment variables to the name of the compiler and any |
| 12 |
# switches it requires for proper operation. If CC is unset then this |
| 13 |
# script may set it. If CC is unset by time this script completes then |
| 14 |
# configure will try `gcc' and `cc' in that order (perhaps some others |
| 15 |
# too). |
| 16 |
# |
| 17 |
# Note: Code later in this file may depend on the value of $CC_BASENAME |
| 18 |
# in order to distinguish between different compilers when |
| 19 |
# deciding which compiler command-line switches to use. This |
| 20 |
# variable is set based on the incoming value of $CC and is only |
| 21 |
# used within this file. |
| 22 |
|
| 23 |
if test "X-$CC" = "X-"; then |
| 24 |
CC=xlc |
| 25 |
CC_BASENAME=xlc |
| 26 |
fi |
| 27 |
|
| 28 |
if test "X-$F77" = "X-"; then |
| 29 |
F77=xlf |
| 30 |
F77_BASENAME=xlf |
| 31 |
fi |
| 32 |
|
| 33 |
# C and Fortran Compiler and Preprocessor Flags |
| 34 |
# --------------------------------------------------- |
| 35 |
# |
| 36 |
# - Flags that end with `_CFLAGS' are always passed to the C compiler. |
| 37 |
# - Flags that end with `_FFLAGS' are always passed to the Fortran |
| 38 |
# compiler. |
| 39 |
# - Flags that end with `_CPPFLAGS' are passed to the C compiler |
| 40 |
# when compiling but not when linking. |
| 41 |
# |
| 42 |
# DEBUG_CFLAGS |
| 43 |
# DEBUG_FFLAGS |
| 44 |
# DEBUG_CPPFLAGS - Flags to pass to the compiler to create a |
| 45 |
# library suitable for use with debugging |
| 46 |
# tools. Usually this list will exclude |
| 47 |
# optimization switches (like `-O') and include |
| 48 |
# switches that turn on symbolic debugging support |
| 49 |
# (like `-g'). |
| 50 |
# |
| 51 |
# PROD_CFLAGS |
| 52 |
# PROD_FFLAGS |
| 53 |
# PROD_CPPFLAGS - Flags to pass to the compiler to create a |
| 54 |
# production version of the library. These |
| 55 |
# usually exclude symbolic debugging switches (like |
| 56 |
# `-g') and include optimization switches (like |
| 57 |
# `-O'). |
| 58 |
# |
| 59 |
# PROFILE_CFLAGS |
| 60 |
# PROFILE_FFLAGS |
| 61 |
# PROFILE_CPPFLAGS- Flags to pass to the compiler to create a |
| 62 |
# library suitable for performance testing (like |
| 63 |
# `-pg'). This may or may not include debugging or |
| 64 |
# production flags. |
| 65 |
# |
| 66 |
# FFLAGS |
| 67 |
# CFLAGS - Flags can be added to these variable which |
| 68 |
# might already be partially initialized. These |
| 69 |
# flags will always be passed to the compiler and |
| 70 |
# should include switches to turn on full warnings. |
| 71 |
# |
| 72 |
# WARNING: flags do not have to be added to the CFLAGS |
| 73 |
# or FFLAGS variable if the compiler is the GNU gcc |
| 74 |
# and g77 compiler. |
| 75 |
# |
| 76 |
# FFLAGS and CFLAGS should contain *something* or else |
| 77 |
# configure will probably add `-g'. For most systems |
| 78 |
# this isn't a problem but some systems will disable |
| 79 |
# optimizations in favor of the `-g'. The configure |
| 80 |
# script will remove the `-g' flag in production mode |
| 81 |
# only. |
| 82 |
# |
| 83 |
# These flags should be set according to the compiler being used. |
| 84 |
# There are two ways to check the compiler. You can try using `-v' or |
| 85 |
# `--version' to see if the compiler will print a version string. You |
| 86 |
# can use the value of $FOO_BASENAME which is the base name of the |
| 87 |
# first word in $FOO, where FOO is either CC or F77 (note that the |
| 88 |
# value of CC may have changed above). |
| 89 |
|
| 90 |
case $CC_BASENAME in |
| 91 |
gcc) |
| 92 |
CFLAGS="$CFLAGS" |
| 93 |
DEBUG_CFLAGS="-g -fverbose-asm" |
| 94 |
DEBUG_CPPFLAGS= |
| 95 |
PROD_CFLAGS="-O3 -fomit-frame-pointer" |
| 96 |
PROD_CPPFLAGS= |
| 97 |
PROFILE_CFLAGS="-pg" |
| 98 |
PROFILE_CPPFLAGS= |
| 99 |
;; |
| 100 |
|
| 101 |
*) |
| 102 |
CFLAGS="$CFLAGS" |
| 103 |
DEBUG_CFLAGS="-g" |
| 104 |
DEBUG_CPPFLAGS= |
| 105 |
PROD_CFLAGS="-O" |
| 106 |
PROD_CPPFLAGS= |
| 107 |
PROFILE_CFLAGS="-pg" |
| 108 |
PROFILE_CPPFLAGS= |
| 109 |
;; |
| 110 |
esac |
| 111 |
|
| 112 |
case $F77_BASENAME in |
| 113 |
g77) |
| 114 |
FFLAGS="$FFLAGS -Wsign-compare" |
| 115 |
DEBUG_FFLAGS="-g" |
| 116 |
PROD_FFLAGS="-O3 -fomit-frame-pointer" |
| 117 |
PROFILE_FFLAGS="-pg" |
| 118 |
;; |
| 119 |
|
| 120 |
*) |
| 121 |
FFLAGS="$FFLAGS" |
| 122 |
DEBUG_FFLAGS="-g" |
| 123 |
PROD_FFLAGS="-O" |
| 124 |
PROFILE_FFLAGS="-pg" |
| 125 |
;; |
| 126 |
esac |
| 127 |
|
| 128 |
# Overriding Configure Tests |
| 129 |
# -------------------------- |
| 130 |
# |
| 131 |
# Values for overriding configuration tests when cross compiling. |
| 132 |
|
| 133 |
# Set this to `yes' or `no' depending on whether the target is big |
| 134 |
# endian or little endian. |
| 135 |
#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'} |