File: configure.ac

package info (click to toggle)
libmatio 1.3.3-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 2,624 kB
  • ctags: 682
  • sloc: ansic: 16,718; sh: 9,304; f90: 2,873; makefile: 100
file content (383 lines) | stat: -rw-r--r-- 9,470 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
dnl  conFigure.ac
dnl
dnl  NOTE:  Process this file with GNU autoconf to produce a configure script.

AC_INIT([MATIO],[1.3.3],[cch@isl-inc.com],[])
AC_CONFIG_SRCDIR([src/matio.h])
AC_CONFIG_AUX_DIR(config)
dnl AM_INIT_AUTOMAKE([-no-undefined])
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
AC_PREREQ([2.59])
AC_CANONICAL_HOST
AC_DEFINE_UNQUOTED([MATIO_PLATFORM],["${host}"])
AC_DEFINE_UNQUOTED([MATIO_MAJOR_VERSION],[1])
AC_DEFINE_UNQUOTED([MATIO_MINOR_VERSION],[3])
AC_DEFINE_UNQUOTED([MATIO_RELEASE_LEVEL],[3])
PACKAGE_RELEASE_DATE="2 June 2008"
AC_SUBST(PACKAGE_RELEASE_DATE)

AC_ARG_VAR([FCLDFLAGS],[Fortran compiler-specific flags at link time])

# Enable fortran interface
AC_ARG_ENABLE(fortran,
[  --enable-fortran            enable fortran interface to mat library],
  [if test "$enableval" = "no" ; then
    enable_fortran=no
  else
    enable_fortran=yes
  fi],
  enable_fortran=no)

dnl 
dnl  Build programs, C compiler, F77 compiler, make, install, etc.
dnl
AC_PROG_CC([pgcc icc gcc cc])

if test "$enable_fortran" = "yes"
then
    AC_PROG_FC([pgf95 pgf90 ifort gfortran g95])
    AC_FC_WRAPPERS
    AC_CONFIG_FILES([src/fortran/matio_t.inc])
fi

dnl
dnl Check whether to build in debug mode
dnl
AC_ARG_ENABLE(debug,AS_HELP_STRING([--enable-debug=yes],[Turn on debugging]),
debug=$enableval,debug=no)
AC_MSG_CHECKING(debug mode)
if test "$debug" = "no"
then
    AC_MSG_RESULT(no)
    AC_DEFINE_UNQUOTED(NODEBUG)
else
    AC_MSG_RESULT(yes)
    AC_DEFINE_UNQUOTED(DEBUG)
    debug=yes
fi

dnl
dnl Check whether to build in profile mode
dnl
AC_ARG_ENABLE(profile,AS_HELP_STRING([--enable-profile=yes],[Turn on profile]),
profile=$enableval,profile=no)
AC_MSG_CHECKING(profile mode)
if test "$profile" = "no"
then
    AC_MSG_RESULT(no)
    AC_DEFINE_UNQUOTED(NODEBUG)
else
    AC_MSG_RESULT(yes)
    AC_DEFINE_UNQUOTED(DEBUG)
    profile=yes
fi

dnl
dnl Check for user-defined suffix to the library/include directories for
dnl installation and search. i.e. --with-libdir-suffix=64 looks in lib64 and
dnl --with-libdir-suffix=/x86_64 would look in lib/x86_64
dnl
MATIO_CHECK_LIBDIR_SUFFIX

dnl
dnl Set library directories to include libdir suffix
dnl
acl_libdirstem="lib$with_libdir_suffix"

dnl
dnl If debugging is enabled, add debugging options to the flags
dnl
if test "$debug" = "yes"
then
    CFLAGS="$CFLAGS $DEBUG_CFLAGS"
    FCFLAGS="$FCFLAGS $DEBUG_FCFLAGS"
else
    CFLAGS="$REL_CFLAGS $CFLAGS"
    FCFLAGS="$REL_FCFLAGS $FCFLAGS"
fi

dnl
dnl If profiling is enabled, add profile options to the flags
dnl
if test "$profile" = "yes"
then
    CFLAGS="$PROFILE_CFLAGS $CFLAGS"
    FCFLAGS="$PROFILE_FCFLAGS $FCFLAGS"
fi

dnl
dnl Try to avoid having libtool search for a fortran compiler
dnl
F77=$FC
AC_DISABLE_SHARED
AC_ENABLE_STATIC
AC_PROG_LIBTOOL

AC_PROG_MAKE_SET
AC_PROG_INSTALL

dnl 
dnl  Libraries
dnl

AC_CHECK_LIB([m],[pow])

dnl
dnl  Headers
dnl

AC_CONFIG_HEADERS([src/matioConfig.h])
AC_STDC_HEADERS
AC_CHECK_HEADER([inttypes.h],[AC_DEFINE_UNQUOTED([HAVE_INTTYPES_H])])
AC_CHECK_HEADER([stdint.h],[AC_DEFINE_UNQUOTED([HAVE_STDINT_H])])
AC_CHECK_HEADER([strings.h],[AC_DEFINE_UNQUOTED([HAVE_STRINGS_H])])
AC_CHECK_SIZEOF(double)
AC_CHECK_SIZEOF(float)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(void *)

dnl
dnl Substitute size of int and void * to matio_t.inc
SIZEOF_INT="$ac_cv_sizeof_int"
SIZEOF_VOID_P="$ac_cv_sizeof_void_p"
AC_SUBST(SIZEOF_INT)
AC_SUBST(SIZEOF_VOID_P)

CHECK_MATIO_INT64_T
CHECK_MATIO_UINT64_T
CHECK_MATIO_INT32_T
CHECK_MATIO_UINT32_T
CHECK_MATIO_INT16_T
CHECK_MATIO_UINT16_T
CHECK_MATIO_INT8_T
CHECK_MATIO_UINT8_T

AC_CACHE_CHECK([for va_copy()],have_va_copy,[
	AC_LINK_IFELSE([#include <stdarg.h>
	void f (int i, ...) {
	va_list args1, args2;
	va_start (args1, i);
	va_copy (args2, args1);
	if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
	  exit (1);
	va_end (args1); va_end (args2);
	}
	int main() {
	  f (0, 42);
	  return 0;
	}],
	[have_va_copy=yes],
	[have_va_copy=no])
])
if test "$have_va_copy" = "no"
then
    AC_CACHE_CHECK([for __va_copy()],have___va_copy,[
        AC_LINK_IFELSE([#include <stdarg.h>
            void f (int i, ...) {
                va_list args1, args2;
                va_start (args1, i);
                __va_copy (args2, args1);
                if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
                    exit (1);
                va_end (args1); va_end (args2);
            }
            int main() {
                f (0, 42);
                return 0;
            }],
	[have___va_copy=yes],
	[have___va_copy=no])
    ])
    if test "have___va_copy" = "yes"
    then
        AC_DEFINE_UNQUOTED([HAVE___VA_COPY])
    fi
else
    AC_DEFINE_UNQUOTED([HAVE_VA_COPY])
fi

AC_CACHE_CHECK([for vsnprintf()],have_vsnprintf,[
        AC_LINK_IFELSE([
        #include <stdlib.h>
        #include <stdarg.h>
        #include <stdio.h>
        int main() {
          va_list ap;
          vsnprintf(NULL,0,"%d",ap);
          return 0;
        }],
        [have_vsnprintf=yes],
        [have_vsnprintf=no])
])

AC_CACHE_CHECK([for snprintf()],have_snprintf,[
        AC_LINK_IFELSE([
        #include <stdlib.h>
        #include <stdarg.h>
        #include <stdio.h>
        int main() {
          snprintf(NULL,0,"%d",0);
          return 0;
        }],
        [have_snprintf=yes],
        [have_snprintf=no])
])

AC_CACHE_CHECK([for vasprintf()],have_vasprintf,[
        AC_LINK_IFELSE([
        #include <stdlib.h>
        #include <stdarg.h>
        #include <stdio.h>
        int main() {
          va_list ap;
          vasprintf(NULL,"%d",ap);
          return 0;
        }],
        [have_vasprintf=yes],
        [have_vasprintf=no])
])

AC_CACHE_CHECK([for asprintf()],have_asprintf,[
        AC_LINK_IFELSE([
        #include <stdlib.h>
        #include <stdarg.h>
        #include <stdio.h>
        int main() {
          asprintf(NULL,0,"%d",0);
          return 0;
        }],
        [have_asprintf=yes],
        [have_asprintf=no])
])

if test "$have_vsnprintf" = "yes"
then
    AC_DEFINE_UNQUOTED([HAVE_VSNPRINTF])
fi
if test "$have_snprintf" = "yes"
then
    AC_DEFINE_UNQUOTED([HAVE_SNPRINTF])
fi
if test "$have_vasprintf" = "yes"
then
    AC_DEFINE_UNQUOTED([HAVE_VASPRINTF])
fi
if test "$have_asprintf" = "yes"
then
    AC_DEFINE_UNQUOTED([HAVE_ASPRINTF])
fi

MATIO_CHECK_ZLIB

dnl
dnl Check whether to build in debug mode
dnl
AC_ARG_ENABLE(extended-sparse,AS_HELP_STRING([--enable-extended-sparse=yes],[Enable extended sparse matrix data types not supported in Matlab]),
extended_sparse=$enableval,extended_sparse=yes)
AC_MSG_CHECKING(enable extended sparse types)
if test "$extended_sparse" = "no"
then
    AC_MSG_RESULT(no)
else
    AC_MSG_RESULT(yes)
    AC_DEFINE_UNQUOTED(EXTENDED_SPARSE)
fi

linux="no"
winnt="no"
sun="no"
case $build_os in
*linux*)
    linux="yes"
    AC_DEFINE_UNQUOTED(LINUX);;
*mingw*)
    winnt="yes"
    AC_DEFINE_UNQUOTED(WINNT);;
*cygwin*)
    winnt="yes"
    AC_DEFINE_UNQUOTED(WINNT);;
*sun*)
    sun="yes"
    AC_DEFINE_UNQUOTED(SUN);;
*solaris*)
    sun="yes"
    AC_DEFINE_UNQUOTED(SUN);;
esac

AM_CONDITIONAL(LINUX, test "x$linux" = "xyes")
AM_CONDITIONAL(WINNT, test "x$winnt" = "xyes")
AM_CONDITIONAL(SUN,   test "x$sun"   = "xyes")

dnl
dnl Check whether to build test programs
dnl
AC_ARG_ENABLE(test,AS_HELP_STRING([--enable-test=yes],[build test programs]),
build_test=$enableval,build_test=no)
AC_MSG_CHECKING(whether to build test programs)
if test "x$build_test" = "xno"
then
    AC_MSG_RESULT(no)
else
    AC_MSG_RESULT(yes)
    build_test=yes
fi  
AM_CONDITIONAL(BUILD_TEST, test "x$build_test" = "xyes")

dnl
dnl Check whether to build documentation
dnl
AC_ARG_ENABLE(docs,AS_HELP_STRING([--enable-docs=yes],[install documentation]),
docs_install=$enableval,docs_install=no)
AC_MSG_CHECKING(install docs)
if test "$docs_install" = "no"
then
    AC_MSG_RESULT(no)
else
    AC_MSG_RESULT(yes)
    docs_install=yes
fi  
AM_CONDITIONAL(DOCS_INSTALL, test "x$docs_install" = "xyes")

AM_CONDITIONAL(ENABLE_FORTRAN, test "$enable_fortran" = "yes" )

dnl
dnl Without this, the linker line is incorrect on platforms without a fortran
dnl compiler even if we are not using fortran sources
dnl
if test "x$enable_fortran" != "xyes"; then
  FCLINK='$(LINK)'
else
  FCLINK='$(LIBTOOL) --mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@'
fi
AC_SUBST(FCLINK)

AC_CONFIG_FILES([Makefile \
                 matio.pc \
                 src/Makefile \
                 test/Makefile \
                 doxygen/Makefile])
AC_OUTPUT

AC_MSG_RESULT([])
AC_MSG_RESULT([   MATIO Configuration Summary       ])
AC_MSG_RESULT([==============================================================])
AC_MSG_RESULT([           C Compiler: $CC])
AC_MSG_RESULT([     Fortran Compiler: $FC])
AC_MSG_RESULT([               CFLAGS: $CFLAGS])
AC_MSG_RESULT([              FCFLAGS: $FCFLAGS])
AC_MSG_RESULT([            FCLDFLAGS: $FCLDFLAGS])
AC_MSG_RESULT([     Shared Libraries: $enable_shared])
AC_MSG_RESULT([     Static Libraries: $enable_static])
AC_MSG_RESULT([])
AC_MSG_RESULT([Features --------------------------------------------])
AC_MSG_RESULT([    Fortran Interface: $enable_fortran])
AC_MSG_RESULT([        test programs: $build_test])
AC_MSG_RESULT([        Documentation: $docs_install])
AC_MSG_RESULT([])
AC_MSG_RESULT([Packages --------------------------------------------])
AC_MSG_RESULT([                 zlib: $ZLIB_LIBS])
AC_MSG_RESULT([])
AC_MSG_RESULT([])