[Top][All Lists]
[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, 19 Dec 2005 14:52:46 +0900 |
Hi all,
Here is the first revision of my patch to support
32/64bit ABI by generating unified ftconfig.h.
Ilya, could you test it? After patching this,
./configure --enable-multi-abi="64_32"
will generate unified ftconfig.h which is same
in the both cases of "-m32" and "-m64".
--
My patch for configure.ac is very very lengthy,
so here is the outline about what it does.
1) check new option "--enable-multi-abi".
2) if multi-abi is specified...
check the pair of multi-abi-type and host-type
objdump (or file) is searched to check whether ABI in object file
is default and optional.
2-1) determine the default ABI.
2-2) check CFLAGS to generate objects with optional ABI
At present, only "-m32" or "-m64" are tested.
3) if we could know how to generate objects with optional ABI...
unset autoconf cache and re-check ABI-dependent features
(at present, only sizeof(int) & sizeof(long) are checked)
in optional ABI.
4) if ABI-dependent features are different...
search CPP macro to determine current ABI from keywords like
C features (LP64, etc) or arch-name (AMD64, PPC64 etc).
5) if useful CPP is found...
generate dual-ABI header file with the name "arch_dep.tmp"
6) if there is "arch_dep.tmp"...
replace ABI-dependent feature part in ftconfig.h by "arch_dep.tmp"
At present, only Linux is supported by --enable-multi-abi:
Linux + GNU C compiler on x86_64. I think ppc64,
s390x and sparc64 could be supported by same hook,
but I've not tested yet. Solaris + GNU C compiler
on x86_64, sparc64 should be very similar framework.
I'm not sure about Intel C compiler and Sun C compiler.
My next goal might be AIX on POWER architechture:
AIX stores both of 32bit and 64bit libraries into
same directories (/lib, /usr/lib), but with _64
suffixes, aslike crt0.o and crt0_64.o.
It seems that default is 32bit-ABI, and "-maix64"
is usable to generate 64bit-ABI. I can find many
__64BIT__ hooks in /usr/include/*.h.
Also I have to learn about IRIX (ECOFF, o32, n32,
n64) and HP-UX on RISC (32bit-SOM, 32bit-ELF,
64bit-ELF).
diff -NBurb freetype2.orig/builds/unix/configure.ac
freetype2-multi-abi/builds/unix/configure.ac
--- freetype2.orig/builds/unix/configure.ac 2005-12-19 14:08:50.000000000
+0900
+++ freetype2-multi-abi/builds/unix/configure.ac 2005-12-19
14:08:04.000000000 +0900
@@ -88,6 +89,182 @@
AC_CHECK_SIZEOF([long])
+# when --enable-multi-abi is specified
+# some 64bit platforms sharring header files for 32bit & 64bit ABI.
+AC_ARG_ENABLE([multi-abi],
+ [ --enable-multi-abi make ftconfig.h shareable between
multiple ABI],
+ [], [])
+if test x"${enable_multi_abi}" = xyes; then
+ enable_multi_abi="64_32"
+fi
+rm -f arch_dep.tmp
+cflags_64=""
+cflags_32=""
+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* )
+ AC_PATH_PROG(OBJDUMP, ${host}"-objdump", ${PATH})
+ 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
+
+ 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} -c conftest.c
+ if test 0 != $?; then
+ AC_MSG_ERROR([compiler does not working])
+ fi
+ default_obj_format=`${OBJDUMP} conftest.${OBJEXT} | expand | tr ' ' '_'`
+ if test 0 != $?; then
+ AC_MSG_ERROR([cannot detect object format])
+ fi
+ case "${default_obj_format}" in
+ *64* )
+ AC_MSG_RESULT([64bit])
+ AC_MSG_CHECKING([CFLAGS -m32 is usable to generate 32bit object file])
+ ${CC} ${XX_CFLAGS} ${CPPFLAGS} ${CFLAGS} -m32 -c conftest.c
+ if test 0 != $?; then
+ AC_MSG_RESULT([no])
+ else
+ obj32_format=`${OBJDUMP} conftest.${OBJEXT} | expand | tr ' ' '_'`
+ if test x"${obj32_format}" = x"${default_obj_format}"; then
+ AC_MSG_RESULT([compiled, but object file is same with 64bit])
+ else
+ AC_MSG_RESULT([yes])
+ cflags_32="-m32"
+ fi
+ fi
+ ;;
+ *32* )
+ AC_MSG_RESULT([32bit])
+ AC_MSG_CHECKING([CFLAGS -m64 is usable to generate 64bit object file])
+ ${CC} ${XX_CFLAGS} ${CPPFLAGS} ${CFLAGS} -m64 -c conftest.c
+ if test 0 != $?; then
+ AC_MSG_RESULT([no])
+ else
+ obj64_format=`${OBJDUMP} conftest.${OBJEXT} | expand | tr ' ' '_'`
+ if test x"${obj64_format}" = x"${default_obj_format}"; then
+ AC_MSG_RESULT([compiled, but object file is same with 32bit])
+ else
+ AC_MSG_RESULT([yes])
+ cflags_32="-m64"
+ fi
+ fi
+ ;;
+ esac
+ rm -f conftest.c conftest.${OBJEXT}
+ if test x"${cflags_64}" = x"${cflags_32}"; then
+ AC_MSG_WARN([cannot detect CFLAGS to generate objects for non-default
arch])
+ fi
+ ;;
+ *)
+ ;;
+esac
+
+if test x"${cflags_64}" != x"${cflags_32}"; then
+ orig_CFLAGS="${CFLAGS}"
+ unset ac_cv_type_int
+ unset ac_cv_type_long
+ if test x"${cflags_64}" = x; then
+ SIZEOF_INT_64=${ac_cv_sizeof_int}
+ SIZEOF_LONG_64=${ac_cv_sizeof_long}
+ CC="${CC} ${cflags_32}"
+ unset ac_cv_sizeof_int
+ unset ac_cv_sizeof_long
+ AC_CHECK_SIZEOF([int])
+ AC_CHECK_SIZEOF([long])
+ SIZEOF_INT_32=${ac_cv_sizeof_int}
+ SIZEOF_LONG_32=${ac_cv_sizeof_long}
+ SIZEOF_INT=${SIZEOF_INT_64}
+ SIZEOF_LONG=${SIZEOF_LONG_64}
+ else
+ SIZEOF_INT_32=${ac_cv_sizeof_int}
+ SIZEOF_LONG_32=${ac_cv_sizeof_long}
+ CC="${CFLAGS} ${cflags_64}"
+ unset ac_cv_sizeof_int
+ unset ac_cv_sizeof_long
+ AC_CHECK_SIZEOF([int])
+ AC_CHECK_SIZEOF([long])
+ SIZEOF_INT_64=${ac_cv_sizeof_int}
+ SIZEOF_LONG_64=${ac_cv_sizeof_long}
+ SIZEOF_INT=${SIZEOF_INT_32}
+ SIZEOF_LONG=${SIZEOF_LONG_32}
+ fi
+ CFLAGS="${orig_CFLAGS}"
+fi
+
+if test x"${cflags_64}" != x"${cflags_32}"; then
+ if test ${SIZEOF_INT_64} = ${SIZEOF_INT_32} && \
+ test ${SIZEOF_LONG_64} = ${SIZEOF_LONG_32}; then
+ AC_MSG_WARN([sizeof(int), sizeof(long) are same in 32bit and 64bit
platform])
+ else
+ macro_abi=""
+ AC_MSG_CHECKING([predefined cpp macro to identify 32bit and 64bit mode])
+ for m in \
+ __LP64__ _LP64 \
+ __x86_64__ __x86_64 __amd64__ __amd64 __i386__ __i386 i386 \
+ __ppc64__ __powerpc64__ __ppc64 \
+ __s390x__ __s390x \
+ __sparc64__ __sparc64
+ do
+ echo ${m} | sed 's|.*|\"&\" &|' > conftest.c
+ ${CPP} ${CPPFLAGS} ${cflags_64} conftest.c | grep ${m} > conftest_64.i
+ ${CPP} ${CPPFLAGS} ${cflags_32} conftest.c | grep ${m} > conftest_32.i
+ cmp conftest_64.i conftest_32.i 2>&1 > /dev/null
+ if test 0 != $?; then
+ if test x"${macro_abi}" = x; then
+ AC_MSG_RESULT(${m})
+ macro_abi=${m}
+ value_64=`awk '{print $2}' < conftest_64.i`
+ value_32=`awk '{print $2}' < conftest_32.i`
+ fi
+ fi
+ done
+ if test x"${macro_abi}" = x; then
+ AC_MSG_ERROR([nothing found])
+ else
+ if test x"${macro_abi}" = x"${value_64}"; then
+ ARCH32_CONDITIONAL='#if defined( '${macro_abi}' )'
+ ARCH64_CONDITIONAL='#if !defined( '${macro_abi}' )'
+ elif test x"${macro_abi}" = x"${value_32}"; then
+ ARCH32_CONDITIONAL='#if !defined( '${macro_abi}' )'
+ ARCH64_CONDITIONAL='#if defined( '${macro_abi}' )'
+ else
+ ARCH32_CONDITIONAL='#if '${macro_abi}' == '${value_32}
+ ARCH64_CONDITIONAL='#if '${macro_abi}' == '${value_64}
+ fi
+ fi
+
+ if test x"${cflags_64}" = x; then
+ echo "${ARCH64_CONDITIONAL} /* default: 64bit mode */" > arch_dep.tmp
+ echo '#define SIZEOF_INT '${SIZEOF_INT_64} >> arch_dep.tmp
+ echo '#define SIZEOF_LONG '${SIZEOF_LONG_64} >> arch_dep.tmp
+ echo '#else /* 32bit mode */' >> arch_dep.tmp
+ echo '#define SIZEOF_INT '${SIZEOF_INT_32} >> arch_dep.tmp
+ echo '#define SIZEOF_LONG '${SIZEOF_LONG_32} >> arch_dep.tmp
+ echo '#endif' >> arch_dep.tmp
+ else
+ echo "${ARCH32_CONDITIONAL} /* default: 32bit mode */" > arch_dep.tmp
+ echo '#define SIZEOF_INT '${SIZEOF_INT_64} >> arch_dep.tmp
+ echo '#define SIZEOF_LONG '${SIZEOF_LONG_64} >> arch_dep.tmp
+ echo '#else /* 32bit mode */' >> arch_dep.tmp
+ echo '#define SIZEOF_INT '${SIZEOF_INT_32} >> arch_dep.tmp
+ echo '#define SIZEOF_LONG '${SIZEOF_LONG_32} >> arch_dep.tmp
+ echo '#endif' >> arch_dep.tmp
+ fi
+ fi
+fi
+
+
# checks for library functions
# Here we check whether we can use our mmap file component.
@@ -168,8 +345,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 -NBurb freetype2.orig/builds/unix/ftconfig.in
freetype2-multi-abi/builds/unix/ftconfig.in
--- freetype2.orig/builds/unix/ftconfig.in 2005-12-19 14:08:50.000000000
+0900
+++ freetype2-multi-abi/builds/unix/ftconfig.in 2005-12-19 14:08:04.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
- Re: [ft-devel] No support for side-by-side installation of x86-64 and i386, (continued)
- Re: [ft-devel] No support for side-by-side installation of x86-64 and i386, mpsuzuki, 2005/12/07
- Re: [ft-devel] No support for side-by-side installation of x86-64 and i386, Frederic Crozat, 2005/12/07
- Re: [ft-devel] No support for side-by-side installation of x86-64 and i386, mpsuzuki, 2005/12/07
- Re: [ft-devel] No support for side-by-side installation of x86-64 and i386, Henrik Grubbström, 2005/12/09
- Re: [ft-devel] No support for side-by-side installation of x86-64 and i386, mpsuzuki, 2005/12/07
- Re: [ft-devel] No support for side-by-side installation of x86-64 and i386, Henrik Grubbström, 2005/12/07
- Re: [ft-devel] No support for side-by-side installation of x86-64 and i386, Werner LEMBERG, 2005/12/08
- Re: [ft-devel] No support for side-by-side installation of x86-64 and i386, mpsuzuki, 2005/12/11
- Re: [ft-devel] No support for side-by-side installation of x86-64and i386, Antoine Leca, 2005/12/12
- Re: [ft-devel] No support for side-by-side installation of x86-64and i386, Werner LEMBERG, 2005/12/12
- Re: [ft-devel] No support for side-by-side installation of x86-64and i386,
mpsuzuki <=
- Re: [ft-devel] No support for side-by-side installation of x86-64and i386, mpsuzuki, 2005/12/26
- Re: [ft-devel] No support for side-by-side installation of x86-64and i386, Werner LEMBERG, 2005/12/26
- Re: [ft-devel] No support for side-by-side installation of x86-64and i386, mpsuzuki, 2005/12/26
- Re: [ft-devel] No support for side-by-side installation of x86-64and i386, mpsuzuki, 2005/12/26
- Re: [ft-devel] No support for side-by-side installation of x86-64and i386, Werner LEMBERG, 2005/12/27
- Re: [ft-devel] No support for side-by-side installation of x86-64and i386, mpsuzuki, 2005/12/31
Re: [ft-devel] No support for side-by-side installation of x86-64 andi386, Antoine Leca, 2005/12/07