From de010513c22947a905b27a164fa9975d6a8b5d63 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 2 Dec 2010 22:42:54 +0100 Subject: Improve autoconf conditionals (i.e. make them work..) --- configure | 387 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 353 insertions(+), 34 deletions(-) (limited to 'configure') diff --git a/configure b/configure index 00ee9b6f..cb26682f 100755 --- a/configure +++ b/configure @@ -596,6 +596,14 @@ ac_includes_default="\ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS +HAVE_CAIRO_FALSE +HAVE_CAIRO_TRUE +Cairo_LIBS +Cairo_CFLAGS +HAVE_LIBPNG_FALSE +HAVE_LIBPNG_TRUE +libPNG_LIBS +libPNG_CFLAGS HAVE_GTK_FALSE HAVE_GTK_TRUE GTK_LIBS @@ -710,7 +718,12 @@ CFLAGS LDFLAGS LIBS CPPFLAGS -CPP' +CPP +PKG_CONFIG +libPNG_CFLAGS +libPNG_LIBS +Cairo_CFLAGS +Cairo_LIBS' # Initialize some variables set by options. @@ -1353,6 +1366,13 @@ Some influential environment variables: CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor + PKG_CONFIG path to pkg-config utility + libPNG_CFLAGS + C compiler flags for libPNG, overriding pkg-config + libPNG_LIBS linker flags for libPNG, overriding pkg-config + Cairo_CFLAGS + C compiler flags for Cairo, overriding pkg-config + Cairo_LIBS linker flags for Cairo, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -4285,12 +4305,14 @@ cat >>confdefs.h <<_ACEOF _ACEOF -for ac_func in strdup +for ac_func in strdup strndup do : - ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup" -if test "x$ac_cv_func_strdup" = x""yes; then : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +eval as_val=\$$as_ac_var + if test "x$as_val" = x""yes; then : cat >>confdefs.h <<_ACEOF -#define HAVE_STRDUP 1 +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi @@ -4587,7 +4609,9 @@ fi $as_echo "yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version)" >&6; } havegtk=true - GTK_LIBS="$GTK_LIBS" + +$as_echo "#define HAVE_GTK 1" >>confdefs.h + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 @@ -4656,7 +4680,7 @@ else $as_echo "no" >&6; } fi - if test x$havegtk = xtrue; then + if test "x$havegtk" = "xtrue"; then HAVE_GTK_TRUE= HAVE_GTK_FALSE='#' else @@ -4735,25 +4759,212 @@ if test "${enable_png+set}" = set; then : enableval=$enable_png; fi + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi + +fi if test "x$enable_png" != "xno"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking libpng" >&5 -$as_echo_n "checking libpng... " >&6; } - if $PKG_CONFIG --atleast-version 1.2.0 libpng ; then - LIBPNG_VERSION=`$PKG_CONFIG --modversion libpng` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBPNG_VERSION" >&5 -$as_echo "$LIBPNG_VERSION" >&6; } - LIBPNG_CFLAGS=`$PKG_CONFIG --cflags libpng` - LIBPNG_LIBS=`$PKG_CONFIG --libs libpng` -$as_echo "#define HAVE_LIBPNG 1" >>confdefs.h +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libPNG" >&5 +$as_echo_n "checking for libPNG... " >&6; } + +if test -n "$libPNG_CFLAGS"; then + pkg_cv_libPNG_CFLAGS="$libPNG_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpng >= 1.2.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libpng >= 1.2.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_libPNG_CFLAGS=`$PKG_CONFIG --cflags "libpng >= 1.2.0" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$libPNG_LIBS"; then + pkg_cv_libPNG_LIBS="$libPNG_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpng >= 1.2.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libpng >= 1.2.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_libPNG_LIBS=`$PKG_CONFIG --libs "libpng >= 1.2.0" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Lower than 1.2.0 or not found" >&5 -$as_echo "Lower than 1.2.0 or not found" >&6; } - fi + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + libPNG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libpng >= 1.2.0" 2>&1` + else + libPNG_PKG_ERRORS=`$PKG_CONFIG --print-errors "libpng >= 1.2.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$libPNG_PKG_ERRORS" >&5 + + as_fn_error "Package requirements (libpng >= 1.2.0) were not met: + +$libPNG_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables libPNG_CFLAGS +and libPNG_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. +" "$LINENO" 5 +elif test $pkg_failed = untried; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables libPNG_CFLAGS +and libPNG_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details." "$LINENO" 5; } +else + libPNG_CFLAGS=$pkg_cv_libPNG_CFLAGS + libPNG_LIBS=$pkg_cv_libPNG_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + havelibpng=true +fi else @@ -4761,6 +4972,14 @@ else $as_echo "no" >&6; } fi + if test x$havelibpng = xtrue; then + HAVE_LIBPNG_TRUE= + HAVE_LIBPNG_FALSE='#' +else + HAVE_LIBPNG_TRUE='#' + HAVE_LIBPNG_FALSE= +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use TIFF" >&5 @@ -4803,21 +5022,97 @@ if test "x$enable_cairo" != "xno"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking Cairo" >&5 -$as_echo_n "checking Cairo... " >&6; } - if $PKG_CONFIG --atleast-version 1.2.0 cairo ; then - CAIRO_VERSION=`$PKG_CONFIG --modversion cairo` - CAIRO_CFLAGS=`$PKG_CONFIG --cflags cairo` - CAIRO_LIBS=`$PKG_CONFIG --libs cairo` + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Cairo" >&5 +$as_echo_n "checking for Cairo... " >&6; } + +if test -n "$Cairo_CFLAGS"; then + pkg_cv_Cairo_CFLAGS="$Cairo_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"cairo >= 1.2.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "cairo >= 1.2.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_Cairo_CFLAGS=`$PKG_CONFIG --cflags "cairo >= 1.2.0" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$Cairo_LIBS"; then + pkg_cv_Cairo_LIBS="$Cairo_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"cairo >= 1.2.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "cairo >= 1.2.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_Cairo_LIBS=`$PKG_CONFIG --libs "cairo >= 1.2.0" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + Cairo_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "cairo >= 1.2.0" 2>&1` + else + Cairo_PKG_ERRORS=`$PKG_CONFIG --print-errors "cairo >= 1.2.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$Cairo_PKG_ERRORS" >&5 + + as_fn_error "Package requirements (cairo >= 1.2.0) were not met: + +$Cairo_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables Cairo_CFLAGS +and Cairo_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. +" "$LINENO" 5 +elif test $pkg_failed = untried; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables Cairo_CFLAGS +and Cairo_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details." "$LINENO" 5; } +else + Cairo_CFLAGS=$pkg_cv_Cairo_CFLAGS + Cairo_LIBS=$pkg_cv_Cairo_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + havecairo=true $as_echo "#define HAVE_CAIRO 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CAIRO_VERSION" >&5 -$as_echo "$CAIRO_VERSION" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found. Some functions will be unavailable." >&5 -$as_echo "not found. Some functions will be unavailable." >&6; } - fi + +fi else @@ -4825,12 +5120,20 @@ else $as_echo "no" >&6; } fi + if test x$havecairo = xtrue; then + HAVE_CAIRO_TRUE= + HAVE_CAIRO_FALSE='#' +else + HAVE_CAIRO_TRUE='#' + HAVE_CAIRO_FALSE= +fi + CFLAGS="$CFLAGS $HDF5_CFLAGS $GTK_CFLAGS $GSL_CFLAGS $OPENCL_CFLAGS -pthread" -CFLAGS="$CFLAGS $LIBTIFF_CFLAGS -D_GNU_SOURCE $LIBPNG_CFLAGS" +CFLAGS="$CFLAGS $LIBTIFF_CFLAGS -D_GNU_SOURCE $libPNG_CFLAGS $Cairo_CFLAGS" LIBS="$LIBS $HDF5_LIBS -lm -lz $GSL_LIBS $GTK_LIBS $OPENCL_LIBS -pthread" -LIBS="$LIBS $LIBTIFF_LIBS $LIBPNG_LIBS" +LIBS="$LIBS $LIBTIFF_LIBS $libPNG_LIBS $Cairo_LIBS" ac_config_files="$ac_config_files Makefile src/Makefile data/Makefile doc/Makefile scripts/Makefile" @@ -4955,6 +5258,14 @@ if test -z "${HAVE_GTK_TRUE}" && test -z "${HAVE_GTK_FALSE}"; then as_fn_error "conditional \"HAVE_GTK\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${HAVE_LIBPNG_TRUE}" && test -z "${HAVE_LIBPNG_FALSE}"; then + as_fn_error "conditional \"HAVE_LIBPNG\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_CAIRO_TRUE}" && test -z "${HAVE_CAIRO_FALSE}"; then + as_fn_error "conditional \"HAVE_CAIRO\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : ${CONFIG_STATUS=./config.status} ac_write_fail=0 @@ -6399,6 +6710,14 @@ if test -z "${HAVE_GTK_TRUE}" && test -z "${HAVE_GTK_FALSE}"; then as_fn_error "conditional \"HAVE_GTK\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${HAVE_LIBPNG_TRUE}" && test -z "${HAVE_LIBPNG_FALSE}"; then + as_fn_error "conditional \"HAVE_LIBPNG\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_CAIRO_TRUE}" && test -z "${HAVE_CAIRO_FALSE}"; then + as_fn_error "conditional \"HAVE_CAIRO\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${am__EXEEXT_TRUE}" && test -z "${am__EXEEXT_FALSE}"; then as_fn_error "conditional \"am__EXEEXT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 -- cgit v1.2.3