AMPI: Add fsglobals (filesystem) and pipglobals (Process-in-Process) privatization...
[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 # Use gnu1x instead of c1x to get _GNU_SOURCE features and inline assembly extensions
40 [ -z "$CMK_ENABLE_C11" ] && CMK_ENABLE_C11="-std=gnu1x"
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 CMK_NATIVE defaults before adding potentially target-specific build-line args
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 [ -z "$CMK_NATIVE_DEFS" ] && CMK_NATIVE_DEFS="$CMK_DEFS"
69 [ -z "$CMK_NATIVE_CC_FLAGS" ] && CMK_NATIVE_CC_FLAGS="$CMK_CC_FLAGS"
70 [ -z "$CMK_NATIVE_CXX_FLAGS" ] && CMK_NATIVE_CXX_FLAGS="$CMK_CXX_FLAGS"
71 [ -z "$CMK_NATIVE_LD_FLAGS" ] && CMK_NATIVE_LD_FLAGS="$CMK_LD_FLAGS"
72 [ -z "$CMK_NATIVE_LDXX_FLAGS" ] && CMK_NATIVE_LDXX_FLAGS="$CMK_LDXX_FLAGS"
73
74 if [ -r $CHARMINC/conv-mach-opt.sh ]
75 then
76 . $CHARMINC/conv-mach-opt.sh
77 fi
78
79 CMK_CC_RELIABLE="$CMK_CC_RELIABLE $CMK_DEFS "
80 CMK_CC_FASTEST="$CMK_CC_FASTEST $CMK_DEFS "
81
82 OPTS_CC="$OPTS_CC $USER_OPTS_CC"
83 OPTS_CXX="$OPTS_CXX $USER_OPTS_CXX"
84 OPTS_LD="$OPTS_LD $USER_OPTS_LD"
85
86 [ -z "$CMK_PIC" ] && CMK_PIC='-fpic'
87 [ -z "$CMK_PIE" ] && CMK_PIE='-pie -fPIE'
88
89 [ -z "$CMK_SEQ_CC" ] && CMK_SEQ_CC="$CMK_CC"
90 [ -z "$CMK_SEQ_CXX" ] && CMK_SEQ_CXX="$CMK_CXX"
91 [ -z "$CMK_SEQ_LD" ] && CMK_SEQ_LD="$CMK_LD"
92 [ -z "$CMK_SEQ_LDXX" ] && CMK_SEQ_LDXX="$CMK_LDXX"
93 [ -z "$CMK_SEQ_F90" ] && CMK_SEQ_F90="$CMK_CF90"
94 [ -z "$CMK_SEQ_AR" ] && CMK_SEQ_AR="$CMK_AR"
95 [ -z "$CMK_SEQ_RANLIB" ] && CMK_SEQ_RANLIB="$CMK_RANLIB"
96 [ -z "$CMK_SEQ_LIBS" ] && CMK_SEQ_LIBS="$CMK_NATIVE_LIBS"
97
98 [ -z "$CMK_SEQ_DEFS" ] && CMK_SEQ_DEFS="$CMK_DEFS"
99 [ -z "$CMK_SEQ_CC_FLAGS" ] && CMK_SEQ_CC_FLAGS="$CMK_CC_FLAGS"
100 [ -z "$CMK_SEQ_CXX_FLAGS" ] && CMK_SEQ_CXX_FLAGS="$CMK_CXX_FLAGS"
101 [ -z "$CMK_SEQ_LD_FLAGS" ] && CMK_SEQ_LD_FLAGS="$CMK_LD_FLAGS"
102 [ -z "$CMK_SEQ_LDXX_FLAGS" ] && CMK_SEQ_LDXX_FLAGS="$CMK_LDXX_FLAGS"
103
104 CMK_CPP_C_FLAGS="$CMK_CPP_C_FLAGS $CMK_DEFS"
105 CMK_CC_FLAGS="$CMK_CC_FLAGS $CMK_DEFS"
106 CMK_CXX_FLAGS="$CMK_CXX_FLAGS $CMK_DEFS"
107 CMK_LD_FLAGS="$CMK_LD_FLAGS $CMK_DEFS"
108 CMK_LDXX_FLAGS="$CMK_LDXX_FLAGS $CMK_DEFS"
109
110 CMK_NATIVE_CC_FLAGS="$CMK_NATIVE_CC_FLAGS $CMK_NATIVE_DEFS"
111 CMK_NATIVE_CXX_FLAGS="$CMK_NATIVE_CXX_FLAGS $CMK_NATIVE_DEFS"
112 CMK_NATIVE_LD_FLAGS="$CMK_NATIVE_LD_FLAGS $CMK_NATIVE_DEFS"
113 CMK_NATIVE_LDXX_FLAGS="$CMK_NATIVE_LDXX_FLAGS $CMK_NATIVE_DEFS"
114
115 CMK_SEQ_CC_FLAGS="$CMK_SEQ_CC_FLAGS $CMK_SEQ_DEFS"
116 CMK_SEQ_CXX_FLAGS="$CMK_SEQ_CXX_FLAGS $CMK_SEQ_DEFS"
117 CMK_SEQ_LD_FLAGS="$CMK_SEQ_LD_FLAGS $CMK_SEQ_DEFS"
118 CMK_SEQ_LDXX_FLAGS="$CMK_SEQ_LDXX_FLAGS $CMK_SEQ_DEFS"
119
120 [ -z "$CMK_CELL" ] && CMK_CELL=0
121
122 [ -z "$CMK_C_OPENMP" ] && CMK_C_OPENMP="-fopenmp"
123 [ -z "$CMK_F_OPENMP" ] && CMK_F_OPENMP="$CMK_C_OPENMP"
124 [ -z "$CMK_LD_OPENMP" ] && CMK_LD_OPENMP="$CMK_C_OPENMP"
125
126 if [ -n "$GNI_CRAYXE" -o -n "$GNI_CRAYXC" ] && [ -z "$CMK_SMP" ]
127 then
128   . $CHARMINC/conv-mach-pxshm.sh
129 fi
130
131 if [ -n "$GNI_CRAYXE" -o -n "$GNI_CRAYXC" ] && [ -z "$REGULARPAGE" ]
132 then
133   . $CHARMINC/conv-mach-hugepages.sh
134 fi