This catches clang in a clang specific C preprocessor conditional
before clang gets a chance to mess up at pretending to be gcc.
The camlibs/pentax/js0n.c state machine tables use a lot of both
GNU style range designators [ a ... b ], and later overrides some
of the values in the range. This is not very pure C, but relatively
effient to code, so we can accept silencing some warnings here.
Fixes: https://github.com/gphoto/libgphoto2/issues/761
This rewrites the variadic macro PTP_CNT_INIT() and the ptp_init_container()
function such that they compile with the strictest compiler available:
clang -std=c99 -pedantic -Wall -Wextra -Weverything
This is achieved by moving the code argument to be the first of the
variable arguments, and adapting the parameter counting and argument
handling inside ptp_init_container() accordingly.
As the code in ptp_init_container() which handles the va_args and puts
them into PTPContainer Param<N> fields relies on a particular memory
layout of the PTPContainer struct, this adds compile time assertions
which check the memory layout is the one the code expects.
Closes: https://github.com/gphoto/libgphoto2/pull/740
Update the checks for libjpeg to try libjpeg.pc with
PKG_CHECK_MODULES first, and also to allow explicitly
set LIBJPEG_CFLAGS and LIBJPEG_LIBS.
The old detection logic did not allow specifying the location
of libjpeg at all. It only allowed either disabling libjpeg
or using libjpeg from the default include and linker paths.
So this also changes the places in the Makefiles where we
used to add @LIBJPEG@ to the linker to both link with
$(LIBJPEG_LIBS) and compile with $(LIBJPEG_CFLAGS).
The new configure logic keeps --without-jpeg to force-
disable libjpeg, but updates the detection of libjpeg
to first try the LIBJPEG_* variables if given, otherwise
try PKG_CHECK_MODULES for libjpeg, and only then falls
back to the old way of just trying the default include
and link locations for libjpeg.
This mentions more information in the configure summary
if not building with libjpeg.
This is the first time we make it possible to build with
libjpeg from e.g. FreeBSD ports' or MacOS homebrew's
jpeg-turbo packages.
Add remaining source files including libgphoto2/i18n.h
or libgphoto2_port/i18n.h to the respective POTFILES.in,
regardless of whether or not the source file actually
contains translated strings.
Factor out the i18n definitions into i18n.h include files:
One include file each for libgphoto2 and for libgphoto2_port.
This removes the complete
#ifdef ENABLE_NLS
# include <libintl.h>
# undef _
# define _(String) dgettext (GETTEXT_PACKAGE, String)
# ifdef gettext_noop
# define N_(String) gettext_noop (String)
# else
# define N_(String) (String)
# endif
#else
# define _(String) (String)
# define N_(String) (String)
#endif
block (which in some occasions defines even more macros)
and replaces it with a single line
#include "libgphoto2/i18n.h"
for camlibs and libgphoto2 itself and with
#include "libgphoto2_port/i18n.h"
for iolibs and libgphoto2_port itself.
This gives us two central locations to change the defintions.