Compare commits
5 commits
master
...
check-depr
Author | SHA1 | Date | |
---|---|---|---|
|
aac3d34f2f | ||
|
c12f8e827d | ||
|
25fae1f789 | ||
|
42b0ff871a | ||
|
6ccf0ea362 |
1 changed files with 192 additions and 49 deletions
|
@ -604,6 +604,84 @@ set ${save_config_args}
|
|||
|
||||
# Whether to use Mac OS resource-based fonts.
|
||||
|
||||
# to prevent the dependency with the deprecated APIs on Mac OS X,
|
||||
# check the compiler flag to detect the declared deprecation.
|
||||
#
|
||||
# test the flag "-Werror=deprecated-declarations" availability.
|
||||
# test 1: test whether the compiler accepts __attribute__((deprecated)).
|
||||
# test 2: test whether the compiler passes normal source if the flag is given.
|
||||
# test 3: test whether the compiler passes normal source if -Werror is given.
|
||||
# test 4: test whether the compiler rejects the source using deprecated variable.
|
||||
|
||||
CFLAG_error_deprecated=""
|
||||
|
||||
# test 1
|
||||
AC_MSG_CHECKING([${CC} accepts __attribute__((deprecated))])
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([],[int x __attribute__((deprecated)); x = 0;])
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
ac_cc_attr_deprecated="yes"
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
ac_cc_attr_deprecated="no"
|
||||
])
|
||||
|
||||
# test 2
|
||||
if test "x${ac_cc_attr_deprecated}" = "xyes"; then
|
||||
AC_MSG_CHECKING([${CC} compiler flag -Werror=deprecated-declarations])
|
||||
orig_CFLAGS="${CFLAGS}"
|
||||
CFLAGS="${CFLAGS} -Werror=deprecated-declarations"
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([],[int x; x = 0;])
|
||||
],[ # test 2 success: -Werror=deprecated-declarations is available.
|
||||
AC_MSG_RESULT([supported])
|
||||
CFLAG_error_deprecated="-Werror=deprecated-declarations"
|
||||
],[ # test 2 failed: -Werror=deprecated-declarations is invalid flag.
|
||||
AC_MSG_RESULT([unavailable])
|
||||
CFLAG_error_deprecated=""
|
||||
])
|
||||
CFLAGS="${orig_CFLAGS}"
|
||||
fi
|
||||
|
||||
# test 3
|
||||
if test "x${ac_cc_attr_deprecated}" = "xyes" -a "x${CFLAG_error_deprecated}" = "x"; then
|
||||
AC_MSG_CHECKING([${CC} compiler flag -Werror])
|
||||
orig_CFLAGS="${CFLAGS}"
|
||||
CFLAGS="${CFLAGS} -Werror"
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([],[int x; x = 0;])
|
||||
],[ # test 3 success: -Werror is available.
|
||||
AC_MSG_RESULT([supported])
|
||||
CFLAG_error_deprecated="-Werror"
|
||||
],[ # test 2 failed: -Werror=deprecated-declarations is invalid flag.
|
||||
AC_MSG_RESULT([unavailable])
|
||||
CFLAG_error_deprecated=""
|
||||
])
|
||||
CFLAGS="${orig_CFLAGS}"
|
||||
fi
|
||||
|
||||
# test 4
|
||||
if test "x${ac_cc_attr_deprecated}" = "xyes" -a "x${CFLAG_error_deprecated}" != "x"; then
|
||||
AC_MSG_CHECKING([${CC} ${CFLAG_error_deprecated} works properly])
|
||||
orig_CFLAGS="${CFLAGS}"
|
||||
CFLAGS="${CFLAGS} ${CFLAG_error_deprecated}"
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([],[int x __attribute__((deprecated)); x = 0;])
|
||||
],[
|
||||
AC_MSG_RESULT([no]) # ${CFLAG_error_deprecated} cannot refuse a problematic source.
|
||||
CFLAG_error_deprecated=""
|
||||
],[
|
||||
AC_MSG_RESULT([yes]) # compiler refuses a problematic source.
|
||||
])
|
||||
CFLAGS="${orig_CFLAGS}"
|
||||
fi
|
||||
|
||||
if expr "${CC} ${CFLAGS} " : ".* -Wno-deprecated-declarations .*" > /dev/null; then
|
||||
AC_MSG_WARN([-Wno-deprecated-declaraions is given, some warnings would be hidden.])
|
||||
CFLAG_error_deprecated=""
|
||||
fi
|
||||
|
||||
ftmac_c="" # src/base/ftmac.c should not be included in makefiles by default
|
||||
|
||||
AC_ARG_WITH([old-mac-fonts],
|
||||
|
@ -613,7 +691,38 @@ if test x$with_old_mac_fonts = xyes; then
|
|||
orig_LDFLAGS="${LDFLAGS}"
|
||||
AC_MSG_CHECKING([CoreServices & ApplicationServices of Mac OS X])
|
||||
ft2_extra_libs="-Wl,-framework,CoreServices -Wl,-framework,ApplicationServices"
|
||||
LDFLAGS="$LDFLAGS $ft2_extra_libs"
|
||||
LDFLAGS="$LDFLAGS ${ft2_extra_libs}"
|
||||
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([
|
||||
|
||||
#if defined(__GNUC__) && defined(__APPLE_CC__)
|
||||
# include <CoreServices/CoreServices.h>
|
||||
# include <ApplicationServices/ApplicationServices.h>
|
||||
#else
|
||||
# include <ConditionalMacros.h>
|
||||
# include <Files.h>
|
||||
#endif
|
||||
|
||||
],
|
||||
[
|
||||
|
||||
short res = 0;
|
||||
|
||||
|
||||
UseResFile( res );
|
||||
|
||||
])
|
||||
],[
|
||||
AC_MSG_RESULT([available])
|
||||
],[
|
||||
AC_MSG_RESULT([not found])
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([whether UseRes() is deprecated])
|
||||
orig_CFLAGS="${CFLAGS}"
|
||||
CFLAGS="${CFLAGS} ${CFLAG_error_deprecated}"
|
||||
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([
|
||||
|
||||
|
@ -634,11 +743,12 @@ if test x$with_old_mac_fonts = xyes; then
|
|||
UseResFile( res );
|
||||
|
||||
])],
|
||||
[AC_MSG_RESULT([ok])
|
||||
[AC_MSG_RESULT([not deprecated])
|
||||
CFLAGS="${orig_CFLAGS}"
|
||||
ftmac_c='ftmac.c'
|
||||
AC_MSG_CHECKING([whether OS_INLINE macro is ANSI compatible])
|
||||
orig_CFLAGS="$CFLAGS -DFT_MACINTOSH"
|
||||
CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS"
|
||||
orig_CFLAGS="${CFLAGS} -DFT_MACINTOSH"
|
||||
CFLAGS="${CFLAGS} ${XX_CFLAGS} ${XX_ANSIFLAGS}"
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([
|
||||
|
||||
|
@ -662,15 +772,15 @@ if test x$with_old_mac_fonts = xyes; then
|
|||
|
||||
])],
|
||||
[AC_MSG_RESULT([ok])
|
||||
CFLAGS="$orig_CFLAGS"
|
||||
CFLAGS="$CFLAGS -DHAVE_ANSI_OS_INLINE=1"
|
||||
CFLAGS="${orig_CFLAGS}"
|
||||
CFLAGS="${CFLAGS} -DHAVE_ANSI_OS_INLINE=1"
|
||||
],
|
||||
[AC_MSG_RESULT([no, ANSI incompatible])
|
||||
CFLAGS="$orig_CFLAGS"
|
||||
CFLAGS="${orig_CFLAGS}"
|
||||
])
|
||||
AC_MSG_CHECKING([type ResourceIndex])
|
||||
orig_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS"
|
||||
orig_CFLAGS="${CFLAGS}"
|
||||
CFLAGS="${CFLAGS} ${XX_CFLAGS} ${XX_ANSIFLAGS}"
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([
|
||||
|
||||
|
@ -691,22 +801,23 @@ if test x$with_old_mac_fonts = xyes; then
|
|||
|
||||
])],
|
||||
[AC_MSG_RESULT([ok])
|
||||
CFLAGS="$orig_CFLAGS"
|
||||
CFLAGS="$CFLAGS -DHAVE_TYPE_RESOURCE_INDEX=1"
|
||||
CFLAGS="${orig_CFLAGS}"
|
||||
CFLAGS="${CFLAGS} -DHAVE_TYPE_RESOURCE_INDEX=1"
|
||||
],
|
||||
[AC_MSG_RESULT([no])
|
||||
CFLAGS="$orig_CFLAGS"
|
||||
CFLAGS="$CFLAGS -DHAVE_TYPE_RESOURCE_INDEX=0"
|
||||
CFLAGS="${orig_CFLAGS}"
|
||||
CFLAGS="${CFLAGS} -DHAVE_TYPE_RESOURCE_INDEX=0"
|
||||
])],
|
||||
[AC_MSG_RESULT([not found])
|
||||
[AC_MSG_RESULT([deprecated, Carbon API would not be used])
|
||||
CFLAGS="${orig_CFLAGS}"
|
||||
ft2_extra_libs=""
|
||||
LDFLAGS="${orig_LDFLAGS}"
|
||||
CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"])
|
||||
CFLAGS="${CFLAGS} -DDARWIN_NO_CARBON"])
|
||||
else
|
||||
case x$host_os in
|
||||
case "x${host_os}" in
|
||||
xdarwin*)
|
||||
dnl AC_MSG_WARN([host system is MacOS but configured to build without Carbon])
|
||||
CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"
|
||||
CFLAGS="${CFLAGS} -DDARWIN_NO_CARBON"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
|
@ -718,10 +829,13 @@ fi
|
|||
|
||||
AC_ARG_WITH([fsspec],
|
||||
AS_HELP_STRING([--with-fsspec],
|
||||
[use obsolete FSSpec API of MacOS, if available (default=yes)]))
|
||||
if test x$with_fsspec = xno; then
|
||||
CFLAGS="$CFLAGS -DHAVE_FSSPEC=0"
|
||||
elif test x$with_old_mac_fonts = xyes -a x$with_fsspec != x; then
|
||||
[use obsolete FSSpec API of MacOS, if available (default=no)]),
|
||||
[with_fsspec="${withval}"],[with_fsspec="no"])
|
||||
if test "x${with_fsspec}" = "xno"; then
|
||||
CFLAGS="${CFLAGS} -DHAVE_FSSPEC=0"
|
||||
elif test "x${with_old_mac_fonts}" = "xyes" -a "x${with_fsspec}" != "xno"; then
|
||||
orig_CFLAGS="${CFLAGS}"
|
||||
CFLAGS="${CFLAGS} ${CFLAG_error_deprecated}"
|
||||
AC_MSG_CHECKING([FSSpec-based FileManager])
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([
|
||||
|
@ -750,9 +864,11 @@ elif test x$with_old_mac_fonts = xyes -a x$with_fsspec != x; then
|
|||
|
||||
])],
|
||||
[AC_MSG_RESULT([ok])
|
||||
CFLAGS="$CFLAGS -DHAVE_FSSPEC=1"],
|
||||
CFLAGS="${orig_CFLAGS}"
|
||||
CFLAGS="${CFLAGS} -DHAVE_FSSPEC=1"],
|
||||
[AC_MSG_RESULT([not found])
|
||||
CFLAGS="$CFLAGS -DHAVE_FSSPEC=0"])
|
||||
CFLAGS="${orig_CFLAGS}"
|
||||
CFLAGS="${CFLAGS} -DHAVE_FSSPEC=0"])
|
||||
fi
|
||||
|
||||
|
||||
|
@ -760,15 +876,18 @@ fi
|
|||
|
||||
AC_ARG_WITH([fsref],
|
||||
AS_HELP_STRING([--with-fsref],
|
||||
[use Carbon FSRef API of MacOS, if available (default=yes)]))
|
||||
if test x$with_fsref = xno; then
|
||||
[use Carbon FSRef API of MacOS, if available (default=no)]),
|
||||
[with_fsref="${withval}"],[with_fsref="no"])
|
||||
if test "x${with_fsref}" = "xno"; then
|
||||
AC_MSG_WARN([
|
||||
*** WARNING
|
||||
FreeType2 built without FSRef API cannot load
|
||||
data-fork fonts on MacOS, except of XXX.dfont.
|
||||
])
|
||||
CFLAGS="$CFLAGS -DHAVE_FSREF=0"
|
||||
elif test x$with_old_mac_fonts = xyes -a x$with_fsref != x; then
|
||||
CFLAGS="${CFLAGS} -DHAVE_FSREF=0"
|
||||
elif test "x${with_old_mac_fonts}" = "xyes" -a "x${with_fsref}" != "xno"; then
|
||||
orig_CFLAGS="${CFLAGS}"
|
||||
CFLAGS="${CFLAGS} ${CFLAG_error_deprecated}"
|
||||
AC_MSG_CHECKING([FSRef-based FileManager])
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([
|
||||
|
@ -792,7 +911,14 @@ elif test x$with_old_mac_fonts = xyes -a x$with_fsref != x; then
|
|||
UInt8* path;
|
||||
SInt16 desiredRefNum;
|
||||
SInt16* iterator;
|
||||
SInt16* actualRefNum;
|
||||
void* actualRefNum = NULL;
|
||||
/*
|
||||
* FSGetForkCBInfo() 4th parameter actualRefNum
|
||||
* should be typed as SInt16* until 10.4, and
|
||||
* should be typed as FSIORefNum* since 10.5,
|
||||
* but FSIORefNum was undefined before 10.5.
|
||||
* ftmac.c always passes NULL for this parameter.
|
||||
*/
|
||||
HFSUniStr255* outForkName;
|
||||
FSVolumeRefNum volume;
|
||||
FSCatalogInfoBitmap whichInfo;
|
||||
|
@ -817,9 +943,11 @@ elif test x$with_old_mac_fonts = xyes -a x$with_fsref != x; then
|
|||
#endif
|
||||
])],
|
||||
[AC_MSG_RESULT([ok])
|
||||
CFLAGS="$CFLAGS -DHAVE_FSREF=1"],
|
||||
CFLAGS="${orig_CFLAGS}"
|
||||
CFLAGS="${CFLAGS} -DHAVE_FSREF=1"],
|
||||
[AC_MSG_RESULT([not found])
|
||||
CFLAGS="$CFLAGS -DHAVE_FSREF=0"])
|
||||
CFLAGS="${orig_CFLAGS}"
|
||||
CFLAGS="${CFLAGS} -DHAVE_FSREF=0"])
|
||||
fi
|
||||
|
||||
|
||||
|
@ -828,10 +956,13 @@ fi
|
|||
|
||||
AC_ARG_WITH([quickdraw-toolbox],
|
||||
AS_HELP_STRING([--with-quickdraw-toolbox],
|
||||
[use MacOS QuickDraw in ToolBox, if available (default=yes)]))
|
||||
if test x$with_quickdraw_toolbox = xno; then
|
||||
[use MacOS QuickDraw in ToolBox, if available (default=no)]),
|
||||
[with_quickdraw_toolbox="${withval}"],[with_quickdraw_toolbox="no"])
|
||||
if test "x${with_quickdraw_toolbox}" = "xno"; then
|
||||
CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0"
|
||||
elif test x$with_old_mac_fonts = xyes -a x$with_quickdraw_toolbox != x; then
|
||||
elif test "x${with_old_mac_fonts}" = "xyes" -a "x${with_quickdraw_toolbox}" != "xno"; then
|
||||
orig_CFLAGS="${CFLAGS}"
|
||||
CFLAGS="${CFLAGS} ${CFLAG_error_deprecated}"
|
||||
AC_MSG_CHECKING([QuickDraw FontManager functions in ToolBox])
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([
|
||||
|
@ -859,9 +990,11 @@ elif test x$with_old_mac_fonts = xyes -a x$with_quickdraw_toolbox != x; then
|
|||
|
||||
])],
|
||||
[AC_MSG_RESULT([ok])
|
||||
CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=1"],
|
||||
CFLAGS="${orig_CFLAGS}"
|
||||
CFLAGS="${CFLAGS} -DHAVE_QUICKDRAW_TOOLBOX=1"],
|
||||
[AC_MSG_RESULT([not found])
|
||||
CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_TOOLBOX=0"])
|
||||
CFLAGS="${orig_CFLAGS}"
|
||||
CFLAGS="${CFLAGS} -DHAVE_QUICKDRAW_TOOLBOX=0"])
|
||||
fi
|
||||
|
||||
|
||||
|
@ -870,10 +1003,13 @@ fi
|
|||
|
||||
AC_ARG_WITH([quickdraw-carbon],
|
||||
AS_HELP_STRING([--with-quickdraw-carbon],
|
||||
[use MacOS QuickDraw in Carbon, if available (default=yes)]))
|
||||
if test x$with_quickdraw_carbon = xno; then
|
||||
CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0"
|
||||
elif test x$with_old_mac_fonts = xyes -a x$with_quickdraw_carbon != x; then
|
||||
[use MacOS QuickDraw in Carbon, if available (default=no)]),
|
||||
[with_quickdraw_carbon="${withval}"],[with_quickdraw_carbon="no"])
|
||||
if test "x${with_quickdraw_carbon}" = "xno"; then
|
||||
CFLAGS="${CFLAGS} -DHAVE_QUICKDRAW_CARBON=0"
|
||||
elif test "x${with_old_mac_fonts}" = "xyes" -a "x${with_quickdraw_carbon}" != "xno"; then
|
||||
orig_CFLAGS="${CFLAGS}"
|
||||
CFLAGS="${CFLAGS} ${CFLAG_error_deprecated}"
|
||||
AC_MSG_CHECKING([QuickDraw FontManager functions in Carbon])
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([
|
||||
|
@ -911,9 +1047,11 @@ elif test x$with_old_mac_fonts = xyes -a x$with_quickdraw_carbon != x; then
|
|||
|
||||
])],
|
||||
[AC_MSG_RESULT([ok])
|
||||
CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=1"],
|
||||
CFLAGS="${orig_CFLAGS}"
|
||||
CFLAGS="${CFLAGS} -DHAVE_QUICKDRAW_CARBON=1"],
|
||||
[AC_MSG_RESULT([not found])
|
||||
CFLAGS="$CFLAGS -DHAVE_QUICKDRAW_CARBON=0"])
|
||||
CFLAGS="${orig_CFLAGS}"
|
||||
CFLAGS="${CFLAGS} -DHAVE_QUICKDRAW_CARBON=0"])
|
||||
fi
|
||||
|
||||
|
||||
|
@ -921,10 +1059,13 @@ fi
|
|||
|
||||
AC_ARG_WITH([ats],
|
||||
AS_HELP_STRING([--with-ats],
|
||||
[use AppleTypeService, if available (default=yes)]))
|
||||
if test x$with_ats = xno; then
|
||||
CFLAGS="$CFLAGS -DHAVE_ATS=0"
|
||||
elif test x$with_old_mac_fonts = xyes -a x$with_ats != x; then
|
||||
[use AppleTypeService, if available (default=no)]),
|
||||
[with_ats="${withval}"],[with_ats="no"])
|
||||
if test "x${with_ats}" = "xno"; then
|
||||
CFLAGS="${CFLAGS} -DHAVE_ATS=0"
|
||||
elif test "x${with_old_mac_fonts}" = "xyes" -a "x${with_ats}" != "xno"; then
|
||||
orig_CFLAGS="${CFLAGS}"
|
||||
CFLAGS="${CFLAGS} ${CFLAG_error_deprecated}"
|
||||
AC_MSG_CHECKING([AppleTypeService functions])
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([
|
||||
|
@ -950,19 +1091,21 @@ elif test x$with_old_mac_fonts = xyes -a x$with_ats != x; then
|
|||
|
||||
])],
|
||||
[AC_MSG_RESULT([ok])
|
||||
CFLAGS="$CFLAGS -DHAVE_ATS=1"],
|
||||
CFLAGS="${orig_CFLAGS}"
|
||||
CFLAGS="${CFLAGS} -DHAVE_ATS=1"],
|
||||
[AC_MSG_RESULT([not found])
|
||||
CFLAGS="$CFLAGS -DHAVE_ATS=0"])
|
||||
CFLAGS="${orig_CFLAGS}"
|
||||
CFLAGS="${CFLAGS} -DHAVE_ATS=0"])
|
||||
fi
|
||||
|
||||
case "$CFLAGS" in
|
||||
case "${CFLAGS}" in
|
||||
*HAVE_FSSPEC* | *HAVE_FSREF* | *HAVE_QUICKDRAW* | *HAVE_ATS* )
|
||||
AC_MSG_WARN([
|
||||
*** WARNING
|
||||
FSSpec/FSRef/QuickDraw/ATS options are explicitly given,
|
||||
thus it is recommended to replace src/base/ftmac.c by builds/mac/ftmac.c.
|
||||
])
|
||||
CFLAGS="$CFLAGS "'-I$(TOP_DIR)/builds/mac/'
|
||||
CFLAGS="${CFLAGS} "'-I$(TOP_DIR)/builds/mac/'
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
|
|
Loading…
Add table
Reference in a new issue