--- configure.orig 2014-04-17 04:04:49.000000000 +0800 +++ configure 2014-08-22 15:05:34.087308378 +0800 @@ -746,6 +746,7 @@ FGDB_INC FGDB_LIB FGDB_ENABLED +OPENJPEG_VERSION HAVE_OPENJPEG JASPER_FLAGS HAVE_JASPER @@ -22200,14 +22201,78 @@ if test "$HAVE_OPENJPEG" = "yes"; then LIBS="-lopenjp2 $LIBS" fi + else + for ac_header in openjpeg-2.1/openjpeg.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "openjpeg-2.1/openjpeg.h" "ac_cv_header_openjpeg_2_1_openjpeg_h" "$ac_includes_default" +if test "x$ac_cv_header_openjpeg_2_1_openjpeg_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_OPENJPEG_2_1_OPENJPEG_H 1 +_ACEOF + +fi + +done + + if test "$ac_cv_header_openjpeg_2_1_openjpeg_h" = "yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for opj_stream_set_user_data_length in -lopenjp2" >&5 +$as_echo_n "checking for opj_stream_set_user_data_length in -lopenjp2... " >&6; } +if ${ac_cv_lib_openjp2_opj_stream_set_user_data_length+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lopenjp2 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char opj_stream_set_user_data_length (); +int +main () +{ +return opj_stream_set_user_data_length (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_openjp2_opj_stream_set_user_data_length=yes +else + ac_cv_lib_openjp2_opj_stream_set_user_data_length=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_openjp2_opj_stream_set_user_data_length" >&5 +$as_echo "$ac_cv_lib_openjp2_opj_stream_set_user_data_length" >&6; } +if test "x$ac_cv_lib_openjp2_opj_stream_set_user_data_length" = xyes; then : + HAVE_OPENJPEG=yes +else + HAVE_OPENJPEG=no +fi + + if test "$HAVE_OPENJPEG" = "yes"; then + OPENJPEG_VERSION=20100 + LIBS="-lopenjp2 $LIBS" + fi + fi fi else HAVE_OPENJPEG=yes if test -r $with_openjpeg/include/openjpeg-2.0/openjpeg.h ; then EXTRA_INCLUDES="-I$with_openjpeg/include $EXTRA_INCLUDES" + elif test -r $with_openjpeg/include/openjpeg-2.1/openjpeg.h ; then + OPENJPEG_VERSION=20100 + EXTRA_INCLUDES="-I$with_openjpeg/include $EXTRA_INCLUDES" else - as_fn_error $? "openjpeg.h not found in $with_openjpeg/include/openjpeg-2.0" "$LINENO" 5 + as_fn_error $? "openjpeg.h not found in $with_openjpeg/include/openjpeg-2.0 or $with_openjpeg/include/openjpeg-2.1" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for opj_stream_set_user_data_length in -lopenjp2" >&5 @@ -22266,6 +22331,7 @@ HAVE_OPENJPEG=$HAVE_OPENJPEG +OPENJPEG_VERSION=$OPENJPEG_VERSION