diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2012-07-12 20:34:34 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2012-07-12 20:34:34 +0000 |
commit | 0c6a5fa0d9719a40748d8726b4543f02f70518c1 (patch) | |
tree | 241f9ae619069ac5861d7621ade296102ab5de5d /m4m | |
download | libexif-tarball-0c6a5fa0d9719a40748d8726b4543f02f70518c1.tar.gz |
libexif-0.6.21HEADlibexif-0.6.21master
Diffstat (limited to 'm4m')
-rw-r--r-- | m4m/Makefile.am | 1 | ||||
-rw-r--r-- | m4m/Makefile.in | 398 | ||||
-rw-r--r-- | m4m/gp-byteorder.m4 | 354 | ||||
-rw-r--r-- | m4m/gp-check-library.m4 | 378 | ||||
-rw-r--r-- | m4m/gp-check-popt.m4 | 180 | ||||
-rw-r--r-- | m4m/gp-check-shell-environment.m4 | 48 | ||||
-rw-r--r-- | m4m/gp-config-msg.m4 | 102 | ||||
-rw-r--r-- | m4m/gp-documentation.m4 | 149 | ||||
-rw-r--r-- | m4m/gp-gettext-hack.m4 | 82 | ||||
-rw-r--r-- | m4m/gp-packaging.m4 | 74 | ||||
-rw-r--r-- | m4m/gp-pkg-config.m4 | 42 | ||||
-rw-r--r-- | m4m/gp-references.m4 | 48 | ||||
-rw-r--r-- | m4m/stdint.m4 | 734 |
13 files changed, 2590 insertions, 0 deletions
diff --git a/m4m/Makefile.am b/m4m/Makefile.am new file mode 100644 index 0000000..297314a --- /dev/null +++ b/m4m/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = gp-byteorder.m4 gp-check-library.m4 gp-check-popt.m4 gp-check-shell-environment.m4 gp-config-msg.m4 gp-documentation.m4 gp-gettext-hack.m4 gp-packaging.m4 gp-pkg-config.m4 gp-references.m4 stdint.m4 diff --git a/m4m/Makefile.in b/m4m/Makefile.in new file mode 100644 index 0000000..ad1bb2c --- /dev/null +++ b/m4m/Makefile.in @@ -0,0 +1,398 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = m4m +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4m/gp-check-shell-environment.m4 \ + $(top_srcdir)/m4m/gp-config-msg.m4 \ + $(top_srcdir)/m4m/gp-documentation.m4 \ + $(top_srcdir)/m4m/gp-gettext-hack.m4 \ + $(top_srcdir)/m4m/stdint.m4 $(top_srcdir)/auto-m4/gettext.m4 \ + $(top_srcdir)/auto-m4/iconv.m4 $(top_srcdir)/auto-m4/lib-ld.m4 \ + $(top_srcdir)/auto-m4/lib-link.m4 \ + $(top_srcdir)/auto-m4/lib-prefix.m4 \ + $(top_srcdir)/auto-m4/libtool.m4 \ + $(top_srcdir)/auto-m4/ltoptions.m4 \ + $(top_srcdir)/auto-m4/ltsugar.m4 \ + $(top_srcdir)/auto-m4/ltversion.m4 \ + $(top_srcdir)/auto-m4/lt~obsolete.m4 \ + $(top_srcdir)/auto-m4/nls.m4 $(top_srcdir)/auto-m4/po.m4 \ + $(top_srcdir)/auto-m4/progtest.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CPPFLAGS = @AM_CPPFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AM_LDFLAGS = @AM_LDFLAGS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOT = @DOT@ +DOXYGEN = @DOXYGEN@ +DOXYGEN_OUTPUT_DIR = @DOXYGEN_OUTPUT_DIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GMSGFMT = @GMSGFMT@ +GREP = @GREP@ +HAVE_DOT = @HAVE_DOT@ +HTML_APIDOC_DIR = @HTML_APIDOC_DIR@ +HTML_APIDOC_INTERNALS_DIR = @HTML_APIDOC_INTERNALS_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBEXIF_AGE = @LIBEXIF_AGE@ +LIBEXIF_CURRENT = @LIBEXIF_CURRENT@ +LIBEXIF_CURRENT_MIN = @LIBEXIF_CURRENT_MIN@ +LIBEXIF_REVISION = @LIBEXIF_REVISION@ +LIBEXIF_VERSION_INFO = @LIBEXIF_VERSION_INFO@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = gp-byteorder.m4 gp-check-library.m4 gp-check-popt.m4 gp-check-shell-environment.m4 gp-config-msg.m4 gp-documentation.m4 gp-gettext-hack.m4 gp-packaging.m4 gp-pkg-config.m4 gp-references.m4 stdint.m4 +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu m4m/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu m4m/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/m4m/gp-byteorder.m4 b/m4m/gp-byteorder.m4 new file mode 100644 index 0000000..693f939 --- /dev/null +++ b/m4m/gp-byteorder.m4 @@ -0,0 +1,354 @@ +dnl AC_NEED_BYTEORDER_H ( HEADER-TO-GENERATE ) +dnl Copyright 2001-2002 by Dan Fandrich <dan@coneharvesters.com> +dnl This file may be copied and used freely without restrictions. No warranty +dnl is expressed or implied. +dnl +dnl Create a header file that guarantees that byte swapping macros of the +dnl ntohl variety as well as the extended types included in OpenBSD and +dnl NetBSD such as le32toh are defined. If possible, the standard ntohl +dnl are overloaded as they are optimized for the given platform, but when +dnl this is not possible (e.g. on a big-endian machine) they are defined +dnl in this file. + +dnl Look for a symbol in a header file +dnl AC_HAVE_SYMBOL ( IDENTIFIER, HEADER-FILE, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND ) +AC_DEFUN([AC_HAVE_SYMBOL], +[ +AC_MSG_CHECKING(for $1 in $2) +AC_EGREP_CPP([symbol is present|\<$1\>],[ +#include <$2> +#ifdef $1 + symbol is present +#endif + ], +[AC_MSG_RESULT(yes) +$3 +], +[AC_MSG_RESULT(no) +$4 +])]) + + +dnl Create a header file that defines extended byte swapping macros +AC_DEFUN([AC_NEED_BYTEORDER_H], +[ +changequote(, )dnl +ac_dir=`echo $1|sed 's%/[^/][^/]*$%%'` +changequote([, ])dnl +if test "$ac_dir" != "$1" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" +fi + +# We're only interested in the target CPU, but it's not always set +effective_target="$target" +if test "x$effective_target" = xNONE -o "x$effective_target" = x ; then + effective_target="$host" +fi +AC_SUBST(effective_target) + +cat > "$1" << EOF +/* This file is generated automatically by configure */ +/* It is valid only for the system type ${effective_target} */ + +#ifndef __BYTEORDER_H +#define __BYTEORDER_H + +EOF + +dnl First, do an endian check +AC_C_BIGENDIAN + +dnl Look for NetBSD-style extended byte swapping macros +AC_HAVE_SYMBOL(le32toh,machine/endian.h, + [HAVE_LE32TOH=1 + cat >> "$1" << EOF +/* extended byte swapping macros are already available */ +#include <machine/endian.h> + +EOF], + +[ + +dnl Look for standard byte swapping macros +AC_HAVE_SYMBOL(ntohl,arpa/inet.h, + [cat >> "$1" << EOF +/* ntohl and relatives live here */ +#include <arpa/inet.h> + +EOF], + + [AC_HAVE_SYMBOL(ntohl,netinet/in.h, + [cat >> "$1" << EOF +/* ntohl and relatives live here */ +#include <netinet/in.h> + +EOF],true)]) +]) + +dnl Look for generic byte swapping macros + +dnl OpenBSD +AC_HAVE_SYMBOL(swap32,machine/endian.h, + [cat >> "$1" << EOF +/* swap32 and swap16 are defined in machine/endian.h */ + +EOF], + + [ +dnl Linux GLIBC + AC_HAVE_SYMBOL(bswap_32,byteswap.h, + [cat >> "$1" << EOF +/* Define generic byte swapping functions */ +#include <byteswap.h> +#define swap16(x) bswap_16(x) +#define swap32(x) bswap_32(x) +#define swap64(x) bswap_64(x) + +EOF], + + [ +dnl NetBSD + AC_HAVE_SYMBOL(bswap32,machine/endian.h, + dnl We're already including machine/endian.h if this test succeeds + [cat >> "$1" << EOF +/* Define generic byte swapping functions */ +EOF + if test "$HAVE_LE32TOH" != "1"; then + echo '#include <machine/endian.h>'>> "$1" + fi +cat >> "$1" << EOF +#define swap16(x) bswap16(x) +#define swap32(x) bswap32(x) +#define swap64(x) bswap64(x) + +EOF], + + [ +dnl FreeBSD + AC_HAVE_SYMBOL(__byte_swap_long,sys/types.h, + [cat >> "$1" << EOF +/* Define generic byte swapping functions */ +#include <sys/types.h> +#define swap16(x) __byte_swap_word(x) +#define swap32(x) __byte_swap_long(x) +/* No optimized 64 bit byte swapping macro is available */ +#define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\ + ((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\ + ((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\ + ((uint64_t)(x) << 8) & 0x000000ff00000000ULL | \\ + ((x) >> 8) & 0x00000000ff000000ULL | \\ + ((x) >> 24) & 0x0000000000ff0000ULL | \\ + ((x) >> 40) & 0x000000000000ff00ULL | \\ + ((x) >> 56) & 0x00000000000000ffULL)) + +EOF], + + [ +dnl OS X + AC_HAVE_SYMBOL(NXSwapLong,machine/byte_order.h, + [cat >> "$1" << EOF +/* Define generic byte swapping functions */ +#include <machine/byte_order.h> +#define swap16(x) NXSwapShort(x) +#define swap32(x) NXSwapLong(x) +#define swap64(x) NXSwapLongLong(x) + +EOF], + [ + if test $ac_cv_c_bigendian = yes; then + cat >> "$1" << EOF +/* No other byte swapping functions are available on this big-endian system */ +#define swap16(x) ((uint16_t)(((x) << 8) | ((uint16_t)(x) >> 8))) +#define swap32(x) ((uint32_t)(((uint32_t)(x) << 24) & 0xff000000UL | \\ + ((uint32_t)(x) << 8) & 0x00ff0000UL | \\ + ((x) >> 8) & 0x0000ff00UL | \\ + ((x) >> 24) & 0x000000ffUL)) +#define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\ + ((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\ + ((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\ + ((uint64_t)(x) << 8) & 0x000000ff00000000ULL | \\ + ((x) >> 8) & 0x00000000ff000000ULL | \\ + ((x) >> 24) & 0x0000000000ff0000ULL | \\ + ((x) >> 40) & 0x000000000000ff00ULL | \\ + ((x) >> 56) & 0x00000000000000ffULL)) + +EOF + else + cat >> "$1" << EOF +/* Use these as generic byteswapping macros on this little endian system */ +#define swap16(x) ntohs(x) +#define swap32(x) ntohl(x) +/* No optimized 64 bit byte swapping macro is available */ +#define swap64(x) ((uint64_t)(((uint64_t)(x) << 56) & 0xff00000000000000ULL | \\ + ((uint64_t)(x) << 40) & 0x00ff000000000000ULL | \\ + ((uint64_t)(x) << 24) & 0x0000ff0000000000ULL | \\ + ((uint64_t)(x) << 8) & 0x000000ff00000000ULL | \\ + ((x) >> 8) & 0x00000000ff000000ULL | \\ + ((x) >> 24) & 0x0000000000ff0000ULL | \\ + ((x) >> 40) & 0x000000000000ff00ULL | \\ + ((x) >> 56) & 0x00000000000000ffULL)) + +EOF + fi +]) + ]) + ]) + ]) +]) + + +[ +if test "$HAVE_LE32TOH" != "1"; then + cat >> "$1" << EOF +/* The byte swapping macros have the form: */ +/* EENN[a]toh or htoEENN[a] where EE is be (big endian) or */ +/* le (little-endian), NN is 16 or 32 (number of bits) and a, */ +/* if present, indicates that the endian side is a pointer to an */ +/* array of uint8_t bytes instead of an integer of the specified length. */ +/* h refers to the host's ordering method. */ + +/* So, to convert a 32-bit integer stored in a buffer in little-endian */ +/* format into a uint32_t usable on this machine, you could use: */ +/* uint32_t value = le32atoh(&buf[3]); */ +/* To put that value back into the buffer, you could use: */ +/* htole32a(&buf[3], value); */ + +/* Define aliases for the standard byte swapping macros */ +/* Arguments to these macros must be properly aligned on natural word */ +/* boundaries in order to work properly on all architectures */ +#define htobe16(x) htons(x) +#define htobe32(x) htonl(x) +#define be16toh(x) ntohs(x) +#define be32toh(x) ntohl(x) + +#define HTOBE16(x) (x) = htobe16(x) +#define HTOBE32(x) (x) = htobe32(x) +#define BE32TOH(x) (x) = be32toh(x) +#define BE16TOH(x) (x) = be16toh(x) + +EOF + + if test $ac_cv_c_bigendian = yes; then + cat >> "$1" << EOF +/* Define our own extended byte swapping macros for big-endian machines */ +#define htole16(x) swap16(x) +#define htole32(x) swap32(x) +#define le16toh(x) swap16(x) +#define le32toh(x) swap32(x) + +#define htobe64(x) (x) +#define be64toh(x) (x) + +#define HTOLE16(x) (x) = htole16(x) +#define HTOLE32(x) (x) = htole32(x) +#define LE16TOH(x) (x) = le16toh(x) +#define LE32TOH(x) (x) = le32toh(x) + +#define HTOBE64(x) (void) (x) +#define BE64TOH(x) (void) (x) + +EOF + else + cat >> "$1" << EOF +/* On little endian machines, these macros are null */ +#define htole16(x) (x) +#define htole32(x) (x) +#define htole64(x) (x) +#define le16toh(x) (x) +#define le32toh(x) (x) +#define le64toh(x) (x) + +#define HTOLE16(x) (void) (x) +#define HTOLE32(x) (void) (x) +#define HTOLE64(x) (void) (x) +#define LE16TOH(x) (void) (x) +#define LE32TOH(x) (void) (x) +#define LE64TOH(x) (void) (x) + +/* These don't have standard aliases */ +#define htobe64(x) swap64(x) +#define be64toh(x) swap64(x) + +#define HTOBE64(x) (x) = htobe64(x) +#define BE64TOH(x) (x) = be64toh(x) + +EOF + fi +fi + +cat >> "$1" << EOF +/* Define the C99 standard length-specific integer types */ +#include <_stdint.h> + +EOF + +case "${effective_target}" in + i[3456]86-*) + cat >> "$1" << EOF +/* Here are some macros to create integers from a byte array */ +/* These are used to get and put integers from/into a uint8_t array */ +/* with a specific endianness. This is the most portable way to generate */ +/* and read messages to a network or serial device. Each member of a */ +/* packet structure must be handled separately. */ + +/* The i386 and compatibles can handle unaligned memory access, */ +/* so use the optimized macros above to do this job */ +#define be16atoh(x) be16toh(*(uint16_t*)(x)) +#define be32atoh(x) be32toh(*(uint32_t*)(x)) +#define be64atoh(x) be64toh(*(uint64_t*)(x)) +#define le16atoh(x) le16toh(*(uint16_t*)(x)) +#define le32atoh(x) le32toh(*(uint32_t*)(x)) +#define le64atoh(x) le64toh(*(uint64_t*)(x)) + +#define htobe16a(a,x) *(uint16_t*)(a) = htobe16(x) +#define htobe32a(a,x) *(uint32_t*)(a) = htobe32(x) +#define htobe64a(a,x) *(uint64_t*)(a) = htobe64(x) +#define htole16a(a,x) *(uint16_t*)(a) = htole16(x) +#define htole32a(a,x) *(uint32_t*)(a) = htole32(x) +#define htole64a(a,x) *(uint64_t*)(a) = htole64(x) + +EOF + ;; + + *) + cat >> "$1" << EOF +/* Here are some macros to create integers from a byte array */ +/* These are used to get and put integers from/into a uint8_t array */ +/* with a specific endianness. This is the most portable way to generate */ +/* and read messages to a network or serial device. Each member of a */ +/* packet structure must be handled separately. */ + +/* Non-optimized but portable macros */ +#define be16atoh(x) ((uint16_t)(((x)[0]<<8)|(x)[1])) +#define be32atoh(x) ((uint32_t)(((x)[0]<<24)|((x)[1]<<16)|((x)[2]<<8)|(x)[3])) +#define be64atoh(x) ((uint64_t)(((x)[0]<<56)|((x)[1]<<48)|((x)[2]<<40)| \\ + ((x)[3]<<32)|((x)[4]<<24)|((x)[5]<<16)|((x)[6]<<8)|(x)[7])) +#define le16atoh(x) ((uint16_t)(((x)[1]<<8)|(x)[0])) +#define le32atoh(x) ((uint32_t)(((x)[3]<<24)|((x)[2]<<16)|((x)[1]<<8)|(x)[0])) +#define le64atoh(x) ((uint64_t)(((x)[7]<<56)|((x)[6]<<48)|((x)[5]<<40)| \\ + ((x)[4]<<32)|((x)[3]<<24)|((x)[2]<<16)|((x)[1]<<8)|(x)[0])) + +#define htobe16a(a,x) (a)[0]=(uint8_t)((x)>>8), (a)[1]=(uint8_t)(x) +#define htobe32a(a,x) (a)[0]=(uint8_t)((x)>>24), (a)[1]=(uint8_t)((x)>>16), \\ + (a)[2]=(uint8_t)((x)>>8), (a)[3]=(uint8_t)(x) +#define htobe64a(a,x) (a)[0]=(uint8_t)((x)>>56), (a)[1]=(uint8_t)((x)>>48), \\ + (a)[2]=(uint8_t)((x)>>40), (a)[3]=(uint8_t)((x)>>32), \\ + (a)[4]=(uint8_t)((x)>>24), (a)[5]=(uint8_t)((x)>>16), \\ + (a)[6]=(uint8_t)((x)>>8), (a)[7]=(uint8_t)(x) +#define htole16a(a,x) (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x) +#define htole32a(a,x) (a)[3]=(uint8_t)((x)>>24), (a)[2]=(uint8_t)((x)>>16), \\ + (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x) +#define htole64a(a,x) (a)[7]=(uint8_t)((x)>>56), (a)[6]=(uint8_t)((x)>>48), \\ + (a)[5]=(uint8_t)((x)>>40), (a)[4]=(uint8_t)((x)>>32), \\ + (a)[3]=(uint8_t)((x)>>24), (a)[2]=(uint8_t)((x)>>16), \\ + (a)[1]=(uint8_t)((x)>>8), (a)[0]=(uint8_t)(x) + +EOF + ;; +esac +] + +cat >> "$1" << EOF +#endif /*__BYTEORDER_H*/ +EOF]) diff --git a/m4m/gp-check-library.m4 b/m4m/gp-check-library.m4 new file mode 100644 index 0000000..dd3700a --- /dev/null +++ b/m4m/gp-check-library.m4 @@ -0,0 +1,378 @@ +dnl @synopsis GP_CHECK_LIBRARY([VARNAMEPART],[libname],[VERSION-REQUIREMENT], +dnl [headername],[functionname], +dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], +dnl [OPTIONAL-REQUIRED-ETC],[WHERE-TO-GET-IT]) +dnl +dnl Checks for the presence of a certain library. +dnl +dnl Parameters: +dnl +dnl VARNAMEPART partial variable name for variable definitions +dnl libname name of library +dnl VERSION-REQUIREMENT check for the version using pkg-config. +dnl default: [] +dnl headername name of header file +dnl default: [] +dnl functionname name of function name in library +dnl default: [] +dnl ACTION-IF-FOUND shell action to execute if found +dnl default: [] +dnl ACTION-IF-NOT-FOUND shell action to execute if not found +dnl default: [] +dnl OPTIONAL-REQUIRED-ETC one of "mandatory", "default-on", "default-off" +dnl "disable-explicitly" +dnl default: [mandatory] +dnl WHERE-TO-GET-IT place where to find the library, e.g. a URL +dnl default: [] +dnl +dnl What the ACTION-IFs can do: +dnl +dnl * change the variable have_[$1] to "yes" or "no" and thus change +dnl the outcome of the test +dnl * execute additional checks to define more specific variables, e.g. +dnl for different API versions +dnl +dnl What the OPTIONAL-REQUIRED-ETC options mean: +dnl +dnl mandatory Absolute requirement, cannot be disabled. +dnl default-on If found, it is used. If not found, it is not used. +dnl default-off In case of --with-libfoo, detect it. Without +dnl --with-libfoo, do not look for and use it. +dnl disable-explicitly Required by default, but can be disabled by +dnl explicitly giving --without-libfoo. +dnl +dnl These results have happened after calling GP_CHECK_LIBRARY: +dnl +dnl AM_CONDITIONAL([HAVE_VARPREFIX],[ if found ]) +dnl AM_SUBST([have_VARPREFIX], [ "yes" if found, "no" if not found ]) +dnl AM_SUBST([VARPREFIX_CFLAGS],[ -I, -D and stuff ]) +dnl AM_SUBST([VARPREFIX_LIBS], [ /path/to/libname.la -L/path -lfoo ]) +dnl +dnl Parameters to ./configure which influence the GP_CHECK_LIBRARY results: +dnl +dnl * VARNAMEPART_LIBS=/foobar/arm-palmos/lib/libname.la +dnl VARNAMEPART_CFLAGS=-I/foobar/include +dnl * --without-libfoo +dnl * --with-libfoo=/usr/local +dnl * --with-libfoo-include-dir=/foobar/include +dnl * --with-libfoo-lib=/foobar/arm-palmos/lib +dnl * --with-libfoo=autodetect +dnl +dnl Examples: +dnl GP_CHECK_LIBRARY([LIBEXIF], [libexif])dnl +dnl GP_CHECK_LIBRARY([LIBEXIF], [libexif-gtk], [>= 0.3.3])dnl +dnl note the space! ^ +dnl +dnl Possible enhancements: +dnl +dnl * Derive VAR_PREFIX directly from libname +dnl This will change the calling conventions, so be aware of that. +dnl * Give names of a header file and function name and to a test +dnl compilation. +dnl +AC_DEFUN([_GP_CHECK_LIBRARY_SOEXT],[dnl +AC_MSG_CHECKING([for dynamic library extension]) +soext="" +case "$host" in + *linux*) soext=".so" ;; + *sunos*) soext=".so" ;; + *solaris*) soext=".so" ;; + *bsd*) soext=".so" ;; + *darwin*) soext=".dylib" ;; + *w32*) soext=".dll" ;; +esac +if test "x$soext" = "x"; then + soext=".so" + AC_MSG_RESULT([${soext}]) + AC_MSG_WARN([ +Host system "${host}" not recognized, defaulting to "${soext}". +]) +else + AC_MSG_RESULT([${soext}]) +fi +])dnl +dnl +AC_DEFUN([_GP_CHECK_LIBRARY],[ +# ---------------------------------------------------------------------- +# [GP_CHECK_LIBRARY]([$1],[$2],[$3], +# [$4],[$5], +# [...],[...],[$8]) +m4_ifval([$9],[dnl +# $9 +])dnl +# ---------------------------------------------------------------------- +dnl +AC_REQUIRE([GP_CONFIG_MSG])dnl +AC_REQUIRE([GP_PKG_CONFIG])dnl +AC_REQUIRE([_GP_CHECK_LIBRARY_SOEXT])dnl +dnl Use _CFLAGS and _LIBS given to configure. +dnl This makes it possible to set these vars in a configure script +dnl and AC_CONFIG_SUBDIRS this configure. +AC_ARG_VAR([$1][_CFLAGS], [CFLAGS for compiling with ][$2])dnl +AC_ARG_VAR([$1][_LIBS], [LIBS to add for linking against ][$2])dnl +dnl +AC_MSG_CHECKING([for ][$2][ to use]) +userdef_[$1]=no +have_[$1]=no +if test "x${[$1][_LIBS]}" = "x" && test "x${[$1][_CFLAGS]}" = "x"; then + dnl define --with/--without argument + m4_if([$8], [default-off], + [m4_pushdef([gp_lib_arg],[--without-][$2])dnl + try_[$1]=no + ], + [m4_pushdef([gp_lib_arg],[--with-][$2])dnl + try_[$1]=auto + ])dnl + AC_ARG_WITH([$2],[AS_HELP_STRING([gp_lib_arg][=PREFIX],[where to find ][$2][, "no" or "auto"])],[try_][$1][="$withval"]) + if test "x${[try_][$1]}" = "xauto"; then [try_][$1]=autodetect; fi + AC_MSG_RESULT([${try_][$1][}]) + m4_popdef([gp_lib_arg])dnl + if test "x${[try_][$1]}" = "xautodetect"; then + dnl OK, we have to autodetect. + dnl We start autodetection with the cleanest known method: pkg-config + if test "x${[have_][$1]}" = "xno"; then + dnl we need that line break after the PKG_CHECK_MODULES + m4_ifval([$3], + [PKG_CHECK_MODULES([$1],[$2][ $3],[have_][$1][=yes],[:])], + [PKG_CHECK_MODULES([$1],[$2], [have_][$1][=yes],[:])] + ) + fi + dnl If pkg-config didn't find anything, try the libfoo-config program + dnl certain known libraries ship with. + if test "x${[have_][$1]}" = "xno"; then + AC_MSG_WARN([The `$2' library could not be found using pkg-config. +No version checks will be performed if it is found using any other method.]) + AC_MSG_CHECKING([$2][ config program]) + m4_pushdef([gp_lib_config],[m4_if([$2],[libusb],[libusb-config], + [$2],[libgphoto2],[gphoto2-config], + [$2],[libgphoto2_port],[gphoto2-port-config], + [none])])dnl + AC_MSG_RESULT([gp_lib_config]) + AC_PATH_PROG([$1][_CONFIG_PROG],[gp_lib_config]) + if test -n "${[$1][_CONFIG_PROG]}" && + test "${[$1][_CONFIG_PROG]}" != "none"; then + AC_MSG_CHECKING([for ][$2][ parameters from ][gp_lib_config]) + [$1]_LIBS="$(${[$1][_CONFIG_PROG]} --libs || echo "*error*")" + [$1]_CFLAGSS="$(${[$1][_CONFIG_PROG]} --cflags || echo "*error*")" + if test "x${[$1]_LIBS}" = "*error*" || + test "x${[$1]_CFLAGS}" = "*error*"; then + AC_MSG_RESULT([error]) + else + have_[$1]=yes + AC_MSG_RESULT([ok]) + fi + fi + m4_popdef([gp_lib_config])dnl + fi + dnl Neither pkg-config, nor the libfoo-config program have found anything. + dnl So let's just probe the system. + if test "x${[have_][$1]}" = "xno"; then + ifs="$IFS" + IFS=":" # FIXME: for W32 and OS/2 we may need ";" here + for _libdir_ in \ + ${LD_LIBRARY_PATH} \ + "${libdir}" \ + "${prefix}/lib64" "${prefix}/lib" \ + /usr/lib64 /usr/lib \ + /usr/local/lib64 /usr/local/lib \ + /opt/lib64 /opt/lib + do + IFS="$ifs" + for _soext_ in .la ${soext} .a; do + if test -f "${_libdir_}/[$2]${_soext_}" + then + if test "x${_soext_}" = "x.la" || + test "x${_soext_}" = "x.a"; then + [$1]_LIBS="${_libdir_}/[$2]${_soext_}" + else + [$1]_LIBS="-L${_libdir_} -l$(echo "$2" | sed 's/^lib//')" + fi + break + fi + done + if test "x${[$1][_LIBS]}" != "x"; then + break + fi + done + IFS="$ifs" + if test "x${[$1][_LIBS]}" != "x"; then + have_[$1]=yes + fi + fi + elif test "x${[try_][$1]}" = "xno"; then + : + else + [$1][_LIBS]="-L${[try_][$1]}/lib -l$(echo "$2" | sed 's/^lib//')" + [$1][_CFLAGS]="-I${[try_][$1]}/include" + fi +elif test "x${[$1][_LIBS]}" != "x" && test "x${[$1][_CFLAGS]}" != "x"; then + AC_MSG_RESULT([user-defined]) + userdef_[$1]=yes + have_[$1]=yes +else + AC_MSG_RESULT([broken call]) + AC_MSG_ERROR([ +* Fatal: +* When calling configure for ${PACKAGE_TARNAME} +* ${PACKAGE_NAME} +* either set both [$1][_LIBS] *and* [$1][_CFLAGS] +* or neither. +]) +fi +dnl +dnl ACTION-IF-FOUND +dnl +m4_ifval([$6],[dnl +if test "x${[have_][$1]}" = "xyes"; then +# ACTION-IF-FOUND +$6 +fi +])dnl +dnl +dnl ACTION-IF-NOT-FOUND +dnl +m4_ifval([$7],[dnl +if test "x${[have_][$1]}" = "xno"; then +# ACTION-IF-NOT-FOUND +$7 +fi +])dnl +dnl +dnl Run our own test compilation +dnl +m4_ifval([$4],[dnl +if test "x${[have_][$1]}" = "xyes"; then +dnl AC_MSG_CHECKING([whether ][$2][ test compile succeeds]) +dnl AC_MSG_RESULT([${[have_][$1]}]) +CPPFLAGS_save="$CPPFLAGS" +CPPFLAGS="${[$1]_CFLAGS}" +AC_CHECK_HEADER([$4],[have_][$1][=yes],[have_][$1][=no]) +CPPFLAGS="$CPPFLAGS_save" +fi +])dnl +dnl +dnl Run our own test link +dnl Does not work for libraries which be built after configure time, +dnl so we deactivate it for them (userdef_). +dnl +m4_ifval([$5],[dnl +if test "x${[userdef_][$1]}" = "xno" && test "x${[have_][$1]}" = "xyes"; then + AC_MSG_CHECKING([for function ][$5][ in ][$2]) + LIBS_save="$LIBS" + LIBS="${[$1]_LIBS}" + AC_TRY_LINK_FUNC([$5],[],[have_][$1][=no]) + LIBS="$LIBS_save" + AC_MSG_RESULT([${[have_][$1]}]) +fi +])dnl +dnl +dnl Abort configure script if mandatory, but not found +dnl +m4_if([$8],[mandatory],[ +if test "x${[have_][$1]}" = "xno"; then + AC_MSG_ERROR([ +PKG_CONFIG_PATH=${PKG_CONFIG_PATH} +[$1][_LIBS]=${[$1][_LIBS]} +[$1][_CFLAGS]=${[$1][_CFLAGS]} + +* Fatal: ${PACKAGE_NAME} requires $2 to build. +* +* Possible solutions: +* - set PKG_CONFIG_PATH to adequate value +* - call configure with [$1][_LIBS]=.. and [$1][_CFLAGS]=.. +* - call configure with one of the --with-$2 parameters +]m4_ifval([$9],[dnl +* - get $2 and install it +],[dnl +* - get $2 and install it: + $9])) +fi +])dnl +dnl +dnl Abort configure script if not found and not explicitly disabled +dnl +m4_if([$8],[disable-explicitly],[ +if test "x${[try_][$1]}" != "xno" && test "x${[have_][$1]}" = "xno"; then + AC_MSG_ERROR([ +PKG_CONFIG_PATH=${PKG_CONFIG_PATH} +[$1][_LIBS]=${[$1][_LIBS]} +[$1][_CFLAGS]=${[$1][_CFLAGS]} + +* Fatal: ${PACKAGE_NAME} by default requires $2 to build. +* You must explicitly disable $2 to build ${PACKAGE_TARNAME} without it. +* +* Possible solutions: +* - call configure with --with-$2=no or --without-$2 +* - set PKG_CONFIG_PATH to adequate value +* - call configure with [$1][_LIBS]=.. and [$1][_CFLAGS]=.. +* - call configure with one of the --with-$2 parameters +]m4_ifval([$9],[dnl +* - get $2 and install it +],[dnl +* - get $2 and install it: + $9])) +fi +])dnl +AM_CONDITIONAL([HAVE_][$1], [test "x$have_[$1]" = "xyes"]) +if test "x$have_[$1]" = "xyes"; then + AC_DEFINE([HAVE_][$1], 1, [whether we compile with ][$2][ support]) + GP_CONFIG_MSG([$2],[yes])dnl + AC_MSG_CHECKING([$2][ library flags]) + AC_MSG_RESULT([${[$1][_LIBS]}]) + AC_MSG_CHECKING([$2][ cpp flags]) + AC_MSG_RESULT([${[$1][_CFLAGS]}]) +else + GP_CONFIG_MSG([$2],[no])dnl +fi +dnl AC_SUBST is done implicitly by AC_ARG_VAR above. +dnl AC_SUBST([$1][_LIBS]) +dnl AC_SUBST([$1][_CFLAGS]) +])dnl +dnl +dnl #################################################################### +dnl +AC_DEFUN([_GP_CHECK_LIBRARY_SYNTAX_ERROR],[dnl +m4_errprint(__file__:__line__:[ Error: +*** Calling $0 macro with old syntax +*** Aborting. +])dnl +m4_exit(1)dnl +])dnl +dnl +dnl #################################################################### +dnl +AC_DEFUN([GP_CHECK_LIBRARY],[dnl +m4_if([$4], [mandatory], [_GP_CHECK_LIBRARY_SYNTAX_ERROR($0)], + [$4], [default-enabled], [_GP_CHECK_LIBRARY_SYNTAX_ERROR($0)], + [$4], [default-disabled], [_GP_CHECK_LIBRARY_SYNTAX_ERROR($0)])dnl +m4_if([$8], [], [dnl + _GP_CHECK_LIBRARY([$1],[$2],[$3],[$4],[$5],[$6],[$7],[mandatory],[$9])], + [$8], [default-on], [dnl + _GP_CHECK_LIBRARY([$1],[$2],[$3],[$4],[$5],[$6],[$7],[$8],[$9])], + [$8], [disable-explicitly], [dnl + _GP_CHECK_LIBRARY([$1],[$2],[$3],[$4],[$5],[$6],[$7],[$8],[$9])], + [$8], [default-off], [dnl + _GP_CHECK_LIBRARY([$1],[$2],[$3],[$4],[$5],[$6],[$7],[$8],[$9])], + [$8], [mandatory], [dnl + _GP_CHECK_LIBRARY([$1],[$2],[$3],[$4],[$5],[$6],[$7],[$8],[$9])], + [m4_errprint(__file__:__line__:[ Error: +Illegal argument 6 to $0: `$6' +It must be one of "default-on", "default-off", "mandatory". +])m4_exit(1)])dnl +])dnl +dnl +m4_pattern_disallow([GP_CHECK_LIBRARY]) +m4_pattern_disallow([_GP_CHECK_LIBRARY]) +m4_pattern_disallow([_GP_CHECK_LIBRARY_SYNTAX_ERROR]) +m4_pattern_disallow([_GP_CHECK_LIBRARY_SOEXT]) +dnl +dnl #################################################################### +dnl +dnl Please do not remove this: +dnl filetype: 6e60b4f0-acb2-4cd5-8258-42014f92bd2c +dnl I use this to find all the different instances of this file which +dnl are supposed to be synchronized. +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/m4m/gp-check-popt.m4 b/m4m/gp-check-popt.m4 new file mode 100644 index 0000000..585bf21 --- /dev/null +++ b/m4m/gp-check-popt.m4 @@ -0,0 +1,180 @@ +dnl @synopsis GP_CHECK_POPT(FLAG) +dnl +dnl Check whether libpopt is available. +dnl FLAG must be one of +dnl "mandatory" +dnl "default-enabled" +dnl "default-disabled" +dnl +AC_DEFUN([GP_CHECK_POPT],[ +# +# [GP_CHECK_POPT] +# +AC_REQUIRE([GP_CONFIG_MSG])dnl +m4_if([$1],[mandatory], [_GP_CHECK_POPT([mandatory])], + [$1],[default-enabled], [_GP_CHECK_POPT([disable])], + [$1],[default-disabled], [_GP_CHECK_POPT([enable])], + [m4_errprint(__file__:__line__:[ Error: +Illegal argument to $0: `$1' +Valid values are: mandatory, default-enabled, default-disabled +])m4_exit(1)])dnl +])dnl +dnl +AC_DEFUN([_GP_CHECK_POPT],[ +m4_if([$1],[mandatory],[ +try_popt=yes +require_popt=yes +],[ +try_popt=auto +require_popt=no +AC_ARG_ENABLE([popt], +[AS_HELP_STRING([--$1-popt],[Do not use popt])], +[ if test "x$withval" = no \ + || test "x$withval" = off \ + || test "x$withval" = false; + then + try_popt=no + require_popt=no + elif test "x$withval" = yes \ + || test "x$withval" = on \ + || test "x$withval" = true + then + try_popt=yes + require_popt=yes + fi +])dnl +])dnl + +AC_MSG_CHECKING([whether popt is required]) +AC_MSG_RESULT([${require_popt}]) + +if test "$require_popt" != yes; then + AC_MSG_CHECKING([whether popt is requested]) + AC_MSG_RESULT([${try_popt}]) +fi + +dnl Implicit AC_SUBST +AC_ARG_VAR([POPT_CFLAGS],[CPPFLAGS to compile with libpopt])dnl +AC_ARG_VAR([POPT_LIBS],[LDFLAGS to link with libpopt])dnl + +have_popt=no + +if test "x$POPT_CFLAGS" = "x" && test "x$POPT_LIBS" = "x"; then + + # try to find options to compile popt.h + CPPFLAGS_save="$CPPFLAGS" + popth_found=no + for popt_prefix in "" /usr /usr/local + do + if test -n "${popt_prefix}"; then + : + elif test -d "${popt_prefix}/include"; then + CPPFLAGS="-I${popt_prefix}/include ${CPPFLAGS}" + else + continue + fi + ac_cv_header_popt_h="" + unset ac_cv_header_popt_h + AC_CHECK_HEADER([popt.h], [popth_found=yes]) + if test "$popth_found" = yes; then break; fi + done + CPPFLAGS="$CPPFLAGS_save" + if test "$popth_found" = "yes"; then + if test "$popt_prefix" = ""; then + POPT_CFLAGS="" + else + POPT_CFLAGS="-I${popt_prefix}/include" + fi + else + AC_MSG_ERROR([ +* Cannot autodetect popt.h +* +* Set POPT_CFLAGS and POPT_LIBS correctly. +]) + fi + + # try to find options to link against popt + LDFLAGS_save="$LDFLAGS" + popt_links=no + for popt_prefix in /usr "" /usr/local; do + # We could have "/usr" and "lib64" at the beginning of the + # lists. Then the first tested location would + # incidentally be the right one on 64bit systems, and + # thus work around a bug in libtool on 32bit systems: + # + # 32bit libtool doesn't know about 64bit systems, and so the + # compilation will fail when linking a 32bit library from + # /usr/lib to a 64bit binary. + # + # This hack has been confirmed to workwith a + # 32bit Debian Sarge and 64bit Fedora Core 3 system. + for ldir in lib64 "" lib; do + popt_libdir="${popt_prefix}/${ldir}" + if test "${popt_libdir}" = "/"; then + popt_libdir="" + elif test -d "${popt_libdir}"; then + LDFLAGS="-L${popt_libdir} ${LDFLAGS}" + else + continue + fi + # Avoid caching of results + ac_cv_lib_popt_poptStuffArgs="" + unset ac_cv_lib_popt_poptStuffArgs + AC_CHECK_LIB([popt], [poptStuffArgs], [popt_links=yes]) + if test "$popt_links" = yes; then break; fi + done + if test "$popt_links" = yes; then break; fi + done + LDFLAGS="$LDFLAGS_save" + if test "$popt_links" = "yes"; then + if test "$popt_libdir" = ""; then + POPT_LIBS="-lpopt" + else + POPT_LIBS="-L${popt_libdir} -lpopt" + fi + else + AC_MSG_ERROR([ +* Cannot autodetect library directory containing popt +* +* Set POPT_CFLAGS and POPT_LIBS correctly. +]) + fi + have_popt=yes +elif test "x$POPT_CFLAGS" != "x" && test "x$POPT_LIBS" != "x"; then + # just use the user specivied option + popt_msg="yes (user specified)" + have_popt=yes +else + AC_MSG_ERROR([ +* Fatal: Either set both POPT_CFLAGS and POPT_LIBS or neither. +]) +fi + +AC_MSG_CHECKING([if popt is functional]) +if test "$require_popt$have_popt" = "yesno"; then + AC_MSG_RESULT([no, but required]) + AC_MSG_ERROR([ +* popt library not found +* Fatal: ${PACKAGE_NAME} (${PACKAGE_TARNAME}) requires popt +* Please install it and/or set POPT_CFLAGS and POPT_LIBS. +]) +fi +AC_MSG_RESULT([${have_popt}]) + +GP_CONFIG_MSG([use popt library], [${have_popt}]) +if test "$have_popt" = "yes"; then + AC_DEFINE([HAVE_POPT],[1],[whether the popt library is available]) + GP_CONFIG_MSG([popt libs],[${POPT_LIBS}]) + GP_CONFIG_MSG([popt cppflags],[${POPT_CFLAGS}]) +fi +AM_CONDITIONAL([HAVE_POPT],[test "$have_popt" = "yes"]) +])dnl +dnl +dnl Please do not remove this: +dnl filetype: 7595380e-eff3-49e5-90ab-e40f1d544639 +dnl I use this to find all the different instances of this file which +dnl are supposed to be synchronized. +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/m4m/gp-check-shell-environment.m4 b/m4m/gp-check-shell-environment.m4 new file mode 100644 index 0000000..b9850e7 --- /dev/null +++ b/m4m/gp-check-shell-environment.m4 @@ -0,0 +1,48 @@ +dnl @synopsis GP_CHECK_SHELL_ENVIRONMENT([SHOW-LOCALE-VARS]) +dnl +dnl Check that the shell environment is sane. +dnl +dnl If SHOW-LOCALE-VARS is set to [true], print all LC_* and LANG* +dnl variables at configure time. (WARNING: This is not portable!) +dnl +dnl +AC_DEFUN([GP_CHECK_SHELL_ENVIRONMENT], +[ +# make sure "cd" doesn't print anything on stdout +if test x"${CDPATH+set}" = xset +then + CDPATH=: + export CDPATH +fi + +# make sure $() command substitution works +AC_MSG_CHECKING([for POSIX sh \$() command substitution]) +if test "x$(pwd)" = "x`pwd`" && test "y$(echo "foobar")" = "y`echo foobar`" # '''' +then + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) + uname=`uname 2>&1` # '' + uname_a=`uname -a 2>&1` # '' + AC_MSG_ERROR([ + +* POSIX sh \$() command substition does not work with this shell. +* +* You are running a very rare species of shell. Please report this +* sighting to <${PACKAGE_BUGREPORT}>: +* SHELL=${SHELL} +* uname=${uname} +* uname-a=${uname_a} +* Please also include your OS and version. +* +* Run this configure script using a better (i.e. POSIX compliant) shell. +]) +fi +dnl +m4_if([$1],[true],[dnl +printenv | grep -E '^(LC_|LANG)' +])dnl + +dnl +])dnl +dnl diff --git a/m4m/gp-config-msg.m4 b/m4m/gp-config-msg.m4 new file mode 100644 index 0000000..cc19351 --- /dev/null +++ b/m4m/gp-config-msg.m4 @@ -0,0 +1,102 @@ +dnl +dnl GP_CONFIG_INIT +dnl use default LHS width (called implicitly if not called explicitly) +dnl GP_CONFIG_INIT([WIDTH-OF-LHS]) +dnl explicitly set the LHS width to the given value +dnl +dnl GP_CONFIG_MSG +dnl empty output line +dnl GP_CONFIG_MSG([LHS],[RHS]) +dnl formatted output line "LHS: RHS" +dnl +dnl GP_CONFIG_OUTPUT +dnl print all the output messages we collected in the mean time +dnl +dnl Simple way to print a configuration summary at the end of ./configure. +dnl +dnl Example usage: +dnl +dnl GP_CONFIG_INIT +dnl GP_CONFIG_MSG([Source code location],[${srcdir}]) +dnl GP_CONFIG_MSG([Compiler],[${CC}]) +dnl GP_CONFIG_MSG +dnl GP_CONFIG_MSG([Feature foo],[${foo}]) +dnl GP_CONFIG_MSG([Location of bar],[${bar}]) +dnl [...] +dnl AC_OUTPUT +dnl GP_CONFIG_OUTPUT +dnl +dnl +AC_DEFUN([GP_CONFIG_INIT], +[dnl +AC_REQUIRE([GP_CHECK_SHELL_ENVIRONMENT]) +dnl the empty string must contain at least as many spaces as the substr length +dnl FIXME: let m4 determine that length +dnl (collect left parts in array and choose largest length) +m4_if([$1],[],[gp_config_len="30"],[gp_config_len="$1"]) +gp_config_empty="" +gp_config_len3="$(expr "$gp_config_len" - 3)" +n="$gp_config_len" +while test "$n" -gt 0; do + gp_config_empty="${gp_config_empty} " + n="$(expr "$n" - 1)" +done +gp_config_msg=" +Configuration (${PACKAGE_TARNAME} ${PACKAGE_VERSION}): +" +])dnl +dnl +dnl +AC_DEFUN([GP_CONFIG_MSG], +[AC_REQUIRE([GP_CONFIG_INIT])dnl +m4_if([$1],[],[ +gp_config_msg="${gp_config_msg} +" +],[$2],[],[ +gp_config_msg="${gp_config_msg} + [$1] +" +],[ +gp_config_msg_len="$(expr "[$1]" : '.*')" +if test "$gp_config_msg_len" -ge "$gp_config_len"; then + gp_config_msg_lhs="$(expr "[$1]" : "\(.\{0,${gp_config_len3}\}\)")..:" +else + gp_config_msg_lhs="$(expr "[$1]:${gp_config_empty}" : "\(.\{0,${gp_config_len}\}\)")" +fi +gp_config_msg="${gp_config_msg} ${gp_config_msg_lhs} [$2] +" +])])dnl +dnl +AC_DEFUN([GP_CONFIG_MSG_SUBDIRS],[dnl +# Message about configured subprojects +if test "x$subdirs" != "x"; then + GP_CONFIG_MSG()dnl + _subdirs="" + for sd in $subdirs; do + ssd="$(basename "$sd")" + if test "x$_subdirs" = "x"; then + _subdirs="$ssd"; + else + _subdirs="$_subdirs $ssd" + fi + done + GP_CONFIG_MSG([Subprojects],[${_subdirs}])dnl +fi +])dnl +dnl +AC_DEFUN([GP_CONFIG_OUTPUT], +[AC_REQUIRE([GP_CONFIG_INIT])dnl +AC_REQUIRE([GP_CONFIG_MSG])dnl +AC_REQUIRE([GP_CONFIG_MSG_SUBDIRS])dnl +echo "${gp_config_msg} +You may run \"make\" and \"make install\" now." +])dnl +dnl +dnl Please do not remove this: +dnl filetype: de774af3-dc3b-4b1d-b6f2-4aca35d3da16 +dnl I use this to find all the different instances of this file which +dnl are supposed to be synchronized. +dnl +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/m4m/gp-documentation.m4 b/m4m/gp-documentation.m4 new file mode 100644 index 0000000..c355f06 --- /dev/null +++ b/m4m/gp-documentation.m4 @@ -0,0 +1,149 @@ +dnl +dnl check where to install documentation +dnl +dnl determines documentation "root directory", i.e. the directory +dnl where all documentation will be placed in +dnl + +AC_DEFUN([GP_DOC_GENERAL],[dnl +AC_MSG_CHECKING([whether to build any docs]) +AC_ARG_ENABLE([docs], [dnl +AS_HELP_STRING([--disable-docs], [whether to create any documentation])], [dnl +case "$enableval" in + yes|true|on) gp_build_docs="yes" ;; + *) gp_build_docs="no" ;; +esac +],[dnl +gp_build_docs="yes" +])dnl +AC_MSG_RESULT([${gp_build_docs}]) +AM_CONDITIONAL([BUILD_DOCS], [test "x${gp_build_docs}" = "xyes"]) +])dnl + +AC_DEFUN([GP_CHECK_DOC_DIR], +[ +AC_REQUIRE([GP_DOC_GENERAL])dnl +AC_BEFORE([$0], [GP_BUILD_GTK_DOCS])dnl +AC_BEFORE([$0], [GP_CHECK_DOXYGEN])dnl + +AC_ARG_WITH([doc-dir], +[AS_HELP_STRING([--with-doc-dir=PATH], +[Where to install docs [default=autodetect]])]) + +# check for the main ("root") documentation directory +AC_MSG_CHECKING([main docdir]) + +if test "x${with_doc_dir}" != "x" +then # docdir is given as parameter + docdir="${with_doc_dir}" + AC_MSG_RESULT([${docdir} (from parameter)]) +else # otherwise invent a docdir hopefully compatible with system policy + if test -d "/usr/share/doc" + then + maindocdir='${prefix}/share/doc' + AC_MSG_RESULT([${maindocdir} (FHS style)]) + elif test -d "/usr/doc" + then + maindocdir='${prefix}/doc' + AC_MSG_RESULT([${maindocdir} (old style)]) + else + maindocdir='${datadir}/doc' + AC_MSG_RESULT([${maindocdir} (default value)]) + fi + AC_MSG_CHECKING([package docdir]) + # check whether to include package version into documentation path + # FIXME: doesn't work properly. + if ls -d /usr/{share/,}doc/make-[0-9]* > /dev/null 2>&1 + then + docdir="${maindocdir}/${PACKAGE}-${VERSION}" + AC_MSG_RESULT([${docdir} (redhat style)]) + else + docdir="${maindocdir}/${PACKAGE}" + AC_MSG_RESULT([${docdir} (default style)]) + fi +fi + +AC_SUBST([docdir]) +])dnl + +dnl +dnl check whether to build docs and where to: +dnl +dnl * determine presence of prerequisites (only gtk-doc for now) +dnl * determine destination directory for HTML files +dnl + +AC_DEFUN([GP_BUILD_GTK_DOCS], +[ +# docdir has to be determined in advance +AC_REQUIRE([GP_CHECK_DOC_DIR]) + +# --------------------------------------------------------------------------- +# gtk-doc: We use gtk-doc for building our documentation. However, we +# require the user to explicitely request the build. +# --------------------------------------------------------------------------- +try_gtkdoc=false +gtkdoc_msg="no (not requested)" +have_gtkdoc=false +AC_ARG_ENABLE([docs], +[AS_HELP_STRING([--enable-docs], +[Use gtk-doc to build documentation [default=no]])],[ + if test x$enableval = xyes; then + try_gtkdoc=true + fi +]) +if $try_gtkdoc; then + AC_PATH_PROG([GTKDOC],[gtkdoc-mkdb]) + if test -n "${GTKDOC}"; then + have_gtkdoc=true + gtkdoc_msg="yes" + else + gtkdoc_msg="no (http://www.gtk.org/rdp/download.html)" + fi +fi +AM_CONDITIONAL([ENABLE_GTK_DOC], [$have_gtkdoc]) +GP_CONFIG_MSG([build API docs with gtk-doc],[$gtkdoc_msg]) + + +# --------------------------------------------------------------------------- +# Give the user the possibility to install html documentation in a +# user-defined location. +# --------------------------------------------------------------------------- +AC_ARG_WITH([html-dir], +[AS_HELP_STRING([--with-html-dir=PATH], +[Where to install html docs [default=autodetect]])]) + +AC_MSG_CHECKING([for html dir]) +if test "x${with_html_dir}" = "x" ; then + htmldir="${docdir}/html" + AC_MSG_RESULT([${htmldir} (default)]) +else + htmldir="${with_html_dir}" + AC_MSG_RESULT([${htmldir} (from parameter)]) +fi +AC_SUBST([htmldir]) +apidocdir="${htmldir}/api" +AC_SUBST([apidocdir}]) + +])dnl + + +dnl doxygen related stuff +dnl look for tools +dnl define substitutions for Doxyfile.in +AC_DEFUN([GP_CHECK_DOXYGEN],[dnl +AC_REQUIRE([GP_CHECK_DOC_DIR])dnl +AC_PATH_PROG([DOT], [dot], [false]) +AC_PATH_PROG([DOXYGEN], [doxygen], [false]) +AM_CONDITIONAL([HAVE_DOXYGEN], [test "x$DOXYGEN" != "xfalse"]) +AM_CONDITIONAL([HAVE_DOT], [test "x$DOT" != "xfalse"]) +if test "x$DOT" != "xfalse"; then + AC_SUBST([HAVE_DOT],[YES]) +else + AC_SUBST([HAVE_DOT],[NO]) +fi +AC_SUBST([HTML_APIDOC_DIR], ["${PACKAGE_TARNAME}-api.html"]) +AC_SUBST([DOXYGEN_OUTPUT_DIR], [doxygen-output]) +AC_SUBST([HTML_APIDOC_INTERNALS_DIR], ["${PACKAGE_TARNAME}-internals.html"]) +])dnl + diff --git a/m4m/gp-gettext-hack.m4 b/m4m/gp-gettext-hack.m4 new file mode 100644 index 0000000..0c6635a --- /dev/null +++ b/m4m/gp-gettext-hack.m4 @@ -0,0 +1,82 @@ +dnl +dnl GP_GETTEXT_HACK +dnl +dnl gettext hack, originally designed for libexif, libgphoto2, and Co. +dnl This creates a po/Makevars file with adequate values if the +dnl po/Makevars.template is present. +dnl +dnl Example usage: +dnl GP_GETTEXT_HACK([${PACKAGE_TARNAME}-${LIBFOO_CURRENT}], +dnl [Copyright Holder], +dnl [foo-translation@example.org]) +dnl ALL_LINGUAS="de es fr" +dnl AM_GNU_GETTEXT_VERSION([0.14.1]) +dnl AM_GNU_GETTEXT([external]) +dnl AM_PO_SUBDIRS() +dnl AM_ICONV() +dnl GP_GETTEXT_FLAGS +dnl +dnl You can leave out the GP_GETTEXT_HACK parameters if you want to, +dnl GP_GETTEXT_HACK will try fall back to sensible values in that case: +dnl + +AC_DEFUN([GP_GETTEXT_HACK], +[ +AC_BEFORE([$0], [AM_GNU_GETTEXT])dnl +AC_BEFORE([$0], [AM_GNU_GETTEXT_VERSION])dnl +m4_if([$1],[],[GETTEXT_PACKAGE="${PACKAGE_TARNAME}"],[GETTEXT_PACKAGE="$1"]) +# The gettext domain we're using +AM_CPPFLAGS="$AM_CPPFLAGS -DGETTEXT_PACKAGE=\\\"${GETTEXT_PACKAGE}\\\"" +AC_SUBST([GETTEXT_PACKAGE]) +sed_cmds="s|^DOMAIN.*|DOMAIN = ${GETTEXT_PACKAGE}|" +m4_if([$2],[],[],[sed_cmds="${sed_cmds};s|^COPYRIGHT_HOLDER.*|COPYRIGHT_HOLDER = $2|"]) +m4_ifval([$3],[ +sed_mb="$3" +],[ +if test -n "$PACKAGE_BUGREPORT"; then + sed_mb="${PACKAGE_BUGREPORT}" +else + AC_MSG_ERROR([ +*** Your configure.{ac,in} is wrong. +*** Either define PACKAGE_BUGREPORT (by using the 4-parameter AC INIT syntax) +*** or give [GP_GETTEXT_HACK] the third parameter. +*** +]) +fi +]) +sed_cmds="${sed_cmds};s|^MSGID_BUGS_ADDRESS.*|MSGID_BUGS_ADDRESS = ${sed_mb}|" +# Not so sure whether this hack is all *that* evil... +AC_MSG_CHECKING([for po/Makevars requiring hack]) +if test -f "${srcdir}/po/Makevars.template"; then + sed "$sed_cmds" < "${srcdir}/po/Makevars.template" > "${srcdir}/po/Makevars" + AC_MSG_RESULT([yes, done.]) +else + AC_MSG_RESULT([no]) +fi +]) + +AC_DEFUN([GP_GETTEXT_FLAGS], +[ +AC_REQUIRE([AM_GNU_GETTEXT]) +AC_REQUIRE([GP_CONFIG_INIT]) +if test "x${BUILD_INCLUDED_LIBINTL}" = "xyes"; then + AM_CFLAGS="${AM_CFLAGS} -I\$(top_srcdir)/intl" +fi +GP_CONFIG_MSG([Use translations],[${USE_NLS}]) +if test "x$USE_NLS" = "xyes" && test "${BUILD_INCLUDED_LIBINTL}"; then + GP_CONFIG_MSG([Use included libintl],[${BUILD_INCLUDED_LIBINTL}]) +fi +dnl We cannot use AC_DEFINE_UNQUOTED() for these definitions, as +dnl we require make to do insert the proper $(datadir) value +AC_SUBST([localedir], ['$(datadir)/locale']) +AM_CPPFLAGS="$AM_CPPFLAGS -DLOCALEDIR=\\\"${localedir}\\\"" +]) + +dnl Please do not remove this: +dnl filetype: 71ff3941-a5ae-4677-a369-d7cb01f92c81 +dnl I use this to find all the different instances of this file which +dnl are supposed to be synchronized. + +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/m4m/gp-packaging.m4 b/m4m/gp-packaging.m4 new file mode 100644 index 0000000..163ece3 --- /dev/null +++ b/m4m/gp-packaging.m4 @@ -0,0 +1,74 @@ +AC_DEFUN([GPKG_CHECK_RPM], +[ +AC_ARG_WITH([rpmbuild], +[AS_HELP_STRING([--with-rpmbuild=PATH], +[Program to use for building RPMs])]) + +if test -x "${with_rpmbuild}" +then + RPMBUILD="${with_rpmbuild}" + AC_MSG_CHECKING([for rpmbuild or rpm]) + AC_MSG_RESULT([${RPMBUILD} (from parameter)]) +else + AC_MSG_RESULT([using autodetection]) + AC_CHECK_PROGS(RPMBUILD, [rpmbuild rpm], false) + AC_MSG_CHECKING([for rpmbuild or rpm]) + AC_MSG_RESULT([${RPMBUILD} (autodetected)]) +fi +AC_SUBST([RPMBUILD]) +AM_CONDITIONAL([ENABLE_RPM], [test "$RPMBUILD" != "false"]) + +# whether libusb-devel is installed or not defines whether the RPM +# packages we're going to build will depend on libusb and libusb-devel +# RPM packages or not. +AM_CONDITIONAL([RPM_LIBUSB_DEVEL], [rpm -q libusb-devel > /dev/null 2>&1]) +]) + +AC_DEFUN([GPKG_CHECK_LINUX], +[ + # effective_target has to be determined in advance + AC_REQUIRE([AC_NEED_BYTEORDER_H]) + + is_linux=false + case "$effective_target" in + *linux*) + is_linux=true + ;; + esac + AM_CONDITIONAL([HAVE_LINUX], ["$is_linux"]) + + # required for docdir + # FIXME: Implicit dependency + # AC_REQUIRE(GP_CHECK_DOC_DIR) + + AC_ARG_WITH([hotplug-doc-dir], + [AS_HELP_STRING([--with-hotplug-doc-dir=PATH], + [Where to install hotplug scripts as docs [default=autodetect]])]) + + AC_MSG_CHECKING([for hotplug doc dir]) + if test "x${with_hotplug_doc_dir}" != "x" + then # given as parameter + hotplugdocdir="${with_hotplug_doc_dir}" + AC_MSG_RESULT([${hotplugdocdir} (from parameter)]) + else # start at docdir + hotplugdocdir="${docdir}/linux-hotplug" + AC_MSG_RESULT([${hotplugdocdir} (default)]) + fi + AC_SUBST([hotplugdocdir]) + + AC_ARG_WITH([hotplug-usermap-dir], + [AS_HELP_STRING([--with-hotplug-usermap-dir=PATH], + [Where to install hotplug scripts as docs [default=autodetect]])]) + + AC_MSG_CHECKING([for hotplug usermap dir]) + if test "x${with_hotplug_usermap_dir}" != "x" + then # given as parameter + hotplugusermapdir="${with_hotplug_usermap_dir}" + AC_MSG_RESULT([${hotplugusermapdir} (from parameter)]) + else # start at docdir + hotplugusermapdir="${docdir}/linux-hotplug" + AC_MSG_RESULT([${hotplugusermapdir} (default)]) + fi + + AC_SUBST([hotplugusermapdir]) +]) diff --git a/m4m/gp-pkg-config.m4 b/m4m/gp-pkg-config.m4 new file mode 100644 index 0000000..531bfe4 --- /dev/null +++ b/m4m/gp-pkg-config.m4 @@ -0,0 +1,42 @@ +dnl @synopsis GP_PKG_CONFIG +dnl +dnl If you want to set the PKG_CONFIG_PATH, best do so before +dnl calling GP_PKG_CONFIG +AC_DEFUN([GP_PKG_CONFIG],[ +# +# [GP_PKG_CONFIG] +# +AC_ARG_VAR([PKG_CONFIG],[pkg-config package config utility]) +export PKG_CONFIG +AC_ARG_VAR([PKG_CONFIG_PATH],[directory where pkg-config looks for *.pc files]) +export PKG_CONFIG_PATH + +AC_MSG_CHECKING([PKG_CONFIG_PATH]) +if test "x${PKG_CONFIG_PATH}" = "x"; then + AC_MSG_RESULT([empty]) +else + AC_MSG_RESULT([${PKG_CONFIG_PATH}]) +fi + +dnl AC_REQUIRE([PKG_CHECK_MODULES]) +AC_PATH_PROG([PKG_CONFIG],[pkg-config],[false]) +if test "$PKG_CONFIG" = "false"; then +AC_MSG_ERROR([ +*** Build requires pkg-config +*** +*** Possible solutions: +*** - set PKG_CONFIG to where your pkg-config is located +*** - set PATH to include the directory where pkg-config is installed +*** - get it from http://freedesktop.org/software/pkgconfig/ and install it +]) +fi +])dnl + +dnl Please do not remove this: +dnl filetype: d87b877b-80ec-447c-b042-21ec4a27c6f0 +dnl I use this to find all the different instances of this file which +dnl are supposed to be synchronized. + +dnl Local Variables: +dnl mode: autoconf +dnl End: diff --git a/m4m/gp-references.m4 b/m4m/gp-references.m4 new file mode 100644 index 0000000..fca98f1 --- /dev/null +++ b/m4m/gp-references.m4 @@ -0,0 +1,48 @@ +dnl +dnl Define external references +dnl +dnl Define once, use many times. +dnl No more URLs and Mail addresses in translated strings and stuff. +dnl + +AC_DEFUN([GP_REF],[ +AC_SUBST([$1],["$2"]) +AC_DEFINE_UNQUOTED([$1],["$2"],[$3]) +]) + +AC_DEFUN([GP_REFERENCES], +[ + +GP_REF( [URL_GPHOTO_HOME], + [http://www.gphoto.org/], + [gphoto project home page])dnl + +GP_REF( [URL_GPHOTO_PROJECT], + [http://sourceforge.net/projects/gphoto], + [gphoto sourceforge project page]) + +GP_REF( [URL_DIGICAM_LIST], + [http://www.teaser.fr/~hfiguiere/linux/digicam.html], + [camera list with support status]) + +GP_REF( [URL_JPHOTO_HOME], + [http://jphoto.sourceforge.net/], + [jphoto home page]) + +GP_REF( [URL_USB_MASSSTORAGE], + [http://www.linux-usb.org/USB-guide/x498.html], + [information about using USB mass storage]) + +GP_REF( [MAIL_GPHOTO_DEVEL], + [<gphoto-devel@lists.sourceforge.net>], + [gphoto development mailing list]) + +GP_REF( [MAIL_GPHOTO_USER], + [<gphoto-user@lists.sourceforge.net>], + [gphoto user mailing list]) + +GP_REF( [MAIL_GPHOTO_TRANSLATION], + [<gphoto-translation@lists.sourceforge.net>], + [gphoto translation mailing list]) + +]) diff --git a/m4m/stdint.m4 b/m4m/stdint.m4 new file mode 100644 index 0000000..f95b28c --- /dev/null +++ b/m4m/stdint.m4 @@ -0,0 +1,734 @@ +dnl AC_NEED_STDINT_H ( HEADER-TO-GENERATE ) +dnl Copyright 2001-2002 by Dan Fandrich <dan@coneharvesters.com> +dnl This file may be copied and used freely without restrictions. No warranty +dnl is expressed or implied. +dnl +dnl Look for a header file that defines size-specific integer types like the +dnl ones recommended to be in stdint.h in the C99 standard (e.g. uint32_t). +dnl This is a dumbed-down version of the macro of the same name in the file +dnl ac_need_stdint_h.m4 which is part of the ac-archive, available at +dnl <URL:http://ac-archive.sourceforge.net/> (also, another macro +dnl AC_CREATE_STDINT_H by the same author). This version is not as smart, +dnl but works on older autoconf versions and has a different license. + +dnl AX_CHECK_DEFINED_TYPE ( TYPE, FILE, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND ) +dnl This is similar to _AC_CHECK_TYPE_NEW (a.k.a. new syntax version of +dnl AC_CHECK_TYPE) in autoconf 2.50 but works on older versions +AC_DEFUN([AX_CHECK_DEFINED_TYPE], +[AC_MSG_CHECKING([for $1 in $2]) +AC_EGREP_CPP(changequote(<<,>>)dnl +<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl +changequote([,]), [#include <$2>], +ac_cv_type_$1=yes, ac_cv_type_$1=no)dnl +AC_MSG_RESULT($ac_cv_type_$1) +if test $ac_cv_type_$1 = yes; then + $3 +else + $4 +fi +]) + +dnl Look for a header file that defines size-specific integer types +AC_DEFUN([AX_NEED_STDINT_H], +[ +changequote(, )dnl +ac_dir=`echo "$1"|sed 's%/[^/][^/]*$%%'` +changequote([, ])dnl +if test "$ac_dir" != "$1" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" +fi + +AX_CHECK_DEFINED_TYPE(uint8_t, +stdint.h, +[ +cat > "$1" <<EOF +/* This file is generated automatically by configure */ +#include <stdint.h> +EOF], +[AX_CHECK_DEFINED_TYPE(uint8_t, +inttypes.h, +[cat > "$1" <<EOF +/* This file is generated automatically by configure */ +#include <inttypes.h> +EOF], +[AX_CHECK_DEFINED_TYPE(uint8_t, +sys/types.h, +[cat > "$1" <<EOF +/* This file is generated automatically by configure */ +#include <sys/types.h> +EOF], +[AX_CHECK_DEFINED_TYPE(u_int8_t, +sys/types.h, +[cat > "$1" <<EOF +/* This file is generated automatically by configure */ +#ifndef __STDINT_H +#define __STDINT_H +#include <sys/types.h> +typedef u_int8_t uint8_t; +typedef u_int16_t uint16_t; +typedef u_int32_t uint32_t; +EOF + +AX_CHECK_DEFINED_TYPE(u_int64_t, +sys/types.h, +[cat >> "$1" <<EOF +typedef u_int64_t uint64_t; +#endif /*!__STDINT_H*/ +EOF], +[cat >> "$1" <<EOF +/* 64-bit types are not available on this system */ +/* typedef u_int64_t uint64_t; */ +#endif /*!__STDINT_H*/ +EOF]) + +], +[AC_MSG_WARN([I can't find size-specific integer definitions on this system]) +if test -e "$1" ; then + rm -f "$1" +fi +])])])])dnl +]) + +AC_DEFUN([AX_CHECK_DATA_MODEL],[ + AC_CHECK_SIZEOF(char) + AC_CHECK_SIZEOF(short) + AC_CHECK_SIZEOF(int) + AC_CHECK_SIZEOF(long) + AC_CHECK_SIZEOF(void*) + ac_cv_char_data_model="" + ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_char" + ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_short" + ac_cv_char_data_model="$ac_cv_char_data_model$ac_cv_sizeof_int" + ac_cv_long_data_model="" + ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_int" + ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_long" + ac_cv_long_data_model="$ac_cv_long_data_model$ac_cv_sizeof_voidp" + AC_MSG_CHECKING([data model]) + case "$ac_cv_char_data_model/$ac_cv_long_data_model" in + 122/242) ac_cv_data_model="IP16" ; n="standard 16bit machine" ;; + 122/244) ac_cv_data_model="LP32" ; n="standard 32bit machine" ;; + 122/*) ac_cv_data_model="i16" ; n="unusual int16 model" ;; + 124/444) ac_cv_data_model="ILP32" ; n="standard 32bit unixish" ;; + 124/488) ac_cv_data_model="LP64" ; n="standard 64bit unixish" ;; + 124/448) ac_cv_data_model="LLP64" ; n="unusual 64bit unixish" ;; + 124/*) ac_cv_data_model="i32" ; n="unusual int32 model" ;; + 128/888) ac_cv_data_model="ILP64" ; n="unusual 64bit numeric" ;; + 128/*) ac_cv_data_model="i64" ; n="unusual int64 model" ;; + 222/*2) ac_cv_data_model="DSP16" ; n="strict 16bit dsptype" ;; + 333/*3) ac_cv_data_model="DSP24" ; n="strict 24bit dsptype" ;; + 444/*4) ac_cv_data_model="DSP32" ; n="strict 32bit dsptype" ;; + 666/*6) ac_cv_data_model="DSP48" ; n="strict 48bit dsptype" ;; + 888/*8) ac_cv_data_model="DSP64" ; n="strict 64bit dsptype" ;; + 222/*|333/*|444/*|666/*|888/*) : + ac_cv_data_model="iDSP" ; n="unusual dsptype" ;; + *) ac_cv_data_model="none" ; n="very unusual model" ;; + esac + AC_MSG_RESULT([$ac_cv_data_model ($ac_cv_long_data_model, $n)]) +]) + +dnl AX_CHECK_HEADER_STDINT_X([HEADERLIST][,ACTION-IF]) +AC_DEFUN([AX_CHECK_HEADER_STDINT_X],[ +AC_CACHE_CHECK([for stdint uintptr_t], [ac_cv_header_stdint_x],[ + ac_cv_header_stdint_x="" # the 1997 typedefs (inttypes.h) + AC_MSG_RESULT([(..)]) + for i in m4_ifval([$1],[$1],[stdint.h inttypes.h sys/inttypes.h]) ; do + unset ac_cv_type_uintptr_t + unset ac_cv_type_uint64_t + AC_CHECK_TYPE(uintptr_t,[ac_cv_header_stdint_x=$i],continue,[#include <$i>]) + AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>]) + m4_ifvaln([$1],[$1]) break + done + AC_MSG_CHECKING([for stdint uintptr_t]) + ]) +]) + +AC_DEFUN([AX_CHECK_HEADER_STDINT_O],[ +AC_CACHE_CHECK([for stdint uint32_t], [ac_cv_header_stdint_o],[ + ac_cv_header_stdint_o="" # the 1995 typedefs (sys/inttypes.h) + AC_MSG_RESULT([(..)]) + for i in m4_ifval([$1],[$1],[inttypes.h sys/inttypes.h stdint.h]) ; do + unset ac_cv_type_uint32_t + unset ac_cv_type_uint64_t + AC_CHECK_TYPE(uint32_t,[ac_cv_header_stdint_o=$i],continue,[#include <$i>]) + AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>]) + m4_ifvaln([$1],[$1]) break + break; + done + AC_MSG_CHECKING([for stdint uint32_t]) + ]) +]) + +AC_DEFUN([AX_CHECK_HEADER_STDINT_U],[ +AC_CACHE_CHECK([for stdint u_int32_t], [ac_cv_header_stdint_u],[ + ac_cv_header_stdint_u="" # the BSD typedefs (sys/types.h) + AC_MSG_RESULT([(..)]) + for i in m4_ifval([$1],[$1],[sys/types.h inttypes.h sys/inttypes.h]) ; do + unset ac_cv_type_u_int32_t + unset ac_cv_type_u_int64_t + AC_CHECK_TYPE(u_int32_t,[ac_cv_header_stdint_u=$i],continue,[#include <$i>]) + AC_CHECK_TYPE(u_int64_t,[and64="/u_int64_t"],[and64=""],[#include<$i>]) + m4_ifvaln([$1],[$1]) break + break; + done + AC_MSG_CHECKING([for stdint u_int32_t]) + ]) +]) + +AC_DEFUN([AX_CREATE_STDINT_H], +[# ------ AX CREATE STDINT H ------------------------------------- +AC_MSG_CHECKING([for stdint types]) +ac_stdint_h=`echo ifelse($1, , _stdint.h, $1)` +# try to shortcircuit - if the default include path of the compiler +# can find a "stdint.h" header then we assume that all compilers can. +AC_CACHE_VAL([ac_cv_header_stdint_t],[ +old_CXXFLAGS="$CXXFLAGS" ; CXXFLAGS="" +old_CPPFLAGS="$CPPFLAGS" ; CPPFLAGS="" +old_CFLAGS="$CFLAGS" ; CFLAGS="" +AC_TRY_COMPILE([#include <stdint.h>],[int_least32_t v = 0;], +[ac_cv_stdint_result="(assuming C99 compatible system)" + ac_cv_header_stdint_t="stdint.h"; ], +[ac_cv_header_stdint_t=""]) +CXXFLAGS="$old_CXXFLAGS" +CPPFLAGS="$old_CPPFLAGS" +CFLAGS="$old_CFLAGS" ]) + +v="... $ac_cv_header_stdint_h" +if test "$ac_stdint_h" = "stdint.h" ; then + AC_MSG_RESULT([(are you sure you want them in ./stdint.h?)]) +elif test "$ac_stdint_h" = "inttypes.h" ; then + AC_MSG_RESULT([(are you sure you want them in ./inttypes.h?)]) +elif test "_$ac_cv_header_stdint_t" = "_" ; then + AC_MSG_RESULT([(putting them into $ac_stdint_h)$v]) +else + ac_cv_header_stdint="$ac_cv_header_stdint_t" + AC_MSG_RESULT([$ac_cv_header_stdint (shortcircuit)]) +fi + +if test "_$ac_cv_header_stdint_t" = "_" ; then # can not shortcircuit.. + +dnl .....intro message done, now do a few system checks..... +dnl btw, all old CHECK_TYPE macros do automatically "DEFINE" a type, +dnl therefore we use the autoconf implementation detail CHECK_TYPE_NEW +dnl instead that is triggered with 3 or more arguments (see types.m4) + +inttype_headers=`echo $2 | sed -e 's/,/ /g'` + +ac_cv_stdint_result="(no helpful system typedefs seen)" +AX_CHECK_HEADER_STDINT_X(dnl + stdint.h inttypes.h sys/inttypes.h $inttype_headers, + ac_cv_stdint_result="(seen uintptr_t$and64 in $i)") + +if test "_$ac_cv_header_stdint_x" = "_" ; then +AX_CHECK_HEADER_STDINT_O(dnl, + inttypes.h sys/inttypes.h stdint.h $inttype_headers, + ac_cv_stdint_result="(seen uint32_t$and64 in $i)") +fi + +if test "_$ac_cv_header_stdint_x" = "_" ; then +if test "_$ac_cv_header_stdint_o" = "_" ; then +AX_CHECK_HEADER_STDINT_U(dnl, + sys/types.h inttypes.h sys/inttypes.h $inttype_headers, + ac_cv_stdint_result="(seen u_int32_t$and64 in $i)") +fi fi + +dnl if there was no good C99 header file, do some typedef checks... +if test "_$ac_cv_header_stdint_x" = "_" ; then + AC_MSG_CHECKING([for stdint datatype model]) + AC_MSG_RESULT([(..)]) + AX_CHECK_DATA_MODEL +fi + +if test "_$ac_cv_header_stdint_x" != "_" ; then + ac_cv_header_stdint="$ac_cv_header_stdint_x" +elif test "_$ac_cv_header_stdint_o" != "_" ; then + ac_cv_header_stdint="$ac_cv_header_stdint_o" +elif test "_$ac_cv_header_stdint_u" != "_" ; then + ac_cv_header_stdint="$ac_cv_header_stdint_u" +else + ac_cv_header_stdint="stddef.h" +fi + +AC_MSG_CHECKING([for extra inttypes in chosen header]) +AC_MSG_RESULT([($ac_cv_header_stdint)]) +dnl see if int_least and int_fast types are present in _this_ header. +unset ac_cv_type_int_least32_t +unset ac_cv_type_int_fast32_t +AC_CHECK_TYPE(int_least32_t,,,[#include <$ac_cv_header_stdint>]) +AC_CHECK_TYPE(int_fast32_t,,,[#include<$ac_cv_header_stdint>]) +AC_CHECK_TYPE(intmax_t,,,[#include <$ac_cv_header_stdint>]) + +fi # shortcircut to system "stdint.h" +# ------------------ PREPARE VARIABLES ------------------------------ +if test "$GCC" = "yes" ; then +ac_cv_stdint_message="using gnu compiler "`$CC --version | head -1` +else +ac_cv_stdint_message="using $CC" +fi + +AC_MSG_RESULT([make use of $ac_cv_header_stdint in $ac_stdint_h dnl +$ac_cv_stdint_result]) + +dnl ----------------------------------------------------------------- +# ----------------- DONE inttypes.h checks START header ------------- +AC_CONFIG_COMMANDS([$ac_stdint_h],[ +AC_MSG_NOTICE(creating $ac_stdint_h : $_ac_stdint_h) +ac_stdint=$tmp/_stdint.h + +echo "#ifndef" $_ac_stdint_h >$ac_stdint +echo "#define" $_ac_stdint_h "1" >>$ac_stdint +echo "#ifndef" _GENERATED_STDINT_H >>$ac_stdint +echo "#define" _GENERATED_STDINT_H '"'$PACKAGE $VERSION'"' >>$ac_stdint +echo "/* generated $ac_cv_stdint_message */" >>$ac_stdint +if test "_$ac_cv_header_stdint_t" != "_" ; then +echo "#define _STDINT_HAVE_STDINT_H" "1" >>$ac_stdint +echo "#include <stdint.h>" >>$ac_stdint +echo "#endif" >>$ac_stdint +echo "#endif" >>$ac_stdint +else + +cat >>$ac_stdint <<STDINT_EOF + +/* ................... shortcircuit part ........................... */ + +#if defined HAVE_STDINT_H || defined _STDINT_HAVE_STDINT_H +#include <stdint.h> +#else +#include <stddef.h> + +/* .................... configured part ............................ */ + +STDINT_EOF + +echo "/* whether we have a C99 compatible stdint header file */" >>$ac_stdint +if test "_$ac_cv_header_stdint_x" != "_" ; then + ac_header="$ac_cv_header_stdint_x" + echo "#define _STDINT_HEADER_INTPTR" '"'"$ac_header"'"' >>$ac_stdint +else + echo "/* #undef _STDINT_HEADER_INTPTR */" >>$ac_stdint +fi + +echo "/* whether we have a C96 compatible inttypes header file */" >>$ac_stdint +if test "_$ac_cv_header_stdint_o" != "_" ; then + ac_header="$ac_cv_header_stdint_o" + echo "#define _STDINT_HEADER_UINT32" '"'"$ac_header"'"' >>$ac_stdint +else + echo "/* #undef _STDINT_HEADER_UINT32 */" >>$ac_stdint +fi + +echo "/* whether we have a BSD compatible inet types header */" >>$ac_stdint +if test "_$ac_cv_header_stdint_u" != "_" ; then + ac_header="$ac_cv_header_stdint_u" + echo "#define _STDINT_HEADER_U_INT32" '"'"$ac_header"'"' >>$ac_stdint +else + echo "/* #undef _STDINT_HEADER_U_INT32 */" >>$ac_stdint +fi + +echo "" >>$ac_stdint + +if test "_$ac_header" != "_" ; then if test "$ac_header" != "stddef.h" ; then + echo "#include <$ac_header>" >>$ac_stdint + echo "" >>$ac_stdint +fi fi + +echo "/* which 64bit typedef has been found */" >>$ac_stdint +if test "$ac_cv_type_uint64_t" = "yes" ; then +echo "#define _STDINT_HAVE_UINT64_T" "1" >>$ac_stdint +else +echo "/* #undef _STDINT_HAVE_UINT64_T */" >>$ac_stdint +fi +if test "$ac_cv_type_u_int64_t" = "yes" ; then +echo "#define _STDINT_HAVE_U_INT64_T" "1" >>$ac_stdint +else +echo "/* #undef _STDINT_HAVE_U_INT64_T */" >>$ac_stdint +fi +echo "" >>$ac_stdint + +echo "/* which type model has been detected */" >>$ac_stdint +if test "_$ac_cv_char_data_model" != "_" ; then +echo "#define _STDINT_CHAR_MODEL" "$ac_cv_char_data_model" >>$ac_stdint +echo "#define _STDINT_LONG_MODEL" "$ac_cv_long_data_model" >>$ac_stdint +else +echo "/* #undef _STDINT_CHAR_MODEL // skipped */" >>$ac_stdint +echo "/* #undef _STDINT_LONG_MODEL // skipped */" >>$ac_stdint +fi +echo "" >>$ac_stdint + +echo "/* whether int_least types were detected */" >>$ac_stdint +if test "$ac_cv_type_int_least32_t" = "yes"; then +echo "#define _STDINT_HAVE_INT_LEAST32_T" "1" >>$ac_stdint +else +echo "/* #undef _STDINT_HAVE_INT_LEAST32_T */" >>$ac_stdint +fi +echo "/* whether int_fast types were detected */" >>$ac_stdint +if test "$ac_cv_type_int_fast32_t" = "yes"; then +echo "#define _STDINT_HAVE_INT_FAST32_T" "1" >>$ac_stdint +else +echo "/* #undef _STDINT_HAVE_INT_FAST32_T */" >>$ac_stdint +fi +echo "/* whether intmax_t type was detected */" >>$ac_stdint +if test "$ac_cv_type_intmax_t" = "yes"; then +echo "#define _STDINT_HAVE_INTMAX_T" "1" >>$ac_stdint +else +echo "/* #undef _STDINT_HAVE_INTMAX_T */" >>$ac_stdint +fi +echo "" >>$ac_stdint + + cat >>$ac_stdint <<STDINT_EOF +/* .................... detections part ............................ */ + +/* whether we need to define bitspecific types from compiler base types */ +#ifndef _STDINT_HEADER_INTPTR +#ifndef _STDINT_HEADER_UINT32 +#ifndef _STDINT_HEADER_U_INT32 +#define _STDINT_NEED_INT_MODEL_T +#else +#define _STDINT_HAVE_U_INT_TYPES +#endif +#endif +#endif + +#ifdef _STDINT_HAVE_U_INT_TYPES +#undef _STDINT_NEED_INT_MODEL_T +#endif + +#ifdef _STDINT_CHAR_MODEL +#if _STDINT_CHAR_MODEL+0 == 122 || _STDINT_CHAR_MODEL+0 == 124 +#ifndef _STDINT_BYTE_MODEL +#define _STDINT_BYTE_MODEL 12 +#endif +#endif +#endif + +#ifndef _STDINT_HAVE_INT_LEAST32_T +#define _STDINT_NEED_INT_LEAST_T +#endif + +#ifndef _STDINT_HAVE_INT_FAST32_T +#define _STDINT_NEED_INT_FAST_T +#endif + +#ifndef _STDINT_HEADER_INTPTR +#define _STDINT_NEED_INTPTR_T +#ifndef _STDINT_HAVE_INTMAX_T +#define _STDINT_NEED_INTMAX_T +#endif +#endif + + +/* .................... definition part ............................ */ + +/* some system headers have good uint64_t */ +#ifndef _HAVE_UINT64_T +#if defined _STDINT_HAVE_UINT64_T || defined HAVE_UINT64_T +#define _HAVE_UINT64_T +#elif defined _STDINT_HAVE_U_INT64_T || defined HAVE_U_INT64_T +#define _HAVE_UINT64_T +typedef u_int64_t uint64_t; +#endif +#endif + +#ifndef _HAVE_UINT64_T +/* .. here are some common heuristics using compiler runtime specifics */ +#if defined __STDC_VERSION__ && defined __STDC_VERSION__ >= 199901L +#define _HAVE_UINT64_T +#define _HAVE_LONGLONG_UINT64_T +typedef long long int64_t; +typedef unsigned long long uint64_t; + +#elif !defined __STRICT_ANSI__ +#if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__ +#define _HAVE_UINT64_T +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; + +#elif defined __GNUC__ || defined __MWERKS__ || defined __ELF__ +/* note: all ELF-systems seem to have loff-support which needs 64-bit */ +#if !defined _NO_LONGLONG +#define _HAVE_UINT64_T +#define _HAVE_LONGLONG_UINT64_T +typedef long long int64_t; +typedef unsigned long long uint64_t; +#endif + +#elif defined __alpha || (defined __mips && defined _ABIN32) +#if !defined _NO_LONGLONG +typedef long int64_t; +typedef unsigned long uint64_t; +#endif + /* compiler/cpu type to define int64_t */ +#endif +#endif +#endif + +#if defined _STDINT_HAVE_U_INT_TYPES +/* int8_t int16_t int32_t defined by inet code, redeclare the u_intXX types */ +typedef u_int8_t uint8_t; +typedef u_int16_t uint16_t; +typedef u_int32_t uint32_t; + +/* glibc compatibility */ +#ifndef __int8_t_defined +#define __int8_t_defined +#endif +#endif + +#ifdef _STDINT_NEED_INT_MODEL_T +/* we must guess all the basic types. Apart from byte-adressable system, */ +/* there a few 32-bit-only dsp-systems that we guard with BYTE_MODEL 8-} */ +/* (btw, those nibble-addressable systems are way off, or so we assume) */ + +dnl /* have a look at "64bit and data size neutrality" at */ +dnl /* http://unix.org/version2/whatsnew/login_64bit.html */ +dnl /* (the shorthand "ILP" types always have a "P" part) */ + +#if defined _STDINT_BYTE_MODEL +#if _STDINT_LONG_MODEL+0 == 242 +/* 2:4:2 = IP16 = a normal 16-bit system */ +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned long uint32_t; +#ifndef __int8_t_defined +#define __int8_t_defined +typedef char int8_t; +typedef short int16_t; +typedef long int32_t; +#endif +#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL == 444 +/* 2:4:4 = LP32 = a 32-bit system derived from a 16-bit */ +/* 4:4:4 = ILP32 = a normal 32-bit system */ +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +#ifndef __int8_t_defined +#define __int8_t_defined +typedef char int8_t; +typedef short int16_t; +typedef int int32_t; +#endif +#elif _STDINT_LONG_MODEL+0 == 484 || _STDINT_LONG_MODEL+0 == 488 +/* 4:8:4 = IP32 = a 32-bit system prepared for 64-bit */ +/* 4:8:8 = LP64 = a normal 64-bit system */ +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +#ifndef __int8_t_defined +#define __int8_t_defined +typedef char int8_t; +typedef short int16_t; +typedef int int32_t; +#endif +/* this system has a "long" of 64bit */ +#ifndef _HAVE_UINT64_T +#define _HAVE_UINT64_T +typedef unsigned long uint64_t; +typedef long int64_t; +#endif +#elif _STDINT_LONG_MODEL+0 == 448 +/* LLP64 a 64-bit system derived from a 32-bit system */ +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +#ifndef __int8_t_defined +#define __int8_t_defined +typedef char int8_t; +typedef short int16_t; +typedef int int32_t; +#endif +/* assuming the system has a "long long" */ +#ifndef _HAVE_UINT64_T +#define _HAVE_UINT64_T +#define _HAVE_LONGLONG_UINT64_T +typedef unsigned long long uint64_t; +typedef long long int64_t; +#endif +#else +#define _STDINT_NO_INT32_T +#endif +#else +#define _STDINT_NO_INT8_T +#define _STDINT_NO_INT32_T +#endif +#endif + +/* + * quote from SunOS-5.8 sys/inttypes.h: + * Use at your own risk. As of February 1996, the committee is squarely + * behind the fixed sized types; the "least" and "fast" types are still being + * discussed. The probability that the "fast" types may be removed before + * the standard is finalized is high enough that they are not currently + * implemented. + */ + +#if defined _STDINT_NEED_INT_LEAST_T +typedef int8_t int_least8_t; +typedef int16_t int_least16_t; +typedef int32_t int_least32_t; +#ifdef _HAVE_UINT64_T +typedef int64_t int_least64_t; +#endif + +typedef uint8_t uint_least8_t; +typedef uint16_t uint_least16_t; +typedef uint32_t uint_least32_t; +#ifdef _HAVE_UINT64_T +typedef uint64_t uint_least64_t; +#endif + /* least types */ +#endif + +#if defined _STDINT_NEED_INT_FAST_T +typedef int8_t int_fast8_t; +typedef int int_fast16_t; +typedef int32_t int_fast32_t; +#ifdef _HAVE_UINT64_T +typedef int64_t int_fast64_t; +#endif + +typedef uint8_t uint_fast8_t; +typedef unsigned uint_fast16_t; +typedef uint32_t uint_fast32_t; +#ifdef _HAVE_UINT64_T +typedef uint64_t uint_fast64_t; +#endif + /* fast types */ +#endif + +#ifdef _STDINT_NEED_INTMAX_T +#ifdef _HAVE_UINT64_T +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; +#else +typedef long intmax_t; +typedef unsigned long uintmax_t; +#endif +#endif + +#ifdef _STDINT_NEED_INTPTR_T +#ifndef __intptr_t_defined +#define __intptr_t_defined +/* we encourage using "long" to store pointer values, never use "int" ! */ +#if _STDINT_LONG_MODEL+0 == 242 || _STDINT_LONG_MODEL+0 == 484 +typedef unsinged int uintptr_t; +typedef int intptr_t; +#elif _STDINT_LONG_MODEL+0 == 244 || _STDINT_LONG_MODEL+0 == 444 +typedef unsigned long uintptr_t; +typedef long intptr_t; +#elif _STDINT_LONG_MODEL+0 == 448 && defined _HAVE_UINT64_T +typedef uint64_t uintptr_t; +typedef int64_t intptr_t; +#else /* matches typical system types ILP32 and LP64 - but not IP16 or LLP64 */ +typedef unsigned long uintptr_t; +typedef long intptr_t; +#endif +#endif +#endif + +/* The ISO C99 standard specifies that in C++ implementations these + should only be defined if explicitly requested. */ +#if !defined __cplusplus || defined __STDC_CONSTANT_MACROS +#ifndef UINT32_C + +/* Signed. */ +# define INT8_C(c) c +# define INT16_C(c) c +# define INT32_C(c) c +# ifdef _HAVE_LONGLONG_UINT64_T +# define INT64_C(c) c ## L +# else +# define INT64_C(c) c ## LL +# endif + +/* Unsigned. */ +# define UINT8_C(c) c ## U +# define UINT16_C(c) c ## U +# define UINT32_C(c) c ## U +# ifdef _HAVE_LONGLONG_UINT64_T +# define UINT64_C(c) c ## UL +# else +# define UINT64_C(c) c ## ULL +# endif + +/* Maximal type. */ +# ifdef _HAVE_LONGLONG_UINT64_T +# define INTMAX_C(c) c ## L +# define UINTMAX_C(c) c ## UL +# else +# define INTMAX_C(c) c ## LL +# define UINTMAX_C(c) c ## ULL +# endif + + /* literalnumbers */ +#endif +#endif + +/* These limits are merily those of a two complement byte-oriented system */ + +/* Minimum of signed integral types. */ +# define INT8_MIN (-128) +# define INT16_MIN (-32767-1) +# define INT32_MIN (-2147483647-1) +# define INT64_MIN (-__INT64_C(9223372036854775807)-1) +/* Maximum of signed integral types. */ +# define INT8_MAX (127) +# define INT16_MAX (32767) +# define INT32_MAX (2147483647) +# define INT64_MAX (__INT64_C(9223372036854775807)) + +/* Maximum of unsigned integral types. */ +# define UINT8_MAX (255) +# define UINT16_MAX (65535) +# define UINT32_MAX (4294967295U) +# define UINT64_MAX (__UINT64_C(18446744073709551615)) + +/* Minimum of signed integral types having a minimum size. */ +# define INT_LEAST8_MIN INT8_MIN +# define INT_LEAST16_MIN INT16_MIN +# define INT_LEAST32_MIN INT32_MIN +# define INT_LEAST64_MIN INT64_MIN +/* Maximum of signed integral types having a minimum size. */ +# define INT_LEAST8_MAX INT8_MAX +# define INT_LEAST16_MAX INT16_MAX +# define INT_LEAST32_MAX INT32_MAX +# define INT_LEAST64_MAX INT64_MAX + +/* Maximum of unsigned integral types having a minimum size. */ +# define UINT_LEAST8_MAX UINT8_MAX +# define UINT_LEAST16_MAX UINT16_MAX +# define UINT_LEAST32_MAX UINT32_MAX +# define UINT_LEAST64_MAX UINT64_MAX + + /* shortcircuit*/ +#endif + /* once */ +#endif +#endif +STDINT_EOF +fi + if cmp -s $ac_stdint_h $ac_stdint 2>/dev/null; then + AC_MSG_NOTICE([$ac_stdint_h is unchanged]) + else + ac_dir=`AS_DIRNAME(["$ac_stdint_h"])` + AS_MKDIR_P(["$ac_dir"]) + rm -f $ac_stdint_h + mv $ac_stdint $ac_stdint_h + fi +],[# variables for create stdint.h replacement +PACKAGE="$PACKAGE" +VERSION="$VERSION" +ac_stdint_h="$ac_stdint_h" +_ac_stdint_h=AS_TR_CPP(_$PACKAGE-$ac_stdint_h) +ac_cv_stdint_message="$ac_cv_stdint_message" +ac_cv_header_stdint_t="$ac_cv_header_stdint_t" +ac_cv_header_stdint_x="$ac_cv_header_stdint_x" +ac_cv_header_stdint_o="$ac_cv_header_stdint_o" +ac_cv_header_stdint_u="$ac_cv_header_stdint_u" +ac_cv_type_uint64_t="$ac_cv_type_uint64_t" +ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t" +ac_cv_char_data_model="$ac_cv_char_data_model" +ac_cv_long_data_model="$ac_cv_long_data_model" +ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t" +ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t" +ac_cv_type_intmax_t="$ac_cv_type_intmax_t" +]) +]) |