Index: configure.in =================================================================== --- configure.in (revision 84704) +++ configure.in (working copy) @@ -2685,7 +2685,7 @@ # On Tru64, chflags seems to be present, but calling it will # exit Python AC_CACHE_CHECK([for chflags], [ac_cv_have_chflags], [dnl -AC_RUN_IFELSE([AC_LANG_SOURCE([[[ +AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include int main(int argc, char*argv[]) @@ -2694,7 +2694,7 @@ return 1; return 0; } -]]])], +]])], [ac_cv_have_chflags=yes], [ac_cv_have_chflags=no], [ac_cv_have_chflags=cross]) @@ -2703,11 +2703,11 @@ AC_CHECK_FUNC([chflags], [ac_cv_have_chflags="yes"], [ac_cv_have_chflags="no"]) fi if test "$ac_cv_have_chflags" = yes ; then - AC_DEFINE(HAVE_CHFLAGS, 1, [Define to 1 if you have the `chflags' function.]) + AC_DEFINE(HAVE_CHFLAGS, 1, [Define to 1 if you have the 'chflags' function.]) fi AC_CACHE_CHECK([for lchflags], [ac_cv_have_lchflags], [dnl -AC_RUN_IFELSE([AC_LANG_SOURCE([[[ +AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include int main(int argc, char*argv[]) @@ -2716,15 +2716,26 @@ return 1; return 0; } -]]])],[ac_cv_have_lchflags=yes],[ac_cv_have_lchflags=no],[ac_cv_have_lchflags=cross]) +]])],[ac_cv_have_lchflags=yes],[ac_cv_have_lchflags=no],[ac_cv_have_lchflags=cross]) ]) if test "$ac_cv_have_lchflags" = cross ; then AC_CHECK_FUNC([lchflags], [ac_cv_have_lchflags="yes"], [ac_cv_have_lchflags="no"]) fi if test "$ac_cv_have_lchflags" = yes ; then - AC_DEFINE(HAVE_LCHFLAGS, 1, [Define to 1 if you have the `lchflags' function.]) + AC_DEFINE(HAVE_LCHFLAGS, 1, [Define to 1 if you have the 'lchflags' function.]) fi +# Check for conditionally available flags that can be passed to the *chflags(2) +# functions, as FreeBSD defines some flags, and OSX defines others. +if test "$ac_cv_have_chflags" = yes || test "$ac_cv_have_lchflags" = yes ; then + for i in UF_NOUNLINK UF_HIDDEN SF_NOUNLINK ; do + AC_CHECK_DECL($i,,,[[ +#include +#include +]]) + done +fi + dnl Check if system zlib has *Copy() functions dnl dnl On MacOSX the linker will search for dylibs on the entire linker path Index: Modules/posixmodule.c =================================================================== --- Modules/posixmodule.c (revision 84704) +++ Modules/posixmodule.c (working copy) @@ -8297,6 +8297,33 @@ #endif #endif +#if defined(HAVE_CHFLAGS) || defined(HAVE_LCHFLAGS) + if (ins(d, "UF_NODUMP", (long)UF_NODUMP)) return -1; + if (ins(d, "UF_IMMUTABLE", (long)UF_IMMUTABLE)) return -1; + if (ins(d, "UF_APPEND", (long)UF_APPEND)) return -1; +/* FreeBSD specific */ +#ifdef HAVE_UF_NOUNLINK + if (ins(d, "UF_NOUNLINK", (long)UF_NOUNLINK)) return -1; +#endif +/* OSX specific */ +#ifdef HAVE_UF_HIDDEN + if (ins(d, "UF_HIDDEN", (long)UF_HIDDEN)) return -1; +#endif + if (ins(d, "UF_OPAQUE", (long)UF_OPAQUE)) return -1; + if (ins(d, "SF_ARCHIVED", (long)SF_ARCHIVED)) return -1; + if (ins(d, "SF_IMMUTABLE", (long)SF_IMMUTABLE)) return -1; + if (ins(d, "SF_APPEND", (long)SF_APPEND)) return -1; +/* FreeBSD specific */ +#ifdef HAVE_SF_NOUNLINK + if (ins(d, "SF_NOUNLINK", (long)SF_NOUNLINK)) return -1; +#endif +/* + * SF_SNAPSHOT isn't listed here because it's purely FreeBSD based, and it + * seems to have little value for python, as it's used by the system (kernel?) + * to set the snapshot inode for UFS* based filesystems. + */ +#endif /* defined(HAVE_CHFLAGS) || defined(HAVE_LCHFLAGS) */ + #if defined(PYOS_OS2) if (insertvalues(d)) return -1; #endif