2804805ce82fd215373a298c8d1baa71bf13185f
[charm.git] / src / scripts / conv-config.sh
1 #!/bin/sh
2 #
3 # Generic converse configuration script:
4 #   Reads various configuration scripts and sets defaults.
5
6 if [ -z "$CHARMINC" ]
7 then
8         echo "conv-config.sh: CHARMINC must point to the charm include dir"
9         exit 1
10 fi
11
12 if [ -r $CHARMINC/conv-mach-pre.sh ]
13 then
14 . $CHARMINC/conv-mach-pre.sh
15 fi
16
17 if [ -r $CHARMINC/conv-common.sh ]
18 then
19 . $CHARMINC/conv-common.sh
20 fi
21
22 if [ ! -r $CHARMINC/conv-mach.sh ]
23 then
24         echo "Can't find conv-mach.sh in $CHARMINC directory."
25         exit 1
26 fi
27
28 CMK_LD_SHARED="-shared"
29
30 . $CHARMINC/conv-mach.sh
31
32 [ -z "$CMK_C_OPTIMIZE" ] && CMK_C_OPTIMIZE="-O2"
33 [ -z "$CMK_C_DEBUG" ] && CMK_C_DEBUG="-g"
34 [ -z "$CMK_CXX_OPTIMIZE" ] && CMK_CXX_OPTIMIZE="$CMK_C_OPTIMIZE"
35 [ -z "$CMK_CXX_DEBUG" ] && CMK_CXX_DEBUG="$CMK_C_DEBUG"
36 [ -z "$CMK_F90_OPTIMIZE" ] && CMK_F90_OPTIMIZE="-O2"
37 [ -z "$CMK_F90_DEBUG" ] && CMK_F90_DEBUG="-O"
38
39 [ -z "$CMK_ENABLE_C11" ] && CMK_ENABLE_C11="-std=c1x"
40 [ -z "$CMK_ENABLE_CPP11" ] && CMK_ENABLE_CPP11="-std=c++0x"
41
42 [ -z "$CMK_CC" ] && CMK_CC='cc '
43 [ -z "$CMK_CXX" ] && CMK_CXX='c++ '
44 [ -z "$CMK_SUF" ] && CMK_SUF='o'
45 [ -z "$CMK_AR" ] && CMK_AR='ar q'
46 [ -z "$CMK_QT" ] && CMK_QT='generic'
47 [ -z "$CMK_LD" ] && CMK_LD="$CMK_CC"
48 [ -z "$CMK_LDXX" ] && CMK_LDXX="$CMK_CXX"
49 [ -z "$CMK_NM" ] && CMK_NM='nm '
50 [ -z "$CMK_SHARED_SUF" ] && CMK_SHARED_SUF='so'
51
52 [ -z "$CMK_FPP" ] && CMK_FPP="$CMK_CF90"
53 [ -z "$CMK_CF90_FIXED" ] && CMK_CF90_FIXED="$CMK_CF90"
54 [ -z "$CMK_CC_RELIABLE" ] && CMK_CC_RELIABLE="$CMK_CC"
55 [ -z "$CMK_CC_FASTEST" ] && CMK_CC_FASTEST="$CMK_CC"
56 [ -z "$CMK_CC_RELIABLE" ] && CMK_CC_RELIABLE="$CMK_CC"
57 [ -z "$CMK_CF77" ] && CMK_CF77_FIXED="$CMK_CF90"
58 [ -z "$CMK_CF77_FIXED" ] && CMK_CF77_FIXED="$CMK_CF77"
59
60 # set default earlier because option configs may need these value
61 [ -z "$CMK_NATIVE_CC" ] && CMK_NATIVE_CC="$CMK_CC"
62 [ -z "$CMK_NATIVE_CXX" ] && CMK_NATIVE_CXX="$CMK_CXX"
63 [ -z "$CMK_NATIVE_LD" ] && CMK_NATIVE_LD="$CMK_LD"
64 [ -z "$CMK_NATIVE_LDXX" ] && CMK_NATIVE_LDXX="$CMK_LDXX"
65 [ -z "$CMK_NATIVE_F90" ] && CMK_NATIVE_F90="$CMK_CF90"
66 [ -z "$CMK_NATIVE_AR" ] && CMK_NATIVE_AR="$CMK_AR"
67
68 if [ -r $CHARMINC/conv-mach-opt.sh ]
69 then
70 . $CHARMINC/conv-mach-opt.sh
71 fi
72
73 OPTS_CC="$OPTS_CC $USER_OPTS_CC"
74 OPTS_CXX="$OPTS_CXX $USER_OPTS_CXX"
75 OPTS_LD="$OPTS_LD $USER_OPTS_LD"
76 OPTS_LDXX="$OPTS_LDXX $USER_OPTS_LDXX"
77
78 if [ -n "$CMK_CC64" ] 
79 then
80   QT=`echo $CMK_QT | sed -e 's/64$//'`
81   if test $QT = $CMK_QT
82   then
83     if echo $CMK_QT | grep '-' > /dev/null 2> /dev/null
84     then
85       CMK_QT=`echo $CMK_QT | sed -e 's/-/64-/'`
86     else
87       CMK_QT="${CMK_QT}64"
88     fi
89   fi
90 fi
91
92 [ -z "$CMK_PIC" ] && CMK_PIC='-fpic'
93
94 [ -z "$CMK_SEQ_CC" ] && CMK_SEQ_CC="$CMK_CC"
95 [ -z "$CMK_SEQ_CXX" ] && CMK_SEQ_CXX="$CMK_CXX"
96 [ -z "$CMK_SEQ_LD" ] && CMK_SEQ_LD="$CMK_LD"
97 [ -z "$CMK_SEQ_LDXX" ] && CMK_SEQ_LDXX="$CMK_LDXX"
98 [ -z "$CMK_SEQ_F90" ] && CMK_SEQ_F90="$CMK_CF90"
99 [ -z "$CMK_SEQ_AR" ] && CMK_SEQ_AR="$CMK_AR"
100 [ -z "$CMK_SEQ_RANLIB" ] && CMK_SEQ_RANLIB="$CMK_RANLIB"
101 [ -z "$CMK_SEQ_LIBS" ] && CMK_SEQ_LIBS="$CMK_NATIVE_LIBS"
102
103 [ -z "$CMK_CELL" ] && CMK_CELL=0
104
105 [ -z "$CMK_C_OPENMP" ] && CMK_C_OPENMP="-fopenmp"
106 [ -z "$CMK_F_OPENMP" ] && CMK_F_OPENMP="$CMK_C_OPENMP"
107 [ -z "$CMK_LD_OPENMP" ] && CMK_LD_OPENMP="$CMK_C_OPENMP"
108
109 # apply incdir and libdir
110 CMK_CC="$CMK_CC $CMK_INCDIR "
111 CMK_CXX="$CMK_CXX $CMK_INCDIR "
112 CMK_CXXPP="$CMK_CXXPP $CMK_INCDIR "
113 CMK_CPP_C="$CMK_CPP_C $CMK_INCDIR "
114 CMK_CC_FASTEST="$CMK_CC_FASTEST $CMK_INCDIR "
115 CMK_CC_RELIABLE="$CMK_CC_RELIABLE $CMK_INCDIR "
116 CMK_LD="$CMK_LD $CMK_LIBDIR "
117 CMK_LDXX="$CMK_LDXX $CMK_LIBDIR "
118
119 # native compiler skips incdir and libdir at build
120 # chances are they may be different compilers
121 #CMK_NATIVE_CC="$CMK_NATIVE_CC $CMK_INCDIR "
122 #CMK_NATIVE_CXX="$CMK_NATIVE_CXX $CMK_INCDIR "
123 #CMK_NATIVE_LD="$CMK_NATIVE_LD $CMK_LIBDIR "
124 #CMK_NATIVE_LDXX="$CMK_NATIVE_LDXX $CMK_LIBDIR "
125
126 if [ -n "$GNI_CRAYXE" -o -n "$GNI_CRAYXC" ] && [ -z "$CMK_SMP" ]
127 then
128   . $CHARMINC/conv-mach-pxshm.sh
129 fi
130