itest for C++ compiler

automatically disable C++ support if no compiler found
This commit is contained in:
John Cupitt 2011-08-16 13:26:57 +01:00
parent 3383344a31
commit 11eb90cdb3
7 changed files with 34 additions and 56 deletions

View File

@ -2,6 +2,7 @@
- don't use G_VALUE_COLLECT_INIT(), many platforms do not have a glib this
recent
- don't leave image->kill set when we detect termination
- test for a working C++ compiler, disable C++ parts of none found
10/8/11 started 7.26.2
- oops, im_benchmark.c had some stuff turned off

2
TODO
View File

@ -1,5 +1,3 @@
- missing g++ does not make configure complain or disable C++ support ...
instead you get a fail during compilation
- scrap acinclude.m4 and put those macros into m4/

View File

@ -150,22 +150,40 @@ AC_PROG_INSTALL
AC_PROG_LN_S
AM_WITH_DMALLOC
# vips_PROG_CXX_WORKS
# Check whether the C++ compiler works.
AC_DEFUN([vips_PROG_CXX_WORKS],
[AC_REQUIRE([AC_PROG_CXX])dnl
AC_CACHE_CHECK([whether the C++ compiler works],
[vips_cv_prog_cxx_works],
[AC_LANG_PUSH([C++])
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
[vips_cv_prog_cxx_works=yes],
[vips_cv_prog_cxx_works=no])
AC_LANG_POP([C++])])
])
# option to build without C++
# handy for some embedded applications
# also, including C++ source causes link problems on some
# platforms, so have an option to disable it
AC_ARG_ENABLE(cxx,
AS_HELP_STRING([--enable-cxx], [build C++ components (default: enabled)]))
AS_HELP_STRING([--enable-cxx], [build C++ components (default: test)]))
if test x"$enable_cxx" != "xno"; then
AC_DEFINE(ENABLE_CXX,1,[build C++ components])
AM_CONDITIONAL(ENABLE_CXX, true)
# need -lstdc++ for (eg.) the C++ format loaders
# this gets added to vips-7.xx.pc to help mingw and friends link programs
# using libvips
VIPS_CXX_LIBS="-lstdc++"
enable_cxx=yes
else
if test x"$enable_cxx" != x"no"; then
vips_PROG_CXX_WORKS
if test x"$vips_cv_prog_cxx_works" = x"yes"; then
AC_DEFINE(ENABLE_CXX,1,[build C++ components])
AM_CONDITIONAL(ENABLE_CXX, true)
# need -lstdc++ for (eg.) the C++ format loaders
# this gets added to vips-7.xx.pc to help mingw and friends link programs
# using libvips
VIPS_CXX_LIBS="-lstdc++"
enable_cxx=yes
fi
fi
if test x"$enable_cxx" != x"yes"; then
AM_CONDITIONAL(ENABLE_CXX, false)
VIPS_CXX_LIBS=""
enable_cxx=no

View File

@ -36,7 +36,7 @@ lib_LTLIBRARIES = libvips.la
libvips_la_SOURCES = dummy.c
if ENABLE_CXX
libvips_la_SOURCES += dummy2.cc
libvips_la_SOURCES += cimg/dummy2.cc
endif
# DLLs need dependant libs there too ... put @VIPS_LIBS@ at the end

View File

@ -3,7 +3,7 @@ noinst_LTLIBRARIES = libcimg.la
libcimg_la_SOURCES = \
CImg.h \
cimg_dispatch.c \
cimg.cpp
cimg.cpp
# various cimg settings as well
# we need to change these a bit for win32
@ -21,4 +21,7 @@ AM_CPPFLAGS = \
-DLOCALEDIR=\""$(LOCALEDIR)"\"
endif
# used by the final libvips link rather than us
EXTRA_DIST = dummy2.cc
INCLUDES = -I${top_srcdir}/libvips/include @VIPS_CFLAGS@ @VIPS_INCLUDES@

View File

@ -1,42 +0,0 @@
Making install in include
make[1]: Entering directory `/home/john/GIT/libvips/libvips/include'
Making install in vips
make[2]: Entering directory `/home/john/GIT/libvips/libvips/include/vips'
glib-mkenums --template enumtemplate \
../../../libvips/include/vips/memory.h ../../../libvips/include/vips/util.h ../../../libvips/include/vips/buf.h ../../../libvips/include/vips/image.h ../../../libvips/include/vips/object.h > xgen-geth && \
( cmp -s xgen-geth enumtypes.h || cp xgen-geth enumtypes.h ) && \
rm -f xgen-geth
make[3]: Entering directory `/home/john/GIT/libvips/libvips/include/vips'
make[3]: Nothing to be done for `install-exec-am'.
glib-mkenums --template enumtemplate \
../../../libvips/include/vips/memory.h ../../../libvips/include/vips/util.h ../../../libvips/include/vips/buf.h ../../../libvips/include/vips/image.h ../../../libvips/include/vips/object.h > xgen-geth && \
( cmp -s xgen-geth enumtypes.h || cp xgen-geth enumtypes.h ) && \
rm -f xgen-geth
test -z "/home/john/vips/include/vips" || /bin/mkdir -p "/home/john/vips/include/vips"
/usr/bin/install -c -m 644 almostdeprecated.h deprecated.h arithmetic.h boolean.h buf.h colour.h conversion.h convolution.h debug.h dispatch.h disp.h enumtypes.h error.h operation.h format.h inplace.h generate.h header.h histograms_lut.h freq_filt.h image.h interpolate.h intl.h mask.h memory.h morphology.h mosaicing.h other.h video.h cimg_funcs.h object.h private.h rect.h region.h relational.h resample.h semaphore.h threadpool.h thread.h transform.h '/home/john/vips/include/vips'
/usr/bin/install -c -m 644 util.h version.h vector.h vips7compat.h vips.h '/home/john/vips/include/vips'
make[3]: Leaving directory `/home/john/GIT/libvips/libvips/include/vips'
make[2]: Leaving directory `/home/john/GIT/libvips/libvips/include/vips'
make[2]: Entering directory `/home/john/GIT/libvips/libvips/include'
make[3]: Entering directory `/home/john/GIT/libvips/libvips/include'
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
make[3]: Leaving directory `/home/john/GIT/libvips/libvips/include'
make[2]: Leaving directory `/home/john/GIT/libvips/libvips/include'
make[1]: Leaving directory `/home/john/GIT/libvips/libvips/include'
Making install in arithmetic
make[1]: Entering directory `/home/john/GIT/libvips/libvips/arithmetic'
/bin/bash ../../libtool --tag=CC --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -I../../libvips/include -DDEBUG_FATAL -DDEBUG_LEAK -pthread -fopenmp -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/libxml2 -I/usr/include/libpng12 -I/usr/include/libexif -I/usr/include/glib-2.0 -I/usr/include/freetype2 -I/usr/include/OpenEXR -I/usr/include/ImageMagick -I/home/john/vips/include/orc-0.4 -g -Wall -MT arith_dispatch.lo -MD -MP -MF .deps/arith_dispatch.Tpo -c -o arith_dispatch.lo arith_dispatch.c
libtool: compile: gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -I../../libvips/include -DDEBUG_FATAL -DDEBUG_LEAK -pthread -fopenmp -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/libxml2 -I/usr/include/libpng12 -I/usr/include/libexif -I/usr/include/glib-2.0 -I/usr/include/freetype2 -I/usr/include/OpenEXR -I/usr/include/ImageMagick -I/home/john/vips/include/orc-0.4 -g -Wall -MT arith_dispatch.lo -MD -MP -MF .deps/arith_dispatch.Tpo -c arith_dispatch.c -fPIC -DPIC -o .libs/arith_dispatch.o
libtool: compile: gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -I../../libvips/include -DDEBUG_FATAL -DDEBUG_LEAK -pthread -fopenmp -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/libxml2 -I/usr/include/libpng12 -I/usr/include/libexif -I/usr/include/glib-2.0 -I/usr/include/freetype2 -I/usr/include/OpenEXR -I/usr/include/ImageMagick -I/home/john/vips/include/orc-0.4 -g -Wall -MT arith_dispatch.lo -MD -MP -MF .deps/arith_dispatch.Tpo -c arith_dispatch.c -o arith_dispatch.o >/dev/null 2>&1
mv -f .deps/arith_dispatch.Tpo .deps/arith_dispatch.Plo
/bin/bash ../../libtool --tag=CC --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -I../../libvips/include -DDEBUG_FATAL -DDEBUG_LEAK -pthread -fopenmp -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/libxml2 -I/usr/include/libpng12 -I/usr/include/libexif -I/usr/include/glib-2.0 -I/usr/include/freetype2 -I/usr/include/OpenEXR -I/usr/include/ImageMagick -I/home/john/vips/include/orc-0.4 -g -Wall -MT im_abs.lo -MD -MP -MF .deps/im_abs.Tpo -c -o im_abs.lo im_abs.c
libtool: compile: gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -I../../libvips/include -DDEBUG_FATAL -DDEBUG_LEAK -pthread -fopenmp -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/libxml2 -I/usr/include/libpng12 -I/usr/include/libexif -I/usr/include/glib-2.0 -I/usr/include/freetype2 -I/usr/include/OpenEXR -I/usr/include/ImageMagick -I/home/john/vips/include/orc-0.4 -g -Wall -MT im_abs.lo -MD -MP -MF .deps/im_abs.Tpo -c im_abs.c -fPIC -DPIC -o .libs/im_abs.o
libtool: compile: gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -I../../libvips/include -DDEBUG_FATAL -DDEBUG_LEAK -pthread -fopenmp -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/libxml2 -I/usr/include/libpng12 -I/usr/include/libexif -I/usr/include/glib-2.0 -I/usr/include/freetype2 -I/usr/include/OpenEXR -I/usr/include/ImageMagick -I/home/john/vips/include/orc-0.4 -g -Wall -MT im_abs.lo -MD -MP -MF .deps/im_abs.Tpo -c im_abs.c -o im_abs.o >/dev/null 2>&1
mv -f .deps/im_abs.Tpo .deps/im_abs.Plo
/bin/bash ../../libtool --tag=CC --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -I../../libvips/include -DDEBUG_FATAL -DDEBUG_LEAK -pthread -fopenmp -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/libxml2 -I/usr/include/libpng12 -I/usr/include/libexif -I/usr/include/glib-2.0 -I/usr/include/freetype2 -I/usr/include/OpenEXR -I/usr/include/ImageMagick -I/home/john/vips/include/orc-0.4 -g -Wall -MT im_avg.lo -MD -MP -MF .deps/im_avg.Tpo -c -o im_avg.lo im_avg.c
libtool: compile: gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -I../../libvips/include -DDEBUG_FATAL -DDEBUG_LEAK -pthread -fopenmp -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/libxml2 -I/usr/include/libpng12 -I/usr/include/libexif -I/usr/include/glib-2.0 -I/usr/include/freetype2 -I/usr/include/OpenEXR -I/usr/include/ImageMagick -I/home/john/vips/include/orc-0.4 -g -Wall -MT im_avg.lo -MD -MP -MF .deps/im_avg.Tpo -c im_avg.c -fPIC -DPIC -o .libs/im_avg.o
libtool: compile: gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -I../../libvips/include -DDEBUG_FATAL -DDEBUG_LEAK -pthread -fopenmp -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/libxml2 -I/usr/include/libpng12 -I/usr/include/libexif -I/usr/include/glib-2.0 -I/usr/include/freetype2 -I/usr/include/OpenEXR -I/usr/include/ImageMagick -I/home/john/vips/include/orc-0.4 -g -Wall -MT im_avg.lo -MD -MP -MF .deps/im_avg.Tpo -c im_avg.c -o im_avg.o >/dev/null 2>&1
mv -f .deps/im_avg.Tpo .deps/im_avg.Plo
/bin/bash ../../libtool --tag=CC --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -I../../libvips/include -DDEBUG_FATAL -DDEBUG_LEAK -pthread -fopenmp -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/libxml2 -I/usr/include/libpng12 -I/usr/include/libexif -I/usr/include/glib-2.0 -I/usr/include/freetype2 -I/usr/include/OpenEXR -I/usr/include/ImageMagick -I/home/john/vips/include/orc-0.4 -g -Wall -MT im_bandmean.lo -MD -MP -MF .deps/im_bandmean.Tpo -c -o im_bandmean.lo im_bandmean.c
libtool: compile: gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -I../../libvips/include -DDEBUG_FATAL -DDEBUG_LEAK -pthread -fopenmp -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/libxml2 -I/usr/include/libpng12 -I/usr/include/libexif -I/usr/include/glib-2.0 -I/usr/include/freetype2 -I/usr/include/OpenEXR -I/usr/include/ImageMagick -I/home/john/vips/include/orc-0.4 -g -Wall -MT im_bandmean.lo -MD -MP -MF .deps/im_bandmean.Tpo -c im_bandmean.c -fPIC -DPIC -o .libs/im_bandmean.o