configure.ac 12.4 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
# ======================================================================
# This is the Matrix configuration input file
# Process this file with autoconf to produce a configure script.
# ======================================================================


# ----------------------------------------------------------------------
# Identify the package and initialize the autotools:
# ----------------------------------------------------------------------

11
AC_PREREQ(2.59)
Lynn Garren's avatar
Lynn Garren committed
12
AC_INIT(CLHEP Matrix, 2.2.0.7, http://savannah.cern.ch/projects/clhep/, Matrix)
13
AC_CONFIG_AUX_DIR(autotools)
Lynn Garren's avatar
Lynn Garren committed
14
AC_CANONICAL_TARGET
15
AC_CONFIG_SRCDIR([src/DiagMatrix.cc])
16
AM_INIT_AUTOMAKE(1.9 foreign)
Lynn Garren's avatar
Lynn Garren committed
17
AC_PROG_INSTALL
18
19
20
21
22
23
24
AC_PROG_LN_S
AC_PROG_RANLIB

# ----------------------------------------------------------------------
# --enable-shared and --enable-static
# both shared and static libraries are built by default
# ----------------------------------------------------------------------
25

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
AC_ARG_ENABLE(shared,
   AC_HELP_STRING([--disable-shared],[do not build shared libraries]),
        [case "${enableval}" in
          yes) build_shared="yes";;
          no)  build_shared="no";;
          *)   build_shared="yes";;
        esac],
        [build_shared="yes"])
AC_ARG_ENABLE(static,
   AC_HELP_STRING([--disable-static],[do not build static libraries]),
        [case "${enableval}" in
          yes) build_static="yes";;
          no)  build_static="no";;
          *)   build_static="yes";;
        esac],
        [build_static="yes"])
Lynn Garren's avatar
Lynn Garren committed
42
43
44
45
46
47
48
49
AC_ARG_ENABLE(visual,
   AC_HELP_STRING([--enable-visual],[on by default when using Visual C++]),
        [case "${enableval}" in
          yes) build_visual="yes";;
          no)  build_visual="no";;
          *)   build_visual="no";;
        esac],
        [build_visual="no"])
50
51
52
53
54
55
56
57
58

AC_ARG_ENABLE(gmake,
   AC_HELP_STRING([--enable-gmake],[use gmake (default is make)]),
        [case "${enableval}" in
          yes) use_gmake="yes";;
          no)  use_gmake="no";;
          *)   use_gmake="no";;
        esac],
        [use_gmake="no"])
59
60
61
62
63
64
65
66
67
68
69
70

# ----------------------------------------------------------------------
# Identify the files that 'configure' is to produce:
# ----------------------------------------------------------------------

# Header containing #defines:
AM_CONFIG_HEADER([Matrix/defs.h])

# Makefiles:
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([Matrix/Makefile])
AC_CONFIG_FILES([src/Makefile])
Lynn Garren's avatar
Lynn Garren committed
71
AC_CONFIG_FILES([test/Makefile])
72
AC_CONFIG_FILES([Matrix-deps])
Lynn Garren's avatar
Lynn Garren committed
73
AC_CONFIG_FILES([Matrix/copy-header.pl], [chmod +x Matrix/copy-header.pl])
74

75
76
77
# Configuration inquiry program/script:
AC_CONFIG_FILES([Matrix-config], [chmod +x Matrix-config])

78
# Test driver program/script:
Lynn Garren's avatar
Lynn Garren committed
79
AC_CONFIG_FILES([test/testMatrix.sh], [chmod +x test/testMatrix.sh])
Lynn Garren's avatar
Lynn Garren committed
80
AC_CONFIG_FILES([test/testInversion.sh], [chmod +x test/testInversion.sh])
81
AC_CONFIG_FILES([test/testBug6176.sh], [chmod +x test/testBug6176.sh])
82
83
84
85
86
87
88

# ----------------------------------------------------------------------
# Capture post-install information:
# ----------------------------------------------------------------------

Matrix_CPPFLAGS="-I$includedir"
Matrix_LDFLAGS="-L$libdir"
89
Matrix_LIBS="-lCLHEP-$PACKAGE-$VERSION -lCLHEP-Random-$VERSION -lCLHEP-Vector-$VERSION"
90
91
92
93
94
95
96
97
98
99
100
101

AC_SUBST(Matrix_CPPFLAGS)
AC_SUBST(Matrix_LIBS)
AC_SUBST(Matrix_LDFLAGS)

# ----------------------------------------------------------------------
# Supply boilerplate for Matrix/defs.h source header:
# ----------------------------------------------------------------------

AH_TOP([#ifndef MATRIX_DEFS_H
#define MATRIX_DEFS_H])

Lynn Garren's avatar
Lynn Garren committed
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
## the undefs are converted by configure
AH_VERBATIM([PACKAGE],[/* Name of package */
#ifndef PACKAGE
#undef PACKAGE
#endif])
AH_VERBATIM([PACKAGE_BUGREPORT],[/* Define to the address where bug reports for this package should be sent. */
#ifndef PACKAGE_BUGREPORT
#undef PACKAGE_BUGREPORT
#endif])
AH_VERBATIM([PACKAGE_NAME],[/* Define to the full name of this package. */
#ifndef PACKAGE_NAME
#undef PACKAGE_NAME
#endif])
AH_VERBATIM([PACKAGE_STRING],[/* Define to the full name and version of this package. */
#ifndef PACKAGE_STRING
#undef PACKAGE_STRING
#endif])
AH_VERBATIM([PACKAGE_TARNAME],[/* Define to the one symbol short name of this package. */
#ifndef PACKAGE_TARNAME
#undef PACKAGE_TARNAME
#endif])
AH_VERBATIM([PACKAGE_VERSION],[/* Define to the version of this package. */
#ifndef PACKAGE_VERSION
#undef PACKAGE_VERSION
#endif])
AH_VERBATIM([VERSION],[/* Version number of package */
#ifndef VERSION
#undef VERSION
#endif])

132
133
134
135
136
137
## disable allocator until it is fixed
AH_VERBATIM([DISABLE_ALLOC],[/* disable non-compliant allocator */
#ifndef DISABLE_ALLOC
#define DISABLE_ALLOC
#endif])

138
139
140
141
142
143
144
145
146
147
148
149
150
AH_BOTTOM([#endif  // MATRIX_DEFS_H])


# ----------------------------------------------------------------------
# Account for any user configuration options:
# ----------------------------------------------------------------------


# ----------------------------------------------------------------------
# Check for needed programs:
# ----------------------------------------------------------------------

# Locate a C++ compiler:
Lynn Garren's avatar
Lynn Garren committed
151
AC_PROG_CXX(cl g++ g++4 c++ icc aCC CC cxx cc++ FCC RCC xlC_r xlC gpp)
152
153
154
155
156
157
158

# Use it hereinafter:
AC_LANG(C++)

# Ensure we've found a preprocessor:
AC_REQUIRE_CPP

159
# copy and diff
Lynn Garren's avatar
Lynn Garren committed
160
161
case "$target" in
*-*-win32*)
162
163
  COPY_P="copy -p";DIFF_Q="diff -q -b"
  ;;
Lynn Garren's avatar
Lynn Garren committed
164
*-*-cygwin*)
165
166
  COPY_P="cp -p";DIFF_Q="diff -q -b"
  ;;
Lynn Garren's avatar
Lynn Garren committed
167
*-*-solaris*)
168
169
170
  COPY_P="cp -p";DIFF_Q="diff -b"
  use_gmake="yes"
  ;;
Lynn Garren's avatar
Lynn Garren committed
171
*-*-linux*)
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
  COPY_P="cp -p";DIFF_Q="diff -q -b"
  ;;
*)
  COPY_P="cp -p";DIFF_Q="diff -q -b"
esac

AM_CONDITIONAL(USE_GMAKE, test x$use_gmake = xyes)

AC_SUBST(COPY_P)
AC_SUBST(DIFF_Q)

# worry about compiler flags
case "$CXX" in
g++) 
   case "$target" in
   *-*-linux*) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
Lynn Garren's avatar
Lynn Garren committed
189
190
191
192
193
      MY_SHFLAGS="-fPIC -DPIC"
      MY_SHLINK="-shared -Wl,--no-undefined"
      MY_SHNAME="-Wl,-soname,"
      MY_LD="-Wl,--rpath -Wl,"
      SHEXT=so
194
      AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
195
      LEAKTEST="testBug7328"
196
197
      ;;
   *-*-darwin*) 
198
      AM_CXXFLAGS="-O -pedantic -Wall"
Lynn Garren's avatar
Lynn Garren committed
199
200
      MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib
      MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl,"
201
      AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
202
203
204
205
206
207
208
209
210
211
      LEAKTEST=""
      ;;
   *-*-cygwin*)
      AM_CXXFLAGS="-O -ansi -pedantic -Wall"
      MY_SHFLAGS="-DPIC"; SHEXT=dll
      MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive"
      MY_SHLINKEXTRA="-Wl,--no-whole-archive"
      MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl,"
      AR="ar"; ARFLAGS="cru"
      build_static="yes"
212
      build_shared="no"
Lynn Garren's avatar
Lynn Garren committed
213
      LEAKTEST="testBug7328"
214
215
216
      ;;
   *) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall"
Lynn Garren's avatar
Lynn Garren committed
217
218
219
220
221
      MY_SHFLAGS="-fPIC -DPIC"
      MY_SHLINK="-shared -Wl,--no-undefined"
      MY_SHNAME="-Wl,-soname,"
      MY_LD="-Wl,--rpath -Wl,"
      SHEXT=so
222
      AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
      LEAKTEST="testBug7328"
   esac;;
g++4) 
   case "$target" in
   *-*-linux*) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
      MY_SHFLAGS="-fPIC -DPIC"
      MY_SHLINK="-shared -Wl,--no-undefined"
      MY_SHNAME="-Wl,-soname,"
      MY_LD="-Wl,--rpath -Wl,"
      SHEXT=so
      AR="ar"; ARFLAGS="cru"
      LEAKTEST="testBug7328"
      ;;
   *) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall"
      MY_SHFLAGS="-fPIC -DPIC"
      MY_SHLINK="-shared -Wl,--no-undefined"
      MY_SHNAME="-Wl,-soname,"
      MY_LD="-Wl,--rpath -Wl,"
      SHEXT=so
      AR="ar"; ARFLAGS="cru"
      LEAKTEST=""
246
247
248
249
250
   esac;;
c++) 
   case "$target" in
   *-*-linux*) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
Lynn Garren's avatar
Lynn Garren committed
251
252
253
254
255
      MY_SHFLAGS="-fPIC -DPIC"
      MY_SHLINK="-shared -Wl,--no-undefined"
      MY_SHNAME="-Wl,-soname,"
      MY_LD="-Wl,--rpath -Wl,"
      SHEXT=so
256
      AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
257
      LEAKTEST="testBug7328"
258
259
      ;;
   *-*-darwin*) 
260
      AM_CXXFLAGS="-O -pedantic -Wall"
Lynn Garren's avatar
Lynn Garren committed
261
262
263
264
265
266
267
268
269
270
271
      MY_SHFLAGS=""; MY_SHLINK="-dynamiclib -single_module -undefined dynamic_lookup"; SHEXT=dylib
      MY_SHNAME="-Wl,-install_name,"; MY_LD="-bind_at_load -Wl,--rpath -Wl,"
      AR="ar"; ARFLAGS="cru"
      LEAKTEST=""
      ;;
   *-*-cygwin*)
      AM_CXXFLAGS="-O -ansi -pedantic -Wall"
      MY_SHFLAGS="-DPIC"; SHEXT=dll
      MY_SHLINK="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive"
      MY_SHLINKEXTRA="-Wl,--no-whole-archive"
      MY_SHNAME="-Wl,-out-implib="; MY_LD="-Wl,--rpath -Wl,"
272
      AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
273
      build_static="yes"
274
      build_shared="no"
Lynn Garren's avatar
Lynn Garren committed
275
      LEAKTEST="testBug7328"
276
277
278
      ;;
   *) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall"
Lynn Garren's avatar
Lynn Garren committed
279
280
281
282
283
284
285
286
287
288
289
290
291
      MY_SHFLAGS="-fPIC -DPIC"
      MY_SHLINK="-shared -Wl,--no-undefined"
      MY_SHNAME="-Wl,-soname,"
      MY_LD="-Wl,--rpath -Wl,"
      SHEXT=so
      AR="ar"; ARFLAGS="cru"
      LEAKTEST="testBug7328"
   esac;;
icc)
   case "$target" in
   *-*-linux*)
      AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1"
      AM_LDFLAGS="-lstdc++"
292
293
      MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
      MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
Lynn Garren's avatar
Lynn Garren committed
294
295
296
297
298
299
300
301
302
303
      AR="xiar"; ARFLAGS="cru"
      LEAKTEST="testBug7328"
      ;;
   *)
      AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1"
      AM_LDFLAGS="-lstdc++"
      MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
      MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
      AR="xiar"; ARFLAGS="cru"
      LEAKTEST="testBug7328"
304
305
   esac;;
cl)  
Lynn Garren's avatar
Lynn Garren committed
306
   AM_CXXFLAGS="-EHsc -nologo -GR -MD"
307
   AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
308
309
310
311
312
313
314
315
   MY_SHFLAGS=" "; MY_SHLINK="lib /NOLOGO"; SHEXT=lib
   MY_SHNAME="/OUT:"; MY_LD=" "
   build_static="no"
   build_shared="yes"
   build_visual="yes"
   CXXFLAGS=" "
   AC_SUBST(CXXFLAGS)
   LEAKTEST="testBug7328"
316
317
318
319
320
321
322
323
324
   ;;
CC)  
   case "$target" in
   *-*-solaris*) 
      AM_CXXFLAGS="-O"
      MY_SHFLAGS="-KPIC -DPIC"; MY_SHLINK="-G"; SHEXT=so
      MY_SHNAME="-h"; MY_LD="-R"
      AM_LDFLAGS="-lsunmath"
      AR="CC"; ARFLAGS="-xar -o"
Lynn Garren's avatar
Lynn Garren committed
325
326
      build_shared="no"
      LEAKTEST=""
327
328
329
330
      ;;
   *-*-hpux*) AM_CXXFLAGS="+O3 +DAportable +a1 -z -pta +Onolimit"
              AR="ar"; ARFLAGS="cru"
              build_shared="no"
Lynn Garren's avatar
Lynn Garren committed
331
              LEAKTEST=""
332
333
334
	      ;;
   *-*-irix*) AM_CXXFLAGS="-O -OPT:Olimit=0 -pta"
              AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
335
              LEAKTEST=""
336
337
338
339
340
341
342
343
              build_shared="no"
	      ;;
   *)   echo UNEXPECTED CHOICE OF OPERATING SYSTEM FOR $CXX: $target
   esac;;
aCC) 
   AM_CXXFLAGS="-O -Aa +DAportable +Onolimit"
   AR="ar"; ARFLAGS="cru"
   build_shared="no"
Lynn Garren's avatar
Lynn Garren committed
344
   LEAKTEST=""
345
346
347
348
349
   ;;
cxx) 
   AM_CXXFLAGS="-O -std strict_ansi -timplicit_local"
   AR="ar"; ARFLAGS="cru"
   build_shared="no"
Lynn Garren's avatar
Lynn Garren committed
350
   LEAKTEST=""
351
352
353
354
355
   ;;
xlC) 
   AM_CXXFLAGS="-O3 -qtwolink -+"
   AR="ar"; ARFLAGS="cru"
   build_shared="no"
Lynn Garren's avatar
Lynn Garren committed
356
   LEAKTEST=""
357
358
   ;;
*)   echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX
Lynn Garren's avatar
Lynn Garren committed
359
360
esac

361
362
AM_CONDITIONAL(BUILD_SHARED, test x$build_shared = xyes)
AM_CONDITIONAL(BUILD_STATIC, test x$build_static = xyes)
Lynn Garren's avatar
Lynn Garren committed
363
AM_CONDITIONAL(BUILD_VISUAL, test x$build_visual = xyes)
364
365
366
367
368
369
370
371
372
373

AC_SUBST(AM_CXXFLAGS)
AC_SUBST(AM_LDFLAGS)
AC_SUBST(MY_SHFLAGS)
AC_SUBST(MY_SHLINK)
AC_SUBST(MY_SHNAME)
AC_SUBST(MY_LD)
AC_SUBST(SHEXT)
AC_SUBST(AR)
AC_SUBST(ARFLAGS)
Lynn Garren's avatar
Lynn Garren committed
374
375
376
377
378
379
380
381
382
AC_SUBST(LEAKTEST)


# ----------------------------------------------------------------------
# Check for supported link flags
# ----------------------------------------------------------------------

AC_CHECK_LIB([c -Wl,--as-needed],open,[MY_SHEXTRA="-Wl,--as-needed"])
AC_SUBST(MY_SHEXTRA)
383

384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# ----------------------------------------------------------------------
# Set system-dependent options:
# ----------------------------------------------------------------------


# ----------------------------------------------------------------------
# Check for needed libraries:
# ----------------------------------------------------------------------


# ----------------------------------------------------------------------
# Check for needed header files:
# ----------------------------------------------------------------------


# ----------------------------------------------------------------------
# Check for needed typedefs, structures, and compiler characteristics:
# ----------------------------------------------------------------------
Lynn Garren's avatar
Lynn Garren committed
402

403
404
405
406
407
408
409
410
411
412
413
414
415
416

# ----------------------------------------------------------------------
# Check for needed library functions:
# ----------------------------------------------------------------------


# ----------------------------------------------------------------------
# Finish up:
# ----------------------------------------------------------------------

AC_OUTPUT


# ======================================================================