319 kx dnl Copyright (C) 2007-2023 Hubert Figuière
319 kx dnl Small portions are:
319 kx dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
319 kx dnl This file is free software, distributed under the terms of the GNU
319 kx dnl General Public License. As a special exception to the GNU General
319 kx dnl Public License, this file may be distributed as part of a program
319 kx dnl that contains a configuration script generated by Autoconf, under
319 kx dnl the same distribution terms as the rest of that program.
319 kx
319 kx AC_PREREQ([2.69])
319 kx AC_INIT([exempi],[2.6.5])
319 kx AM_INIT_AUTOMAKE([foreign dist-bzip2 dist-xz subdir-objects])
319 kx AM_MAINTAINER_MODE
319 kx m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
319 kx AM_SILENT_RULES([yes])
319 kx
319 kx dnl ---------------------------------------------------------------------------
319 kx dnl Advanced information about versioning:
319 kx dnl * "Writing shared libraries" by Mike Hearn
319 kx dnl http://plan99.net/~mike/writing-shared-libraries.html
319 kx dnl * libtool.info chapter "Versioning"
319 kx dnl * libtool.info chapter "Updating library version information"
319 kx dnl ---------------------------------------------------------------------------
319 kx dnl Versioning:
319 kx dnl - CURRENT (Major): Increment if the interface has changes. AGE is always
319 kx dnl *changed* at the same time.
319 kx dnl - AGE (Micro): Increment if any interfaces have been added; set to 0
319 kx dnl if any interfaces have been removed. Removal has
319 kx dnl precedence over adding, so set to 0 if both happened.
319 kx dnl It denotes upward compatibility.
319 kx dnl - REVISION (Minor): Increment any time the source changes; set to
319 kx dnl 0 if you incremented CURRENT.
319 kx dnl
319 kx dnl To summarize. Any interface *change* increment CURRENT. If that interface
319 kx dnl change does not break upward compatibility (ie it is an addition),
319 kx dnl increment AGE, Otherwise AGE is reset to 0. If CURRENT has changed,
319 kx dnl REVISION is set to 0, otherwise REVISION is incremented.
319 kx dnl ---------------------------------------------------------------------------
319 kx dnl 1.99.0 is the revision 2 0 0
319 kx dnl 1.99.1 is the revision 3 1 0
319 kx dnl 1.99.2 is the revision 4 2 0
319 kx dnl 1.99.3 is the revision 5 3 0
319 kx dnl 1.99.4 is the revision 6 4 0
319 kx dnl ABI breakage reset major to 3
319 kx dnl 1.99.5 is the revision 3.0.0
319 kx dnl 1.99.6 is the revision 3.1.0 WHICH IS WRONG!!!
319 kx dnl 1.99.7 is the revision 4.1.0
319 kx dnl 1.99.8 is the revision 4.1.1
319 kx dnl 1.99.9 is the revision 4.1.1 (no library change have been made)
319 kx dnl 2.0.0 is the revision 4.1.2
319 kx dnl 2.0.1 is the revision 4.1.3
319 kx dnl 2.0.2 is the revision 4.1.4
319 kx dnl 2.1.0 is the revision 5.2.0
319 kx dnl 2.1.1 is the revision 5.2.1
319 kx dnl 2.2.0 is the revision 5.2.2 -- no public API change
319 kx dnl 2.2.1 is the revision 5.2.3 -- no public API change
319 kx dnl 2.2.2 is the revision 5.2.4 -- no public API change
319 kx dnl 2.2.3 is the revision 5.2.5 -- no public API change
319 kx dnl 2.3.0 is the revision 6.3.0
319 kx dnl 2.4.0 is the revision 7.4.0
319 kx dnl 2.4.1 is the revision 7.4.1
319 kx dnl 2.4.2 is the revision 7.4.2
319 kx dnl 2.4.3 is the revision 7.4.3
319 kx dnl 2.4.4 is the revision 7.4.4
319 kx dnl 2.4.5 is the revision 7.4.5
319 kx dnl 2.4.6 is the revision 7.4.6
319 kx dnl 2.5.0 is the revision 8.0.0 -- Removed XMP SDK symbols.
319 kx dnl 2.5.1 is the revision 8.0.1
319 kx dnl 2.5.2 is the revision 8.0.2
319 kx dnl 2.6.0 is the revision 9.1.0
319 kx dnl 2.6.1 is the revision 9.1.1
319 kx dnl 2.6.2 is the revision 9.1.2
319 kx dnl 2.6.3 is the revision 9.1.3
319 kx dnl 2.6.4 is the revision 9.1.4
319 kx dnl 2.6.5 is the revision 9.1.5
319 kx AC_SUBST([EXEMPI_REVISION], [5])
319 kx AC_SUBST([EXEMPI_AGE], [1])
319 kx AC_SUBST([EXEMPI_CURRENT], [9])
319 kx AC_SUBST([EXEMPI_CURRENT_MIN],
319 kx [`expr $EXEMPI_CURRENT - $EXEMPI_AGE`])
319 kx AC_SUBST([EXEMPI_VERSION_INFO],
319 kx [$EXEMPI_CURRENT:$EXEMPI_REVISION:$EXEMPI_AGE])
319 kx
319 kx dnl the major version. used for package names, etc
319 kx EXEMPI_MAJOR_VERSION=2.0
319 kx AC_SUBST(EXEMPI_MAJOR_VERSION)
319 kx
319 kx dnl the path where includes are installed
319 kx EXEMPI_INCLUDE_BASE=exempi-$EXEMPI_MAJOR_VERSION
319 kx AC_SUBST(EXEMPI_INCLUDE_BASE)
319 kx
319 kx dnl --------------------------------------------------------------------
319 kx dnl guess directory to install *.pc into
319 kx dnl --------------------------------------------------------------------
319 kx pkgconfigdir='${libdir}/pkgconfig'
319 kx AC_SUBST(pkgconfigdir)
319 kx
319 kx AC_CONFIG_MACRO_DIR([m4])
319 kx
319 kx AC_PROG_CC
319 kx AC_PROG_CXX
319 kx AC_PROG_LIBTOOL
319 kx AX_CXX_COMPILE_STDCXX_11(noext,mandatory)
319 kx
319 kx AC_C_BIGENDIAN
319 kx AC_DEFINE(CHECKED_ENDIANNESS)
319 kx
319 kx AC_ARG_WITH(darwinports,[ --with-darwinports add /opt/local/... to CPP/LDFLAGS (Mac OSX)],[
319 kx if test "x$withval" != "xno"; then
319 kx CPPFLAGS="$CPPFLAGS -I/opt/local/include"
319 kx LDFLAGS="$LDFLAGS -L/opt/local/lib"
319 kx CC=g++
319 kx fi
319 kx ])
319 kx AC_ARG_WITH(fink,[ --with-fink add /sw/... to CPP/LDFLAGS (Mac OSX)],[
319 kx if test "x$withval" != "xno"; then
319 kx CPPFLAGS="$CPPFLAGS -I/sw/include"
319 kx LDFLAGS="$LDFLAGS -L/sw/lib"
319 kx CC=g++
319 kx fi
319 kx ])
319 kx
319 kx
319 kx AC_CHECK_HEADER(expat.h, ,
319 kx AC_MSG_ERROR([expat headers missing]))
319 kx AC_CHECK_HEADER(iconv.h, ,
319 kx AC_MSG_ERROR([iconv headers missing]))
319 kx AC_CHECK_HEADER(zlib.h, ,
319 kx AC_MSG_ERROR([zlib headers missing]))
319 kx
319 kx dnl Blatently copied from iconv.m4 to remove the crack about libtool
319 kx dnl But check for constness of the iconv parameters.
319 kx AC_MSG_CHECKING([for iconv declaration])
319 kx AC_CACHE_VAL(am_cv_proto_iconv, [
319 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
319 kx #include <stdlib.h>
319 kx #include <iconv.h>
319 kx extern
319 kx #ifdef __cplusplus
319 kx "C"
319 kx #endif
319 kx #if defined(__STDC__) || defined(__cplusplus)
319 kx size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
319 kx #else
319 kx size_t iconv();
319 kx #endif
319 kx ]], [[]])],[am_cv_proto_iconv_arg1=""],[am_cv_proto_iconv_arg1="const"])
319 kx am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
319 kx am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
319 kx AC_MSG_RESULT([$]{ac_t:-
319 kx }[$]am_cv_proto_iconv)
319 kx AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
319 kx [Define as const if the declaration of iconv() needs const.])
319 kx dnl end iconv checks
319 kx
319 kx
319 kx dnl TLS.
319 kx AX_TLS
319 kx if test "$ac_cv_tls" != "none"; then
319 kx AC_DEFINE(HAVE_NATIVE_TLS, [1], [Define if compiler has native TLS.])
319 kx fi
319 kx dnl end TLS
319 kx
319 kx
319 kx AC_ARG_ENABLE(samples,
319 kx AS_HELP_STRING([--enable-samples=yes|no],[enable the samples. (default is yes)]),
319 kx enable_samples=$enableval,
319 kx enable_samples=yes)
319 kx AM_CONDITIONAL([ENABLE_SAMPLES], [test x"$enable_samples" = xyes])
319 kx
319 kx
319 kx AC_ARG_ENABLE(unittest,
319 kx AS_HELP_STRING([--enable-unittest=yes|no],[enable the unittest. requires boost (default is yes)]),
319 kx ENABLE_UNITTEST=$enableval,
319 kx ENABLE_UNITTEST=yes)
319 kx if test x$ENABLE_UNITTEST = xyes ; then
319 kx BOOST_REQUIRE([1.60.0])
319 kx BOOST_TEST([mt-s])
319 kx else
319 kx ENABLE_UNITTEST=no
319 kx fi
319 kx
319 kx
319 kx AC_SEARCH_LIBS([dlopen], [dl dld], [], [
319 kx AC_MSG_ERROR([unable to find the dlopen() function])
319 kx ])
319 kx AC_SEARCH_LIBS([clock_gettime], [rt], [], [
319 kx AC_MSG_ERROR([unable to find the clock_gettime() function])
319 kx ])
319 kx
319 kx case $build_vendor in
319 kx apple)
319 kx EXEMPI_PLATFORM_DEF=MAC_ENV
319 kx LDFLAGS="$LDFLAGS -framework CoreServices -stdlib=libc++"
319 kx CPPFLAGS="$CPPFLAGS -std=c++11 -stdlib=libc++"
319 kx ;;
319 kx *)
319 kx EXEMPI_PLATFORM_DEF=UNIX_ENV
319 kx ;;
319 kx esac
319 kx
319 kx AC_SUBST(EXEMPI_PLATFORM_DEF)
319 kx AM_CONDITIONAL(MAC_ENV, test x$EXEMPI_PLATFORM_DEF = xMAC_ENV)
319 kx AM_CONDITIONAL(UNIX_ENV, test x$EXEMPI_PLATFORM_DEF = xUNIX_ENV)
319 kx
319 kx AM_CONDITIONAL(WITH_UNIT_TEST, test x$ENABLE_UNITTEST = xyes)
319 kx
319 kx dnl Check for valgrind (optional) for make check.
319 kx dnl AC_CHECK_PROG(VALGRIND, valgrind, valgrind)
319 kx AC_CHECK_HEADERS(valgrind/memcheck.h)
319 kx if test "$VALGRIND" = ""; then
319 kx AC_MSG_WARN([Valgrind is missing. checks will run without])
319 kx fi
319 kx if test "$VALGRIND" != ""; then
319 kx dnl due to stupid m4 I had to double the [ and ] in the regexp
319 kx vg_ver=`valgrind --version | sed -e 's/.*-\([[0-9]]\)\.[[0-9]].*/\1/'`
319 kx VALGRIND="$VALGRIND --tool=memcheck --leak-check=yes --num-callers=10 --error-exitcode=100"
319 kx if test "$vg_ver" != "3" ; then
319 kx VALGRIND="$VALGRIND --logfile-fd=-1"
319 kx fi
319 kx fi
319 kx AC_SUBST(VALGRIND)
319 kx
319 kx AC_LANG([C++])
319 kx AC_LANG_COMPILER_REQUIRE
319 kx
319 kx AX_APPEND_COMPILE_FLAGS([-fvisibility=hidden])
319 kx
319 kx dnl ***************************************************************
319 kx dnl Excessive warnings
319 kx dnl ***************************************************************
319 kx AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option], [
319 kx ax_compiler_flags_test="-Werror=unknown-warning-option"
319 kx ], [
319 kx ax_compiler_flags_test=""
319 kx ])
319 kx
319 kx AC_ARG_ENABLE(asan,[ --enable-asan Turn on address sanitizer],[
319 kx AX_APPEND_COMPILE_FLAGS([-fsanitize=address -fno-omit-frame-pointer])
319 kx ]
319 kx ,
319 kx [
319 kx
319 kx ])
319 kx
319 kx XMPCORE_CPPFLAGS="-D$EXEMPI_PLATFORM_DEF=1 -DXMP_IMPL=1 -DXMP_ClientBuild=0 \
319 kx -DXMP_StaticBuild=1 -DBanAllEntityUsage=1 \
319 kx -D_FILE_OFFSET_BITS=64 -DHAVE_EXPAT_CONFIG_H=1 -DXML_STATIC=1"
319 kx AC_SUBST(XMPCORE_CPPFLAGS)
319 kx
319 kx AC_CONFIG_FILES([
319 kx Makefile
319 kx third-party/Makefile
319 kx third-party/zuid/interfaces/Makefile
319 kx third-party/zlib/Makefile
319 kx third-party/expat/Makefile
319 kx source/Makefile
319 kx XMPCore/Makefile
319 kx XMPCore/source/Makefile
319 kx XMPFiles/Makefile
319 kx XMPFiles/source/Makefile
319 kx XMPFiles/source/FileHandlers/Makefile
319 kx XMPFiles/source/FormatSupport/Makefile
319 kx XMPFiles/source/NativeMetadataSupport/Makefile
319 kx XMPFiles/source/PluginHandler/Makefile
319 kx XMPFilesPlugins/Makefile
319 kx XMPFilesPlugins/api/Makefile
319 kx XMPFilesPlugins/api/source/Makefile
319 kx XMPFilesPlugins/PDF_Handler/Makefile
319 kx samples/Makefile
319 kx samples/source/Makefile
319 kx samples/testfiles/Makefile
319 kx build/GNUmakefile
319 kx public/Makefile
319 kx public/include/Makefile
319 kx public/include/client-glue/Makefile
319 kx exempi/Makefile
319 kx exempi/doc/Makefile
319 kx exempi/doc/Doxyfile
319 kx exempi/exempi-2.0.pc
319 kx ])
319 kx AC_OUTPUT
319 kx
319 kx
319 kx echo "
319 kx Defines:
319 kx
319 kx EXEMPI_PLATFORM_DEF = $EXEMPI_PLATFORM_DEF
319 kx CPPFLAGS = $CPPFLAGS
319 kx LDFLAGS = $LDFLAGS
319 kx Thread Local Storage = $ac_cv_tls
319 kx Run unit test = $ENABLE_UNITTEST
319 kx "