configure.in 9.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
# ======================================================================
# This is the CLHEP 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
2.0.4.3  
Lynn Garren committed
12
AC_INIT(CLHEP, 2.0.4.3, http://savannah.cern.ch/projects/clhep/ )
13 14
AC_CANONICAL_TARGET
AC_CONFIG_SRCDIR([Vector/src/AxisAngle.cc])
15
AM_INIT_AUTOMAKE(1.9 foreign)
Lynn Garren's avatar
Lynn Garren committed
16 17 18
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_RANLIB
19 20 21 22 23

# ----------------------------------------------------------------------
# subpackages
# ----------------------------------------------------------------------

24
AC_CONFIG_SUBDIRS(Units Vector Evaluator GenericFunctions Geometry Random Matrix RandomObjects RefCount Cast Exceptions)
25 26 27 28 29 30 31 32 33 34 35 36 37 38

# ----------------------------------------------------------------------
# --enable-exceptions or --disable-exceptions
# --disable-exceptions is the default
# ----------------------------------------------------------------------

AC_ARG_ENABLE(exceptions,
   AC_HELP_STRING([--enable-exceptions],[use CLHEP/Exceptions (off by default)]),
        [case "${enableval}" in
          yes) AC_SUBST(use_exceptions,["#define ENABLE_ZOOM_EXCEPTIONS"]) ;;
          no)  AC_SUBST(use_exceptions,["#undef  ENABLE_ZOOM_EXCEPTIONS"]) ;;
          *)   AC_SUBST(use_exceptions,["#define ENABLE_ZOOM_EXCEPTIONS"]) ;;
        esac],
        [AC_SUBST(use_exceptions,["#undef  ENABLE_ZOOM_EXCEPTIONS"])])
39

Lynn Garren's avatar
Lynn Garren committed
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
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
56 57 58 59 60 61 62 63
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"])
Lynn Garren's avatar
Lynn Garren committed
64

Lynn Garren's avatar
Lynn Garren committed
65 66 67 68 69 70 71 72 73
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"])

74 75 76 77 78 79
# ----------------------------------------------------------------------
# Identify the files that 'configure' is to produce:
# ----------------------------------------------------------------------

# Makefiles:
AC_CONFIG_FILES([Makefile])
Lynn Garren's avatar
Lynn Garren committed
80
AC_CONFIG_FILES([getObjectList], [chmod +x getObjectList])
81 82 83 84 85 86 87
# tarball scripts
AC_CONFIG_FILES([makeSourceDist], [chmod +x makeSourceDist])
AC_CONFIG_FILES([makeBinaryTar], [chmod +x makeBinaryTar])

# build clheplib
AC_CONFIG_FILES([build-clheplib], [chmod +x build-clheplib])

Lynn Garren's avatar
Lynn Garren committed
88 89 90
# build ClhepVersion.h
AC_CONFIG_FILES([build-header], [chmod +x build-header])

Lynn Garren's avatar
Lynn Garren committed
91 92 93
# Configuration inquiry program/script:
AC_CONFIG_FILES([clhep-config], [chmod +x clhep-config])

Lynn Garren's avatar
Lynn Garren committed
94 95 96 97
# ----------------------------------------------------------------------
# Capture post-install information:
# ----------------------------------------------------------------------

98 99 100 101 102
# ----------------------------------------------------------------------
# Check for needed programs:
# ----------------------------------------------------------------------

# Locate a C++ compiler:
Lynn Garren's avatar
Lynn Garren committed
103
AC_PROG_CXX(cl g++ g++4 c++ icc aCC CC cxx cc++ FCC RCC xlC_r xlC gpp)
104 105 106 107 108 109 110

# Use it hereinafter:
AC_LANG(C++)

# Ensure we've found a preprocessor:
AC_REQUIRE_CPP

111
# copy and diff
112 113
case "$target" in
*-*-win32*)
114 115
  COPY_P="copy -p";DIFF_Q="diff -q -b"
  ;;
116
*-*-cygwin*)
117 118
  COPY_P="cp -p";DIFF_Q="diff -q -b"
  ;;
119
*-*-solaris*)
120
  COPY_P="cp -p";DIFF_Q="diff -b"
Lynn Garren's avatar
Lynn Garren committed
121
  use_gmake="yes"
122
  ;;
123
*-*-linux*)
124 125 126 127 128 129
  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
130 131
AM_CONDITIONAL(USE_GMAKE, test x$use_gmake = xyes)

132 133 134 135 136 137 138
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
139 140
   *-*-linux*) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
141 142 143 144 145
      MY_SHFLAGS="-fPIC -DPIC"
      MY_SHLINK="-shared -Wl,--no-undefined"
      MY_SHNAME="-Wl,-soname,"
      MY_LD="-Wl,--rpath -Wl,"
      SHEXT=so
Lynn Garren's avatar
Lynn Garren committed
146
      AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
147 148 149
      ;;
   *-*-darwin*) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
150 151 152 153
      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"
      ;;
154 155 156 157 158 159 160 161 162 163
   *-*-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"
      build_shared="no"
      ;;
164 165
   *) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall"
166 167 168 169 170
      MY_SHFLAGS="-fPIC -DPIC"
      MY_SHLINK="-shared -Wl,--no-undefined"
      MY_SHNAME="-Wl,-soname,"
      MY_LD="-Wl,--rpath -Wl,"
      SHEXT=so
171 172 173 174 175 176
      AR="ar"; ARFLAGS="cru"
   esac;;
g++4) 
   case "$target" in
   *-*-linux*) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
177 178 179 180 181
      MY_SHFLAGS="-fPIC -DPIC"
      MY_SHLINK="-shared -Wl,--no-undefined"
      MY_SHNAME="-Wl,-soname,"
      MY_LD="-Wl,--rpath -Wl,"
      SHEXT=so
182 183
      AR="ar"; ARFLAGS="cru"
      ;;
Lynn Garren's avatar
Lynn Garren committed
184 185
   *) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall"
186 187 188 189 190
      MY_SHFLAGS="-fPIC -DPIC"
      MY_SHLINK="-shared -Wl,--no-undefined"
      MY_SHNAME="-Wl,-soname,"
      MY_LD="-Wl,--rpath -Wl,"
      SHEXT=so
Lynn Garren's avatar
Lynn Garren committed
191
      AR="ar"; ARFLAGS="cru"
192 193 194
   esac;;
c++) 
   case "$target" in
Lynn Garren's avatar
Lynn Garren committed
195 196
   *-*-linux*) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
197 198 199 200 201
      MY_SHFLAGS="-fPIC -DPIC"
      MY_SHLINK="-shared -Wl,--no-undefined"
      MY_SHNAME="-Wl,-soname,"
      MY_LD="-Wl,--rpath -Wl,"
      SHEXT=so
Lynn Garren's avatar
Lynn Garren committed
202
      AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
203 204 205
      ;;
   *-*-darwin*) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall -D_GNU_SOURCE"
206 207
      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
208
      AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
209
      ;;
210 211 212 213 214 215 216 217 218 219
   *-*-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"
      build_shared="no"
      ;;
Lynn Garren's avatar
Lynn Garren committed
220 221
   *) 
      AM_CXXFLAGS="-O -ansi -pedantic -Wall"
222 223 224 225 226
      MY_SHFLAGS="-fPIC -DPIC"
      MY_SHLINK="-shared -Wl,--no-undefined"
      MY_SHNAME="-Wl,-soname,"
      MY_LD="-Wl,--rpath -Wl,"
      SHEXT=so
Lynn Garren's avatar
Lynn Garren committed
227
      AR="ar"; ARFLAGS="cru"
228
   esac;;
Lynn Garren's avatar
Lynn Garren committed
229 230 231
icc)
   case "$target" in
   *-*-linux*)
Lynn Garren's avatar
Lynn Garren committed
232
      AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1"
Lynn Garren's avatar
Lynn Garren committed
233 234 235 236 237 238
      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"
      ;;
   *)
Lynn Garren's avatar
Lynn Garren committed
239
      AM_CXXFLAGS="-O -ansi -fp-model precise -no-gcc -w1"
Lynn Garren's avatar
Lynn Garren committed
240 241 242 243 244
      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"
   esac;;
245
cl)  
Lynn Garren's avatar
Lynn Garren committed
246
   AM_CXXFLAGS="-EHsc -nologo -GR -MD"
Lynn Garren's avatar
Lynn Garren committed
247
   AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
248 249 250 251 252
   MY_SHFLAGS=" "; MY_SHLINK="lib /NOLOGO"; SHEXT=lib
   MY_SHNAME="/OUT:"; MY_LD=" "
   build_static="no"
   build_shared="yes"
   build_visual="yes"
Lynn Garren's avatar
Lynn Garren committed
253 254
   CXXFLAGS=" "
   AC_SUBST(CXXFLAGS)
255 256 257
   ;;
CC)  
   case "$target" in
Lynn Garren's avatar
Lynn Garren committed
258 259 260 261 262
   *-*-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
263
      AR="CC"; ARFLAGS="-xar -o"
Lynn Garren's avatar
Lynn Garren committed
264
      build_shared="no"
Lynn Garren's avatar
Lynn Garren committed
265 266
      ;;
   *-*-hpux*) AM_CXXFLAGS="+O3 +DAportable +a1 -z -pta +Onolimit"
Lynn Garren's avatar
Lynn Garren committed
267
              AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
268 269 270
              build_shared="no"
	      ;;
   *-*-irix*) AM_CXXFLAGS="-O -OPT:Olimit=0 -pta"
Lynn Garren's avatar
Lynn Garren committed
271
              AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
272 273
              build_shared="no"
	      ;;
274 275 276 277
   *)   echo UNEXPECTED CHOICE OF OPERATING SYSTEM FOR $CXX: $target
   esac;;
aCC) 
   AM_CXXFLAGS="-O -Aa +DAportable +Onolimit"
Lynn Garren's avatar
Lynn Garren committed
278
   AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
279
   build_shared="no"
280 281 282
   ;;
cxx) 
   AM_CXXFLAGS="-O -std strict_ansi -timplicit_local"
Lynn Garren's avatar
Lynn Garren committed
283
   AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
284
   build_shared="no"
285 286 287
   ;;
xlC) 
   AM_CXXFLAGS="-O3 -qtwolink -+"
Lynn Garren's avatar
Lynn Garren committed
288
   AR="ar"; ARFLAGS="cru"
Lynn Garren's avatar
Lynn Garren committed
289
   build_shared="no"
290 291
   ;;
*)   echo UNEXPECTED CHOICE OF C++ COMPILER: $CXX
292 293
esac

Lynn Garren's avatar
Lynn Garren committed
294 295
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
296
AM_CONDITIONAL(BUILD_VISUAL, test x$build_visual = xyes)
Lynn Garren's avatar
Lynn Garren committed
297

298
AC_SUBST(AM_CXXFLAGS)
Lynn Garren's avatar
Lynn Garren committed
299 300 301 302 303 304
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
305 306
AC_SUBST(AR)
AC_SUBST(ARFLAGS)
307

308 309 310 311 312 313 314
# ----------------------------------------------------------------------
# Check for supported link flags
# ----------------------------------------------------------------------

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

315 316 317 318 319 320 321 322
# ----------------------------------------------------------------------
# Finish up:
# ----------------------------------------------------------------------

AC_OUTPUT


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