[Ffmpeg-devel] Mac OS X Intel last part: balign directives

Nigel Pearson nigel
Fri Aug 11 03:28:04 CEST 2006


	Luca, thanks for the clarification.


	While Rich's proposal is extremely correct,
I am wondering if it just a little too exhaustive?

> The solution is to make a test in configure to test the behavior of
> align. First try assembling a file with .balign or .p2align. If one
> fails try the other. If both fail, first try .align 3. This will fail
> if .align takes its argument in bytes rather than as the number of low
> bits that must be zero; if it does try .align 8. If they all fail,
> disable alignment altogether and hope it's not needed.

	Given that, in over four years, only one platform
has been found that has .p2align instead of .balign,
I suspect that one configure test (instead of four!)
would be enough? e.g.:


--- configure   (revision 5978)
+++ configure   (working copy)
@@ -335,6 +335,7 @@
  cross_prefix=""
  cross_compile="no"
  cc="gcc"
+as_has_balign="default"
  ar="ar"
  ranlib="ranlib"
  make="make"
@@ -996,6 +997,16 @@
  EOF
  fi

+# OS X has a very old assembler which necessitates source code changes
+if test $as_has_balign = "default"; then
+    as_has_balign="no"
+    check_cc <<EOF && as_has_balign="yes"
+        int main(void) {
+        __asm__ __volatile__ (".balign 8");
+        }
+EOF
+fi
+
  #Darwin CC versions
  needmdynamicnopic="no"
  if test $targetos = Darwin; then
@@ -1472,6 +1483,7 @@
  echo "install prefix   $PREFIX"
  echo "source path      $source_path"
  echo "C compiler       $cc"
+echo "Supports .balign $as_has_balign"
  echo "make             $make"
  echo "CPU              $cpu ($tune)"
  if test "$BUILDSUF" != ""; then
@@ -1676,6 +1688,13 @@
    echo "TARGET_MMI=yes" >> config.mak
    echo "#define HAVE_MMI 1" >> $TMPH
  fi
+if test "$as_has_balign" = "yes" ; then
+  echo "#define ASMALIGN8  ".balign 8  \n\t" >> $TMPH
+  echo "#define ASMALIGN16 ".balign 16 \n\t" >> $TMPH
+else
+  echo "#define ASMALIGN8  ".p2align 3 \n\t" >> $TMPH
+  echo "#define ASMALIGN16 ".p2align 4 \n\t" >> $TMPH
+fi
  if test "$altivec" = "yes" ; then
    echo "TARGET_ALTIVEC=yes" >> config.mak
    echo "#define HAVE_ALTIVEC 1" >> $TMPH

--
Nigel Pearson, nigel at ind.tansu.com.au|     "They did the
Telstra Net. Eng., Sydney, Australia | white man power dance,
Office: 9202 3900    Fax:  9261 3912 |     and ... Shazam"
Mobile: 0408 664435  Home: 9792 6998 | Lois Lane - Smallville




More information about the ffmpeg-devel mailing list