Ticket #7818: sage-env

File sage-env, 19.9 KB (added by drkirkby, 12 years ago)

Updated sage-env, much improved, but added back LN, MKIDR etc, to avoid risk of breakage

Line 
1#!/usr/bin/env bash
2
3###########################################################################
4#
5#  Set environment variables for building and/or running Sage.
6#  You must source this; see below!
7#
8#  AUTHORS:   William Stein                            2005-12
9#             David Kirkby <david.kirkby@onetel.net>   2009-12-29
10#
11###########################################################################
12
13##########################################################################
14#
15#  If you want to set all environment variables for your shell like
16#  they are during the build of Sage packages, type
17#
18#             source local/bin/sage-env
19#
20#  from the SAGE_ROOT directory.   To do the same from a /bin/bash
21#  script use ". local/bin/sage-env".
22#
23##########################################################################
24
25# GUESS SAGE_ROOT from pwd
26SAVEDIR="`pwd`"
27if [ -f sage -a -d spkg ]; then
28    GUESSED_SAGE_ROOT="`pwd`"
29else
30    if [ -f ../../sage -a -d ../../spkg ]; then
31        cd ../../
32        GUESSED_SAGE_ROOT="`pwd`"
33    else
34        GUESSED_SAGE_ROOT=""
35    fi
36fi
37cd "$SAVEDIR"
38
39
40if [ "$SAGE_ROOT" = "" ]; then
41    if [ "$GUESSED_SAGE_ROOT" = "" ]; then
42        echo "Error: You must set the SAGE_ROOT environment"
43        echo "variable or run this script from the SAGE_ROOT or "
44        echo "SAGE_ROOT/local/bin/ directory."
45        exit 1
46    else
47        SAGE_ROOT="$GUESSED_SAGE_ROOT"
48        export SAGE_ROOT
49    fi
50else
51    if [ -f "$SAGE_ROOT"/sage -a -d "$SAGE_ROOT"/spkg ]; then
52        # SAGE_ROOT points to a sage installation as expected
53        if [ "$SAGE_ROOT" != "$GUESSED_SAGE_ROOT" ]; then
54            echo "Warning: Attempted to overwrite SAGE_ROOT environment variable"
55        fi
56    else
57        echo "Error: The SAGE_ROOT environment variable is set to"
58        echo "a bad value. You must correct it or erase it and"
59        echo "run this script from the SAGE_ROOT or"
60        echo "SAGE_ROOT/local/bin/ directory." 
61        exit 1
62    fi
63fi
64
65
66if [ "x$SAGE_PRINT_ENVIRONMENT" = "xyes" ] ; then
67    echo "The following environment variables can be set by the user"
68    echo "but unfortunately, not all packages use them, so you can not"
69    echo "rely on them working as intended. "
70    echo "AR          The archiver (e.g. ar, /usr/ccs/bin/ar or /usr/bin/ar)"
71    echo "AS          The assembler (e.g. as, /usr/ccs/bin/as or /usr/bin/as)"
72    echo "CC          The C compiler (e.g cc, /opt/SUNWspro/bin/cc or /usr/bin/gcc)"
73    echo "CFLAGS      Flag(s) for the C compiler"
74    echo "CXX         The C++ compiler (e.g g++, /opt/SUNWspro/bin/CC or /usr/local/bin/g++)"
75    echo "CXXFLAGS    Flag(s) for the C++ compiler"
76    echo "LD          The linker (e.g. ld, /usr/ccs/bin/ld or /usr/bin/ld)"
77    echo "LDFLAGS     Linker flag(s) (e.g. -D token)"
78    echo "MAKE        The make program (e.g. make, /usr/bin/make or /usr/local/bin/gmake)"
79    echo "MAKEFLAGS   Flag(s) to make (e.g. -j4)."
80    echo "RANLIB      Archiver ranlib (e.g. ranlib, /usr/ccs/bin/ranlib etc)"
81    echo "SAGE64      Set to \"yes\" to build a 64-bit binary"
82    echo "SAGE_DEBUG  Set to \"no\" if you do not want debugging information"
83    echo "We attempt to set this to sensible values, but check below to"
84    echo "ensure they are OK. If you wish to override any then please use:"
85    echo "setenv NAME_OF_ENVIROMENT_VARIABLE value_of_environment_variable"
86    echo "(if you use tcsh, csh or a similar shell) or"
87    echo "NAME_OF_ENVIROMENT_VARIABLE=value_of_environment_variable"
88    echo "export NAME_OF_ENVIROMENT_VARIABLE"
89    echo "if you use sh, bash or a similar shell"
90fi
91
92# Setting Sage-related location environment variables.
93BUILD=build
94SAGE_PACKAGES="$SAGE_ROOT/spkg" && export SAGE_PACKAGES
95SAGE_LOCAL="$SAGE_ROOT/local"   && export SAGE_LOCAL
96SAGE_DATA="$SAGE_ROOT/data"     && export SAGE_DATA
97SAGE_DOC="$SAGE_ROOT/devel/sage/doc" && export SAGE_DOC
98PATH="$SAGE_ROOT:$SAGE_LOCAL/bin:$PATH" && export PATH
99
100# We offer a toolchain option, so if $SAGE_LOCAL/toolchain/toolchain-env exists source it.
101# Since the user might do something crazy we do not do any checks, but hope for the best.
102# source is not portable - use a dot instead.
103if [ -f $SAGE_LOCAL/toolchain/toolchain-env ]; then
104  . $SAGE_LOCAL/toolchain/toolchain-env
105fi
106
107# For a framework Python build on OS X, Python's bin directory is not local/bin
108if [ `uname` = "Darwin" ]; then
109    PATH="$SAGE_LOCAL/Frameworks/Python.framework/Versions/2.5/bin:$PATH" && export PATH
110fi
111
112if [ "$LIBRARY_PATH" != "" ]; then
113    LIBRARY_PATH="$SAGE_LOCAL/lib/:$LIBRARY_PATH"
114else
115    LIBRARY_PATH="$SAGE_LOCAL/lib/"
116fi
117export LIBRARY_PATH
118
119GP_DATA_DIR="$SAGE_LOCAL/share/pari" && export GP_DATA_DIR
120GPHELP="$SAGE_LOCAL/bin/gphelp" && export GPHELP
121GPDOCDIR="$SAGE_LOCAL/share/pari/doc" && export GPDOCDIR
122
123SINGULARPATH="$SAGE_LOCAL/share/singular" && export SINGULARPATH
124
125if [ "$SAGE_SERVER" = "" ]; then
126    SAGE_SERVER="http://www.sagemath.org/"
127    export SAGE_SERVER
128fi
129
130if [ "$DOT_SAGE" = "" ]; then
131    DOT_SAGE="$HOME/.sage/"
132    export DOT_SAGE
133fi
134
135if [ "$SAGE_STARTUP_FILE" = "" ]; then
136    SAGE_STARTUP_FILE="$DOT_SAGE/init.sage"
137    export SAGE_STARTUP_FILE
138fi
139
140if [ -d "$SAGE_ROOT/local/lib/python" ]; then
141    PYTHONPATH="$SAGE_PATH:$SAGE_ROOT/local/lib/python"   && export PYTHONPATH
142    PYTHONHOME="$SAGE_ROOT/local" && export PYTHONHOME
143fi
144
145if [ -z "${SAGE_ORIG_LD_LIBRARY_PATH_SET}" ]; then
146    SAGE_ORIG_LD_LIBRARY_PATH=$LD_LIBRARY_PATH && export SAGE_ORIG_LD_LIBRARY_PATH
147    SAGE_ORIG_LD_LIBRARY_PATH_SET=True && export SAGE_ORIG_LD_LIBRARY_PATH_SET
148fi
149
150if [ -z "$SAGE_TESTDIR" ]; then
151    SAGE_TESTDIR="$DOT_SAGE"/tmp && export SAGE_TESTDIR
152fi
153
154LD_LIBRARY_PATH="$SAGE_ROOT/local/lib/:$LD_LIBRARY_PATH" && export LD_LIBRARY_PATH
155# The following is needed for openmpi:
156LD_LIBRARY_PATH="$SAGE_ROOT/local/lib/openmpi:$LD_LIBRARY_PATH" && export LD_LIBRARY_PATH
157# The following is needed for R (in case the Sage install is moved):
158LD_LIBRARY_PATH="$SAGE_ROOT/local/lib/R/lib:$LD_LIBRARY_PATH" && export LD_LIBRARY_PATH 
159# The following is needed for OS X (especially for the
160# Singular install).
161if [ `uname` = "Darwin" ]; then
162    if [ -z "${SAGE_ORIG_DYLD_LIBRARY_PATH_SET}" ]; then
163        SAGE_ORIG_DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH && export SAGE_ORIG_DYLD_LIBRARY_PATH
164        SAGE_ORIG_DYLD_LIBRARY_PATH_SET=True && export SAGE_ORIG_DYLD_LIBRARY_PATH_SET
165    fi
166    DYLD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DYLD_LIBRARY_PATH:$SAGE_LOCAL/lib/R/lib" && export DYLD_LIBRARY_PATH
167fi
168
169if [ "$1" = "-short" ]; then
170    exit 0
171fi
172
173if [ -z "$RHOME" ]; then
174    RHOME="$SAGE_LOCAL/lib/R" && export RHOME
175fi
176
177
178############ compilation flags
179
180# Setting Sage-related compilation flags.
181# This could be used in code to make special changes only when
182# code is being built as part of Sage.
183__sage__="" && export __sage__
184# Set the default compiler to gcc if the environment variable
185# CC is not set.
186if [ "$CC" = "" ]; then
187     CC="gcc"         && export CC
188fi
189 # Set the default C++ compiler to g++ if the environment variable
190# CXX is not set.
191if [ "$CXX" = "" ]; then
192    CXX="g++"         && export CXX
193fi
194
195if [ "$LD" = "" ]; then
196    LD="ld"  && export LD
197fi
198if [ "$AR" = "" ]; then
199    AR="ar"  && export AR
200fi
201if [ "$AS" = "" ]; then
202    AS="as"  && export AS
203fi
204
205UNAME=`uname`
206if [ `uname | sed -e 's/WIN.\+/WIN/'` = "CYGWIN" ]; then
207    UNAME="CYGWIN"
208fi
209
210if [ "$LDFLAGS" = "" ]; then
211    LDFLAGS=""          && export LDFLAGS
212fi
213
214if [ "$SAGE64" = "" ]; then
215    SAGE64="no" && export SAGE64
216fi
217
218if [ "$SAGE64" != "yes" -a "$SAGE64" != "no" ]; then
219    echo "The environment variable SAGE64 (=$SAGE64) must be either unset, yes or no."
220    exit 1
221fi
222
223# In case SAGE64 has been set to yes before re-inject it into the environment
224# This is only done on OSX and Solaris since those are the only real multi lib
225# arches we support. Eventually Linux PPC on the PS3 might need to be added here
226# Although not supported by Sage, both the HP-UX and AIX operating systems
227# can have both 32 and 64 bit code on the same system
228. $SAGE_LOCAL/bin/sage-check-64 2> /dev/null
229export SAGE64
230
231# Make use of the scripts on Trac #7505 to determine the correct
232# compiler options. One of the following will be output by the
233# the scripts testcc.sh and testcxx.sh
234#  * GCC
235#  * Sun_Studio
236#  * HP_on_Tru64
237#  * HP_on_Alpha_Linux
238#  * HP_on_HP-UX
239#  * IBM_on_AIX
240#  * Unknown
241
242# In each case, I've called the flag as similar as
243# possible to the GNU names, to make it easier to change code.
244# i.e. the flag for generating position independent code is called
245# FPIC_FLAG, as the option with gcc is -fPIC. 
246# The option for generating shared libraries is called
247# SHARED_FLAG, as the option for gcc is -shared.
248# Likewise for SONAME_FLAG, WHOLE_ARCHIVE_FLAG and NO_WHOLE_ARCHIVE_FLAG
249
250# If all instances of -fPIC in Sage were replaced by $FPIC_FLAG
251# Sage would be a lot more portable than it currently is.
252# Likewise, for several other options which depend on the compiler.
253if  [ "x`$SAGE_LOCAL/bin/testcc.sh $CC`" = "xGCC" ] ; then 
254    # These are the names of the environment variables, and their GCC
255    # name. They are not appended to CFLAGS, CXXFLAGS or FCFLAGS as they
256    # are not always needed.
257    FPIC_FLAG="-fPIC"
258    SHARED_FLAG="-shared" 
259    SONAME_FLAG="-soname"
260    WHOLE_ARCHIVE_FLAG="--whole-archive" 
261    NO_WHOLE_ARCHIVE_FLAG="--no-whole-archive" 
262
263    # Enable warnings on gcc.
264    CFLAGS="$CFLAGS -Wall" 
265    CXXFLAGS="$CXXFLAGS -Wall"
266    FCFLAGS="$FCFLAGS -Wall"
267elif  [ "x`$SAGE_LOCAL/bin/testcc.sh $CC`" = "xSun_Studio" ] ; then 
268    # -xcode=pic32 is valid on 64-bit too, despite the name.
269    # It is equivalent to the obsolete -KPIC on SPARC and -kPIC on x86
270    # These flags for Solaris should work in most circumstances.
271    # Identical flags have been used to build a 32-bit version of Sage
272    # on SPARC.
273    FPIC_FLAG="-xcode=pic32"
274    SHARED_FLAG="-G"
275    SONAME_FLAG="-h"
276    WHOLE_ARCHIVE_FLAG="-z allextract"
277    NO_WHOLE_ARCHIVE_FLAG="-z defaultextract"
278
279    # The Sun C++ compiler is supplied with two standard libraries.
280    # http://developers.sun.com/solaris/articles/cmp_stlport_libCstd.html
281    # The default library is based on an old version of the C++ standard
282    # and is not compatible with the latest standard. This line forces the
283    # use of the new library with: -library=stlport4.
284    CXXFLAGS="$CXXFLAGS -library=stlport4"
285
286    # The Sun compiler is quite fussy by default (much
287    # more so than the GNU ones, so adding more warnings will
288    # be too much)
289elif  [ "x`$SAGE_LOCAL/bin/testcc.sh $CC`" = "xHP_on_HP-UX" ] ; then 
290    # HP's C++ compiler creates position independent code by default, but
291    # I assume the C compiler does not.
292    FPIC_FLAG="-b"       # HP's C++ compiler creates position independent code by default.
293    SHARED_FLAG="-b"     # I'm not 100% sure of this.
294    SONAME_FLAG=""
295    WHOLE_ARCHIVE_FLAG=""
296    NO_WHOLE_ARCHIVE_FLAG=""
297
298    # Like the Sun compiler, the HP compiler has an old and a new library
299    # and by default uses the old library. To use a newer library, which
300    # is closer to the current C++ standard, the option -AA must be given.
301    # Unlike most other compilers, by default it does no optimization at
302    # all, which is undesirable, so -O is added.
303    CFLAGS="$CFLAGS -O"
304    CXXFLAGS="$CXXFLAGS -AA -O"
305    FCFLAGS="$FCFLAGS -O"
306elif  [ "x`$SAGE_LOCAL/bin/testcc.sh $CC`" = "xIBM_on_AIX" ] ; then
307    echo "Warning: Some compiler options when using HP's compiler"
308    echo "on HP-UX are in the file sage-env. These might"             
309    echo "not be correct and so will need adjusting."
310    echo "It is suggested that you try to build Sage with"
311    echo "GCC first, as that is more likely to work, as the"
312    echo "compiler flags used by GCC are the same, irrespective"
313    echo "of the operating system. "
314    FPIC_FLAG="-qpic"       
315    SHARED_FLAG=""   
316    SONAME_FLAG=""
317    WHOLE_ARCHIVE_FLAG=""
318    NO_WHOLE_ARCHIVE_FLAG=""
319elif  [ "x`$SAGE_LOCAL/bin/testcc.sh $CC`" = "xHP_on_Tru64" ] ; then
320    echo "Warning: Some compiler options when using HP's compiler"
321    echo "on Tru64 are in the file sage-env. These might"             
322    echo "not be correct and so will need adjusting."
323    echo "It is suggested that you try to build Sage with"
324    echo "GCC first, as that is more likely to work, as the"
325    echo "compiler flags used by GCC are the same, irrespective"
326    echo "of the operating system. "
327    FPIC_FLAG=""       
328    SHARED_FLAG=""   
329    SONAME_FLAG=""
330    WHOLE_ARCHIVE_FLAG=""
331    NO_WHOLE_ARCHIVE_FLAG=""
332elif  [ "x`$SAGE_LOCAL/bin/testcc.sh $CC`" = "xHP_on_Alpha_Linux" ] ; then
333    echo "Warning: Some compiler options when using HP's compiler"
334    echo "on Alpha Linux are in the file sage-env. These might"             
335    echo "not be correct and so will need adjusting."
336    echo "It is suggested that you try to build Sage with"
337    echo "GCC first, as that is more likely to work, as the"
338    echo "compiler flags used by GCC are the same, irrespective"
339    echo "of the operating system. "
340    FPIC_FLAG=""       
341    SHARED_FLAG=""   
342    SONAME_FLAG=""
343    WHOLE_ARCHIVE_FLAG=""
344    NO_WHOLE_ARCHIVE_FLAG=""
345elif  [ "x`$SAGE_LOCAL/bin/testcc.sh $CC`" = "xUnknown" ] ; then
346    echo "Your compiler type is unknown. So suitable compiler" 
347    echo "options are unknown. The flags will be set to the names" 
348    echo "used by GCC, but these are probably wrong"
349    echo "Please advise on the sage-support mailing list what"
350    echo "compiler you are using, and someone will help you"
351    FPIC_FLAG="-fPIC"
352    SHARED_FLAG="-shared"
353    SONAME_FLAG="-soname"
354    WHOLE_ARCHIVE_FLAG="--whole-archive" 
355    NO_WHOLE_ARCHIVE_FLAG="--no-whole-archive"
356    CFLAGS = "$CFLAGS -Wall"
357    CXXFLAGS = "$CXXFLAGS -Wall"
358    FCFLAGS = "$FCFLAGS -Wall"
359fi
360
361# Add debugging option (-g) unless SAGE_DEBUG is set to "no".
362
363if [  "x$SAGE_DEBUG" != "xno"  ] ; then
364   CFLAGS="$CFLAGS -g"
365   CXXFLAGS="$CXXFLAGS -g"
366   FCFLAGS="$FCFLAGS -g"
367fi
368
369
370# Add the appropate options to CFLAGS, CXXFLAGS and FCFLAGS to
371# produce a 64-bit binary. Doing this once, and only once in
372# sage-env is preferable to setting it in virtually all
373# .spkg files. If its wrong, it can be changed here.
374
375# It is possible that -m64 or the appropiate option might be
376# needed for linking in some places, so it is also exported
377# as a variable itself, though I doubt it would be needed
378# often. Flint will need this, and so does ECL I believe.
379
380if [ "x$SAGE64" = "xyes" ] ; then
381   if  [ "x`$SAGE_LOCAL/bin/testcc.sh $CC`" = "xGCC" ] ; then 
382      # Flags for a 64-bit build.
383      CFLAG64="-m64"
384      CXXFLAG64="-m64"
385      FCFLAG64="-m64"
386   elif  [ "x`$SAGE_LOCAL/bin/testcc.sh $CC`" = "xSun_Studio" ] ; then
387      CFLAG64="-m64"
388      CXXFLAG64="-m64"
389      FCFLAG64="-m64"
390   elif  [ "x`$SAGE_LOCAL/bin/testcc.sh $CC`" = "xIBM_on_AIX" ] ; then 
391      # http://www-01.ibm.com/support/docview.wss?uid=swg27012860&aid=1
392      # The appropriate 64-bit option for IBM's C++ and Fortran
393      # compilers are assumed to be the same as the
394      # C compiler. This has not been checked
395      # Adding -q64 to generate 64-bit code
396      CFLAG64="-q64"
397      CXXFLAG64="-q64"
398      FCFLAG64="-q64"
399   elif  [ "x`$SAGE_LOCAL/bin/testcc.sh $CC`" = "xHP_on_HP-UX" ] ; then 
400      # Two sort of processors are used on HP-UX machines - the older
401      # PA-RISC and the newer Itanium. The 'model' command is the preffered
402      # way to get this information, rather than 'uname', as HP might in future
403      # use model numbers which are incompatible with the 'uname' command.
404      # This is documented in the 'model' man page.
405      if [ `model | grep 9000` ] ; then
406         # Adding compiler flags for PA-RISC 2.0 architecture.
407         CFLAG64="+DA2.0W"
408         CXXFLAG64="+DA2.0W"
409         FCFLAG64="+DA2.0W"
410      elif [ `model | grep ia64` ]  ; then
411         # Itanium.
412         CFLAG64="+DD64"
413         CXXFLAG64="+DD64"
414         FCFLAG64="+DD64"
415      fi
416   elif  [ "x`$SAGE_LOCAL/bin/testcc.sh $CC`" = "xHP_on_Tru64" ] ; then 
417      # 64-bit is the default on Tru64, so no options needed to build
418      # http://h30097.www3.hp.com/docs/porting/tru64-to-hpux/TITLE.HTM
419      CFLAG64=""
420      CXXFLAG64=""
421      FCFLAG64=""
422   elif  [ "x`$SAGE_LOCAL/bin/testcc.sh $CC`" = "xHP_on_Alpha_Linux" ] ; then 
423      # I've not carefully checked the Tru64 or Alpha Linux documentation
424      # but it can be found at http://h30097.www3.hp.com/cplus/
425      # I'll add the correct flags at a later date, but this is not urgent
426      # as there is nobody porting Sage to Tru64 yet.
427      CFLAG64="-HP_on_Alpha_Linux_option-to-build-64-bit-code"
428      CXXFLAG64="-HP_on_Alpha_Linux_option-to-build-64-bit-code"
429      FCFLAG64="-HP_on_Alpha_Linux_option-to-build-64-bit-code"
430   elif  [ "x`$SAGE_LOCAL/bin/testcc.sh $CC`" = "xUnknown" ] ; then
431      echo "Warning: Since the compiler type is unknown, the"
432      echo "compiler option to generate 64-bit code is unknown. The -m64"
433      echo "option, which is used by GCC will be added, but this"
434      echo "is probably wrong. Without knowing the compiler, it's"
435      echo "impossible to know the right flags to use"
436      CFLAG64="-m64"
437      CXXFLAG64="-m64"
438      FCFLAG64="-m64"
439   fi
440   CFLAGS="$CFLAGS $CFLAG64"
441   CXXFLAGS="$CXXFLAGS $CXXFLAG64"
442   FCFLAGS="$FCFLAGS $FCFLAG64"
443fi
444
445if [ "$CXXFLAGS" = "" ]; then
446   CXXFLAGS="$CFLAGS"
447fi
448
449if [ "$CP" = "" ]; then
450    CP="cp"  && export CP
451fi
452
453if [ "$MV" = "" ]; then
454    MV="mv"  && export MV
455fi
456
457if [ "$MAKE" = "" ]; then
458    MAKE="make"         && export MAKE
459fi
460
461if [ "$RM" = "" ]; then
462    RM="rm"  && export RM
463fi
464 
465if [ "$RANLIB" = "" ]; then
466    RANLIB="ranlib"  && export RANLIB
467fi
468 
469if [ "$LN" = "" ]; then
470    LN="ln"  && export LN
471fi
472 
473if [ "$MKDIR" = "" ]; then
474    MKDIR="mkdir"  && export MKDIR
475fi
476 
477if [ "$CHMOD" = "" ]; then
478    CHMOD="chmod"  && export CHMOD
479fi
480 
481if [ "$TOUCH" = "" ]; then
482    TOUCH="touch"  && export TOUCH
483fi
484
485if [ "$MAKEFLAGS" != "" ]; then
486    MFLAGS="$MAKEFLAGS"  && export MFLAGS
487fi
488
489# See trac 7186 -- this is needed if ecl is moved
490ECLDIR="$SAGE_LOCAL/lib/ecl/" && export ECLDIR
491
492# Set a variable SHARED_LIBRARY_EXTENSION equal to the extension (without the dot)
493# used on shared libraries. Lots of bits of code in Sage have differenent excepts for
494# OS X and Cygwin, but a lot of this could be cleared up using
495if [ "x$UNAME" = "xAIX" ] ; then
496    SHARED_LIBRARY_EXTENSION="a"
497elif [ "x$UNAME" = "xCYGWIN" ] ; then
498    SHARED_LIBRARY_EXTENSION="dll"
499elif [ "x$UNAME" = "xDarwin" ] ; then
500    SHARED_LIBRARY_EXTENSION="dylib"
501elif [ "x$UNAME" = "xHP-UX" ] ; then
502    SHARED_LIBRARY_EXTENSION="sl"
503else
504    SHARED_LIBRARY_EXTENSION="so"
505fi
506
507# Export variable names.
508export CC
509export CFLAG64
510export CFLAGS
511export CXXFLAG64
512export CXXFLAGS
513export FCFLAG64
514export FCFLAGS
515export FPIC_FLAG
516export NO_WHOLE_ARCHIVE_FLAG
517export SAGE_DEBUG
518export SHARED_FLAG
519export SHARED_LIBRARY_EXTENSION
520export SONAME_FLAG
521export UNAME
522export WHOLE_ARCHIVE_FLAG
523
524# Print environment variables if the variable SAGE_PRINT_ENVIRONMENT
525# is exported to 'yes'
526if [ "x$SAGE_PRINT_ENVIRONMENT" = "xyes" ] ; then
527   echo "The environment for Sage will be as follows. If any"
528   echo "variables are wrong, you may be able to change them"
529   echo "by setting a variable."
530   echo "AR=$AR"
531   echo "AS=$AS"
532   echo "CC=$CC"
533   echo "CFLAG64=$CFLAG64  - Used by C compiler to build 64-bit code (-m64 for gcc)"
534   echo "CFLAGS=$CFLAGS"
535   echo "CP=$CP"
536   echo "CXX=$CXX"
537   echo "CXXFLAG64=$CXXFLAG64  - Used by C++ compiler to build 64-bit code (-m64 for g++)"
538   echo "CXXFLAGS=$CXXFLAGS"
539   echo "ECLDIR=$ECLDIR"
540   echo "FCFLAG64=$FCFLAG64 flag used by Fortran compiler to build 64-bit code (-m64 for gfortran)"
541   echo "FCFLAGS=$FCFLAGS"
542   echo "FPIC_FLAG=$FPIC_FLAG  - Used to produce position independent code"
543   echo "LD=$LD"
544   echo "LDFLAGS=$LDFLAGS"
545   echo "MAKE=$MAKE"
546   echo "MAKEFLAGS=$MAKEFLAGS (MFLAGS will be exported the same too)"
547   echo "RANLIB=$RANLIB"
548   echo "SAGE64=$SAGE64"
549   echo "SHARED_FLAG=$SHARDED_FLAG  - used to build a shared library"
550   echo "SHARED_LIBRARY_EXTENSION=$SHARED_LIBRARY_EXTENSION  - sl, so, dll etc"
551   echo "SONAME_FLAG="$SONAME_FLAG"
552   echo "WHOLE_ARCHIVE_FLAG="$WHOLE_ARCHIVE_FLAG"
553   echo "NO_WHOLE_ARCHIVE_FLAG=$NO_WHOLE_ARCHIVE_FLAG"
554fi