File: configure.ac

package info (click to toggle)
grib-api 1.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 28,008 kB
  • ctags: 10,015
  • sloc: ansic: 63,157; sh: 9,355; f90: 2,545; makefile: 2,496; yacc: 519; perl: 240; lex: 217
file content (471 lines) | stat: -rwxr-xr-x 13,982 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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
dnl Process this file with autoconf to produce a configure script.

AC_DEFUN([_AM_AUTOCONF_VERSION],[])

AC_PREREQ(2.59)
AC_INIT(src/grib_api.h,[ ], [Software.Services@ecmwf.int])

# Source file containing package/library versioning information.

 . ${srcdir}/version.sh

GRIB_API_MAIN_VERSION="${GRIB_API_MAJOR_VERSION}.${GRIB_API_MINOR_VERSION}.${GRIB_API_REVISION_VERSION}"
 echo $GRIB_API_MAIN_VERSION
PACKAGE_VERSION="${GRIB_API_MAIN_VERSION}"
AC_SUBST(GRIB_API_MAIN_VERSION)
echo "configuring ${PACKAGE_NAME} ${PACKAGE_VERSION}"

AC_CONFIG_AUX_DIR([config])

# Ensure that make can run correctly
AM_SANITY_CHECK

AC_CONFIG_SRCDIR([src/grib_api.h])
AC_CONFIG_HEADER([src/config.h])
AM_INIT_AUTOMAKE($PACKAGE_NAME,[${PACKAGE_VERSION}],[http://www.ecmwf.int])

definition_files_path=/usr/local/share/grib_api/definitions
samples_files_path=/usr/local/share/grib_api/samples
ifs_samples_files_path=/usr/local/share/grib_api/ifs_samples
default_perl_install='${prefix}/perl'

if test "$prefix" == 'NONE' ; then
	prefix="/usr/local"
fi

if test "$prefix" != '/usr/local' ; then
  definition_files_path=${prefix}/share/grib_api/definitions
  samples_files_path=${prefix}/share/grib_api/samples
  ifs_samples_files_path=${prefix}/share/grib_api/ifs_samples
  default_perl_install=${prefix}/perl
fi

if test "$datadir" != '${datarootdir}' ; then
   definition_files_path=$datadir/definitions
fi


AC_DEFINE_UNQUOTED(GRIB_API_MAIN_VERSION,$GRIB_API_MAIN_VERSION,Grib Api version)
AC_DEFINE_UNQUOTED(GRIB_API_MAJOR_VERSION,$GRIB_API_MAJOR_VERSION,Grib Api Major release)
AC_DEFINE_UNQUOTED(GRIB_API_MINOR_VERSION,$GRIB_API_MINOR_VERSION,Grib Api Minor release)
AC_DEFINE_UNQUOTED(GRIB_API_REVISION_VERSION,$GRIB_API_REVISION_VERSION,Grib Api Revision release)
AH_TEMPLATE([_LARGE_FILE_API],
			[Needs to be undefined on some AIX])

dnl Checks for programs.
AC_PROG_CC(xlc_r xlc gcc cc) 
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_YACC
AC_PROG_LEX
AC_PROG_F77(gfortran pgf90 pgf77 xlf gfortran f77 g77 f90 ifort) 
AC_PROG_FC(gfortran pgf90 xlf90 gfortran f90 ifort) 

dnl check availability of pthreads
AC_ARG_ENABLE([pthread],
  [AC_HELP_STRING([--enable-pthread],
                  [enable POSIX thread ])],
    GRIB_PTHREADS=1 , GRIB_PTHREADS=0
)

if test $GRIB_PTHREADS -eq 1
then
AC_GRIB_PTHREADS
AC_GRIB_LINUX_PTHREADS
else
GRIB_LINUX_PTHREADS=0
fi

AC_DEFINE_UNQUOTED(GRIB_PTHREADS,$GRIB_PTHREADS,1->pthreads enabled 0->pthreads disabled)
AC_DEFINE_UNQUOTED(GRIB_LINUX_PTHREADS,$GRIB_LINUX_PTHREADS,1->pthreads enabled 0->pthreads disabled)

dnl check on uppercase fortran modules not working to be fixed
dnl some fortran compilers change the name of the .mod file in upper case!
ac_cv_prog_f90_uppercase_mod=no
AC_PROG_FC_UPPERCASE_MOD
AM_CONDITIONAL(UPPER_CASE_MOD, [test "x$ac_cv_prog_f90_uppercase_mod" = xyes])

AC_IEEE_BE
AC_DEFINE_UNQUOTED(IEEE_BE,$IS_IEEE_BE,1-> ieee big endian float/double 0->no ieee big endian float/double)

AC_IEEE_LE
AC_DEFINE_UNQUOTED(IEEE_LE,$IS_IEEE_LE,1-> ieee little endian float/double 0->no ieee little endian float/double)

dnl disable ieee native packing
AC_ARG_ENABLE([ieee-native],
  [AC_HELP_STRING([--disable-ieee-native],
                  [disable ieee native packing])],
     without_ieee=1,without_ieee=0)

if test $without_ieee -eq 1
then
AC_DEFINE_UNQUOTED(IEEE_LE,0,1-> ieee little endian float/double 0->no ieee little endian float/double)
AC_DEFINE_UNQUOTED(IEEE_BE,0,1-> ieee big endian float/double 0->no ieee big endian float/double)
fi

AC_BIG_ENDIAN
AC_DEFINE_UNQUOTED(IS_BIG_ENDIAN,$IS_BIG_ENDIAN,1-> big endian 0->little endian)

AC_INLINE
AC_DEFINE_UNQUOTED(GRIB_INLINE,$HAS_INLINE,inline if available)

AC_ALIGN
AC_DEFINE_UNQUOTED(GRIB_MEM_ALIGN,$MEM_ALIGN,memory alignment required)

AC_ARG_ENABLE([align-memory],
  [AC_HELP_STRING([--enable-align-memory],
                  [enable memory alignement])],
AC_DEFINE_UNQUOTED(GRIB_MEM_ALIGN,1,memory alignment required) ,
	 )

dnl enable memory management
AC_ARG_ENABLE([memory-management],
  [AC_HELP_STRING([--enable-memory-management],
                  [enable memory ])],
AC_DEFINE_UNQUOTED(MANAGE_MEM,1,memory management) ,
AC_DEFINE_UNQUOTED(MANAGE_MEM,0,memory management) 
	 )

dnl enable development configuration
DEVEL_RULES='' 
AC_ARG_ENABLE([development],
  [AC_HELP_STRING([--enable-development],
                  [enable development configuration ])],
    GRIB_DEVEL=1 , GRIB_DEVEL=0
)
if test $GRIB_DEVEL -eq 1
then
   DEVEL_RULES='extrules.am'
else
   DEVEL_RULES='dummy.am'
fi
AC_SUBST(DEVEL_RULES)
AC_SUBST(GRIB_DEVEL)


dnl Large file support
AC_FUNC_FSEEKO
CREATE_H=''
if test x"$ac_cv_func_fseeko" != xyes ; then
	CREATE_H='./create_h.sh 1'
else
	CREATE_H='./create_h.sh 0'
fi 

AC_SYS_LARGEFILE

dnl What OS are we running?
AC_CANONICAL_HOST

dnl Use libtool
AM_PROG_LIBTOOL
dnl Libtool version information (we use 0 and '0d' for debian until grib_api
dnl maintainers start providing shared libraries)
GRIBAPI_LIBTOOL_VERSIONING="-version-info 0:0:0 -release 0d"
AC_SUBST(GRIBAPI_LIBTOOL_VERSIONING)

GRIB_SAMPLES_PATH=$samples_files_path
GRIB_IFS_SAMPLES_PATH=$ifs_samples_files_path
GRIB_TEMPLATES_PATH=$samples_files_path
GRIB_DEFINITION_PATH=$definition_files_path

AC_DEFINE_UNQUOTED(GRIB_TEMPLATES_PATH,"$samples_files_path",Directory where templates are)
AC_DEFINE_UNQUOTED(GRIB_SAMPLES_PATH,"$samples_files_path",Directory where samples are)
AC_DEFINE_UNQUOTED(GRIB_DEFINITION_PATH,"$definition_files_path",Directory where definition files are)

AC_SUBST(GRIB_TEMPLATES_PATH)
AC_SUBST(GRIB_SAMPLES_PATH)
AC_SUBST(GRIB_IFS_SAMPLES_PATH)
AC_SUBST(GRIB_DEFINITION_PATH)

dnl Fortran interface
AC_ARG_ENABLE([fortran],
  [AC_HELP_STRING([--disable-fortran],
                  [disable fortran interface])],
     without_fortran=1,without_fortran=0)

if test "x$FC" == "x"
then
  without_fortran=1
fi

AM_CONDITIONAL([F90_CHECK], [test $without_fortran -ne 1])
AM_CONDITIONAL([FORTRAN_MOD], [test $without_fortran -ne 1])

if test $without_fortran -ne 1
then
  FORTRAN_MOD=fortran
  AC_SUBST(FORTRAN_MOD)
  F90_CHECK="examples/F90"
  AC_SUBST(F90_CHECK)

  dnl detect the Fortran 90 modules inclusion flag.
dnl  AX_F90_MODULE_FLAG
dnl  if test "$ax_cv_f90_modflag" = "not found" ; then
dnl    AC_MSG_ERROR([unable to find compiler flag for modules inclusion])
dnl  fi
dnl    F90_MODULE_FLAG=$ax_cv_f90_modflag
  F90_MODULE_FLAG="-I " 
  AC_SUBST([F90_MODULE_FLAG])
fi

dnl EMOS
AC_ARG_WITH([emos],
        [AC_HELP_STRING([--with-emos=EMOS],
	    [use emos for tests])],
        emos=$withval, emos='none')

EMOS_LIB=""
if test "$emos" != 'none'
then
  EMOS_LIB=$emos
  AC_DEFINE(HAVE_LIBEMOS,1,Define if you have EMOS library)
fi


dnl fortran libraries
AC_ARG_WITH([fortranlibdir],
        [AC_HELP_STRING([--with-fortranlibdir=FORTRANDIR],
	    [fortran libraries directory ])],
        fortranlibdir=$withval, fortranlibdir='')

AC_ARG_WITH([fortranlibs],
        [AC_HELP_STRING([--with-fortranlibs=FORTRANLIBS],
	    [fortran libraries to link from C])],
        fortranlibs=$withval, fortranlibs='none')

if test "$fortranlibs" != 'none'
then
   EMOS_LIB="$emos -L$fortranlibdir $fortranlibs -Wl,-rpath $fortranlibdir"
fi

AC_SUBST(EMOS_LIB)

dnl timer
AC_ARG_ENABLE([timer],
  [AC_HELP_STRING([--enable-timer],
                  [enable timer])],
     with_timer=1,with_timer=0)
if test ${with_timer} -eq 1
then
  AC_DEFINE(GRIB_TIMER,1,1->Timer on 0->Timer off)
else
  AC_DEFINE(GRIB_TIMER,0,1->Timer on 0->Timer off)
fi


dnl multithread packing
AC_ARG_ENABLE([omp-packing],
  [AC_HELP_STRING([--enable-omp-packing],
                  [enable OpenMP multithreaded packing])],
     with_omp=1,with_omp=0)
if test ${with_omp} -eq 1
then
  AC_DEFINE(OMP_PACKING,1,1->OpenMP packing 0->single thread packing)
else
  AC_DEFINE(OMP_PACKING,0,1->OpenMP packing 0->single thread packing)
fi

dnl Check for jpeg
AC_ARG_ENABLE([jpeg],
  [AC_HELP_STRING([--disable-jpeg],
                  [disable jpeg 2000 for grib 2 decoding/encoding])],
     without_jpeg=1,without_jpeg=0)

AC_ARG_WITH([jasper],
        [AC_HELP_STRING([--with-jasper=JASPER],
	    [use specified jasper installation directory])],
        jasper_dir=$withval, jasper_dir='system')

if test $jasper_dir != 'system'
then
  CFLAGS="$CFLAGS -I${jasper_dir}/include"
  LDFLAGS="$LDFLAGS -L${jasper_dir}/lib"
fi

AC_ARG_WITH([openjpeg],
        [AC_HELP_STRING([--with-openjpeg=OPENJPEG],
	    [use specified openjpeg installation directory])],
        openjpeg_dir=$withval, openjpeg_dir='system')

if test $openjpeg_dir != 'system'
then
  CFLAGS="$CFLAGS -I${openjpeg_dir}/include"
  LDFLAGS="$LDFLAGS -L${openjpeg_dir}/lib"
fi

if test $without_jpeg -ne 1
then
    AC_DEFINE(HAVE_JPEG,1,JPEG enabled)
    AC_CHECK_LIB(jasper,jas_stream_memopen,jasper_ok=1,jasper_ok=0)
    AC_CHECK_LIB(openjpeg,opj_image_create,openjpeg_ok=1,openjpeg_ok=0)

    jpeg_ok=0

    if test $jasper_ok -eq 1
    then
	  jpeg_ok=1
      LIB_JASPER='-ljasper'
      LIBS="$LIB_JASPER $LIBS"
      AC_DEFINE(HAVE_LIBJASPER,1,Define if you have JPEG version 2 "Jasper" library)
      AC_SUBST(LIB_JASPER)
	fi

	if test $openjpeg_ok -eq 1
	then
	  jpeg_ok=1
      LIB_OPENJPEG='-lopenjpeg'
      LIBS="$LIB_OPENJPEG $LIBS"
      AC_DEFINE(HAVE_LIBOPENJPEG,1,Define if you have JPEG version 2 "Openjpeg" library)
      AC_SUBST(LIB_OPENJPEG)
	fi

	if test $jpeg_ok -eq 0
	then
      AC_MSG_NOTICE([
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  CONFIGURATION ERROR: jasper required.                                                               
  jasper installation is not working or missing.                                 

  To fix this problem you have the following options.                                  
  1) Install without the jpeg support enabled (--disable-jpeg), but you won't be able 
     to decode grib 2 data encoded in jpeg.                       
  2) Check if you have jasper installed in a path different from your system path. 
     In this case you can provide your jasper installation path to the configure
     through the option --with-jasper="your_jasper_path"
  3) Download jasper from http://www.ece.uvic.ca/~mdadams/jasper/ and install it.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	  ])
	  [ 0 -eq 1 ]
	  exit 
    fi
  JPEG_TEST="jpeg.sh"
  AC_SUBST(JPEG_TEST)
fi


dnl Check for png
AC_ARG_WITH([png-support],
  [AC_HELP_STRING([--with-png-support],
                  [add support for png decoding/encoding])],
     with_png=1,with_png=0)

if test $with_png -gt 0
then
    AC_MSG_CHECKING(for PNG )
    AC_MSG_RESULT()
    AC_CHECK_HEADER(png.h,passed=1,passed=0)
     AC_CHECK_LIB(png,png_read_png,passed=1,passed=0)
    AC_MSG_CHECKING(if PNG support package is complete)

    if test $passed -gt 0
    then
      LIB_PNG='-lpng'
      LIBS="$LIB_PNG $LIBS"
      AC_DEFINE(HAVE_LIBPNG,1,Define to 1 if you have the png library (-lpng))
      AC_SUBST(LIB_PNG)
      AC_MSG_RESULT(yes)
    else
      AC_MSG_RESULT(no -- some components failed test)
    fi
fi

dnl Perl installation directory

#PERL_INSTALL_OPTIONS="PREFIX=$prefix INSTALLDIRS=perl"
PERL_INSTALL_OPTIONS="LIB=$default_perl_install"

AC_ARG_ENABLE([install-system-perl],
        [AC_HELP_STRING([--enable-install-system-perl],
		                [perl modules will install in the standard perl installation ])],
        enable_perl_install='yes', enable_perl_install='no')

if test "$enable_perl_install" = 'yes'
then
    PERL_INSTALL_OPTIONS=""
fi

AC_SUBST(PERL_INSTALL_OPTIONS)


dnl Disable build/install of Perl grib_api.
AC_ARG_WITH([perl],
        [AC_HELP_STRING([--with-perl=PERL],
	    [use specified Perl binary to configure Perl grib_api])],
        with_perl=$withval, with_perl='no')

dnl Look for PERL if Perl requested
if test "$with_perl" != 'no'
then
  if test "$with_perl" != 'yes'
  then
    AC_CACHE_CHECK(for perl,ac_cv_path_PERL,ac_cv_path_PERL="$with_perl");
    PERL=$ac_cv_path_PERL
    AC_SUBST(PERL)dnl
  else
    AC_PATH_PROGS(PERL,perl perl5,perl)dnl
  fi
fi

dnl Get full paths
builddir=`pwd`

dnl Options to pass when configuring Perl grib_api
GRIB_API_LIB="${builddir}/src/grib_api.a"
GRIB_API_INC="${builddir}/src"
AC_ARG_WITH([perl-options],
  [AC_HELP_STRING([--with-perl-options=[OPTIONS]], [options to pass on command-line when
                          generating Perl grib_api's Makefile from Makefile.PL])],
  PERL_MAKE_OPTIONS=$withval)
AC_SUBST(PERL_MAKE_OPTIONS)
AC_SUBST(GRIB_API_LIB)
AC_SUBST(GRIB_API_INC)

AM_CONDITIONAL(WITH_PERL, test $with_perl != no)

dnl AC_DISABLE_SHARED
dnl AC_PROG_LIBTOOL

dnl Checks for ar and rm
AC_CHECK_PROG(RM, rm, rm)
AC_CHECK_TOOL(AR, ar, ar)

dnl Check if -pedantic available
grib_api_PROG_CC_WARNING_PEDANTIC([-Wall])

dnl Enable -Werror despite compiler version
grib_api_ENABLE_WARNINGS_ARE_ERRORS

dnl Checks for libraries
AC_CHECK_LIB(m,pow)

dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([stddef.h stdlib.h string.h sys/param.h sys/time.h unistd.h math.h stdarg.h assert.h ctype.h fcntl.h])


dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME

dnl Checks for library functions.
AC_FUNC_CLOSEDIR_VOID
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([bzero gettimeofday])

AC_OUTPUT( Makefile src/Makefile fortran/Makefile tools/Makefile definitions/Makefile samples/Makefile ifs_samples/grib1/Makefile ifs_samples/grib1_mlgrib2/Makefile tests/Makefile examples/C/Makefile examples/F90/Makefile tigge/Makefile perl/GRIB-API/Makefile.PL perl/Makefile)

AC_MSG_NOTICE([

  Configuration completed.

    You can now say 'make' to compile the grib_api package, 'make check' to
	  test it  and 'make install' to install it afterwards.
	  ])