Commit 3376ca7fd7d741b06171f5e605f7304c590d4ab5
1 parent
cde53380
use gammalib macro AC_FIND_LIB_HEADER
Showing
1 changed file
with
16 additions
and
133 deletions
configure.ac
| @@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
| 18 | # | 18 | # |
| 19 | # Process this file with autoconf to produce a configure script | 19 | # Process this file with autoconf to produce a configure script |
| 20 | 20 | ||
| 21 | -AC_INIT([GammaLib], [0.4.9], [knodlseder@cesr.fr], [gammalib]) | 21 | +AC_INIT([GammaLib], [0.4.10], [knodlseder@cesr.fr], [gammalib]) |
| 22 | AC_CONFIG_SRCDIR([src/support/GTools.cpp]) | 22 | AC_CONFIG_SRCDIR([src/support/GTools.cpp]) |
| 23 | AC_CONFIG_MACRO_DIR([m4]) | 23 | AC_CONFIG_MACRO_DIR([m4]) |
| 24 | AM_INIT_AUTOMAKE([gnu no-dependencies]) | 24 | AM_INIT_AUTOMAKE([gnu no-dependencies]) |
| @@ -312,70 +312,13 @@ if test "x$with_cfitsio" = "xyes"; then | @@ -312,70 +312,13 @@ if test "x$with_cfitsio" = "xyes"; then | ||
| 312 | *) cfitsio_deps="-lm" ;; | 312 | *) cfitsio_deps="-lm" ;; |
| 313 | esac | 313 | esac |
| 314 | 314 | ||
| 315 | - # First search for cfitsio in the standard paths using AC_CHECK_LIB | ||
| 316 | - # and check for appropriate headers using AC_CHECK_HEADERS. This allows | ||
| 317 | - # also to search in paths that are eventually specified by LDFAGS and | ||
| 318 | - # CPPFLAGS. | ||
| 319 | - AC_CHECK_LIB([cfitsio], [ffpss], | ||
| 320 | - [has_cfitsio="yes" | ||
| 321 | - AC_MSG_NOTICE([cfitsio found])], | ||
| 322 | - [], [${cfitsio_deps}]) | ||
| 323 | - AC_CHECK_HEADERS([fitsio.h cfitsio/fitsio.h], [break]) | ||
| 324 | - if test x"$ac_cv_header_fitsio_h" != "xyes" -a x"$ac_cv_header_cfitsio_fitsio_h" != "xyes"; then | ||
| 325 | - has_cfitsio="no" | ||
| 326 | - AC_MSG_NOTICE([cfitsio headers not found or not usable]) | ||
| 327 | - fi | ||
| 328 | - | ||
| 329 | - # If cfitsio has not been found then search for cfitsio shared library in a some | ||
| 330 | - # default directories | ||
| 331 | - if test "x$has_cfitsio" = "xno"; then | ||
| 332 | - for i in "$gammalib_prefix" /opt/local /usr/local /usr ; do | ||
| 333 | - if test -f $i/lib64/libcfitsio.so -o -f $i/lib64/libcfitsio.dylib; then | ||
| 334 | - if test -f $i/include/fitsio.h; then | ||
| 335 | - LIBDIR_CFITSIO=$i/lib64 | ||
| 336 | - INCDIR_CFITSIO=$i/include | ||
| 337 | - break | ||
| 338 | - fi | ||
| 339 | - if test -f $i/include/cfitsio/fitsio.h; then | ||
| 340 | - LIBDIR_CFITSIO=$i/lib64 | ||
| 341 | - INCDIR_CFITSIO=$i/include/cfitsio/ | ||
| 342 | - break | ||
| 343 | - fi | ||
| 344 | - fi | ||
| 345 | - if test -f $i/lib/libcfitsio.so -o -f $i/lib/libcfitsio.dylib; then | ||
| 346 | - if test -f $i/include/fitsio.h; then | ||
| 347 | - LIBDIR_CFITSIO=$i/lib | ||
| 348 | - INCDIR_CFITSIO=$i/include | ||
| 349 | - break | ||
| 350 | - fi | ||
| 351 | - if test -f $i/include/cfitsio/fitsio.h; then | ||
| 352 | - LIBDIR_CFITSIO=$i/lib | ||
| 353 | - INCDIR_CFITSIO=$i/include/cfitsio | ||
| 354 | - break | ||
| 355 | - fi | ||
| 356 | - fi | ||
| 357 | - done | ||
| 358 | - if test -n "$LIBDIR_CFITSIO" -a -n "$INCDIR_CFITSIO"; then | ||
| 359 | - has_cfitsio="yes" | ||
| 360 | - LDFLAGS="$LDFLAGS -L$LIBDIR_CFITSIO" | ||
| 361 | - CPPFLAGS="$CPPFLAGS -I$INCDIR_CFITSIO" | ||
| 362 | - AC_MSG_NOTICE([cfitsio found in ${LIBDIR_CFITSIO}]) | ||
| 363 | - fi | ||
| 364 | - fi | ||
| 365 | - | ||
| 366 | - # Set cfitsio information | ||
| 367 | - if test "x$has_cfitsio" = "xyes"; then | ||
| 368 | - LIBS_CFITSIO="-lcfitsio ${cfitsio_deps}" | ||
| 369 | - LIBS="${LIBS} ${LIBS_CFITSIO}" | ||
| 370 | - fi | 315 | + # Check for cfitsio library and headers |
| 316 | + AC_FIND_LIB_HEADER([cfitsio], [ffpss], [fitsio.h cfitsio/fitsio.h], | ||
| 317 | + [has_cfitsio="yes"], [], [${cfitsio_deps}]) | ||
| 371 | 318 | ||
| 372 | fi | 319 | fi |
| 373 | if test "x$has_cfitsio" = "xyes"; then | 320 | if test "x$has_cfitsio" = "xyes"; then |
| 374 | AC_DEFINE([HAVE_LIBCFITSIO], [1], [Define if cfitsio library is available]) | 321 | AC_DEFINE([HAVE_LIBCFITSIO], [1], [Define if cfitsio library is available]) |
| 375 | - AC_SUBST(CFITSIO) | ||
| 376 | - AC_SUBST(LIBS_CFITSIO) | ||
| 377 | - AC_SUBST(LIBDIR_CFITSIO) | ||
| 378 | - AC_SUBST(INCDIR_CFITSIO) | ||
| 379 | fi | 322 | fi |
| 380 | AM_CONDITIONAL(WITH_CFITSIO, test "x$has_cfitsio" = "xyes") | 323 | AM_CONDITIONAL(WITH_CFITSIO, test "x$has_cfitsio" = "xyes") |
| 381 | 324 | ||
| @@ -384,8 +327,9 @@ dnl =========================== | @@ -384,8 +327,9 @@ dnl =========================== | ||
| 384 | dnl Checks for readline library | 327 | dnl Checks for readline library |
| 385 | dnl =========================== | 328 | dnl =========================== |
| 386 | 329 | ||
| 387 | -# Initialise readline flag | 330 | +# Initialise readline and ncurses flags |
| 388 | has_readline="no" | 331 | has_readline="no" |
| 332 | +has_ncurses="no" | ||
| 389 | 333 | ||
| 390 | # Check if we want to use readline | 334 | # Check if we want to use readline |
| 391 | AC_ARG_WITH([readline], | 335 | AC_ARG_WITH([readline], |
| @@ -397,74 +341,9 @@ AC_ARG_WITH([readline], | @@ -397,74 +341,9 @@ AC_ARG_WITH([readline], | ||
| 397 | # If we want to use readline, then search now the library | 341 | # If we want to use readline, then search now the library |
| 398 | if test "x$with_readline" = "xyes"; then | 342 | if test "x$with_readline" = "xyes"; then |
| 399 | 343 | ||
| 400 | - #NCURSES_LIBS= | ||
| 401 | - #AC_CHECK_LIB(ncurses, tgetstr, NCURSES_LIBS=-lncurses) | ||
| 402 | - #if test "x$NCURSES_LIBS" = "x"; then | ||
| 403 | - # AC_MSG_ERROR([Unable to find ncurses library]) | ||
| 404 | - #fi | ||
| 405 | - #AC_SUBST(NCURSES_LIBS) | ||
| 406 | - | ||
| 407 | - #saved_LDFLAGS="$LDFLAGS" | ||
| 408 | - #LDFLAGS="$LDFLAGS -lncurses" | ||
| 409 | - #READLINE_LIBS= | ||
| 410 | - #AC_CHECK_LIB(readline, readline, READLINE_LIBS=-lreadline) | ||
| 411 | - #if test "x$READLINE_LIBS" = "x"; then | ||
| 412 | - # AC_MSG_ERROR([Unable to find readline library]) | ||
| 413 | - #fi | ||
| 414 | - #AC_CHECK_HEADER(readline/readline.h, :, | ||
| 415 | - # AC_MSG_ERROR([Unable to find readline headers])) | ||
| 416 | - #AC_SUBST(READLINE_LIBS) | ||
| 417 | - #LDFLAGS="$saved_LDFLAGS" | ||
| 418 | - | ||
| 419 | - # Set host specific readline dependencies | ||
| 420 | - readline_deps= | ||
| 421 | - case $host in | ||
| 422 | - sparc*-sun-solaris*) readline_deps="-lncurses" ;; | ||
| 423 | - *) readline_deps="-lncurses" ;; | ||
| 424 | - esac | ||
| 425 | - | ||
| 426 | - # First search for readline using the AC_CHECK_LIB macro. This performs search | ||
| 427 | - # in all standard locations and the paths that are eventually specified by LDFLAGS | ||
| 428 | - AC_CHECK_LIB([readline], [main], | ||
| 429 | - [has_readline="yes" | ||
| 430 | - AC_MSG_NOTICE([readline found])], | ||
| 431 | - [], [${readline_deps}]) | ||
| 432 | - | ||
| 433 | - # If readline has not been found then search for readline shared library in a couple | ||
| 434 | - # of predefined locations | ||
| 435 | - if test "x$has_readline" = "xno"; then | ||
| 436 | - for i in "$gammalib_prefix" /opt/local /usr/local /usr ; do | ||
| 437 | - if test -f $i/lib64/libreadline.so -o -f $i/lib64/libreadline.dylib -a -f $i/include/readline/readline.h; then | ||
| 438 | - LIBDIR_READLINE=$i/lib64 | ||
| 439 | - INCDIR_READLINE=$i/include | ||
| 440 | - break | ||
| 441 | - fi | ||
| 442 | - if test -f $i/lib/libreadline.so -o -f $i/lib/libreadline.dylib -a -f $i/include/readline/readline.h; then | ||
| 443 | - LIBDIR_READLINE=$i/lib | ||
| 444 | - INCDIR_READLINE=$i/include | ||
| 445 | - break | ||
| 446 | - fi | ||
| 447 | - done | ||
| 448 | - if test -n "$LIBDIR_READLINE" -a -n "$INCDIR_READLINE"; then | ||
| 449 | - has_readline="yes" | ||
| 450 | - if test "$LIBDIR_READLINE" != "$LIBDIR_CFITSIO"; then | ||
| 451 | - LDFLAGS="$LDFLAGS -L$LIBDIR_READLINE" | ||
| 452 | - fi | ||
| 453 | - if test "$INCDIR_READLINE" != "$INCDIR_CFITSIO"; then | ||
| 454 | - CPPFLAGS="$CPPFLAGS -I$INCDIR_READLINE" | ||
| 455 | - fi | ||
| 456 | - AC_SUBST(LIBDIR_READLINE) | ||
| 457 | - AC_SUBST(INCDIR_READLINE) | ||
| 458 | - AC_MSG_NOTICE([readline found in ${LIBDIR_READLINE}]) | ||
| 459 | - fi | ||
| 460 | - fi | ||
| 461 | - | ||
| 462 | - # Set readline information | ||
| 463 | - if test "x$has_readline" = "xyes"; then | ||
| 464 | - LIBS_READLINE="-lreadline ${readline_deps}" | ||
| 465 | - AC_SUBST(LIBS_READLINE) | ||
| 466 | - LIBS="${LIBS} ${LIBS_READLINE}" | ||
| 467 | - fi | 344 | + # First check for the presence of the ncurses library |
| 345 | + AC_FIND_LIB_HEADER([ncurses], [tgetstr], [], [has_ncurses="yes"]) | ||
| 346 | + AC_FIND_LIB_HEADER([readline], [readline], [readline/readline.h], [has_readline="yes"]) | ||
| 468 | 347 | ||
| 469 | fi | 348 | fi |
| 470 | if test "x$has_readline" = "xyes"; then | 349 | if test "x$has_readline" = "xyes"; then |
| @@ -575,14 +454,18 @@ echo | @@ -575,14 +454,18 @@ echo | ||
| 575 | echo " GammaLib configuration summary" | 454 | echo " GammaLib configuration summary" |
| 576 | echo " ==============================" | 455 | echo " ==============================" |
| 577 | if test "x$has_cfitsio" = "xyes"; then | 456 | if test "x$has_cfitsio" = "xyes"; then |
| 578 | - echo " * FITS I/O support (yes) $LIBDIR_CFITSIO $INCDIR_CFITSIO" | 457 | + echo " * FITS I/O support (yes)" |
| 579 | else | 458 | else |
| 580 | echo " - FITS I/O support (no) no cfitsio library found" | 459 | echo " - FITS I/O support (no) no cfitsio library found" |
| 581 | fi | 460 | fi |
| 582 | if test "x$has_readline" = "xyes"; then | 461 | if test "x$has_readline" = "xyes"; then |
| 583 | - echo " * Readline support (yes) $LIBDIR_READLINE $INCDIR_READLINE" | 462 | + echo " * Readline support (yes)" |
| 584 | else | 463 | else |
| 585 | - echo " - Readline support (no) no readline library found" | 464 | + if test "x$has_readline" = "xyes"; then |
| 465 | + echo " - Readline support (no) no ncurses library found" | ||
| 466 | + else | ||
| 467 | + echo " - Readline support (no) no readline library found" | ||
| 468 | + fi | ||
| 586 | fi | 469 | fi |
| 587 | if test "x$has_python" = "xyes"; then | 470 | if test "x$has_python" = "xyes"; then |
| 588 | echo " * Python (yes)" | 471 | echo " * Python (yes)" |