1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 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 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438
|
# Process this file with autoconf to produce a configure script.
#
# Hand written file: used as input into GNU Autotools (autoconf).
# This is part of GNU Astronomy Utilities (gnuastro) package.
#
# We use some macros that are distributed as part of the GNU Autoconf
# Archive here. Those macros are all placed in the bootstrapped/m4/
# directory along with those that were imported from Gnulib. The
# ./bootstrap script includes that directory while its running Autoconf so
# we don't need to explicitly call that directory here.
#
# Original author:
# Mohammad Akhlaghi <mohammad@akhlaghi.org>
# Contributing author(s):
# Pedram Ashofteh-Ardakani <pedramardakani@pm.me>
# Jash Shah <jash28582@gmail.com>
# Copyright (C) 2015-2025 Free Software Foundation, Inc.
#
# Gnuastro is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Gnuastro is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
# Definitions:
AC_PREREQ([2.69])
AC_INIT([GNU Astronomy Utilities],
[dummy-according-to-Propagating-the-package-version-in-Gnulib],
[bug-gnuastro@gnu.org],
[gnuastro],
[http://www.gnu.org/software/gnuastro/])
AC_CONFIG_SRCDIR([lib/fits.c])
AC_CONFIG_AUX_DIR([bootstrapped/build-aux])
VERSION_NUMBER=`cd $srcdir \
&& bootstrapped/build-aux/git-version-gen \
.tarball-version --prefix "gnuastro_v"`
gl_INIT_PACKAGE_VERSION([$VERSION_NUMBER])
AM_INIT_AUTOMAKE([-Wall subdir-objects gnu])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIRS([bootstrapped/m4])
# Library version, see the GNU Libtool manual ("Library interface versions"
# section for the exact definition of each) for
GAL_CURRENT=22
GAL_REVISION=0
GAL_AGE=0
GAL_LT_VERSION="${GAL_CURRENT}:${GAL_REVISION}:${GAL_AGE}"
AC_SUBST(GAL_LT_VERSION)
# Checks for programs.
: ${CFLAGS=""}
: ${CXXFLAGS=""}
AC_PROG_CC
AC_PROG_CXX
AC_PROG_AWK
AC_PROG_SED
gl_EARLY
AM_PROG_AR
LT_INIT
# Check the number of jobs. Depending on the operative system (GNU/Linux or
# macOS), the way of getting the number of cores is different. If the
# number of cores can not be obtained, set it to 8.
AC_CHECK_PROG(has_nproc, nproc, [yes], [no])
AS_IF([test $has_nproc = yes],
[jobs=$(nproc --all)],
[
AC_CHECK_PROG(has_sysctl, sysctl, [yes], [no])
AS_IF([test $has_sysctl = yes],
[jobs=$(sysctl -a | awk '/^hw\.ncpu/{print $2}')],
[jobs=8])
])
AC_SUBST(SUGGESTEDJOBS, [$jobs])
# This macro will let the libraries know that we are now in the Gnuastro
# build system, not on the user's system. While we are building Gnuastro,
# we have the important installation information in 'config.h'. But in the
# user's own programs, this information is defined in
# 'gnuastro/config.h'. With this macro, the installed headers can decide
# if the latter should be included or not. Note that 'gnuastro/config.h'
# is only built at installation time and doesn't exist when building
# Gnuastro. Therefore, this macro must not be defined in a user's program.
AC_DEFINE([IN_GNUASTRO_BUILD], [1], [In building, not usage])
# See if 'make check' should be made with Valgrind. This should be done
# before checking the compilation flags because it can re-write
# 'enable-debug').
AC_ARG_ENABLE(check-with-valgrind,
[AS_HELP_STRING([--enable-check-with-valgrind],
[Run 'make check' programs within Valgrind])],
[AS_IF([test "x$enable_check_with_valgrind" != xno],
[enable_check_with_valgrind=yes])],
[enable_check_with_valgrind=no])
AS_IF([test "x$enable_check_with_valgrind" = "xyes"],
[
enable_debug=yes;
AC_CHECK_PROG(has_valgrind, valgrind, [yes], [no])
AS_IF([test "x$has_valgrind" = "xno"],
[AC_MSG_ERROR([Valgrind not found. Please install it or don't use '--enable-check-with-valgrind'])])
])
AM_CONDITIONAL([COND_CHECK_WITH_VALGRIND], [test "x$enable_check_with_valgrind" = "xyes"])
# Set the compilation flags.
AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--enable-debug],
[No optimization, debug flags, no shared lib.])],
[AS_IF([test "x$enable_debug" != xno], [enable_debug=yes])],
[enable_debug=no])
AS_IF([test "x$enable_debug" = "xyes"],
[cflags_add="-g -O0"; enable_shared=no],
[cflags_add="-O3"])
CFLAGS="-Wall $cflags_add $CFLAGS"
CXXFLAGS="-Wall $cflags_add $CXXFLAGS"
# See if the C++ compiler was present. 'CXX' has already been set by
# 'AC_PROG_CXX' (above). According to the Autoconf manual: "if none of the
# [AC_PROG_CXX] checks succeed, then as a last resort [it will] set 'CXX'
# to 'g++'". Therefore, we can't rely on it to see if the compiler
# executable is actually usable. Therefore tests that rely on it will
# fail. Unfortunately some OSs (like Fedora), don't install 'g++' with
# 'gcc', so it may not always be present. To fix this, here we are just
# using 'AC_CHECK_PROG' to see if the 'CXX' executable is reachable in the
# search path and if it isn't, we'll disable the C++ check during 'make
# check' with an Automake conditional.
AC_CHECK_PROG(has_cxx, $CXX, "yes", "no")
AM_CONDITIONAL([COND_HASCXX], [test "x$has_cxx" = "xyes"])
# Check for pthreads and add the appropriate compilation flags. AX_PTHREAD
# comes from the GNU Autoconf Archive's ax_pthread.m4, see there for the
# documentation.
AX_PTHREAD([],[AC_MSG_ERROR([AC_PACKAGE_NAME Needs POSIX Threads (pthread)])])
CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
CC="$PTHREAD_CC"
# See if the C++ compiler understands '-Qunused-arguments'. AX_PTHREAD adds
# puts this option in 'PTHREAD_CFLAGS' when the C compiler knows this
# option. We then pass it to CFLAGS and CXXFLAGS above. But as reported in
# bug #52490, it can happen that sometimes, the C++ compiler doesn't
# recognize it. So we need to do a separate check for C++.
cxxflags_tmp=
for flg in $CXXFLAGS
do
AS_IF([test "$flg" = \-Qunused-arguments],
[ AC_LANG(C++)
AX_CHECK_COMPILE_FLAG([-Qunused-arguments],
[cxx_Qunused_arguments=yes;
cxxflags_tmp="$cxxflags_tmp $flg"],
[cxx_Qunused_arguments=no])
AC_LANG(C) ],
[ cxxflags_tmp="$cxxflags_tmp $flg"])
done
CXXFLAGS="$cxxflags_tmp"
# Check if 'malloc(0)' returns valid pointer
AC_FUNC_MALLOC
# Check the size of necessary system specific types.
AC_CHECK_SIZEOF([size_t])
AC_SUBST(SIZEOF_SIZE_T, [$ac_cv_sizeof_size_t])
AC_DEFINE_UNQUOTED([GAL_CONFIG_SIZEOF_SIZE_T], [$ac_cv_sizeof_size_t],
[On 32bit will be 4, on 64 bit, will be 8])
AC_CHECK_SIZEOF([long])
AC_SUBST(SIZEOF_LONG, [$ac_cv_sizeof_long])
AC_DEFINE_UNQUOTED([GAL_CONFIG_SIZEOF_LONG], [$ac_cv_sizeof_long],
[On 32bit will be 4, on 64 bit, will be 8])
AC_CHECK_SIZEOF([int])
AC_SUBST(SIZEOF_INT, [$ac_cv_sizeof_int])
AC_DEFINE_UNQUOTED([GAL_CONFIG_SIZEOF_INT], [$ac_cv_sizeof_int],
[It may be 16bit or 32bit])
# By default we assume no warnings
anywarnings=no
# Remove any occurance of the current directory './', '.', or the full
# address of the current directory in PATH. The main problem is the
# 'libtool' executable which Gnuastro builds internally in the top build
# directory. However, we also need to know if the system has libtool or
# not.
AC_MSG_CHECKING(if PATH contains current directory)
oldPATH=$PATH
currpwd=$(pwd)
# The first call to SED will remove any occurance of the current directory:
# './', '.', or the full address.
#
# NOTE 1: We cannot simply remove all '.'s, because hidden directories
# (like the '~/.local' that is suggested for local
# installations) will also be altered.
#
# NOTE 2: An empty string in the list of strings (separated by ':')
# means the current directory. This includes cases like: '::',
# or a leading and trailing ':'. So after all the removals of
# the current directory, we will remove all such cases.
#
# NOTE 3: The SED separator can be any character immediately after 's',
# it doesn't just have to be the commonly used '/'. Since '$pwd'
# will possibly contain many '/'s, it is much more easier to use
# a differen separator ('|' in this call to SED).
PATH=$(AS_ECHO([$PATH]) | $SED -e 's|'"$currpwd"'||g' \
-e 's|\.\.*//*||g' \
-e 's|:\.\.*:|:|g' \
-e 's|\.*$||' \
-e 's|^\.*||' \
-e 's|::*|:|g' \
-e 's|^:||' \
-e 's|:$||' )
AS_IF([test $oldPATH = $PATH],
[ path_warning=no ],
[ path_warning=yes; anywarnings=yes ])
AC_MSG_RESULT( $path_warning )
# Libraries
# ---------
#
# After each library is found, AC_SEARCH_LIBS adds the -lLIBRARY flag to
# the LIBS variable which is then given to all the Makefiles. Each new flag
# is added to the left of the old one so order matters here. Note that the
# LIBS variable is also used in checking the next libraries, so the linking
# with their dependent libraries is done automatically with this order, and
# we don't have to explicitly set the dependency flags.
has_gsl=yes
has_libgit2=1
has_cmath=yes
has_wcslib=yes
has_cfitsio=yes
has_libtiff=yes
has_libjpeg=yes
has_gslcblas=yes
missing_mandatory=no
missing_optional_lib=no
# Keep the original LIBS to re-set in the end.
orig_LIBS="$LIBS"
# Basics of the library linking checks
# ------------------------------------
#
# Outputs of 'AC_LIB_HAVE_LINKFLAGS' (which checks for libraries):
#
# - LIB<NAME>: contains the raw 'libNAME.so' or 'libNAME.a' file for some
# libraries. This is necessary for static libraries, but is problematic
# for shared libraries (they will not be linked to the produced
# library: when you run 'ldd libgnuastro.so', you don't see those that
# were linked with a '.so' file here).
#
# To make things worse, when linking Gnuastro's programs with
# Gnuastro's library, libtool will put raw files ('.a' or '.so' files,
# not '-lNAME') before 'libgnuastro.la' (which depends on them). As a
# result, building shared programs with Gnuastro's library will
# fail. But this is desired for static libraries.
#
# - LTLIB<NAME>: has '-lNAME', along with any necessary RPATH flags for
# the local operating system.
#
# Major environment variables:
#
# - LIBS: is primarily used in the compilation checks of the configure
# script where the host's compiler has full control.
#
# - LDADD: is passed to the rules that build Gnuastro's library and
# programs through the 'CONFIG_LDADD' variable.
#
# Since nothing complex is built during the configure script, we'll just
# populate 'LIBS' with 'LTLIB<NAME>'. However, building the programs and
# library is very complex and we have an even more complex BuildProgram in
# Gnaustro. So we fill 'LDADD' conditionally: 1) for building static
# library/programs, we'll use 'LIB<NAME>'. 2) for building shared
# libraries, we'll use 'LTLIB<NAME>'.
# Why C math library (for things like 'log')? Even though '-lm' is also
# found for GSL below, on some systems (reported on Ubuntu), if we don't
# add it explicitly here, the build will crash because of a failure to link
# with the math functions.
AC_LIB_HAVE_LINKFLAGS([m], [], [#include <math.h>])
AS_IF([test "x$LIBM" = x], [],
[LIBS="$LIBM $LIBS"
AS_IF([ test "x$enable_shared" = "xno" ],
[LDADD="$LIBM $LDADD"],
[LDADD="$LTLIBM $LDADD"]) ])
AC_LIB_HAVE_LINKFLAGS([gsl], [gslcblas], [
#include <gsl/gsl_rng.h>
void junk(void) { gsl_rng_env_setup(); } ])
AS_IF([test "x$LIBGSL" = x],
[missing_mandatory=yes; has_gsl=no; has_gslcblas=no],
[LIBS="$LIBGSL $LIBS"
AS_IF([ test "x$enable_shared" = "xno" ],
[LDADD="$LIBGSL $LDADD"],
[LDADD="$LTLIBGSL $LDADD"]) ])
# Since version 0.42, if 'libcurl' is installed, CFITSIO will link with it
# and thus it will be necessary to explicitly link with libcurl also. If it
# doesn't exist on the system, then CFITSIO won't link with it and there is
# no problem for Gnuastro either. So there is no need to stop the configure
# script if libcurl isn't found.
#
# For static builds, linking libcurl (also built in static-only mode) will
# depend on linking with zlib. So we'll need to also search for that
# also. But if libcurl isn't built in static-only mode, then it will have
# undefined symbols for many libraries (for example libpsl, libidn2,
# librtmp, libldap). So if you intend to make Gnuastro statically, then
# build Libcurl in static-only mode so you won't have to check for all
# these extra libraries here.
#
# Similarly, if the Bzip2 library was activated when building CFITSIO, it
# will be necessary in a static build to CFITSIO.
AC_LIB_HAVE_LINKFLAGS([z], [], [#include <zlib.h>])
AS_IF([test "x$LIBZ" = x], [],
[LIBS="$LIBZ $LIBS"
AS_IF([ test "x$enable_shared" = "xno" ],
[LDADD="$LIBZ $LDADD"],
[LDADD="$LTLIBZ $LDADD"]) ])
AC_LIB_HAVE_LINKFLAGS([bz2], [], [#include <bzlib.h>])
AS_IF([test "x$LIBBZ2" = x], [],
[LIBS="$LIBBZ2 $LIBS"
AS_IF([ test "x$enable_shared" = "xno" ],
[LDADD="$LIBBZ2 $LDADD"],
[LDADD="$LTLIBBZ2 $LDADD"]) ])
AC_LIB_HAVE_LINKFLAGS([curl], [], [#include <curl/curl.h>])
AS_IF([test "x$LIBCURL" = x], [],
[LIBS="$LIBCURL $LIBS"
AS_IF([ test "x$enable_shared" = "xno" ],
[LDADD="$LIBCURL $LDADD"],
[LDADD="$LTLIBCURL $LDADD"]) ])
AC_LIB_HAVE_LINKFLAGS([cfitsio], [], [
#include <fitsio.h>
void junk(void) {
int status;
fitsfile *f;
ffopen(&f, "junk", READONLY, &status);} ])
AS_IF([test "x$LIBCFITSIO" = x],
[missing_mandatory=yes; has_cfitsio=no],
[LIBS="$LIBCFITSIO $LIBS"
AS_IF([ test "x$enable_shared" = "xno" ],
[LDADD="$LIBCFITSIO $LDADD"],
[LDADD="$LTLIBCFITSIO $LDADD"]) ])
AC_LIB_HAVE_LINKFLAGS([wcs], [], [
#include <wcslib/wcshdr.h>
void junk(void) {
int nreject, nwcs;
struct wcsprm *wcs;
char *header="JUNK";
wcspih(header, 1, 0, 0, &nreject, &nwcs, &wcs);
} ])
AS_IF([test "x$LIBWCS" = x],
[missing_mandatory=yes; has_wcslib=no],
[LIBS="$LIBWCS $LIBS"
AS_IF([ test "x$enable_shared" = "xno" ],
[LDADD="$LIBWCS $LDADD"],
[LDADD="$LTLIBWCS $LDADD"]) ])
AC_ARG_WITH([libjpeg],
[AS_HELP_STRING([--without-libjpeg],
[disable support for libjpeg])],
[], [with_libjpeg=yes])
AS_IF([test "x$with_libjpeg" != xno],
[ AC_LIB_HAVE_LINKFLAGS([jpeg], [], [
#include <stdio.h>
#include <stdlib.h>
#include <jpeglib.h>
void junk(void) {
struct jpeg_decompress_struct cinfo;
jpeg_create_decompress(&cinfo);
} ]) ])
AS_IF([test "x$LIBJPEG" = x],
[missing_optional_lib=yes; has_libjpeg=no; anywarnings=yes],
[LIBS="$LIBJPEG $LIBS"
AS_IF([ test "x$enable_shared" = "xno" ],
[LDADD="$LIBJPEG $LDADD"],
[LDADD="$LTLIBJPEG $LDADD"]) ])
AM_CONDITIONAL([COND_HASLIBJPEG], [test "x$has_libjpeg" = "xyes"])
AC_ARG_WITH([libtiff],
[AS_HELP_STRING([--without-libtiff],
[disable support for libtiff])],
[], [with_libtiff=yes])
AS_IF([test "x$with_libtiff" != xno],
[ AC_LIB_HAVE_LINKFLAGS([lzma], [], [#include <lzma.h>])
AC_LIB_HAVE_LINKFLAGS([tiff], [], [
#include <tiffio.h>
void junk(void) {TIFF *tif=TIFFOpen("junk", "r");} ])
])
AS_IF([test "x$LIBTIFF" = x],
[missing_optional_lib=yes; has_libtiff=no; anywarnings=yes],
[LIBS="$LIBTIFF $LIBS"
AS_IF([ test "x$enable_shared" = "xno" ],
[LDADD="$LIBTIFF $LDADD"],
[LDADD="$LTLIBTIFF $LDADD"]) ])
AM_CONDITIONAL([COND_HASLIBTIFF], [test "x$has_libtiff" = "xyes"])
# libgit2 (very old versions of libgit2 don't have the 'git_libgit2_init').
AC_ARG_WITH([libgit2],
[AS_HELP_STRING([--without-libgit2],
[disable support for libgit2])],
[], [with_libgit2=yes])
AS_IF([test "x$with_libgit2" != xno],
[ AC_LIB_HAVE_LINKFLAGS([git2], [], [
#include <git2.h>
void junk(void) {git_libgit2_init();} ])
])
AS_IF([test "x$LIBGIT2" = x],
[missing_optional_lib=yes; has_libgit2=0],
[LIBS="$LIBGIT2 $LIBS"
AS_IF([ test "x$enable_shared" = "xno" ],
[LDADD="$LIBGIT2 $LDADD"],
[LDADD="$LTLIBGIT2 $LDADD"]) ])
AC_SUBST(HAVE_LIBGIT2_FOR_CONF, [$has_libgit2])
AC_DEFINE_UNQUOTED([GAL_CONFIG_HAVE_LIBGIT2], [$has_libgit2],
[libgit2 is installed on the system])
AS_IF([test "x$has_libgit2" = "x1"], [], [anywarnings=yes])
# Check if the compiler works with static linking
AS_IF([test "$lt_cv_prog_compiler_static_works" = no ],
[ AS_IF([test "$enable_shared" = no ],
[ anywarnings=yes;
enable_shared_disabled=yes ])
enable_shared=yes ])
# End of library linking list
# ---------------------------
#
# If we are in static mode, convert any string ending in 'libpthread.a' to
# '-lpthread' (because pthread is part of the C library and atleast in
# Gnuastro's usage so far, can't be statically linked (gives errors on
# undefined symbols like '_dl_pagesize' or '_dl_init_static_tls').
AS_IF([test "x$enable_shared" = "xno"],
[ LDADD=$(AS_ECHO(["$LDADD"]) \
| $AWK '{for(i=1; i<=NF; ++i) { \
if( $i ~ /libpthread.a/ ) \
$i="-lpthread" } \
print $0}')
])
# Higher-level library tests
# --------------------------
#
# Once we know that a library exsits, we need to check if it has some
# features or not. This must be done _after_ checking the existance of
# _all_ the libraries, because they may add elements to 'LIBS'/'LDADD' that
# causes possibly different versions of the libraries to be read.
# GSL's 'gsl_interp_steffen' isn't a function. So we'll need to use
# 'AC_LINK_IFELSE'. However, AC_LINK_IFELSE doesn't use 'LDADD', so we'll
# have to temporarily add 'LDADD' to LIBS, then set it back to the
# original.
AC_MSG_CHECKING(if GSL supports Steffen splines)
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[#include <gsl/gsl_interp.h>]],
[[const gsl_interp_type *itype=gsl_interp_steffen;]])],
[AC_MSG_RESULT(yes)
gsl_version_old=no; has_gsl_steffen=1;],
[AC_MSG_RESULT(no)
gsl_version_old=yes; has_gsl_steffen=0; anywarnings=yes;])
AC_DEFINE_UNQUOTED([GAL_CONFIG_HAVE_GSL_INTERP_STEFFEN],
[$has_gsl_steffen],
[GSL has the Steffen interpolation])
AC_SUBST(HAVE_GSL_STEFFEN, [$has_gsl_steffen])
# If the CFITSIO library has the 'fits_is_reentrant' function (it was added
# since version 3.30 of April 2012).
AC_CHECK_LIB([cfitsio], [fits_is_reentrant], [has_fits_is_reentrant=1],
[has_fits_is_reentrant=0; anywarnings=yes], [-lm])
AC_DEFINE_UNQUOTED([GAL_CONFIG_HAVE_FITS_IS_REENTRANT],
[$has_fits_is_reentrant],
[CFITSIO has the fits_is_reentrant function])
AC_SUBST(HAVE_FITS_IS_REENTRANT, [$has_fits_is_reentrant])
# If the WCS library has the 'wcslib_version' function.
AC_CHECK_LIB([wcs], [wcslib_version], [has_wcslib_version=1],
[has_wcslib_version=0; anywarnings=yes], [-lcfitsio -lm])
AC_DEFINE_UNQUOTED([GAL_CONFIG_HAVE_WCSLIB_VERSION], [$has_wcslib_version],
[WCSLIB comes with wcslib_version])
AC_SUBST(HAVE_WCSLIB_VERSION, [$has_wcslib_version])
# If the WCS library supports distortion
AC_CHECK_HEADER([wcslib/dis.h], [has_wcslib_dis_h=1],
[has_wcslib_dis_h=0; anywarnings=yes])
AC_DEFINE_UNQUOTED([GAL_CONFIG_HAVE_WCSLIB_DIS_H], [$has_wcslib_dis_h],
[WCSLIB has distortion header in dis.h])
AC_SUBST(HAVE_WCSLIB_DIS_H, [$has_wcslib_dis_h])
AM_CONDITIONAL([COND_HASWCSDIS_H], [test "x$has_wcslib_dis_h" = "x1"])
# If the WCS library has the 'mjdref' element.
AC_CHECK_MEMBER([struct wcsprm.mjdref], [has_wcslib_mjdref=1],
[has_wcslib_mjdref=0], [[#include <wcslib/wcs.h>]])
AC_DEFINE_UNQUOTED([GAL_CONFIG_HAVE_WCSLIB_MJDREF], [$has_wcslib_mjdref],
[WCSLIB comes with wcsprm.mjdref])
AC_SUBST(HAVE_WCSLIB_MJDREF, [$has_wcslib_mjdref])
# If the WCS library has the OBSFIX macro.
AC_CHECK_DECL(OBSFIX, [has_wcslib_obsfix=1],
[has_wcslib_obsfix=0], [[#include <wcslib/wcsfix.h>]])
AC_DEFINE_UNQUOTED([GAL_CONFIG_HAVE_WCSLIB_OBSFIX], [$has_wcslib_obsfix],
[WCSLIB comes with OBSFIX macro])
AC_SUBST(HAVE_WCSLIB_OBSFIX, [$has_wcslib_obsfix])
# If the WCS library has the 'wcsccs' function.
AC_CHECK_LIB([wcs], [wcsccs], [has_wcslib_wcsccs=1],
[has_wcslib_wcsccs=0; anywarnings=yes], [-lcfitsio -lm])
AC_DEFINE_UNQUOTED([GAL_CONFIG_HAVE_WCSLIB_WCSCCS], [$has_wcslib_wcsccs],
[WCSLIB comes with wcsccs])
AC_SUBST(HAVE_WCSLIB_WCSCCS, [$has_wcslib_wcsccs])
# If the pthreads library has 'pthread_barrier_wait'.
AC_CHECK_LIB([pthread], [pthread_barrier_wait], [has_pthread_barrier=1],
[has_pthread_barrier=0])
AC_DEFINE_UNQUOTED([GAL_CONFIG_HAVE_PTHREAD_BARRIER], [$has_pthread_barrier],
[System has pthread_barrier])
AC_SUBST(HAVE_PTHREAD_BARRIER, [$has_pthread_barrier])
# If a GNU Make header can be found (for Gnuastro's GNU Make extensions)
AC_CHECK_HEADER([gnumake.h], [has_gnumake_h=1],
[has_gnumake_h=0; anywarnings=yes])
AC_DEFINE_UNQUOTED([GAL_CONFIG_HAVE_GNUMAKE_H], [$has_gnumake_h],
[GNU Make's extension header is present.])
AC_SUBST(HAVE_GNUMAKE_H, [$has_gnumake_h])
AM_CONDITIONAL([COND_HASGNUMAKE_H], [test "x$has_gnumake_h" = "x1"])
# Programs
# --------
# Help2man:
AC_CHECK_PROG(has_help2man, help2man, [yes], [no])
AM_CONDITIONAL([COND_HASHELP2MAN], [test "x$has_help2man" = "xyes"])
# cURL:
AC_CHECK_PROG(has_curl, curl, [yes], [no])
AS_IF([test "x$has_curl" = "xno"], [anywarnings=yes])
# Check the libtool executable on the system. Note that Gnuastro also ships
# with a version of Libtool. We don't want Gnuastro's Libtool, here we want
# to see if the system has libtool independent of Gnuastro so BuildProgram
# can use it later. We also need to check some shells to run libtool within
# them.
AC_CHECK_PROG(has_libtool, libtool, [yes], [no])
AC_CHECK_PROG(has_bash, bash, [yes], [no])
AC_CHECK_PROG(has_zsh, zsh, [yes], [no])
# If Libtool is present, make sure it is GNU Libtool
AS_IF([test "x$has_libtool" = "xyes"],
[ AC_MSG_CHECKING(if libtool executable is GNU)
AS_IF( libtool --version 2> /dev/null | grep GNU 2>&1 > /dev/null,
[has_gnulibtool=yes], [has_gnulibtool=no])
AC_MSG_RESULT( $has_gnulibtool )],
[ has_gnulibtool=no ])
# When either the 'libtool' executable isn't GNU or it doesn't exist, then
# look for 'glibtool'.
AS_IF([test "x$has_gnulibtool" = "xyes"],
[ gnulibtool_exec=libtool ],
[ AC_CHECK_PROG(has_glibtool, glibtool, [yes], [no])
AS_IF( [test "x$has_glibtool" = "xyes"],
[has_gnulibtool=yes; gnulibtool_exec=glibtool],
[has_gnulibtool=no; anywarnings=yes] ) ])
# Older versions of GNU Libtool have problems with the 'dash' shell (a
# minimalist shell) and will crash (due to not having the '+=' operator),
# see bug #54430. So we need to check if the system's libtool and shell
# (called by 'sh' as in C's 'system' function within BuildProgram) can work
# with each other. If not, we need to search for Bash and tell BuildProgram
# to use Bash instead of the default. But older versions of Bash also don't
# support this operator, so we'll have to check with Bash is well.
libtool_shell="none"
AS_IF([test "x$has_gnulibtool" = "xyes"],
[
AC_MSG_CHECKING(for shell to use with libtool)
# Make a C source file and run Libtool on it with the specified
# shells.
outname=libtool_shell_test
cprog=libtool_shell_test.c
AS_ECHO(["#include <stdio.h>"]) > $cprog
AS_ECHO(["int main(void){printf(\"success\\n\"); return 0;}"]) >> $cprog
ltargs="--quiet --tag=CC --mode=link $CC $cprog -O3 -o $outname"
# Check the shells, starting with known shells and ultimately
# trying with 'sh' (can be any shell).
AS_IF([test "x$has_bash" = "xyes"],
[AS_IF(bash -c "$gnulibtool_exec $ltargs" > /dev/null 2>&1,
[libtool_shell="bash"],
[bash_version=$BASH_VERSION]) ],
[AS_IF([test "x$has_zsh" = "xyes"],
[AS_IF(zsh -c "$gnulibtool_exec $ltargs" > /dev/null 2>&1,
[libtool_shell="zsh"]) ],
[AS_IF(sh -c "$gnulibtool_exec $ltargs" > /dev/null 2>&1,
[libtool_shell="sh"]) ]) ])
# Clean up: note that no output might have been generated (when no
# proper shell was found). Therefore, for deleting the output file,
# we'll call 'rm' with '-f' so it doesn't complain with an error in
# such cases.
rm $cprog
rm -f $outname
AC_MSG_RESULT($libtool_shell)
])
# If a good shell to call Libtool could be found, then Libtool is usable
# within a program (BuildProgram in this case).
AS_IF([test "x$libtool_shell" = "xnone"],
[
anywarnings=yes;
usable_libtool=no;
AS_IF([test "x$bash_version" = x], [junk=1],
[AS_ECHO(["GNU Bash was found but not a suitable version: $bash_version"]) ])
],
[
usable_libtool=yes
AC_DEFINE_UNQUOTED([GAL_CONFIG_GNULIBTOOL_SHELL], ["$libtool_shell"],
[Shell program to use with GNU Libtool])
AC_DEFINE_UNQUOTED([GAL_CONFIG_GNULIBTOOL_EXEC], ["$gnulibtool_exec"],
[The executable to call GNU Libtool])
])
# Check Ghostscript: "-dPDFFitPage" option to Ghostscript, used by the
# library to convert from EPS to PDF, has been introduced in Ghostscript
# 9.10. Make sure we have at least that version.
#
# Below, only when Ghostscript exists, we check its version and only if its
# version is larger than 9.10, does Gnuastro finally assume the existence
# of Ghostscript. AX_COMPARE_VERSION comes from the GNU Autoconf Archive's
# ax_compare_version.m4.
AC_CHECK_PROG(has_ghostscript, gs, [yes], [no])
AS_IF([test "x$has_ghostscript" = "xyes"],
[AC_MSG_CHECKING(Ghostscript version)
gsversion=$(gs --version)
AX_COMPARE_VERSION([9.10], [gt], [$gsversion], [has_ghostscript=no])
AC_MSG_RESULT( $gsversion )
AC_DEFINE_UNQUOTED([PATH_GHOSTSCRIPT], ["$(which gs)"],
[Location of the host system's Ghostscript binary])
])
# Note: 'has_ghostscript' can be set to 'no' within the AS_IF above, so
# 'anywarnings' cannot be an [RUN-IF-FALSE] argument to the AS_IF above.
AS_IF([test "x$has_ghostscript" = "xno"], [anywarnings=yes])
AM_CONDITIONAL([COND_HASGHOSTSCRIPT], [test "x$has_ghostscript" = "xyes"])
# Check DS9 and TOPCAT
AC_CHECK_PROG(has_ds9, ds9, [yes], [no])
AS_IF([test "x$has_ds9" = "xno"], [anywarnings=yes])
AC_CHECK_PROG(has_topcat, topcat, [yes], [no])
AS_IF([test "x$has_topcat" = "xno"], [anywarnings=yes])
# Check Python3 and NumPy (in that order): and gets their include path if
# they do. This is done using two python scripts:
# py_check_cmd: Uses the sysconfig package's get_paths method
# to get the include path for Python.h header.
# np_check_cmd: Uses numpy's get_include method to get the
# include path for NumPy's core C-API.
#
# NOTE: If using a venv then set the $PYTHON variable to point to the
# python3 command of the venv before running ./configure to perform
# all the following checks in the venv.
AC_ARG_WITH([python],
[AS_HELP_STRING([--with-python],
[enable support for python])],
[], [with_python=no])
AS_IF([test "x$with_python" == xyes],
[
# Variables to simplify commands below.
py_check_cmd='from sysconfig import get_paths; \
print(get_paths().get("include"))'
np_check_cmd='from numpy import get_include; \
print(get_include())'
# Checks if user has a Python version>=3.0
AM_PATH_PYTHON(3.0,,[:])
AS_IF([test "$PYTHON" != :],
[
AC_DEFINE(HAVE_PYTHON, [1],
[Define to 1 if you have Python3.])
AC_MSG_CHECKING(if Numpy is available in the $PYTHON installation)
AS_IF([$PYTHON -c "$py_check_cmd" &> /dev/null],
[python_includedir="$($PYTHON -c "$py_check_cmd")"
AS_IF([$PYTHON -c "$np_check_cmd" &> /dev/null],
[numpy_includedir="$($PYTHON -c "$np_check_cmd")"])])
AS_IF([test "x$numpy_includedir" = x],
[AC_MSG_RESULT([no])], [AC_MSG_RESULT([yes])])
])
AC_SUBST(NUMPY_INCLUDE_DIR, [$numpy_includedir])
AC_SUBST(PYTHON_INCLUDE_DIR, [$python_includedir])
])
AS_IF([test "x$numpy_includedir" = x],
[has_numpy=0], [has_numpy=1;])
AC_SUBST(HAVE_PYTHON, [$has_numpy])
AM_CONDITIONAL([COND_NUMPY], [test "x$numpy_includedir" != x])
# If any necessary dependency is missing inform the user and abort.
AS_IF([test "x$missing_mandatory" = "xyes"],
[
# List missing packages: print the GSL CBLAS message only if GSL is
# present. Otherwise, it is just confusing for the users (CBLAS
# will be installed with GSL). The CBLAS message is only
# interesting if the GSL test has passed.
AS_ECHO([""])
AS_ECHO(["Missing MANDATORY dependencies (necessary to continue):"])
AS_IF([test "x$has_cmath" = "xno"],
[ AS_ECHO([" - C library (math): This may be the cause of all other failures."]) ])
AS_IF([test "x$has_gsl" = "xno"],
[ AS_ECHO([" - GNU Scientific Library (GSL): https://www.gnu.org/software/gsl"]) ],
[ AS_IF([test "x$has_gslcblas" = "xno"],
[ AS_ECHO([" - The BLAS support of GNU Scientific Library (GSL). This should have"])
AS_ECHO([" been installed along with GSL. Try re-installing GSL."]) ]) ])
AS_IF([test "x$has_cfitsio" = "xno"],
[ AS_ECHO([" - CFITSIO: https://heasarc.gsfc.nasa.gov/fitsio"]) ])
AS_IF([test "x$has_wcslib" = "xno"],
[ AS_ECHO([" - WCSLIB: http://www.atnf.csiro.au/people/mcalabre/WCS"]) ])
# Optional dependencies:
AS_IF([test "x$anywarnings" = xyes],
[
AS_ECHO([""])
AS_ECHO(["OPTIONAL warnings/dependencies (for improved functionality):"])
AS_IF([test "x$gsl_version_old" = "xyes"],
[ AS_ECHO([" - Old GSL version: https://www.gnu.org/s/gsl"]) ])
AS_IF([test "x$has_libjpeg" = "xno"],
[ AS_ECHO([" - Missing Libjpeg (JPEG files): http://ijg.org"]) ])
AS_IF([test "x$has_libtiff" = "xno"],
[ AS_ECHO([" - Missing Libtiff (TIFF files): http://libtiff.maptools.org"]) ])
AS_IF([test "x$has_libgit2" = "x0"],
[ AS_ECHO([" - Missing Libgit2: https://libgit2.org"]) ])
AS_IF([test "x$has_curl" = "x0"],
[ AS_ECHO([" - Missing cURL: https://curl.haxx.se"]) ])
dnl AS_IF([test "x$has_numpy" = "x0"],
dnl [ AS_ECHO([" - Missing Numpy (for Python wrappers): https://numpy.org"]) ])
AS_IF([test "x$has_ds9" = "xno"],
[ AS_ECHO([" - Missing SAO DS9: https://sites.google.com/cfa.harvard.edu/saoimageds9"]) ])
AS_IF([test "x$has_topcat" = "xno"],
[ AS_ECHO([" - Missing TOPCAT: http://www.star.bris.ac.uk/~mbt/topcat/"]) ])
AS_IF([test "x$usable_libtool" = "xno"],
[ AS_ECHO([" - Unusable GNU Libtool: https://www.gnu.org/s/libtool"])
AS_IF([test "x$has_gnulibtool" = "xyes"],
[ AS_ECHO([" -- GNU Libtool is present, tested shells not supported."]) ])
AS_IF([test "x$has_libtool" = "xyes"],
[ AS_ECHO([" -- A libtool implementation was found, but it isn't GNU."]) ])
])
AS_IF([test "x$has_ghostscript" = "xno"],
[ AS_ECHO([" - Missing GPL Ghostscript (v9.10 or later): https://www.ghostscript.com"])])
])
# Suggestions on fixing the problem.
AS_ECHO([""])
AS_ECHO(["You can use your package manager for easy and fast installation of all"])
AS_ECHO(["dependencies in one command. See the link below:"])
AS_ECHO([" https://www.gnu.org/s/gnuastro/manual/html_node/Dependencies-from-package-managers.html"])
AS_ECHO([""])
AS_ECHO(["If you have already installed a dependency (for example in '/install/path'),"])
AS_ECHO(["but this script can't link with it, add the path to the LDFLAGS, CPPFLAGS and"])
AS_ECHO(["LD_LIBRARY_PATH environment variables before running configure. For example"])
AS_ECHO(["with the following commands (just correct the '/install/path' part)."])
AS_ECHO([" $ export LDFLAGS=\"\$LDFLAGS -L/install/path/lib\""])
AS_ECHO([" $ export CPPFLAGS=\"\$CPPFLAGS -I/install/path/include\""])
AS_ECHO([" $ export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH:/install/path/lib\""])
AS_ECHO([""])
AS_ECHO(["[TIP:] Put these commands in your startup file (for example '~/.bashrc') to"])
AS_ECHO(["avoid similar problems later. See the link below to learn more:"])
AS_ECHO([" https://www.gnu.org/s/gnuastro/manual/html_node/Installation-directory.html"])
AS_ECHO([""])
AS_ECHO([""])
AC_MSG_ERROR([Mandatory dependency(s) missing, === SEE MESSAGE ABOVE ===.])
])
# Gnulib checks (which are many!). We are doing these after the main
# Gnuastro dependencies so the configure script crashes early if the
# mandatory dependencies aren't present. However, the Gnulib checks are
# very low-level, and the changes in envornment that we made above (in
# particular 'LIBS') can cause conflicts with Gnulib's checks (in
# particular with WCSLIB, because on some systems, WCSLIB's library name:
# 'libwcs' can cause conflicts with the standard wide-character-string
# library: 'libwcs').
new_LIBS="$LIBS"
LIBS="$orig_LIBS"
gl_INIT
LIBS="$new_LIBS"
# Check if Gnulib tests should be done:
AC_ARG_ENABLE([gnulibcheck],
[AS_HELP_STRING([--enable-gnulibcheck],
[In 'make check', also test GNU Gnulib.])],
[enable_gnulibcheck=yes], [enable_gnulibcheck=no])
AM_CONDITIONAL([COND_GNULIBCHECK], [test $enable_gnulibcheck = yes])
# Gnulib checks for the proper name for the C99 equivalent 'restrict'
# keyword and puts it in the 'ac_cv_c_restrict' variable. If none exists,
# it will put a 'no' inside of this variable. As described in the output
# 'bootstrapped/m4/gnulib-common.m4', this is only necessary until Autoconf
# 2.70 is released. Afterwards, we can use AC_C_RESTRICT.
AS_IF([test "x$ac_cv_c_restrict" = "xno"],
[gal_restrict_replace=], [gal_restrict_replace=$ac_cv_c_restrict])
AC_SUBST(RESTRICT_REPLACEMENT, [$gal_restrict_replace])
# Set the one general parameters:
AC_DEFINE_UNQUOTED([CONF_POSTFIX], [".conf"], [Configuration file post fix.])
AC_DEFINE_UNQUOTED([USERCONFIG_DIR], [".local/etc/gnuastro"], [User data dir.])
AC_DEFINE_UNQUOTED([CONF_SHOWFMT], [" %-20s"],
[Configuration file name format.])
# Read arguments about which programs to install. After checking if
# the argument was actually called, remove any value the user might
# have given by setting them to "yes" if they are not "no". These
# options don't accept arguments.
ayes=false
AC_ARG_ENABLE([arithmetic],
[AS_HELP_STRING([--enable-arithmetic],
[Install Arithmetic and other enabled programs.])],
[AS_IF([test "x$enable_arithmetic" != xno],
[enable_arithmetic=yes; ayes=true])],
[enable_arithmetic=notset])
AC_ARG_ENABLE([buildprog],
[AS_HELP_STRING([--enable-buildprog],
[Install BuildProgram and other enabled programs.])],
[AS_IF([test "x$enable_buildprog" != xno],
[enable_buildprog=yes; ayes=true])],
[enable_buildprog=notset])
AC_ARG_ENABLE([convertt],
[AS_HELP_STRING([--enable-convertt],
[Install ConvertType and other enabled programs.])],
[AS_IF([test "x$enable_convertt" != xno],
[enable_convertt=yes; ayes=true])],
[enable_convertt=notset])
AC_ARG_ENABLE([convolve],
[AS_HELP_STRING([--enable-convolve],
[Install Convolve and other enabled programs.])],
[AS_IF([test "x$enable_convolve" != xno],
[enable_cognvolve=yes; ayes=true])],
[enable_convolve=notset])
AC_ARG_ENABLE([cosmiccal],
[AS_HELP_STRING([--enable-cosmiccal],
[Install CosmicCalculator and other enabled programs.])],
[AS_IF([test "x$enable_cosmiccal" != xno],
[enable_cosmiccal=yes; ayes=true])],
[enable_cosmiccal=notset])
AC_ARG_ENABLE([crop],
[AS_HELP_STRING([--enable-crop],
[Install Crop and other enabled programs.])],
[AS_IF([test "x$enable_crop" != xno],
[enable_crop=yes; ayes=true])],
[enable_crop=notset])
AC_ARG_ENABLE([fits],
[AS_HELP_STRING([--enable-fits],
[Install Fits and other enabled programs.])],
[AS_IF([test "x$enable_fits" != xno],
[enable_fits=yes; ayes=true])],
[enable_fits=notset])
AC_ARG_ENABLE([match],
[AS_HELP_STRING([--enable-match],
[Install Match and other enabled programs.])],
[AS_IF([test "x$enable_match" != xno],
[enable_match=yes; ayes=true])],
[enable_match=notset])
AC_ARG_ENABLE([mkcatalog],
[AS_HELP_STRING([--enable-mkcatalog],
[Install MakeCatalog and other enabled programs.])],
[AS_IF([test "x$enable_mkcatalog" != xno],
[enable_mkcatalog=yes; ayes=true])],
[enable_mkcatalog=notset])
AC_ARG_ENABLE([mkprof],
[AS_HELP_STRING([--enable-mkprof],
[Install MakeProfile and other enabled programs.])],
[AS_IF([test "x$enable_mkprof" != xno],
[enable_mkprof=yes; ayes=true])],
[enable_mkprof=notset])
AC_ARG_ENABLE([noisechisel],
[AS_HELP_STRING([--enable-noisechisel],
[Install NoiseChisel and other enabled programs.])],
[AS_IF([test "x$enable_noisechisel" != xno],
[enable_noisechisel=yes; ayes=true])],
[enable_noisechisel=notset])
AC_ARG_ENABLE([query],
[AS_HELP_STRING([--enable-query],
[Install query and other enabled packages.])],
[AS_IF([test "x$enable_query" != xno],
[enable_query=yes; ayes=true])],
[enable_query=notset])
AC_ARG_ENABLE([segment],
[AS_HELP_STRING([--enable-segment],
[Install Segment and other enabled programs.])],
[AS_IF([test "x$enable_segment" != xno],
[enable_segment=yes; ayes=true])],
[enable_segment=notset])
AC_ARG_ENABLE([statistics],
[AS_HELP_STRING([--enable-statistics],
[Install Statistics and other enabled programs.])],
[AS_IF([test "x$enable_statistics" != xno],
[enable_statistics=yes; ayes=true])],
[enable_statistics=notset])
AC_ARG_ENABLE([table],
[AS_HELP_STRING([--enable-table],
[Install Table and other enabled programs.])],
[AS_IF([test "x$enable_table" != xno],
[enable_table=yes; ayes=true])],
[enable_table=notset])
#AC_ARG_ENABLE([TEMPLATE],
# [AS_HELP_STRING([--enable-TEMPLATE],
# [Install TEMPLATE and other enabled packages.])],
# [AS_IF([test "x$enable_TEMPLATE" != xno],
# [enable_TEMPLATE=yes; ayes=true])],
# [enable_TEMPLATE=notset])
AC_ARG_ENABLE([warp],
[AS_HELP_STRING([--enable-warp],
[Install Warp and other enabled programs.])],
[AS_IF([test "x$enable_warp" != xno],
[enable_warp=yes; ayes=true])],
[enable_warp=notset])
# If we had a "ayes" variable to be "true" if there was a 'yes'. So any
# program that is not explicitly requested must be ignored and vice versa
# (if no programs were explicitly requested, then enable all that weren't
# disabled).
AS_IF([test $ayes = true ],
[
AS_IF([test $enable_arithmetic = notset], [enable_arithmetic=no])
AS_IF([test $enable_buildprog = notset], [enable_buildprog=no])
AS_IF([test $enable_convertt = notset], [enable_convertt=no])
AS_IF([test $enable_convolve = notset], [enable_convolve=no])
AS_IF([test $enable_cosmiccal = notset], [enable_cosmiccal=no])
AS_IF([test $enable_crop = notset], [enable_crop=no])
AS_IF([test $enable_fits = notset], [enable_fits=no])
AS_IF([test $enable_match = notset], [enable_match=no])
AS_IF([test $enable_mkcatalog = notset], [enable_mkcatalog=no])
AS_IF([test $enable_mkprof = notset], [enable_mkprof=no])
AS_IF([test $enable_noisechisel = notset], [enable_noisechisel=no])
AS_IF([test $enable_query = notset], [enable_query=no])
AS_IF([test $enable_segment = notset], [enable_segment=no])
AS_IF([test $enable_statistics = notset], [enable_statistics=no])
AS_IF([test $enable_table = notset], [enable_table=no])
# AS_IF([test $enable_TEMPLATE = notset], [enable_TEMPLATE=no])
AS_IF([test $enable_warp = notset], [enable_warp=no])
],
[
AS_IF([test $enable_arithmetic = notset], [enable_arithmetic=yes])
AS_IF([test $enable_buildprog = notset], [enable_buildprog=yes])
AS_IF([test $enable_convertt = notset], [enable_convertt=yes])
AS_IF([test $enable_convolve = notset], [enable_convolve=yes])
AS_IF([test $enable_cosmiccal = notset], [enable_cosmiccal=yes])
AS_IF([test $enable_crop = notset], [enable_crop=yes])
AS_IF([test $enable_fits = notset], [enable_fits=yes])
AS_IF([test $enable_match = notset], [enable_match=yes])
AS_IF([test $enable_mkcatalog = notset], [enable_mkcatalog=yes])
AS_IF([test $enable_mkprof = notset], [enable_mkprof=yes])
AS_IF([test $enable_noisechisel = notset], [enable_noisechisel=yes])
AS_IF([test $enable_query = notset], [enable_query=yes])
AS_IF([test $enable_segment = notset], [enable_segment=yes])
AS_IF([test $enable_statistics = notset], [enable_statistics=yes])
AS_IF([test $enable_table = notset], [enable_table=yes])
# AS_IF([test $enable_TEMPLATE = notset], [enable_TEMPLATE=yes])
AS_IF([test $enable_warp = notset], [enable_warp=yes])
]
)
# BuildProgram depends on the presence of GNU Libtool, if it isn't present,
# then don't build it.
AS_IF([test "x$usable_libtool" = "xno"], [enable_buildprog=no])
# Make the enable_package values available for the Makefile:
AM_CONDITIONAL([COND_ARITHMETIC], [test $enable_arithmetic = yes])
AM_CONDITIONAL([COND_BUILDPROG], [test $enable_buildprog = yes])
AM_CONDITIONAL([COND_CONVERTT], [test $enable_convertt = yes])
AM_CONDITIONAL([COND_CONVOLVE], [test $enable_convolve = yes])
AM_CONDITIONAL([COND_COSMICCAL], [test $enable_cosmiccal = yes])
AM_CONDITIONAL([COND_CROP], [test $enable_crop = yes])
AM_CONDITIONAL([COND_FITS], [test $enable_fits = yes])
AM_CONDITIONAL([COND_MATCH], [test $enable_match = yes])
AM_CONDITIONAL([COND_MKCATALOG], [test $enable_mkcatalog = yes])
AM_CONDITIONAL([COND_MKPROF], [test $enable_mkprof = yes])
AM_CONDITIONAL([COND_NOISECHISEL], [test $enable_noisechisel = yes])
AM_CONDITIONAL([COND_QUERY], [test $enable_query = yes])
AM_CONDITIONAL([COND_SEGMENT], [test $enable_segment = yes])
AM_CONDITIONAL([COND_STATISTICS], [test $enable_statistics = yes])
AM_CONDITIONAL([COND_TABLE], [test $enable_table = yes])
#AM_CONDITIONAL([COND_TEMPLATE], [test $enable_TEMPLATE = yes])
AM_CONDITIONAL([COND_WARP], [test $enable_warp = yes])
# Reset LIBS to the initial value BEFORE generating the Makefiles (so the
# modified value doesn't get written into them). Then report the final
# linking flags and put them in the Makefiles.
LIBS="$orig_LIBS"
AC_SUBST(CONFIG_LDADD, [$LDADD])
AC_SUBST(ENABLE_SHARED, [$enable_shared])
AS_ECHO(["linking flags (LDADD) ... $LDADD"])
AC_DEFINE_UNQUOTED([CONFIG_GNUASTRO_LDADD], ["$LDADD"],
[Linking options for Gnuastro's library])
# Tell autoconf what to work on:
# 1. Order does NOT matter here.
# 2. TEMPLATE cannot be put and then commented here like the cases above,
# so don't forget to add your new utility name here.
AC_CONFIG_FILES([Makefile
doc/Makefile
lib/Makefile
tests/Makefile
bin/crop/Makefile
bin/fits/Makefile
bin/warp/Makefile
bin/table/Makefile
bin/match/Makefile
bin/query/Makefile
bin/mkprof/Makefile
bin/script/Makefile
bin/segment/Makefile
bin/convertt/Makefile
bin/convolve/Makefile
bin/buildprog/Makefile
bin/cosmiccal/Makefile
bin/mkcatalog/Makefile
bin/arithmetic/Makefile
bin/statistics/Makefile
bin/noisechisel/Makefile
bootstrapped/lib/Makefile
bootstrapped/tests/Makefile
])
# Printing guiding messages. Autoconf will make the variable
# enable_guide_message from the first argument to AC_ARG_ENABLE. It will
# also give it a value. From the Autoconf manual, we see that
# '--disable-guide-message' is equivalent to a value of 'no', while with no
# argument, the value will default to 'yes'. In the last argument to
# AC_ARG_ENABLE, we also specify the default behavior (when it isn't given
# at all), here we want the default to be 'yes'.
AC_ARG_ENABLE([guide-message],
[AS_HELP_STRING([--disable-guide-message],
[No messages after each build step.])],
[], [enable_guide_message=yes])
AC_SUBST(GUIDEMESSAGE, [$enable_guide_message])
# Build the man page directory. Note that this is the cleanest and most
# portable way of building this directory. We don't want to do it in any of
# the Makefiles.
AC_CONFIG_COMMANDS([man page directory], [$MKDIR_P doc/man])
# For the version stamp file ('.version').
gl_CONFIG_VERSION_STAMP
# Build the Makefiles.
AC_OUTPUT
# Print a message if necessary
AS_IF([test x$enable_guide_message = xyes],
[
AS_ECHO([])
AS_ECHO([=======================================================================])
AS_ECHO([=======================================================================])
AS_ECHO(["$PACKAGE_NAME (Gnuastro) $PACKAGE_VERSION is successfully"])
AS_ECHO(["configured for this machine."])
AS_ECHO([])
AS_IF([test "x$anywarnings" = xyes],
[
AS_ECHO(["Configuration warning(s):"])
AS_ECHO([])
AS_IF([test "x$gsl_version_old" = "xyes"],
[dependency_notice=yes
AS_ECHO([" - GNU Scientific Library (GSL: https://www.gnu.org/s/gsl) version"])
AS_ECHO([" on this system doesn't have some features that can be useful in"])
AS_ECHO([" some parts of Gnuastro. This build won't crash, but Gnuastro will"])
AS_ECHO([" have less functionality afterwards. We thus recommend building"])
AS_ECHO([" and installing a more recent version of GSL (version >= 2.0,"])
AS_ECHO([" released in October 2015)."])
AS_ECHO([]) ])
AS_IF([test "x$has_fits_is_reentrant" = "x0"],
[dependency_notice=yes
AS_ECHO([" - CFITSIO (https://heasarc.gsfc.nasa.gov/fitsio/) version on"])
AS_ECHO([" this computer doesn't have the 'fits_is_reentrant' function"])
AS_ECHO([" which is used to see if FITS files can be read in parallel"])
AS_ECHO([" or not (it was introduced in version 3.30 released in April"])
AS_ECHO([" 2012). This won't affect the outputs of the programs, but"])
AS_ECHO([" can slow them down."])
AS_ECHO([]) ])
AS_IF([test "x$has_wcslib_version" = "x0"],
[dependency_notice=yes
AS_ECHO([" - WCSLIB (https://www.atnf.csiro.au/people/mcalabre/WCS) version"])
AS_ECHO([" on this system doesn't report its own version (through the "])
AS_ECHO([" function 'wcslib_version'). Therefore Gnuastro can't report "])
AS_ECHO([" the version of WCSLIB in its outputs (which is just metadata, "])
AS_ECHO([" it won't affect the operation of any of Gnuastro's programs). "])
AS_ECHO([" This function was introduced in WCSLIB version 5.0 (released "])
AS_ECHO([" in April 2015)."])
AS_ECHO([]) ])
AS_IF([test "x$has_wcslib_dis_h" = "x0"],
[dependency_notice=yes
AS_ECHO([" - WCSLIB (https://www.atnf.csiro.au/people/mcalabre/WCS) version"])
AS_ECHO([" on this system doesn't support distortions (i.e., it doesn't"])
AS_ECHO([" have 'dis.h'. This build won't crash but Gnuastro will not be able"])
AS_ECHO([" to do distortion-related operations. If you don't need such"])
AS_ECHO([" operations you can ignore this warning."])
AS_ECHO([]) ])
AS_IF([test "x$has_wcslib_wcsccs" = "x0"],
[dependency_notice=yes
AS_ECHO([" - WCSLIB (https://www.atnf.csiro.au/people/mcalabre/WCS) version"])
AS_ECHO([" on this system doesn't support conversion of coordinate systems"])
AS_ECHO([" (through the 'wcsccs' function that was introduced in WCSLIB 7.5, "])
AS_ECHO([" March 2021). For example converting from equatorial J2000 to"])
AS_ECHO([" Galactic coordinates). This build won't crash but the related"])
AS_ECHO([" functionalities in Gnuastro will be disabled. If you don't need"])
AS_ECHO([" such operations you can ignore this warning."])
AS_ECHO([]) ])
AS_IF([test "x$has_libjpeg" = "xno"],
[dependency_notice=yes
AS_ECHO([" - libjpeg (http://ijg.org), could not be linked with in your library"])
AS_ECHO([" search path, or is manually disabled. If JPEG inputs/outputs are"])
AS_ECHO([" requested, the respective tool will inform you and abort with an"])
AS_ECHO([" error."])
AS_ECHO([]) ])
AS_IF([test "x$has_libtiff" = "xno"],
[dependency_notice=yes
AS_ECHO([" - libtiff (http://libtiff.maptools.org), could not be linked with in"])
AS_ECHO([" your library search path, or is manually disabled. If TIFF"])
AS_ECHO([" inputs/outputs are requested, the respective tool will inform"])
AS_ECHO([" you and abort with an error."])
AS_ECHO([]) ])
AS_IF([test "x$has_libgit2" = "x0"],
[dependency_notice=yes
AS_ECHO([" - libgit2 (https://libgit2.org), could not be linked with in your"])
AS_ECHO([" library search path, or is manually disabled. When present, Git's"])
AS_ECHO([" describe output will be stored in the output files if Gnuastro's"])
AS_ECHO([" programs were called within a Gitversion controlled directory to"])
AS_ECHO([" help in reproducibility."])
AS_ECHO([]) ])
AS_IF([test "x$usable_libtool" = "xno"],
[dependency_notice=yes
AS_ECHO([" - GNU Libtool (https://www.gnu.org/s/libtool) can't be used on this"])
AS_ECHO([" system (see below). Gnuastro's BuildProgram uses GNU libtool to"])
AS_ECHO([" link your source code with the various libraries (Gnuastro's"])
AS_ECHO([" dependencies). Therefore BuildProgram will not be built or installed."])
AS_ECHO([" Please note that not having GNU libtool in your search path will not"])
AS_ECHO([" harm the rest of Gnuastro's building and installation. Gnuastro has"])
AS_ECHO([" its own internal implementation of GNU Libtool to build its self. This"])
AS_ECHO([" warning is only to let you know that BuildProgram will not be"])
AS_ECHO([" part of this build. The executable names searched were 'libtool'"])
AS_ECHO([" and 'glibtool'. The shells searched were 'sh', 'bash' and 'zsh'."])
AS_ECHO([])
AS_IF([test "x$has_gnulibtool" = "xyes"],
[AS_ECHO([" -- GNU Libtool is present, but couldn't be run in tested shells."])
AS_IF([test "x$bash_version" = x], [junk=1],
[AS_ECHO([" (GNU Bash was found but not a suitable version: $bash_version)"]) ])
AS_ECHO([])],
[AS_IF([test "x$has_libtool" = "xyes"],
[AS_ECHO([" -- A libtool implementation was found, but it isn't GNU."])
AS_ECHO([]) ]) ])
])
AS_IF([test "x$has_ghostscript" = "xno"],
[dependency_notice=yes
AS_ECHO([" - GPL GhostScript (https://www.ghostscript.com) version 9.10 or later,"])
AS_ECHO([" with the executable name 'gs', was not found in your PATH environment"])
AS_ECHO([" variable. If PDF outputs are desired, the respective tool it will abort"])
AS_ECHO([" with an EPS output which you can convert to PDF by other means."])
AS_ECHO([]) ])
AS_IF([test "x$has_curl" = "xno"],
[dependency_notice=yes
AS_ECHO([" - cURL (https://curl.haxx.se) with the executable name 'curl' was not"])
AS_ECHO([" found in your PATH environment variable. 'astquery' uses it to access"])
AS_ECHO([" remote databases at run-time. So not having 'curl' won't affect this"])
AS_ECHO([" build of Gnuastro, you can continue for now. But to use 'astquery',"])
AS_ECHO([" don't forget to install cURL later (before using 'astquery' for the"])
AS_ECHO([" first time)."])
AS_ECHO([]) ])
AS_IF([test "x$has_gnumake_h" = "x0"],
[dependency_notice=yes
AS_ECHO([" - GNU Make (https://www.gnu.org/software/make) extension headers "])
AS_ECHO([" 'gnumake.h' couldn't be found by the C compiler. If available, "])
AS_ECHO([" Gnuastro can use those headers to add custom GNU Make functions "])
AS_ECHO([" to improve your Makefiles for data analysis workflows."])
AS_ECHO([]) ])
dnl AS_IF([test "x$has_numpy" = "x0"],
dnl [dependency_notice=yes
dnl AS_ECHO([" - Numpy (https://numpy.org) headers couldn't be found within a "])
dnl AS_ECHO([" Python3 installation. If available, Gnuastro's library will be "])
dnl AS_ECHO([" installed with some functions that can help Python wrappers "])
dnl AS_ECHO([" communicate with Gnuastro's library (for example pyGnuastro)."])
dnl AS_ECHO([" If you are within a virtual environment, and Python3 is"])
dnl AS_ECHO([" available there, please set the 'PYTHON' environment variable"])
dnl AS_ECHO([" to the Python3 executable's absolute location."])
dnl AS_ECHO([]) ])
AS_IF([test "x$has_ds9" = "xno"],
[dependency_notice=yes
AS_ECHO([" - (GUI only) SAO ds9 (https://sites.google.com/cfa.harvard.edu/saoimageds9)"])
AS_ECHO([" couldn't be found. DS9 is called by 'astscript-fits-view' to visually"])
AS_ECHO([" inspect FITS images. This doesn't affect the building of Gnuastro. So you"])
AS_ECHO([" can safely install it later (after building and installing Gnuasro)."])
AS_ECHO([]) ])
AS_IF([test "x$has_topcat" = "xno"],
[dependency_notice=yes
AS_ECHO([" - (GUI only) TOPCAT (http://www.star.bris.ac.uk/~mbt/topcat) couldn't be"])
AS_ECHO([" found. TOPCAT is called by 'astscript-fits-view' to visually inspect"])
AS_ECHO([" astronomical tables. This doesn't affect the building of Gnuastro. So "])
AS_ECHO([" you can safely install it later (after building and installing Gnuasro)."])
AS_ECHO([]) ])
AS_IF([test "x$enable_shared_disabled" = "xyes"],
[dependency_notice=yes
AS_ECHO([" - Eventhough you have asked to enable the shared libraries, maybe using"])
AS_ECHO([" the '--enable-debug' option, the compiler does not support it. So, we"])
AS_ECHO([" are intentionally disabling this option."])
AS_ECHO([]) ])
# Notice for obtaining the optional dependencies using a package
# manager.
AS_IF([test "x$dependency_notice" = "xyes"],
[AS_ECHO([" You can use your package manager for easy and fast installation of all"])
AS_ECHO([" the mandatory and optional dependencies in one command. See the link"])
AS_ECHO([" below:"])
AS_ECHO([" https://www.gnu.org/s/gnuastro/manual/html_node/Dependencies-from-package-managers.html"])
AS_ECHO([])
AS_ECHO([" All checks related to the warning(s) above will be skipped."])
AS_ECHO([])
])
# Notice about PATH: The last two scenarios described below are
# taken from
# https://unix.stackexchange.com/questions/65700/is-it-safe-to-add-to-my-path-how-come
AS_IF([test "x$path_warning" = "xyes"],
[AS_ECHO([" - Your PATH contains the current directory. This does not affect"])
AS_ECHO([" this build and installation of Gnuastro in any way, it is just to"])
AS_ECHO([" to remind you that this is a security risk."])
AS_ECHO([" It is a very serious security risk if it is closer to the start"])
AS_ECHO([" of your PATH: a malicious/wrong program might be run instead of"])
AS_ECHO([" a desired program, someone might find out you frequently mistype"])
AS_ECHO([" a command and install a matching one, someone might install a"])
AS_ECHO([" fake command with the name of one that is not installed. You can"])
AS_ECHO([" always run a program in the current directory by explicity adding"])
AS_ECHO([" a './' before it's name. Run the following command after"])
AS_ECHO([" installing Gnuastro to learn more about PATH:"])
AS_ECHO([" $ info gnuastro \"Installation directory\""])
AS_ECHO([]) ])
]
)
AS_ECHO(["To build Gnuastro $PACKAGE_VERSION, please run:"])
AS_ECHO([])
AS_ECHO([" make -j$jobs"])
AS_ECHO([])
AS_ECHO(["(You can change the $jobs to any number of CPU threads.)"])
AS_ECHO(["(Configure with '--disable-guide-message' for no messages.)"])
AS_ECHO(["(Please be patient, some libraries can take a few minutes to compile.)"])
AS_ECHO([=======================================================================])
AS_ECHO([=======================================================================])
AS_ECHO([])
])
|