File: magics-config.in

package info (click to toggle)
magics%2B%2B 2.14.11-4
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 137,572 kB
  • sloc: cpp: 233,348; xml: 19,407; sh: 10,487; ansic: 6,862; perl: 2,536; makefile: 1,418; python: 812; fortran: 624; asm: 271
file content (313 lines) | stat: -rw-r--r-- 7,018 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
#!/bin/sh

prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=`pkg-config --variable=libdir magics`
includedir=@includedir@
F77=`pkg-config --variable=F77 magics`
CC=`pkg-config --variable=CC magics`
CXX=`pkg-config --variable=CXX magics`
CXXFLAGS=`pkg-config --variable=CXXFLAGS magics`
AXX=`pkg-config --variable=AXX magics`
SHLIB_EXT=`pkg-config --variable=SHLIB_EXT magics`
FFLAGS=`pkg-config --variable=FFLAGS magics`
CPPLIBS=`pkg-config --variable=CPPLIBS magics`
LDFLAGS=`pkg-config --variable=LDFLAGS magics`
FLIBS=`pkg-config --variable=FLIBS magics`
MAGICS_3RDPARTY_LIBS=`pkg-config --variable=MAGICS_3RDPARTY_LIBS magics`
MAGICS_3RDPARTY_INCLUDE=`pkg-config --variable=MAGICS_3RDPARTY_INCLUDE magics`
py_dir=`pkg-config --variable=py_dir magics`
suffix=""

#
#  add --print-config
#
#
# test 64bit C/C++ & intel compiler
#
#  configure.ac  -  deprecated string option for gcc !!!!
#



usage()
{
	cat <<EOF
Usage: magics-config [OPTION] ...

Uses by default version @MAGICS_PACKAGE_VERSION@@MAGICS_PACKAGE_VERSION_ADDENDUM@ of Magics.

Generic options
  --version     output Magics version information.
  --help        display this help and exit.
  --print-setup print how the environment can be set up

Compilation support options
  --cxxflags    print pre-processor and compiler flags for C/C++
  --libs        print linking flags for C++
  --clibs       print linking flags for C
  --libdir      print directory where libraries are installed
  --f90static   print library linking information (static)
  --f90shared   print library linking information (shared)

  --compile     compile simple Magics Fortran programs (default single precision!)  
                  Example: magics-config --compile=wind.f
  --compileC    compile simple Magics C programs  
                  Example: magics-config --compileC=wind.c
  --suffix      set suffix of Fortran or C code files

  --double      include compiler option for fortran double precision 
                  (default single - only for interface - internally only double is used)
  --64bit       include fortran option for 64 bit

C/C++ flags use shared libraries if possible, otherwise static libraries are used. '--double' has 
NO effect on C/C++ programs.

Install directories Magics was configured to
  --prefix[=DIR]

EOF
	exit $1
}

if test -h ${prefix}; then
	name=$(readlink -q "${prefix}")
	if test -d ${name}; then
		prefix=name
	else
		prefix=$(dirname "${prefix}")
		prefix="${prefix}/${name}"
	fi
fi

ldlib="${prefix}/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
if test $# -eq 0; then
	usage 1 1>&2
fi

while test $# -gt 0; do
	case "$1" in
		-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
		*) ;;
	esac

	case $1 in
	--prefix=*)
		prefix=$optarg
		;;
	--prefix)
		echo_prefix=yes
		;;
	--version)
		echo @MAGICS_PACKAGE_VERSION@
		;;
	--with-cairo)
		echo "@cairo@"
		;;
	--with-python)
		echo "@python@"
		;;
	--with-odb)
		echo "@odb@"
		;;
	--with-netcdf)
		echo "@netcdf@"
		;;
	--with-metview)
		echo "@metview@"
		;;
	--with-qt)
		echo "@qt@"
		;;
	--with-gd)
		echo "@raster@"
		;;
	--with-bufr)
		echo "@bufr@"
		;;
	--with-spot)
		echo "@spot@"
		;;
	--help)
		usage 0
		;;
	--print-setup)
		echo ""
		echo " For sh, ksh, dash and bash:"
		echo ""
		echo "   export MAGPLUS_HOME=${prefix}"
		echo "   export PATH=${prefix}/bin:\$PATH"
                echo "   export LD_LIBRARY_PATH=\"$ldlib\""
		echo "   export PYTHONPATH=\"${py_dir}:\${PYTHONPATH:-/usr/lib}\""
		echo ""
		echo " You might want add these lines to your login scripts (.profile, .kshrc or .bashrc)."
		echo ""
		;;
	--cxxflags)
		echo_cxxflags=yes
		;;
	--libs)
		echo_libs=yes
		;;
	--libdir)
		echo "${libdir}"
		;;
	--clibs)
		echo_libs=yes
		echo_clibs=yes
		;;
	--f90static)
		echo_static=yes
		echo_shared=no
		;;
	--f90shared)
		echo_shared=yes
		echo_static=no
		;;
	--suffix=*)
		suffix=$optarg
		;;
	--compile=*)
		compile=yes
		f77_file=$optarg
		;;
	--compileC=*)
		compileC=yes
		c_file=$optarg
		;;
	--double)
		double=yes
		case "${F77}" in
			gfortran )
				FXX="-fdefault-real-8 ${FXX}"
				;;
			g77 )
				echo ""#"NO DOUBLE FLAG in g77"
				;;
			# Intel compiler
			# Portland pgf90
			# IBM fortran compiler
			ifc | ifort | pgf90 | pgf77 | xlf | xlf90 | xlf_r | xlf90_r )
				FXX="-r8 ${FXX}"
				;;
		esac
		;;
	--odb)
		odb=no
		;;
	--64bit)
		amd64=yes
		case "${F77}" in
			ifc | ifort | gfortran )
				FXX="-m64 ${FXX}"
				;;
			g77 )
				echo ""#"NO DOUBLE FLAG in g77"
				;;
			# Portland pgf90
			pgf90 | pgf77 )
				FXX="-tp amd64 ${FXX}"
				;;
		esac

		case "${CC}" in
			icc | icpc | gcc | g++ )
				CXX="-m64 ${CXX}"
				;;
			pgc | pgcpp )
				CXX="-tp amd64 ${CXX}"
				;;
		esac
		;; 
	*)
		usage 1 1>&2
		;;
	esac
	shift
done

if test "$echo_prefix" = "yes"; then
	echo $prefix
fi

if test "$echo_cxxflags" = "yes"; then
	if test "$includedir" != "/usr/include" ; then
		my_cxxflags="-I${includedir}"
	fi
	echo "${AXX} ${my_cxxflags} ${MAGICS_3RDPARTY_INCLUDE}"
fi

if test "$echo_libs" = "yes"; then
if test -f ${libdir}/libMagPlus.${SHLIB_EXT} ; then
		my_libs="-L${libdir} -lMagPlus"
	else
		my_libs="${libdir}/libMagPlus.a"
	fi

	my_libs="${my_libs} ${LDFLAGS} ${MAGICS_3RDPARTY_LIBS} ${FLIBS}"

	if test "$echo_clibs" = "yes"; then
		my_libs="${my_libs} $CPPLIBS"
	fi

	echo "${my_libs}"
fi

if test "$double" = "yes"; then
	precision="${FXX} ${libdir}/libMagPlusDouble.a"
else
	precision="${FXX} ${libdir}/libMagPlusSingle.a"
fi


if test "$echo_static" = "yes"; then
	if test -f ${libdir}/libMagPlus.a ; then
	  static="${precision} ${libdir}/libMagPlus.a -L${libdir} ${LDFLAGS} ${MAGICS_3RDPARTY_LIBS} $CPPLIBS"
	  echo ${static}
	else
	  echo "magics-config: NO STATIC LIBRARY available"
	fi
fi

if test "$echo_shared" = "yes"; then
	if test -f ${libdir}/libMagPlus.${SHLIB_EXT} ; then
	  shared="${precision} -L${libdir} -lMagPlus ${LDFLAGS} ${MAGICS_3RDPARTY_LIBS} $CPPLIBS"
	  echo ${shared}
	else
	  echo "magics-config: NO SHARED LIBRARY"
	fi
fi

if test "$echo_flibs" = "yes"; then
	echo ${FLIBS}
fi

if test "$compile" = "yes"; then
	out=""
	if test "${suffix}x" = "x"; then
	   suffix="f"
	fi

	name="`basename $f77_file .${suffix}`"

	if test ${name} != ${f77_file} ; then
	      out="-o $name "              ### avoid overriding source file
	fi
	echo "$F77 ${out}$f77_file ${FFLAGS} ${precision} -L${libdir} -lMagPlus ${LDFLAGS} ${MAGICS_3RDPARTY_LIBS} $CPPLIBS"
	$F77 ${out}$f77_file ${FFLAGS} ${precision} -L${libdir} -Wl,-rpath,${libdir} -lMagPlus ${LDFLAGS} ${MAGICS_3RDPARTY_LIBS} $CPPLIBS
fi

if test "$compileC" = "yes"; then
	out=""
	if test "${suffix}x" = "x"; then
	   suffix="c"
	fi

	name="`basename $c_file .${suffix}`"

	if test ${name} != ${c_file} ; then
	      out="-o $name "              ### avoid overriding source file
	fi
	echo "$CC ${out}$c_file ${CFLAGS} -L${libdir} -lMagPlus ${LDFLAGS} ${MAGICS_3RDPARTY_LIBS} $CPPLIBS ${FLIBS}"
	$CC ${out}$c_file ${CFLAGS} -I${includedir} -L${libdir} -Wl,-rpath,${libdir} -lMagPlus ${LDFLAGS} ${MAGICS_3RDPARTY_LIBS} $CPPLIBS ${FLIBS}
fi