[351] | 1 | # -*- Autoconf -*- |
---|
[107] | 2 | # Process this file with autoconf to produce a configure script. |
---|
| 3 | |
---|
| 4 | AC_PREREQ(2.57) |
---|
[1283] | 5 | AC_INIT([Duchamp], [1.5], [Matthew.Whiting@csiro.au]) |
---|
[168] | 6 | AC_CONFIG_SRCDIR([src/duchamp.hh]) |
---|
[110] | 7 | AC_CONFIG_HEADER([src/config.h]) |
---|
[343] | 8 | AC_PREFIX_DEFAULT(/usr/local) |
---|
[107] | 9 | |
---|
[1224] | 10 | AC_CONFIG_AUX_DIR([config]) |
---|
| 11 | |
---|
| 12 | # Get the system type. |
---|
| 13 | AC_CANONICAL_BUILD |
---|
| 14 | ARCH="${build_cpu}-$build_os" |
---|
| 15 | AC_SUBST([ARCH]) |
---|
| 16 | |
---|
[107] | 17 | # Checks for programs. |
---|
| 18 | AC_PROG_CXX |
---|
| 19 | AC_PROG_CC |
---|
| 20 | AC_PROG_CPP |
---|
[351] | 21 | AC_PROG_F77 |
---|
[338] | 22 | AC_PROG_LN_S |
---|
| 23 | AC_CHECK_PROGS(INSTALL, install) |
---|
[107] | 24 | |
---|
[343] | 25 | # Check for maths library -- will add -lm to $LIBS |
---|
[107] | 26 | AC_CHECK_LIB([m], [log]) |
---|
| 27 | |
---|
| 28 | # Checks for header files. |
---|
| 29 | AC_HEADER_STDC |
---|
[635] | 30 | AC_CHECK_HEADERS([unistd.h time.h math.h values.h iostream fstream sstream iomanip vector string algorithm functional]) |
---|
[168] | 31 | if test "x$ac_cv_header_stdc" = xno; then |
---|
| 32 | AC_MSG_ERROR([ |
---|
| 33 | ------------------------------------------------------------------- |
---|
| 34 | An ANSI standard C library is required to build Duchamp. |
---|
| 35 | One of the ANSI C header files it requires is missing or unusable. |
---|
[107] | 36 | |
---|
[168] | 37 | ERROR: Duchamp configuration failure. |
---|
| 38 | -------------------------------------------------------------------], [1]) |
---|
| 39 | fi |
---|
| 40 | |
---|
[107] | 41 | # Checks for typedefs, structures, and compiler characteristics. |
---|
| 42 | AC_HEADER_STDBOOL |
---|
| 43 | AC_C_CONST |
---|
| 44 | AC_C_INLINE |
---|
| 45 | |
---|
[1221] | 46 | # Library and installation utilities. |
---|
| 47 | #------------------------------------ |
---|
| 48 | # (Taken from Mark Calabretta's wcslib package) |
---|
| 49 | # Static library generation. |
---|
[168] | 50 | AC_PROG_RANLIB |
---|
[1221] | 51 | # Installation utilities. |
---|
| 52 | #AC_PROG_LN_S |
---|
| 53 | #AC_PROG_INSTALL |
---|
[168] | 54 | |
---|
[1221] | 55 | |
---|
| 56 | # Shared library generation. |
---|
| 57 | if test "x$ac_cv_c_compiler_gnu" = xyes ; then |
---|
| 58 | # Note that -fPIC is on by default for Macs, this just makes it obvious. |
---|
| 59 | SHRFLAGS="-fPIC" |
---|
[1224] | 60 | SHRLD="\$(LINK) $SHRFLAGS" |
---|
[1221] | 61 | |
---|
| 62 | case "$build_os" in |
---|
| 63 | darwin*) |
---|
| 64 | AC_MSG_NOTICE([ Using darwin build option]) |
---|
[1227] | 65 | SHRLIB="libduchamp.$PACKAGE_VERSION.dylib" |
---|
[1221] | 66 | SHRLD="$SHRLD -dynamiclib -single_module" |
---|
| 67 | SHRLD="$SHRLD -compatibility_version $PACKAGE_VERSION -current_version $PACKAGE_VERSION" |
---|
[1292] | 68 | SHRLN="libduchamp.dylib" |
---|
[1221] | 69 | |
---|
| 70 | case "$build_cpu" in |
---|
| 71 | powerpc*) |
---|
| 72 | AC_MSG_NOTICE([ Using darwin build option with powerpc subcase]) |
---|
| 73 | # Switch off -fPIC (not applicable for Intel Macs). |
---|
| 74 | CFLAGS="$CFLAGS -mdynamic-no-pic" |
---|
| 75 | ;; |
---|
| 76 | esac |
---|
| 77 | ;; |
---|
| 78 | *) |
---|
| 79 | # Covers Linux and Solaris at least. |
---|
| 80 | AC_MSG_NOTICE([ Using alternative (linux) build option]) |
---|
| 81 | SHRLIB="libduchamp.so.$PACKAGE_VERSION" |
---|
[1224] | 82 | SHRLD="$SHRLD -shared -Wl,-soname,$SHRLIB" |
---|
[1221] | 83 | SHRLN="libduchamp.so" |
---|
| 84 | ;; |
---|
| 85 | esac |
---|
| 86 | |
---|
| 87 | else |
---|
| 88 | AC_MSG_NOTICE([ Not setting shared library options]) |
---|
| 89 | SHRLIB= |
---|
| 90 | SHRFLAGS= |
---|
| 91 | SHRLD= |
---|
| 92 | SHRSFX= |
---|
| 93 | SHRLN= |
---|
| 94 | fi |
---|
| 95 | |
---|
| 96 | AC_SUBST([SHRLIB]) |
---|
| 97 | AC_SUBST([SHRFLAGS]) |
---|
| 98 | AC_SUBST([SHRLD]) |
---|
| 99 | AC_SUBST([SHRSFX]) |
---|
| 100 | AC_SUBST([SHRLN]) |
---|
| 101 | |
---|
[107] | 102 | # Checks for library functions. |
---|
| 103 | AC_FUNC_STRTOD |
---|
| 104 | AC_CHECK_FUNCS([floor pow sqrt strtol log atan fabs]) |
---|
| 105 | |
---|
| 106 | # Extra places to look for third-party include files and libraries. |
---|
| 107 | INCDIRS="$INCDIRS \ |
---|
| 108 | /usr/include \ |
---|
| 109 | /usr/local/include \ |
---|
| 110 | /usr/local/pgplot \ |
---|
| 111 | /usr/local/cfitsio \ |
---|
| 112 | /usr/local/wcslib \ |
---|
| 113 | /local/pgplot \ |
---|
[110] | 114 | /local/cfitsio \ |
---|
| 115 | /opt/local/include" |
---|
[107] | 116 | |
---|
| 117 | LIBDIRS="$LIBDIRS \ |
---|
| 118 | /usr/lib \ |
---|
| 119 | /usr/local/lib \ |
---|
| 120 | /usr/local/pgplot \ |
---|
| 121 | /usr/local/cfitsio \ |
---|
| 122 | /usr/local/wcslib \ |
---|
| 123 | /local/lib \ |
---|
| 124 | /local/pgplot \ |
---|
| 125 | /local/cfitsio \ |
---|
[110] | 126 | /opt/SUNWspro/lib \ |
---|
| 127 | /opt/local/lib" |
---|
[107] | 128 | |
---|
| 129 | AC_MSG_NOTICE(LIBDIRS) |
---|
| 130 | |
---|
| 131 | for LIBDIR in $LIBDIRS ; do |
---|
| 132 | AC_CHECK_FILE([$LIBDIR], [LDFLAGS="$LDFLAGS -L$LIBDIR"], [continue]) |
---|
| 133 | done |
---|
| 134 | |
---|
| 135 | ########################################################################## |
---|
| 136 | # Search for PGPLOT |
---|
[739] | 137 | # use --with-pgplot=directory to specify a particular PGPLOT directory. |
---|
[338] | 138 | # or --without-pgplot or --with-pgplot=no to do without it |
---|
| 139 | # else do the normal searching for libraries. |
---|
[107] | 140 | |
---|
[338] | 141 | AC_MSG_NOTICE([ -- PGPLOT -- ]) |
---|
| 142 | AC_ARG_WITH(pgplot, |
---|
| 143 | [ |
---|
| 144 | AC_HELP_STRING([--with-pgplot=no], |
---|
| 145 | [Compile without PGPLOT graphics capabilities.]) |
---|
| 146 | AC_HELP_STRING([--without-pgplot], |
---|
| 147 | [Compile without PGPLOT graphics capabilities.]) |
---|
| 148 | AC_HELP_STRING([--with-pgplot=<dir>], |
---|
| 149 | [Compile with PGPLOT graphics capabilities, using the directory <dir> to specify the PGPLOT library.]), |
---|
| 150 | ], |
---|
| 151 | [ |
---|
| 152 | if test "x$withval" != xno; then |
---|
| 153 | AC_MSG_NOTICE([Using directory "$withval"]) |
---|
| 154 | PGPLOTINCDIRS=$withval |
---|
| 155 | PGPLOTLIBDIRS=$withval |
---|
| 156 | LDFLAGS="$LDFLAGS -L$withval" |
---|
| 157 | fi |
---|
| 158 | ], |
---|
| 159 | [ |
---|
| 160 | PGPLOTINCDIRS=$INCDIRS |
---|
| 161 | PGPLOTLIBDIRS=$LIBDIRS |
---|
| 162 | ]) |
---|
[107] | 163 | |
---|
[342] | 164 | if test "x$PGPLOTLIBDIRS" = x; then |
---|
[338] | 165 | #the argument to --with-pgplot was no, so we don't look for it. |
---|
| 166 | AC_MSG_NOTICE([Not enabling PGPLOT use.]) |
---|
[384] | 167 | #This is the command to do the linking stage of the compilation |
---|
| 168 | #If no pgplot, we can just link with g++ (or equivalent) |
---|
| 169 | LINKER=$CXX |
---|
| 170 | # AC_CHECK_LIB([stdc++], [main], [PGPLOTLIB="-lstdc++"]) |
---|
| 171 | # if test "x$F77" = xgfortran; then |
---|
| 172 | # PGPLOTLIB="$PGPLOTLIB -bind_at_load" |
---|
| 173 | # fi |
---|
[338] | 174 | else |
---|
[107] | 175 | |
---|
[343] | 176 | #Set up the PGPLOT-related libraries and includes. |
---|
| 177 | |
---|
[338] | 178 | for INCDIR in $PGPLOTINCDIRS ; do |
---|
| 179 | AC_CHECK_FILE([$INCDIR/cpgplot.h], [PGPLOTINC=-I$INCDIR; break]) |
---|
[937] | 180 | AC_CHECK_FILE([$INCDIR/pgplot/cpgplot.h], [PGPLOTINC=-I$INCDIR/pgplot; break]) |
---|
[806] | 181 | AC_CHECK_FILE([$INCDIR/include/cpgplot.h], [PGPLOTINC=-I$INCDIR/include; break]) |
---|
[338] | 182 | done |
---|
| 183 | |
---|
| 184 | # PGPLOT compiled with a SUN compiler but linked with something else. |
---|
[351] | 185 | AC_CHECK_LIB([sunmath], [cosd], [EXTRAPGLIB="-lsunmath $EXTRAPGLIB"], |
---|
| 186 | [], [$EXTRAPGLIB $LIBS]) |
---|
| 187 | AC_CHECK_LIB([M77], [iand_], [EXTRAPGLIB="-lM77 $EXTRAPGLIB"], |
---|
| 188 | [], [$EXTRAPGLIB $LIBS]) |
---|
| 189 | AC_CHECK_LIB([F77], [f77_init], [EXTRAPGLIB="-lF77 $EXTRAPGLIB"], |
---|
| 190 | [], [$EXTRAPGLIB $LIBS]) |
---|
[338] | 191 | |
---|
| 192 | # Search for X11 includes and libraries. |
---|
[1060] | 193 | AC_PATH_XTRA() |
---|
| 194 | ## AC_PATH_X |
---|
[765] | 195 | AC_MSG_NOTICE([X-library search yielded X_CFLAGS=$X_CFLAGS, X_LIBS=$X_LIBS, X_EXTRA_LIBS=$X_EXTRA_LIBS, X_PRE_LIBS=$X_PRE_LIBS]) |
---|
[501] | 196 | # returns C compiler flags needed for X to X_CFLAGS and the X linker flags to X_LIBS |
---|
| 197 | if test "x$X_LIBS" != x; then |
---|
| 198 | LDFLAGS="$LDFLAGS $X_LIBS" |
---|
[765] | 199 | EXTRAPGLIB="$X_LIBS $X_PRE_LIBS -lX11 $EXTRAPGLIB" |
---|
[338] | 200 | fi |
---|
[351] | 201 | |
---|
| 202 | # # Add pgplot libraries, if they exist to the lib path |
---|
| 203 | # for LIBDIR in $PGPLOTLIBDIRS ; do |
---|
| 204 | # AC_CHECK_FILE([$LIBDIR/libcpgplot.a], [PGPLOTLIB="-L$LIBDIR $PGPLOTLIB"; break]) |
---|
| 205 | # done |
---|
[338] | 206 | |
---|
| 207 | # It is possible that other libraries may be required depending on what |
---|
| 208 | # graphics drivers were installed with PGPLOT. |
---|
[351] | 209 | AC_CHECK_LIB([z], [deflate], [EXTRAPGLIB="$EXTRAPGLIB -lz"], |
---|
| 210 | [], [$EXTRAPGLIB $LIBS]) |
---|
| 211 | AC_CHECK_LIB([png], [png_error], [EXTRAPGLIB="$EXTRAPGLIB -lpng"], |
---|
| 212 | [], [$EXTRAPGLIB $LIBS]) |
---|
[343] | 213 | |
---|
[765] | 214 | AC_LANG([Fortran 77]) |
---|
[351] | 215 | AC_CHECK_LIB([pgplot], [pgopen], [PGPLOTLIB="-lpgplot"], |
---|
[352] | 216 | [], [$PGPLOTLIB $EXTRAPGLIB]) |
---|
[351] | 217 | AC_LANG(C) |
---|
[352] | 218 | # Checks for extra libraries needed by PGPLOT -- will add -lg2c -lstdc++ to $LIBS |
---|
| 219 | AC_CHECK_LIB([g2c], [gerror_]) |
---|
| 220 | AC_CHECK_LIB([stdc++], [main]) |
---|
[351] | 221 | if test "x$F77" = xgfortran; then |
---|
| 222 | PGPLOTLIB="-lcpgplot $PGPLOTLIB" |
---|
| 223 | AC_MSG_NOTICE([ Using gfortran, so manually adding -lcpgplot to PGPLOTLIB string.]) |
---|
| 224 | else |
---|
| 225 | AC_CHECK_LIB([cpgplot], [cpgopen], [PGPLOTLIB="-lcpgplot $PGPLOTLIB"], |
---|
| 226 | [], [$PGPLOTLIB $LIBS $EXTRAPGLIB]) |
---|
| 227 | fi |
---|
[338] | 228 | |
---|
| 229 | # If PGPLOT is not present, we give a warning message but still continue. |
---|
| 230 | # The compilation is able to work without the PGPLOT-dependent files. |
---|
| 231 | if test "x$PGPLOTLIB" = x; then |
---|
| 232 | AC_MSG_NOTICE([ |
---|
| 233 | ------------------------------------------------------- |
---|
| 234 | WARNING! PGPLOT could not be found. |
---|
| 235 | Compiling Duchamp without graphics capabilities. |
---|
| 236 | -------------------------------------------------------]) |
---|
[384] | 237 | #We have no pgplot, so we just link with g++ (or equivalent) |
---|
| 238 | LINKER=$CXX |
---|
[338] | 239 | else |
---|
[384] | 240 | #We are using pgplot, so link with the fortran compiler. |
---|
| 241 | LINKER=$F77 |
---|
[351] | 242 | PGPLOTLIB="$PGPLOTLIB $EXTRAPGLIB $LIBS" |
---|
[338] | 243 | AC_MSG_NOTICE([PGPLOT appears to be available.]) |
---|
| 244 | AC_DEFINE([HAVE_PGPLOT], [1], [Define to 1 if PGPLOT is available.]) |
---|
| 245 | for LIBDIR in $PGPLOTLIBDIRS ; do |
---|
[351] | 246 | AC_CHECK_FILE([$LIBDIR/libcpgplot.a], [PGPLOTLIB="-L$LIBDIR $PGPLOTLIB"; break]) |
---|
[806] | 247 | AC_CHECK_FILE([$LIBDIR/lib/libcpgplot.a], [PGPLOTLIB="-L$LIBDIR/lib $PGPLOTLIB"; break]) |
---|
| 248 | AC_CHECK_FILE([$LIBDIR/pgplot/libcpgplot.a], [PGPLOTLIB="-L$LIBDIR/pgplot $PGPLOTLIB"; break]) |
---|
[338] | 249 | done |
---|
[805] | 250 | # if test "x$F77" = xgfortran; then |
---|
| 251 | # PGPLOTLIB="$PGPLOTLIB -bind_at_load" |
---|
| 252 | # fi |
---|
[338] | 253 | fi |
---|
[107] | 254 | |
---|
| 255 | fi |
---|
| 256 | |
---|
[384] | 257 | AC_SUBST([LINKER]) |
---|
[107] | 258 | AC_SUBST([PGPLOTINC]) |
---|
| 259 | AC_SUBST([PGPLOTLIB]) |
---|
| 260 | ########################################################################## |
---|
| 261 | |
---|
| 262 | ########################################################################## |
---|
| 263 | # Search for CFITSIO. |
---|
[338] | 264 | # use --with-cfitsio=directory to specify a particular CFITSIO directory. |
---|
| 265 | # else do the normal searching for libraries. |
---|
| 266 | |
---|
| 267 | AC_MSG_NOTICE([ -- CFITSIO -- ]) |
---|
| 268 | AC_ARG_WITH(cfitsio, |
---|
| 269 | AC_HELP_STRING([--with-cfitsio=<dir>], |
---|
| 270 | [The CFITSIO library and include files are in directory <dir>.]), |
---|
| 271 | [ #if we specify a directory... |
---|
| 272 | if test "x$withval" = xno; then |
---|
| 273 | AC_MSG_NOTICE([ |
---|
| 274 | The CFITSIO library is required. |
---|
| 275 | Ignoring the "--with-cfitsio=no" and searching for the library.], [1]) |
---|
| 276 | CFITSIOINCDIRS=$INCDIRS |
---|
| 277 | CFITSIOLIBDIRS=$LIBDIRS |
---|
| 278 | else |
---|
| 279 | AC_MSG_NOTICE([Using directory "$withval"]) |
---|
[342] | 280 | CFITSIOINCDIRS="$withval \ |
---|
| 281 | $withval/include" |
---|
| 282 | CFITSIOLIBDIRS="$withval \ |
---|
| 283 | $withval/lib" |
---|
[351] | 284 | for LIBDIR in $CFITSIOLIBDIRS ; do |
---|
| 285 | AC_CHECK_FILE([$LIBDIR], [LDFLAGS="$LDFLAGS -L$LIBDIR"], [continue]) |
---|
| 286 | done |
---|
| 287 | for INCDIR in $CFITSIOINCDIRS ; do |
---|
| 288 | AC_CHECK_FILE([$INCDIR], [CPPFLAGS="$CPPFLAGS -I$INCDIR"], [continue]) |
---|
| 289 | done |
---|
[338] | 290 | fi |
---|
| 291 | ], |
---|
| 292 | [ # if directory not specified, go searching. |
---|
| 293 | CFITSIOINCDIRS=$INCDIRS |
---|
| 294 | CFITSIOLIBDIRS=$LIBDIRS |
---|
| 295 | ]) |
---|
| 296 | |
---|
| 297 | for INCDIR in $CFITSIOINCDIRS ; do |
---|
[107] | 298 | AC_CHECK_FILE([$INCDIR/fitsio.h], [CFITSIOINC=-I$INCDIR; break]) |
---|
| 299 | INCDIR=$INCDIR/cfitsio |
---|
| 300 | AC_CHECK_FILE([$INCDIR/fitsio.h], [CFITSIOINC=-I$INCDIR; break]) |
---|
| 301 | done |
---|
| 302 | |
---|
[351] | 303 | AC_CHECK_LIB([socket], [recv], [CFITSIOLIB="$CFITSIOLIB -lsocket"], [], [$LIBS]) |
---|
| 304 | AC_CHECK_LIB([cfitsio], [ffopen], [CFITSIOLIB="$CFITSIOLIB -lcfitsio"], [], |
---|
[107] | 305 | [$CFITSIOLIB $LIBS]) |
---|
| 306 | |
---|
[320] | 307 | # CFITSIO is essential for Duchamp, so exit with error message if it |
---|
| 308 | # is not present. |
---|
[107] | 309 | if test "x$CFITSIOINC" = x -o "x$CFITSIOLIB" = x; then |
---|
| 310 | AC_MSG_ERROR([ |
---|
| 311 | ------------------------------------------------------- |
---|
| 312 | Could not find the CFITSIO library. |
---|
| 313 | |
---|
| 314 | ERROR: Duchamp configuration failure. |
---|
| 315 | -------------------------------------------------------], [1]) |
---|
| 316 | else |
---|
| 317 | AC_MSG_NOTICE([CFITSIO appears to be available.]) |
---|
| 318 | AC_DEFINE([HAVE_CFITSIO], [1], [Define to 1 if CFITSIO is available.]) |
---|
[351] | 319 | for LIBDIR in $CFITSIOLIBDIRS ; do |
---|
| 320 | AC_CHECK_FILE([$LIBDIR/libcfitsio.a], [CFITSIOLIB="-L$LIBDIR $CFITSIOLIB"; break]) |
---|
| 321 | LIBDIR=$LIBDIR/cfitsio |
---|
| 322 | AC_CHECK_FILE([$LIBDIR/libcfitsio.a], [CFITSIOLIB="-L$LIBDIR $CFITSIOLIB"; break]) |
---|
| 323 | done |
---|
| 324 | |
---|
[107] | 325 | fi |
---|
| 326 | |
---|
| 327 | AC_SUBST([CFITSIOINC]) |
---|
| 328 | AC_SUBST([CFITSIOLIB]) |
---|
| 329 | ########################################################################## |
---|
| 330 | |
---|
| 331 | ########################################################################## |
---|
| 332 | # Search for WCSLIB. |
---|
[351] | 333 | # use --with-wcslib=directory to specify a particular WCSLIB directory. |
---|
[338] | 334 | # else do the normal searching for libraries. |
---|
| 335 | |
---|
| 336 | AC_MSG_NOTICE([ -- WCSLIB -- ]) |
---|
[402] | 337 | WCSINCDIR="" |
---|
[338] | 338 | AC_ARG_WITH(wcslib, |
---|
| 339 | AC_HELP_STRING([--with-wcslib=<dir>], |
---|
| 340 | [The WCSLIB library and include files are in directory <dir>.]), |
---|
| 341 | [ #if we specify a directory... |
---|
| 342 | if test "x$withval" = xno; then |
---|
| 343 | AC_MSG_NOTICE([ |
---|
| 344 | The WCSLIB library is required. |
---|
| 345 | Ignoring the "--with-wcslib=no" and searching for the library.], [1]) |
---|
[351] | 346 | WCSINCDIRS=$INCDIRS |
---|
| 347 | WCSLIBDIRS=$LIBDIRS |
---|
[338] | 348 | else |
---|
| 349 | AC_MSG_NOTICE([Using directory "$withval"]) |
---|
| 350 | WCSINCDIRS="$withval \ |
---|
| 351 | $withval/include" |
---|
| 352 | WCSLIBDIRS="$withval \ |
---|
| 353 | $withval/lib" |
---|
[351] | 354 | for LIBDIR in $WCSLIBDIRS ; do |
---|
| 355 | AC_CHECK_FILE([$LIBDIR], [LDFLAGS="$LDFLAGS -L$LIBDIR"], [continue]) |
---|
| 356 | done |
---|
| 357 | for INCDIR in $WCSINCDIRS ; do |
---|
[402] | 358 | AC_CHECK_FILE([$INCDIR/wcslib], |
---|
| 359 | [CPPFLAGS="$CPPFLAGS -I$INCDIR"; WCSINCDIR=$INCDIR; break], |
---|
| 360 | [continue]) |
---|
[351] | 361 | done |
---|
[338] | 362 | fi |
---|
| 363 | ], |
---|
| 364 | [ # if directory not specified, go searching. |
---|
| 365 | WCSINCDIRS=$INCDIRS |
---|
| 366 | WCSLIBDIRS=$LIBDIRS |
---|
| 367 | ]) |
---|
| 368 | |
---|
[107] | 369 | |
---|
[402] | 370 | if test "x$WCSINCDIR" = x; then |
---|
| 371 | for INCBASE in $WCSINCDIRS ; do |
---|
[492] | 372 | AC_CHECK_FILE([$INCBASE/wcslib/wcs.h], [WCSINC="-I$INCBASE -I$INCBASE/wcslib $WCSINC"; break]) |
---|
[351] | 373 | done |
---|
[402] | 374 | else |
---|
[492] | 375 | AC_CHECK_FILE([$WCSINCDIR/wcslib/wcs.h], [WCSINC="-I$WCSINCDIR -I$WCSINCDIR/wcslib $WCSINC"]) |
---|
[402] | 376 | fi |
---|
[349] | 377 | |
---|
[402] | 378 | |
---|
[351] | 379 | # Look for libwcs.a, and libpgsbox.a |
---|
| 380 | AC_CHECK_LIB([wcs], [wcss2p], [WCSLIB="$WCSLIB -lwcs"], [], |
---|
[267] | 381 | [$WCSLIB $LIBS $CFITSIOLIB $PGPLOTLIB]) |
---|
[826] | 382 | |
---|
| 383 | # Only use libpgsbox if we have pgplot enabled - determine this by testing the PGPLOTINCDIRS variable |
---|
| 384 | if test "x$PGPLOTINCDIRS" != x; then |
---|
| 385 | if test "x$F77" = xgfortran; then |
---|
| 386 | WCSLIB="$WCSLIB -lpgsbox" |
---|
| 387 | AC_MSG_NOTICE([ Using gfortran, so manually adding -lpgsbox to WCSLIB string.]) |
---|
| 388 | else |
---|
| 389 | AC_CHECK_LIB([pgsbox], [cpgsbox], [WCSLIB="$WCSLIB -lpgsbox"], [], |
---|
| 390 | [$WCSLIB $LIBS $CFITSIOLIB $PGPLOTLIB]) |
---|
| 391 | fi |
---|
[351] | 392 | fi |
---|
[107] | 393 | |
---|
[320] | 394 | # WCSLIB is essential for Duchamp, so exit with error message if it |
---|
| 395 | # is not present. Need at least libwcs to be available -- libpgsbox will |
---|
| 396 | # depend on PGPLOT being available, but is not critical. |
---|
[107] | 397 | if test "x$WCSINC" = x -o "x$WCSLIB" = x; then |
---|
| 398 | AC_MSG_ERROR([ |
---|
| 399 | ------------------------------------------------------- |
---|
| 400 | Could not find the WCSLIB library. |
---|
| 401 | |
---|
| 402 | ERROR: Duchamp configuration failure. |
---|
| 403 | -------------------------------------------------------], [1]) |
---|
| 404 | else |
---|
| 405 | AC_MSG_NOTICE([WCSLIB appears to be available.]) |
---|
| 406 | AC_DEFINE([HAVE_WCSLIB], [1], [Define to 1 if WCSLIB is available.]) |
---|
[351] | 407 | # Now add the -L statements to start of WCSLIB. |
---|
| 408 | # Search for libwcs.a, and, if we find it, search for libpgsbox in same directory and |
---|
| 409 | # then in other directories, keeping the appropriate order of -L calls. |
---|
| 410 | |
---|
[402] | 411 | DIRLIST=". \ |
---|
| 412 | wcs \ |
---|
| 413 | wcslib" |
---|
| 414 | |
---|
[351] | 415 | for LIBBASE in $WCSLIBDIRS ; do |
---|
| 416 | for DIR in $DIRLIST; do |
---|
| 417 | if test "x$DIR" = x.; then |
---|
| 418 | LIBDIR=$LIBBASE |
---|
| 419 | else |
---|
| 420 | LIBDIR="$LIBBASE/$DIR" |
---|
| 421 | fi |
---|
| 422 | AC_CHECK_FILE([$LIBDIR/libwcs.a], |
---|
| 423 | [WCSLIBFRONT="-L$LIBDIR"; |
---|
| 424 | AC_CHECK_FILE([$LIBDIR/libpgsbox.a], [], [ |
---|
| 425 | for LIBBASE2 in $WCSLIBDIRS ; do |
---|
| 426 | for DIR2 in $DIRLIST; do |
---|
| 427 | if test "x$DIR" = x.; then |
---|
| 428 | LIBDIR=$LIBBASE |
---|
| 429 | else |
---|
| 430 | LIBDIR="$LIBBASE/$DIR" |
---|
| 431 | fi |
---|
| 432 | AC_CHECK_FILE([$LIBDIR2/libpgsbox.a], |
---|
| 433 | [WCSLIBFRONT="$WCSLIB -L$LIBDIR2"; break]) |
---|
| 434 | done |
---|
| 435 | done]) |
---|
| 436 | break]) |
---|
| 437 | done |
---|
| 438 | done |
---|
| 439 | WCSLIB="$WCSLIBFRONT $WCSLIB" |
---|
[107] | 440 | fi |
---|
| 441 | |
---|
| 442 | AC_SUBST([WCSINC]) |
---|
| 443 | AC_SUBST([WCSLIB]) |
---|
| 444 | ########################################################################## |
---|
| 445 | |
---|
| 446 | AC_SUBST([LDFLAGS]) |
---|
| 447 | |
---|
| 448 | AC_CONFIG_FILES([Makefile]) |
---|
| 449 | AC_OUTPUT |
---|