Skip to content

Commit

Permalink
Merge pull request #1708 from kleisauke/out-of-source
Browse files Browse the repository at this point in the history
Fix out-of-source build issues
  • Loading branch information
jcupitt committed Jul 10, 2020
2 parents 97eb2e5 + b84e87b commit 84d0d5a
Show file tree
Hide file tree
Showing 11 changed files with 120 additions and 162 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -52,6 +52,8 @@ libtool
libvips/include/vips/version.h
fred
ltmain.sh
m4/glib-gettext.m4
m4/pkg.m4
m4/gtk-doc.m4
m4/intltool.m4
m4/libtool.m4
Expand Down
88 changes: 32 additions & 56 deletions autogen.sh
@@ -1,66 +1,42 @@
#!/bin/sh
# Based on: https://wiki.gnome.org/Projects/GnomeCommon/Migration#autogen.sh
# Run this to generate all the initial makefiles, etc.
test -n "$srcdir" || srcdir=$(dirname "$0")
test -n "$srcdir" || srcdir=.

# set -x
olddir=$(pwd)

# a bunch of cleaning up ... make certain everything will be regenerated
rm -f Makefile Makefile.in aclocal.m4
rm -rf autom4te.cache
cd $srcdir

# remove m4/ macros put there by libtool etc.
rm -f m4/libtool.m4
rm -f m4/lt~obsolete.m4
rm -f m4/ltoptions.m4
rm -f m4/ltsugar.m4
rm -f m4/ltversion.m4
rm -f m4/gtk-doc.m4
(test -f configure.ac) || {
echo "*** ERROR: Directory '$srcdir' does not look like the top-level project directory ***"
exit 1
}

rm -f config.* configure depcomp
rm -f install-sh intltool-* libtool ltmain.sh missing mkinstalldirs
rm -f stamp-*
rm -f benchmark/temp*
find doc -depth \( \
-path doc/libvips-docs.xml.in \
-o -path doc/Makefile.am \
-o -path 'doc/images/*' \
-o -name '*.xml' ! -name libvips-docs.xml ! -path 'doc/xml/*' \
-o -name '*.py' \
-o -name '*.md' \
-o -name '*.docbook' \
\) -prune -or \( \
-type f \
-o -type d -empty \
\) -delete
# shellcheck disable=SC2016
PKG_NAME=$(autoconf --trace 'AC_INIT:$1' configure.ac)

ACDIR=`aclocal --print-ac-dir`
# OS X with brew has a dirlist in ACDIR that points to several directories
# dirlist supports wildcards, but that would require eval ... which is evil
if [ -e $ACDIR/dirlist ]; then
ACDIR=`cat $ACDIR/dirlist`
if [ "$#" = 0 -a "x$NOCONFIGURE" = "x" ]; then
echo "*** WARNING: I am going to run 'configure' with no arguments." >&2
echo "*** If you wish to pass any to it, please specify them on the" >&2
echo "*** '$0' command line." >&2
echo "" >&2
fi

aclocal -I m4 --install || exit 1
glib-gettextize --force --copy > /dev/null || exit 1
gtkdocize --copy --docdir doc --flavour no-tmpl || exit 1

# some systems need libtoolize, some glibtoolize ... how annoying
printf "testing for glibtoolize ... "
if glibtoolize --version >/dev/null 2>&1; then
LIBTOOLIZE=glibtoolize
echo using glibtoolize
else
LIBTOOLIZE=libtoolize
echo using libtoolize
fi

test -r aclocal.m4 || touch aclocal.m4
# gettextize produces quite a bit of benign and misleading text output, hide
# it ... hopefully any errors will go to stderr and not be hidden
glib-gettextize --force --copy > /dev/null
test -r aclocal.m4 && chmod u+w aclocal.m4
aclocal -I m4
autoconf
autoheader
$LIBTOOLIZE --copy --force --automake
automake --add-missing --copy

if test -z "$NOCONFIGURE"; then
./configure $*
autoreconf --verbose --force --install -Wno-portability || exit 1

cd "$olddir"
if [ "$NOCONFIGURE" = "" ]; then
$srcdir/configure "$@" || exit 1

if [ "$1" = "--help" ]; then
exit 0
else
echo "Now type 'make' to compile $PKG_NAME" || exit 1
fi
else
echo "Skipping configure process."
fi
111 changes: 46 additions & 65 deletions configure.ac
Expand Up @@ -9,10 +9,10 @@ AC_PREREQ(2.62)
# gobject-introspection recommends -Wno-portability
# foreign stops complaints about a missing README (we use README.md instead)
# and missing INSTALL (the standard Gnu INSTALL is not very useful)
# subdir-objects lets us have dumy.cc in a subdir
# subdir-objects lets us have dummy.cc in a subdir
AM_INIT_AUTOMAKE([-Wno-portability foreign subdir-objects])

AC_CONFIG_HEADERS(config.h)
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])

# user-visible library versioning
Expand All @@ -26,7 +26,7 @@ VIPS_MAJOR_VERSION=vips_major_version()
VIPS_MINOR_VERSION=vips_minor_version()
VIPS_MICRO_VERSION=vips_micro_version()
VIPS_VERSION=vips_version()
VIPS_VERSION_STRING=$VIPS_VERSION-`date -u -r ChangeLog`
VIPS_VERSION_STRING=$VIPS_VERSION-`date -u -r $srcdir/ChangeLog`

# libtool library versioning ... not user-visible (except as part of the
# library file name) and does not correspond to major/minor/micro above
Expand Down Expand Up @@ -56,41 +56,20 @@ AC_SUBST(LIBRARY_AGE)
# init introspection support
GOBJECT_INTROSPECTION_CHECK([1.30.0])

# remove the '(disabled, use --enable-introspection to enable)'
# suffix from the found_introspection variable
if test "x$found_introspection" != x"yes"; then
found_introspection=no
fi

# gir needs a list of source files to scan for introspection
#
# build with a glob and a list of files to exclude from scanning
# see also IGNORE_HFILES in doc/Makefile.am
introspection_sources=$(cd libvips ; find . -name "*.c"; find . -name "*.cpp")
filter_list="deprecated introspect.c dummy.c fuzz "

# contains(string, substring)
#
# Returns 0 if the specified string contains the specified substring,
# otherwise returns 1.
contains() {
string="$1"
substring="$2"
if test x"${string#*$substring}" != x"$string"; then
return 0 # $substring is in $string
else
return 1 # $substring is not in $string
fi
}

introspection_sources2=
introspection_sources=$(cd $srcdir/libvips ; find . -path ./deprecated -prune -o -name dummy.c -prune -o -name introspect.c -prune -o \( -name "*.c" -o -name "*.cpp" \) -print)
for name in $introspection_sources; do
found=0
for filter in $filter_list; do
if contains $name ${filter}; then
found=1
fi
done

if [[ $found -eq 0 ]]; then
introspection_sources2="$introspection_sources2 $name"
fi
done
vips_introspection_sources="$introspection_sources2"
vips_introspection_sources="$vips_introspection_sources $name"
done

# add headers that form the public vips8 API .. don't do a find and exclude,
# we end up excluding almost everything argh
Expand Down Expand Up @@ -156,6 +135,7 @@ if test x"$enable_deprecated" != x"no"; then
VIPS_ENABLE_DEPRECATED=1
enable_deprecated=yes
fi
AC_DEFINE_UNQUOTED(ENABLE_DEPRECATED,$VIPS_ENABLE_DEPRECATED,[define to build deprecated components])
AM_CONDITIONAL(ENABLE_DEPRECATED, [test x"$enable_deprecated" = x"yes"])

# this gets pasted into version.h as a #define
Expand Down Expand Up @@ -1324,7 +1304,7 @@ VIPS_LIBS="$ZLIB_LIBS $HEIF_LIBS $MAGICK_LIBS $SPNG_LIBS $PNG_LIBS $IMAGEQUANT_L

# autoconf hates multi-line AC_SUBST so we have to have another copy of this
# thing
VIPS_CONFIG="native win32: $vips_os_win32, native OS X: $vips_os_darwin, open files in binary mode: $vips_binary_open, enable debug: $enable_debug, enable deprecated library components: $enable_deprecated, enable docs with gtkdoc: $enable_gtk_doc, gobject introspection: $found_introspection, enable radiance support: $with_radiance, enable analyze support: $with_analyze, enable PPM support: $with_ppm, use fftw3 for FFT: $with_fftw, Magick package: $with_magickpackage, Magick API version: $magick_version, load with libMagick: $enable_magickload, save with libMagick: $enable_magicksave, accelerate loops with orc: $with_orc, ICC profile support with lcms: $with_lcms, file import with niftiio: $with_nifti, file import with libheif: $with_heif, file import with OpenEXR: $with_OpenEXR, file import with OpenSlide: $with_openslide, file import with matio: $with_matio, PDF import with PDFium: $with_pdfium, PDF import with poppler-glib: $with_poppler, SVG import with librsvg-2.0: $with_rsvg, zlib: $with_zlib, file import with cfitsio: $with_cfitsio, file import/export with libwebp: $with_libwebp, text rendering with pangoft2: $with_pangoft2, file import/export with libpng: $with_png, support 8bpp PNG quantisation: $with_imagequant, file import/export with libtiff: $with_tiff, file import/export with giflib: $with_giflib, file import/export with libjpeg: $with_jpeg, image pyramid export: $with_gsf, use libexif to load/save JPEG metadata: $with_libexif, file import/export with libspng: $with_libspng"
VIPS_CONFIG="native win32: $vips_os_win32, native OS X: $vips_os_darwin, open files in binary mode: $vips_binary_open, enable debug: $enable_debug, enable deprecated library components: $enable_deprecated, enable docs with gtkdoc: $enable_gtk_doc, gobject introspection: $found_introspection, enable radiance support: $with_radiance, enable analyze support: $with_analyze, enable PPM support: $with_ppm, use fftw3 for FFT: $with_fftw, Magick package: $with_magickpackage, Magick API version: $magick_version, load with libMagick: $enable_magickload, save with libMagick: $enable_magicksave, accelerate loops with orc: $with_orc, ICC profile support with lcms: $with_lcms, file import with niftiio: $with_nifti, file import with libheif: $with_heif, file import with OpenEXR: $with_OpenEXR, file import with OpenSlide: $with_openslide, file import with matio: $with_matio, PDF import with PDFium: $with_pdfium, PDF import with poppler-glib: $with_poppler, SVG import with librsvg-2.0: $with_rsvg, zlib: $with_zlib, file import with cfitsio: $with_cfitsio, file import/export with libwebp: $with_libwebp, text rendering with pangoft2: $with_pangoft2, file import/export with libspng: $with_libspng, file import/export with libpng: $with_png, support 8bpp PNG quantisation: $with_imagequant, file import/export with libtiff: $with_tiff, file import/export with giflib: $with_giflib, file import/export with libjpeg: $with_jpeg, image pyramid export: $with_gsf, use libexif to load/save JPEG metadata: $with_libexif"

AC_SUBST(VIPS_LIBDIR)

Expand All @@ -1340,39 +1320,39 @@ AC_SUBST(EXTRA_LIBS_USED)
TOP_SRCDIR=$ac_pwd
AC_SUBST(TOP_SRCDIR)

AC_OUTPUT([
AC_CONFIG_FILES([
vips.pc
vips-cpp.pc
Makefile
libvips/include/vips/version.h
libvips/include/Makefile
libvips/include/vips/Makefile
libvips/Makefile
libvips/arithmetic/Makefile
libvips/colour/Makefile
libvips/colour/profiles/Makefile
libvips/conversion/Makefile
libvips/convolution/Makefile
libvips/deprecated/Makefile
libvips/foreign/Makefile
libvips/freqfilt/Makefile
libvips/histogram/Makefile
libvips/draw/Makefile
libvips/iofuncs/Makefile
libvips/morphology/Makefile
libvips/mosaicing/Makefile
libvips/create/Makefile
libvips/resample/Makefile
cplusplus/include/Makefile
cplusplus/include/vips/Makefile
cplusplus/Makefile
tools/Makefile
tools/batch_crop
tools/batch_image_convert
tools/batch_rubber_sheet
tools/light_correct
tools/shrink_width
test/Makefile
Makefile
$srcdir/libvips/include/vips/version.h
libvips/include/Makefile
libvips/include/vips/Makefile
libvips/Makefile
libvips/arithmetic/Makefile
libvips/colour/Makefile
libvips/colour/profiles/Makefile
libvips/conversion/Makefile
libvips/convolution/Makefile
libvips/deprecated/Makefile
libvips/foreign/Makefile
libvips/freqfilt/Makefile
libvips/histogram/Makefile
libvips/draw/Makefile
libvips/iofuncs/Makefile
libvips/morphology/Makefile
libvips/mosaicing/Makefile
libvips/create/Makefile
libvips/resample/Makefile
cplusplus/include/Makefile
cplusplus/include/vips/Makefile
cplusplus/Makefile
tools/Makefile
tools/batch_crop
tools/batch_image_convert
tools/batch_rubber_sheet
tools/light_correct
tools/shrink_width
test/Makefile
test/variables.sh
test/test-suite/Makefile
test/test-suite/helpers/Makefile
Expand All @@ -1382,6 +1362,7 @@ AC_OUTPUT([
po/Makefile.in
fuzz/Makefile
])
AC_OUTPUT

# also add any new items to VIPS_CONFIG above
AC_MSG_RESULT([dnl
Expand Down
17 changes: 3 additions & 14 deletions doc/Makefile.am
Expand Up @@ -81,10 +81,10 @@ IGNORE_VIPS_C = \
nary.h \
parithmetic.h \
statistic.h \
unaryconst.h \
unary.h \
CImg.h \
unaryconst.h \
pcolour.h \
profiles.h \
bandary.h \
pconversion.h \
correlation.h \
Expand All @@ -94,25 +94,14 @@ IGNORE_VIPS_C = \
point.h \
drawink.h \
pdraw.h \
analyze2vips.h \
csv.h \
dbh.h \
fits.h \
jpeg.h \
magick.h \
matlab.h \
openexr2vips.h \
openslide2vips.h \
ppm.h \
radiance.h \
pforeign.h \
tiff.h \
vipsjpeg.h \
vipspng.h \
webp.h \
pfreqfilt.h \
hist_unary.h \
phistogram.h \
base64.h \
sink.h \
vipsmarshal.h \
pmorphology.h \
Expand Down
7 changes: 4 additions & 3 deletions libvips/include/vips/Makefile.am
Expand Up @@ -45,10 +45,11 @@ pkginclude_HEADERS = \
thread.h \
transform.h \
util.h \
version.h \
vector.h \
vips7compat.h \
vips.h
vips.h

nodist_pkginclude_HEADERS = version.h

EXTRA_DIST = version.h.in internal.h enumtemplate

Expand All @@ -75,4 +76,4 @@ vips_scan_headers = \
${top_srcdir}/libvips/include/vips/region.h

enumtypes.h: $(vips_scan_headers) Makefile.am
glib-mkenums --template enumtemplate $(vips_scan_headers) > enumtypes.h
glib-mkenums --template ${top_srcdir}/libvips/include/vips/enumtemplate $(vips_scan_headers) > enumtypes.h
2 changes: 1 addition & 1 deletion libvips/iofuncs/Makefile.am
Expand Up @@ -79,4 +79,4 @@ vips_scan_headers = \
${top_srcdir}/libvips/include/vips/region.h

enumtypes.c: $(vips_scan_headers) Makefile.am
glib-mkenums --template enumtemplate $(vips_scan_headers) > enumtypes.c
glib-mkenums --template ${top_srcdir}/libvips/iofuncs/enumtemplate $(vips_scan_headers) > enumtypes.c
4 changes: 2 additions & 2 deletions libvips/iofuncs/image.c
Expand Up @@ -801,7 +801,7 @@ static void
vips_image_add_progress( VipsImage *image )
{
if( vips__progress ||
#if VIPS_ENABLE_DEPRECATED
#if ENABLE_DEPRECATED
g_getenv( "VIPS_PROGRESS" ) ||
g_getenv( "IM_PROGRESS" ) ) {
#else
Expand Down Expand Up @@ -2517,7 +2517,7 @@ vips_get_disc_threshold( void )
*/
threshold = 100 * 1024 * 1024;

#if VIPS_ENABLE_DEPRECATED
#if ENABLE_DEPRECATED
if( (env = g_getenv( "VIPS_DISC_THRESHOLD" )) ||
(env = g_getenv( "IM_DISC_THRESHOLD" )) )
#else
Expand Down

0 comments on commit 84d0d5a

Please sign in to comment.