freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft-devel] No support for side-by-side installation of x86-64and i38


From: mpsuzuki
Subject: Re: [ft-devel] No support for side-by-side installation of x86-64and i386
Date: Mon, 26 Dec 2005 18:52:51 +0900

Hi all,

Here's revised version of dual-ABI patch which
generates unified ftconfig.h for 64/32bit UNIX
platforms.

Based on the information by Henrik, I've added
experimental support for Solaris (amd64, sparc64)
and AIX (ia64, ppc64).

Unfortunately, my testing environment is only
cross-building system on Linux/i386. Any testing
report is welcomed.

Regards,
mpsuzuki


diff -x {arch} -x '.*' -Burb 
freetype2--mps-multilib--0.1--base-0/builds/unix/configure.ac 
freetype2--mps-multilib--0.1--patch-4/builds/unix/configure.ac
--- freetype2--mps-multilib--0.1--base-0/builds/unix/configure.ac       
2005-12-26 18:37:24.000000000 +0900
+++ freetype2--mps-multilib--0.1--patch-4/builds/unix/configure.ac      
2005-12-26 18:25:25.000000000 +0900
@@ -88,6 +89,240 @@
 AC_CHECK_SIZEOF([long])
 
 
+# when --enable-multi-abi is specified
+# some 64bit platforms sharring header files for 32bit & 64bit ABI.
+rm -f arch_dep.tmp
+AC_ARG_ENABLE([multi-abi],
+              [  --enable-multi-abi    make ftconfig.h shareable between 
multiple ABI],
+              [], [])
+if test x"${enable_multi_abi}" = x; then
+  enable_multi_abi="no"
+elif test x"${enable_multi_abi}" = xyes; then
+  enable_multi_abi="64_32"
+fi
+
+# prepare known CFLAGS for multilib
+case "${enable_multi_abi}":"${host}" in
+  64_32:amd64-*linux* | 64_32:x86_64-*linux* | \
+  64_32:ppc64-*linux* | 64_32:s390x-*linux*  | 64_32:sparc64-*linux* )
+    cflags_to_check="-m64 -m32"
+    ;;
+  64_32:amd64-*sunos*   | 64_32:x86_64-*sunos* | \
+  64_32:amd64-*solaris* | 64_32:x86_64-*solaris* )
+    case x"${CC}" in
+    *gcc* )
+      cflags_to_check="-m64 -m32"
+      ;;
+    * ) # assume Sun Forte Studio
+      cflags_to_check="-xtarget=generic64 -xtarget=generic32 -m64 -m32 
-xarch=generic64 -xarch=generic32"
+      ;;
+    esac
+    ;;
+  64_32:ia64-*aix* )
+    case x"${CC}" in
+    *gcc* )
+      cflags_to_check="-m64 -m32"
+      ;;
+    * ) # assume IBM compiler
+      cflags_to_check="-q64 -q32 -m64 -m32"
+      ;;
+    esac
+    ;;
+  64_32:ppc*-*aix* | 64_32:power*-aix* )
+    cflags_to_check="-maix64 -m64 -m32"
+    ;;
+  no:* | NO:* )
+    ;;
+  *)
+    AC_MSG_ERROR([this platform is unsupported for multilib configuration: 
${enable_multi_abi}])
+    ;;
+esac
+
+
+# setup command to detect binary format
+cflag_fmt0=""
+cflag_fmt1=""
+if test x"${cflags_to_check}" != x; then
+  if test x"${host}" != x"${build}"; then
+    AC_PATH_PROG(OBJDUMP, ${host}"-objdump", ${PATH})
+  fi
+  if test x"${OBJDUMP}" = x ; then
+    AC_PATH_PROG(OBJDUMP, objdump, ${PATH})
+  fi
+  if test x"${OBJDUMP}" != x ; then
+    OBJDUMP="${OBJDUMP} -p"
+  else
+    AC_PATH_PROG(OBJDUMP, file, ${PATH})
+  fi
+
+  if test x"${OBJDUMP}" = x ; then
+    AC_MSG_ERROR([no program to detect binary format])
+  fi
+fi
+
+
+# check the binary format of default object file
+if test x"${OBJDUMP}" != x; then
+
+  echo '#include "confdefs.h"' >> conftest.c
+  echo '#if HAVE_STDLIB_H'     >> conftest.c
+  echo '# include <stdlib.h>'  >> conftest.c
+  echo '#endif'                >> conftest.c
+  echo 'int main()' >> conftest.c
+  echo '{'          >> conftest.c
+  echo '  exit(0);' >> conftest.c
+  echo '}'          >> conftest.c
+
+  AC_MSG_CHECKING([default object format])
+  ${CC} ${XX_CFLAGS} ${CPPFLAGS} ${CFLAGS} -I. -c conftest.c
+  if test 0 != $?; then
+    AC_MSG_ERROR([compiler does not working])
+  fi
+  obj_fmt0=`${OBJDUMP} conftest.${OBJEXT} | expand | tr ' ' '_'`
+  if test 0 != $?; then
+    AC_MSG_ERROR([cannot detect object format])
+  fi
+  case "${obj_fmt0}" in
+  *64* )
+    AC_MSG_RESULT([64bit])
+    ;;
+  *32* )
+    AC_MSG_RESULT([32bit])
+    ;;
+  *)
+    AC_MSG_RESULT([unknown])
+    ;;
+  esac
+fi
+
+# lookup explicit CFLAG to generate object file in default format
+orig_CC="${CC}"
+if test x"${obj_fmt0}" != x"${obj_fmt1}"; then
+  for test_cflag in ${cflags_to_check} NONE
+  do
+    if test x"${test_cflag}" != xNONE && test x"${cflag_fmt0}" = x ; then
+      AC_MSG_CHECKING([${test_cflag} and its output])
+      CC=`echo "${orig_CC} x" | sed "s/ / ${test_cflag} /" | sed 's,x$,,'`
+      ${CC} ${XX_CFLAGS} ${CPPFLAGS} ${CFLAGS} -I. -c conftest.c 2>/dev/null 
1>/dev/null
+      if test 0 != $?; then
+        AC_MSG_RESULT([unusable flag])
+      else
+        obj_fmt=`${OBJDUMP} conftest.${OBJEXT} | expand | tr ' ' '_'`
+        if test x"${obj_fmt0}" = x"${obj_fmt}"; then
+          AC_MSG_RESULT([default])
+          cflag_fmt0="${test_cflag}"
+        else
+          AC_MSG_RESULT([non-default])
+        fi
+      fi
+    elif test x"${test_cflag}" = xNONE && test x"${cflag_fmt0}" = x ; then
+      AC_MSG_ERROR([cannot find explicit CFLAG to generate default object])
+    fi
+  done
+  CC="${orig_CC}"
+fi
+
+
+# lookup CFLAG to generate object file in non-default format
+orig_CC="${CC}"
+if test x"${obj_fmt0}" != x"${obj_fmt1}"; then
+  for test_cflag in ${cflags_to_check} NONE
+  do
+    if test x"${test_cflag}" != xNONE && test x"${test_cflag}" != 
x"${cflag_fmt0}" && test x"${cflag_fmt1}" = x ; then
+      AC_MSG_CHECKING([${test_cflag} and its output])
+      CC=`echo "${orig_CC} x" | sed "s/ / ${test_cflag} /" | sed 's,x$,,'`
+      ${CC} ${XX_CFLAGS} ${CPPFLAGS} ${CFLAGS} -I. -c conftest.c 2>/dev/null 
1>/dev/null
+      if test 0 != $?; then
+        AC_MSG_RESULT([unusable flag])
+      else
+        obj_fmt1=`${OBJDUMP} conftest.${OBJEXT} | expand | tr ' ' '_'`
+        if test x"${obj_fmt0}" = x"${obj_fmt1}"; then
+          AC_MSG_RESULT([default])
+        else
+          AC_MSG_RESULT([non-default])
+          cflag_fmt1="${test_cflag}"
+        fi
+      fi
+    elif test x"${test_cflag}" = xNONE && test x"${cflag_fmt1}" = x ; then
+      AC_MSG_ERROR([cannot find CFLAG to generate non-default object])
+    fi
+  done
+  CC="${orig_CC}"
+fi
+
+
+if test x"${cflag_fmt0}" != x"${cflag_fmt1}" ; then
+  orig_CC="${CC}"
+  unset ac_cv_type_int
+  unset ac_cv_type_long
+
+  SIZEOF_INT_FMT0=${ac_cv_sizeof_int}
+  SIZEOF_LONG_FMT0=${ac_cv_sizeof_long}
+  CC=`echo "${CC} x" | sed "s/ / ${cflag_fmt1} /" | sed 's,x$,,'`
+  unset ac_cv_sizeof_int
+  unset ac_cv_sizeof_long
+  AC_CHECK_SIZEOF([int])
+  AC_CHECK_SIZEOF([long])
+  SIZEOF_INT_FMT1=${ac_cv_sizeof_int}
+  SIZEOF_LONG_FMT1=${ac_cv_sizeof_long}
+
+  CC="${orig_CC}"
+fi
+
+if test x"${SIZEOF_INT_FMT0}"  = x"${SIZEOF_INT_FMT1}"   && \
+   test x"${SIZEOF_LONG_FMT0}" = x"${SIZEOF_LONG_FMT1}"; then
+  if test x"${cflag_fmt0}" != x"${cflag_fmt1}"; then
+    AC_MSG_WARN([sizeof(int), sizeof(long) are same in both platform])
+  fi
+else
+  macro_abi=""
+  AC_MSG_CHECKING([predefined cpp macro to identify platform])
+  for m in \
+    __LP64__ _LP64 \
+    __arch64__ \
+    __x86_64__ __x86_64 __amd64__ __amd64 __i386__ __i386 i386 \
+    __ppc64__ __powerpc64__ __ppc64 \
+    __s390x__ __s390x \
+    __sparc64__ __sparc64 __sparcv9
+  do
+    echo ${m} | sed 's|.*|\"&\" &|' > conftest.c 
+    ${CPP} ${CPPFLAGS} ${cflag_fmt0} conftest.c | grep ${m} > conftest_fmt0.i
+    ${CPP} ${CPPFLAGS} ${cflag_fmt1} conftest.c | grep ${m} > conftest_fmt1.i
+    cmp conftest_fmt0.i conftest_fmt1.i 2>/dev/null 1>/dev/null
+    if test 0 != $?; then
+      if test x"${macro_abi}" = x; then
+        AC_MSG_RESULT(${m})
+        macro_abi=${m}
+        value_fmt0=`awk '{print $2}' < conftest_fmt0.i`
+        value_fmt1=`awk '{print $2}' < conftest_fmt1.i`
+      fi
+    fi
+  done
+  if test x"${macro_abi}" = x; then
+    AC_MSG_ERROR([nothing found])
+  else
+    if test x"${macro_abi}" = x"${value_fmt0}"; then
+      ARCH_CONDITIONAL_FMT0='#if defined( '${macro_abi}' )'
+      ARCH_CONDITIONAL_FMT1='#if !defined( '${macro_abi}' )'
+    elif test x"${macro_abi}" = x"${value_fmt1}"; then
+      ARCH_CONDITIONAL_FMT0='#if !defined( '${macro_abi}' )'
+      ARCH_CONDITIONAL_FMT1='#if defined( '${macro_abi}' )'
+    else
+      ARCH_CONDITIONAL_FMT0='#if '${macro_abi}' == '${value_fmt0}
+      ARCH_CONDITIONAL_FMT1='#if '${macro_abi}' == '${value_fmt1}
+    fi
+  fi
+  
+  echo "${ARCH_CONDITIONAL_FMT0} /* default */" > arch_dep.tmp
+  echo '#define  SIZEOF_INT '${SIZEOF_INT_FMT0}   >> arch_dep.tmp
+  echo '#define  SIZEOF_LONG '${SIZEOF_LONG_FMT0} >> arch_dep.tmp
+  echo '#else /* non-default */'  >>  arch_dep.tmp
+  echo '#define  SIZEOF_INT '${SIZEOF_INT_FMT1}   >> arch_dep.tmp
+  echo '#define  SIZEOF_LONG '${SIZEOF_LONG_FMT1} >> arch_dep.tmp
+  echo '#endif'  >>  arch_dep.tmp
+fi
+
+
 # checks for library functions
 
 # Here we check whether we can use our mmap file component.
@@ -168,8 +403,16 @@
 AC_CONFIG_HEADERS([ftconfig.h:ftconfig.in],
   [mv ftconfig.h ftconfig.tmp
    sed 's|/undef|#undef|' < ftconfig.tmp > ftconfig.h
+   if test -r arch_dep.tmp; then
+     mv ftconfig.h ftconfig.tmp
+     sed -n '1,/ARCH_DEP_BEGIN/p' >  ftconfig.h < ftconfig.tmp 
+     cat arch_dep.tmp             >> ftconfig.h
+     sed -n '/ARCH_DEP_END/,$p'   >> ftconfig.h < ftconfig.tmp 
+     rm -f arch_dep.tmp
+   fi
    rm ftconfig.tmp])
 
+
 # create the Unix-specific sub-Makefiles `builds/unix/unix-def.mk'
 # and 'builds/unix/unix-cc.mk' that will be used by the build system
 #
diff -x {arch} -x '.*' -Burb 
freetype2--mps-multilib--0.1--base-0/builds/unix/ftconfig.in 
freetype2--mps-multilib--0.1--patch-4/builds/unix/ftconfig.in
--- freetype2--mps-multilib--0.1--base-0/builds/unix/ftconfig.in        
2005-12-26 18:37:24.000000000 +0900
+++ freetype2--mps-multilib--0.1--patch-4/builds/unix/ftconfig.in       
2005-12-26 13:59:53.000000000 +0900
@@ -60,8 +60,11 @@
 #undef HAVE_UNISTD_H
 #undef HAVE_FCNTL_H
 
+
+  /* ARCH_DEP_BEGIN */
 #undef SIZEOF_INT
 #undef SIZEOF_LONG
+  /* ARCH_DEP_END */
 
 
 #define FT_SIZEOF_INT   SIZEOF_INT




reply via email to

[Prev in Thread] Current Thread [Next in Thread]