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


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

Lynn Garren's avatar
Lynn Garren committed
11
AC_PREREQ(2.59)
Lynn Garren's avatar
Lynn Garren committed
12
AC_INIT(CLHEP Utilities, 1.9.3.0, http://savannah.cern.ch/projects/clhep/, Utilities)
13
AC_CONFIG_AUX_DIR(autotools)
Lynn Garren's avatar
Lynn Garren committed
14
AC_CANONICAL_TARGET
Lynn Garren's avatar
Lynn Garren committed
15
AM_INIT_AUTOMAKE(1.9 foreign)
Lynn Garren's avatar
Lynn Garren committed
16
AC_PROG_INSTALL
17
AC_PROG_LN_S
Lynn Garren's avatar
Lynn Garren committed
18
AC_PROG_RANLIB
19

Lynn Garren's avatar
Lynn Garren committed
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# ----------------------------------------------------------------------
# --enable-shared and --enable-static
# both shared and static libraries are built by default
# ----------------------------------------------------------------------

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"])
41
42
43
44
45
46
47
48
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"])
49

Lynn Garren's avatar
Lynn Garren committed
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
71
72
73
74
# ----------------------------------------------------------------------
# Identify the files that 'configure' is to produce:
# ----------------------------------------------------------------------

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

# Makefiles:
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([Utilities/Makefile])

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

Utilities_CPPFLAGS="-I$includedir"
75
76
Utilities_LDFLAGS=" "
Utilities_LIBS=" "
77
78
79
80
81
82
83
84
85
86
87
88

AC_SUBST(Utilities_CPPFLAGS)
AC_SUBST(Utilities_LIBS)
AC_SUBST(Utilities_LDFLAGS)

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

AH_TOP([#ifndef UTILITIES_DEFS_H
#define UTILITIES_DEFS_H])

Lynn Garren's avatar
Lynn Garren committed
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
## 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])

## backwards compatibility
AH_VERBATIM([ENABLE_BACKWARDS_COMPATIBILITY],[/* backwards compatibility will be enabled ONLY in CLHEP 1.9 */
#ifndef ENABLE_BACKWARDS_COMPATIBILITY
#define ENABLE_BACKWARDS_COMPATIBILITY
#endif])

125
126
127
128
129
130
131
132
133
134
135
136
AH_BOTTOM([#endif  // UTILITIES_DEFS_H])


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

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

# Locate a C++ compiler:
Lynn Garren's avatar
Lynn Garren committed
137
AC_PROG_CXX(cl g++ g++4 c++ aCC CC cxx cc++ FCC KCC RCC xlC_r xlC gpp)
138
139
140
141
142
143
144

# Use it hereinafter:
AC_LANG(C++)

# Ensure we've found a preprocessor:
AC_REQUIRE_CPP

145
# copy and diff
Lynn Garren's avatar
Lynn Garren committed
146
147
case "$target" in
*-*-win32*)
148
149
  COPY_P="copy -p";DIFF_Q="diff -q -b"
  ;;
Lynn Garren's avatar
Lynn Garren committed
150
*-*-cygwin*)
151
152
  COPY_P="cp -p";DIFF_Q="diff -q -b"
  ;;
Lynn Garren's avatar
Lynn Garren committed
153
*-*-solaris*)
154
  COPY_P="cp -p";DIFF_Q="diff -b"
Lynn Garren's avatar
Lynn Garren committed
155
  use_gmake="yes"
156
  ;;
Lynn Garren's avatar
Lynn Garren committed
157
*-*-linux*)
158
159
160
161
162
163
  COPY_P="cp -p";DIFF_Q="diff -q -b"
  ;;
*)
  COPY_P="cp -p";DIFF_Q="diff -q -b"
esac

Lynn Garren's avatar
Lynn Garren committed
164
165
AM_CONDITIONAL(USE_GMAKE, test x$use_gmake = xyes)

166
167
168
169
170
171
172
AC_SUBST(COPY_P)
AC_SUBST(DIFF_Q)

# worry about compiler flags
case "$CXX" in
g++) 
   case "$target" in
Lynn Garren's avatar
Lynn Garren committed
173
174
175
176
   *-*-linux*) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
      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
177
178
179
180
      AR="ar"; ARFLAGS="cru"
      ;;
   *-*-darwin*) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
Lynn Garren's avatar
Lynn Garren committed
181
182
      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,"
Lynn Garren's avatar
Lynn Garren committed
183
184
185
186
187
188
189
190
191
192
193
194
195
196
      AR="ar"; ARFLAGS="cru"
      ;;
   *) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall"
      MY_SHFLAGS="-fPIC -DPIC"; MY_SHLINK="-shared"; SHEXT=so
      MY_SHNAME="-Wl,-soname,"; MY_LD="-Wl,--rpath -Wl,"
      AR="ar"; ARFLAGS="cru"
   esac;;
g++4) 
   case "$target" in
   *-*-linux*) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
      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
197
      AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
198
199
200
      ;;
   *-*-darwin*) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
Lynn Garren's avatar
Lynn Garren committed
201
202
      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,"
Lynn Garren's avatar
Lynn Garren committed
203
      AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
204
205
206
207
208
      ;;
   *) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall"
      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
209
      AR="ar"; ARFLAGS="cru"
210
211
212
   esac;;
c++) 
   case "$target" in
Lynn Garren's avatar
Lynn Garren committed
213
214
215
216
   *-*-linux*) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
      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
217
      AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
218
219
220
      ;;
   *-*-darwin*) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
Lynn Garren's avatar
Lynn Garren committed
221
222
      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,"
Lynn Garren's avatar
Lynn Garren committed
223
      AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
224
225
226
227
228
      ;;
   *) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall"
      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
229
      AR="ar"; ARFLAGS="cru"
230
231
   esac;;
cl)  
232
   AM_CXXFLAGS="-EHsc -nologo -GR -GX -MD"
Lynn Garren's avatar
Lynn Garren committed
233
   AR="ar"; ARFLAGS="cru"
234
235
236
237
238
   MY_SHFLAGS=" "; MY_SHLINK="lib /NOLOGO"; SHEXT=lib
   MY_SHNAME="/OUT:"; MY_LD=" "
   build_static="no"
   build_shared="yes"
   build_visual="yes"
239
240
   CXXFLAGS=" "
   AC_SUBST(CXXFLAGS)
241
242
243
   ;;
CC)  
   case "$target" in
Lynn Garren's avatar
Lynn Garren committed
244
245
246
247
248
   *-*-solaris*) 
      AM_CXXFLAGS="-O"
      MY_SHFLAGS="-KPIC -DPIC"; MY_SHLINK="-G"; SHEXT=so
      MY_SHNAME="-h"; MY_LD="-R"
      AM_LDFLAGS="-lsunmath"
Lynn Garren's avatar
Lynn Garren committed
249
      AR="CC"; ARFLAGS="-xar -o"
250
      build_shared="no"
Lynn Garren's avatar
Lynn Garren committed
251
252
      ;;
   *-*-hpux*) AM_CXXFLAGS="+O3 +DAportable +a1 -z -pta +Onolimit"
Lynn Garren's avatar
Lynn Garren committed
253
              AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
254
255
256
              build_shared="no"
	      ;;
   *-*-irix*) AM_CXXFLAGS="-O -OPT:Olimit=0 -pta"
Lynn Garren's avatar
Lynn Garren committed
257
              AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
258
259
              build_shared="no"
	      ;;
260
261
262
263
   *)   echo UNEXPECTED CHOICE OF OPERATING SYSTEM FOR $CXX: $target
   esac;;
aCC) 
   AM_CXXFLAGS="-O -Aa +DAportable +Onolimit"
Lynn Garren's avatar
Lynn Garren committed
264
   AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
265
   build_shared="no"
266
267
268
   ;;
cxx) 
   AM_CXXFLAGS="-O -std strict_ansi -timplicit_local"
Lynn Garren's avatar
Lynn Garren committed
269
   AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
270
   build_shared="no"
271
272
273
   ;;
xlC) 
   AM_CXXFLAGS="-O3 -qtwolink -+"
Lynn Garren's avatar
Lynn Garren committed
274
   AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
275
   build_shared="no"
276
277
   ;;
*)   echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX
Lynn Garren's avatar
Lynn Garren committed
278
279
esac

Lynn Garren's avatar
Lynn Garren committed
280
281
AM_CONDITIONAL(BUILD_SHARED, test x$build_shared = xyes)
AM_CONDITIONAL(BUILD_STATIC, test x$build_static = xyes)
282
AM_CONDITIONAL(BUILD_VISUAL, test x$build_visual = xyes)
Lynn Garren's avatar
Lynn Garren committed
283

284
AC_SUBST(AM_CXXFLAGS)
Lynn Garren's avatar
Lynn Garren committed
285
286
287
288
289
290
AC_SUBST(AM_LDFLAGS)
AC_SUBST(MY_SHFLAGS)
AC_SUBST(MY_SHLINK)
AC_SUBST(MY_SHNAME)
AC_SUBST(MY_LD)
AC_SUBST(SHEXT)
Lynn Garren's avatar
Lynn Garren committed
291
292
AC_SUBST(AR)
AC_SUBST(ARFLAGS)
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311

# ----------------------------------------------------------------------
# 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
312

313
314
315
316
317
318
319
320
321
322
323
324
325
326

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


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

AC_OUTPUT


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