diff --git a/ChangeLog b/ChangeLog index 99c64a20f..6a4c00b35 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2017-11-24 Werner Lemberg + + [unix] Install a massaged `ftoption.h' file (#51780). + + * builds/unix/configure.raw (ftoption_set, ftoption_unset): New + auxiliary functions to construct... + (FTOPTION_H_SED): ... this new variable. + Apply it as a sed argument while copying `ftoption.h' to the + `builds/unix' directory (using `AC_CONFIG_FILES'). + Simplify code of test that checks cpp's computation of bit length + (the test previously created an empty `ftoption.h' file and deleted + it immediately afterwards); without this change, it can happen on my + GNU/Linux box that `configure's execution of `config.status' doesn't + create `ftoption.h' (no idea why this happens). + + * builds/unix/install.mk (install): Install + `builds/unix/ftoption.h'. + + * builds/unix/unix-def.in (DISTCLEAN): Updated. + + * builds/unix/.gitignore: Updated. + 2017-11-23 Tor Andersson Silence unused function warnings (#52465). diff --git a/builds/unix/.gitignore b/builds/unix/.gitignore index e4e0a12c6..f89b226b8 100644 --- a/builds/unix/.gitignore +++ b/builds/unix/.gitignore @@ -10,6 +10,7 @@ configure.ac freetype2.pc freetype-config ftconfig.h +ftoption.h install-sh libtool ltmain.sh diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw index d91a73266..466c0ca00 100644 --- a/builds/unix/configure.raw +++ b/builds/unix/configure.raw @@ -112,15 +112,13 @@ AC_TYPE_LONG_LONG_INT AC_MSG_CHECKING([whether cpp computation of bit length in ftconfig.in works]) orig_CPPFLAGS="${CPPFLAGS}" -CPPFLAGS="-I${srcdir} -I. ${CPPFLAGS}" +CPPFLAGS="-I${srcdir} -I. -I${srcdir}/../../include/freetype/config ${CPPFLAGS}" ac_clean_files= -for f in ft2build.h ftoption.h ftstdlib.h; do - if test ! -f $f; then - ac_clean_files="$ac_clean_files $f" - touch $f - fi -done +if test ! -f ft2build.h; then + ac_clean_files=ft2build.h + touch ft2build.h +fi cat > conftest.c <<\_ACEOF #include @@ -977,27 +975,63 @@ AC_SUBST([build_libtool_libs]) # changing LDFLAGS value should only be done after # lt_cv_prog_compiler_static_works test -if test "$have_zlib" != no; then - CFLAGS="$CFLAGS $ZLIB_CFLAGS -DFT_CONFIG_OPTION_SYSTEM_ZLIB" - LDFLAGS="$LDFLAGS $ZLIB_LIBS" -fi +ftoption_set() +{ + regexp="-e \\\"s|.*#.*def.*$1.*|#define $1|\\\"" + FTOPTION_H_SED="$FTOPTION_H_SED $regexp" +} +ftoption_unset() +{ + regexp="-e \\\"s|.*#.*def.*$1.*|/* #undef $1 */|\\\"" + FTOPTION_H_SED="$FTOPTION_H_SED $regexp" +} + +if test "$have_zlib" != no; then + CFLAGS="$CFLAGS $ZLIB_CFLAGS" + LDFLAGS="$LDFLAGS $ZLIB_LIBS" + ftoption_set FT_CONFIG_OPTION_SYSTEM_ZLIB +else + ftoption_unset FT_CONFIG_OPTION_SYSTEM_ZLIB +fi if test "$have_bzip2" != no; then - CFLAGS="$CFLAGS $BZIP2_CFLAGS -DFT_CONFIG_OPTION_USE_BZIP2" + CFLAGS="$CFLAGS $BZIP2_CFLAGS" LDFLAGS="$LDFLAGS $BZIP2_LIBS" + ftoption_set FT_CONFIG_OPTION_USE_BZIP2 +else + ftoption_unset FT_CONFIG_OPTION_USE_BZIP2 fi if test "$have_libpng" != no; then - CFLAGS="$CFLAGS $LIBPNG_CFLAGS -DFT_CONFIG_OPTION_USE_PNG" + CFLAGS="$CFLAGS $LIBPNG_CFLAGS" LDFLAGS="$LDFLAGS $LIBPNG_LIBS" + ftoption_set FT_CONFIG_OPTION_USE_PNG +else + ftoption_unset FT_CONFIG_OPTION_USE_PNG fi if test "$have_harfbuzz" != no; then - CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS -DFT_CONFIG_OPTION_USE_HARFBUZZ" + CFLAGS="$CFLAGS $HARFBUZZ_CFLAGS" LDFLAGS="$LDFLAGS $HARFBUZZ_LIBS" + ftoption_set FT_CONFIG_OPTION_USE_HARFBUZZ +else + ftoption_unset FT_CONFIG_OPTION_USE_HARFBUZZ fi AC_SUBST([CFLAGS]) AC_SUBST([LDFLAGS]) +# We don't want to use a template file for `ftoption.h', since compilation +# should work without calling a configure script also. For this reason, we +# copy the `include/freetype/config/ftoption.h' file to the `unix/builds' +# directory (using a dummy `AC_CONFIG_FILES' call) and apply the just +# constructed $FTOPTION_H_SED regexp (using the post-action of +# `AC_CONFIG_FILES'); this is also the version that gets installed later on. +# +AC_CONFIG_FILES([ftoption.h:${srcdir}/../../include/freetype/config/ftoption.h], + [mv ftoption.h ftoption.tmp + eval "sed $FTOPTION_H_SED < ftoption.tmp > ftoption.h" + rm ftoption.tmp], + [FTOPTION_H_SED="$FTOPTION_H_SED"]) + # configuration file -- stay in 8.3 limit # # since #undef doesn't survive in configuration header files we replace diff --git a/builds/unix/install.mk b/builds/unix/install.mk index fae486cb3..35d50aac5 100644 --- a/builds/unix/install.mk +++ b/builds/unix/install.mk @@ -30,6 +30,9 @@ # # We also remove `$(includedir)/ft2build.h' for the same reason. # +# Note that some header files get handled twice for simplicity; a special, +# configured version overwrites the generic one. +# install: $(PROJECT_LIBRARY) -$(DELDIR) $(DESTDIR)$(includedir)/freetype2 -$(DELETE) $(DESTDIR)$(includedir)/ft2build.h @@ -55,6 +58,8 @@ install: $(PROJECT_LIBRARY) $(DESTDIR)$(includedir)/freetype2/freetype/config/ftconfig.h $(INSTALL_DATA) $(OBJ_DIR)/ftmodule.h \ $(DESTDIR)$(includedir)/freetype2/freetype/config/ftmodule.h + $(INSTALL_DATA) $(OBJ_BUILD)/ftoption.h \ + $(DESTDIR)$(includedir)/freetype2/freetype/config/ftoption.h $(INSTALL_SCRIPT) -m 755 $(OBJ_BUILD)/freetype-config \ $(DESTDIR)$(bindir)/freetype-config $(INSTALL_SCRIPT) -m 644 $(BUILD_DIR)/freetype2.m4 \ diff --git a/builds/unix/unix-def.in b/builds/unix/unix-def.in index 34e06e380..5de36efab 100644 --- a/builds/unix/unix-def.in +++ b/builds/unix/unix-def.in @@ -43,6 +43,7 @@ DISTCLEAN += $(OBJ_BUILD)/config.cache \ $(OBJ_BUILD)/unix-def.mk \ $(OBJ_BUILD)/unix-cc.mk \ $(OBJ_BUILD)/ftconfig.h \ + $(OBJ_BUILD)/ftoption.h \ $(LIBTOOL) \ $(OBJ_BUILD)/Makefile diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index 3d5e5a453..fbee57352 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -211,6 +211,10 @@ FT_BEGIN_HEADER /* Do not #undef this macro here since the build system might define */ /* it for certain configurations only. */ /* */ + /* If you use a build system like cmake or the `configure' script, */ + /* options set by those programs have precendence, overwriting the */ + /* value here with the configured one. */ + /* */ /* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */ @@ -227,6 +231,10 @@ FT_BEGIN_HEADER /* */ /* Define this macro if you want to enable this `feature'. */ /* */ + /* If you use a build system like cmake or the `configure' script, */ + /* options set by those programs have precendence, overwriting the */ + /* value here with the configured one. */ + /* */ /* #define FT_CONFIG_OPTION_USE_BZIP2 */ @@ -252,6 +260,10 @@ FT_BEGIN_HEADER /* */ /* Define this macro if you want to enable this `feature'. */ /* */ + /* If you use a build system like cmake or the `configure' script, */ + /* options set by those programs have precendence, overwriting the */ + /* value here with the configured one. */ + /* */ /* #define FT_CONFIG_OPTION_USE_PNG */ @@ -265,6 +277,10 @@ FT_BEGIN_HEADER /* */ /* Define this macro if you want to enable this `feature'. */ /* */ + /* If you use a build system like cmake or the `configure' script, */ + /* options set by those programs have precendence, overwriting the */ + /* value here with the configured one. */ + /* */ /* #define FT_CONFIG_OPTION_USE_HARFBUZZ */