aboutsummaryrefslogtreecommitdiff
path: root/pd/m4
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2011-10-09 16:36:37 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2011-10-09 16:36:37 +0000
commit21c068f1916330e90f814bed461fe0821d1665ec (patch)
tree949b73696fff09a44b8d3eb01b70bae7174cbd14 /pd/m4
parentbf8ced1efe1a032342e864edc635fa4e2676670d (diff)
checked in pd-0.43-0.src.tar.gz
svn path=/trunk/; revision=15557
Diffstat (limited to 'pd/m4')
-rw-r--r--pd/m4/android.m4124
-rw-r--r--pd/m4/iphone.m4113
-rw-r--r--pd/m4/universal.m489
3 files changed, 326 insertions, 0 deletions
diff --git a/pd/m4/android.m4 b/pd/m4/android.m4
new file mode 100644
index 00000000..c63927e2
--- /dev/null
+++ b/pd/m4/android.m4
@@ -0,0 +1,124 @@
+dnl Copyright (C) 2010 IOhannes m zmölnig
+dnl This file is free software; IOhannes m zmölnig
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+# AM_CHECK_ANDROID (ACTION_IF_FOUND, ACTION_IF_NOT_FOUND, [ACTION_IF_FAILED])
+# enables the "--with-android" flag;
+# if the androidSDK is detected, this will
+# - set the CC & CPP to the cross-compiler ( resp preprocessor)
+# - as well as the apropriate CFLAGS, INCLUDES and LDFLAGS
+# - these values can also be found in ANDROID_CC, ANDROID_CPP,
+# ANDROID_INCLUDES, ANDROID_ARCH, ANDROID_CFLAGS, ANDROID_LDFLAGS
+# it will then call ACTION_IF_FOUND
+# elif ACTION_IF_FAILED is set and the androidSDK is not detected even though the user
+# requested it (by specifying a path, or simply saying "--with-android=yes"),
+# then ACTION_IF_FAILED is called
+# else
+# ACTION_IF_NOT_FOUND is called
+#
+# TODO: only run checks when architecture is right (x-compiling)
+# hc's code used "arm-linux"
+# --------------------------------------------------------------
+AC_DEFUN([PD_CHECK_ANDROID],
+[
+define([androidpath_default],[${HOME}/src/android/android-ndk-1.6_r1])
+define([androidversion_default],[android-4])
+
+AC_ARG_WITH([android],
+ AS_HELP_STRING( [--with-android=</path/to/sdk>],
+ [specify path to Android SDK (only used when building for Android) [androidpath_default]]),
+ android_path=$withval)
+AC_ARG_WITH([androidversion],
+ AS_HELP_STRING( [--with-androidversion=<sdk-version>],
+ [specify Android target version (only used when building for Android) [androidversion_default]]),
+ android_target_platform=$withval)
+
+
+case $host in
+ arm-linux)
+ ;;
+ *)
+ AC_MSG_NOTICE([Android SDK only available for arm-linux hosts, skipping tests])
+ with_android="no"
+ ;;
+esac
+
+
+if test "x${with_android}" != "xno" ; then
+ AC_MSG_CHECKING([android SDK])
+
+ if test "x${android_path}" = "xyes"; then
+ android_path=androidpath_default
+ fi
+ if test "x${android_target_platform}" = "x"; then
+ android_target_platform=androidversion_default
+ fi
+
+ android_target_arch_abi=arm
+ android_gcc_path="${android_path}/build/prebuilt/linux-x86/arm-eabi-4.2.1/bin"
+ ANDROID_CPP="${android_gcc_path}/arm-eabi-cpp"
+ ANDROID_CC="${android_gcc_path}/arm-eabi-gcc"
+ ANDROID_LD="${android_gcc_path}/arm-eabi-ld"
+ ANDROID_SYSROOT="${android_path}/build/platforms/${android_target_platform}/arch-${android_target_arch_abi}"
+
+ if test -d "${ANDROID_SYSROOT}/usr/include" &&
+ test -x "${ANDROID_CC}" &&
+ test -x "${ANDROID_LD}" &&
+ test -x "${ANDROID_CPP}"; then
+ CPP="${ANDROID_CPP}"
+ CC="${ANDROID_CC}"
+ LD="${ANDROID_LD}"
+ android_target_libgcc=$(${ANDROID_CC} -print-libgcc-file-name)
+
+ #ah, i don't like all this...
+
+ #why do we have to specify _HAVE_UNISTD_H and HAVE_GL: can't we use autoconf tests?
+ ANDROID_DEFS="-DANDROID -D__linux__ -D_HAVE_UNISTD_H -DHAVE_LIBGL -D__BSD_VISIBLE=
+ 1"
+ ANDROID_INCLUDES="-I${ANDROID_SYSROOT}/usr/include"
+
+ # what broken compiler is this, if we have to specify all the architecture defines manually?
+ ANDROID_ARCH_CFLAGS="-march=armv5te -mtune=xscale -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__"
+
+ #shan't we test for these flags?
+ ANDROID_OPT_CFLAGS=" -msoft-float -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -mthumb -fno-strict-aliasing -finline-limit=64 -O2"
+
+ ANDROID_CFLAGS="${ANDROID_ARCH_CFLAGS} ${ANDROID_OPT_CFLAGS}"
+ ANDROID_LDFLAGS="-nostdlib -Wl,--no-undefined -Wl,-rpath-link=${ANDROID_SYSROOT}/usr/lib ${android_target_libgcc}"
+
+ INCLUDES="${INCLUDES} ${ANDROID_INCLUDES}"
+ CFLAGS="${CFLAGS} ${ANDROID_CFLAGS}"
+ LDFLAGS="${LDFLAGS} ${ANDROID_LDFLAGS}"
+
+ # workaround for rpl_malloc/rpl_realloc bug in autoconf when cross-compiling
+ ac_cv_func_malloc_0_nonnull=yes
+ ac_cv_func_realloc_0_nonnull=yes
+
+ AC_MSG_RESULT([yes])
+ [$1]
+ else
+ ANDROID_CPP=""
+ ANDROID_CC=""
+ ANDROID_LD=""
+ ANDROID_SYSROOT=""
+
+ if test "x${with_android}" = "x"; then
+ with_android="no"
+ fi
+
+ AC_MSG_RESULT([no])
+ if test "x${with_android}" = "xno"; then
+ :
+ [$2]
+ else
+ :
+ ifelse([$3], , [$2], [$3])
+ fi
+ fi
+else
+# --without-android
+ [$2]
+fi
+undefine([androidpath_default])
+undefine([androidversion_default])
+]) \ No newline at end of file
diff --git a/pd/m4/iphone.m4 b/pd/m4/iphone.m4
new file mode 100644
index 00000000..2a774807
--- /dev/null
+++ b/pd/m4/iphone.m4
@@ -0,0 +1,113 @@
+dnl Copyright (C) 2010 IOhannes m zmölnig
+dnl This file is free software; IOhannes m zmölnig
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+# AM_CHECK_IPHONE (ACTION_IF_FOUND, ACTION_IF_NOT_FOUND, [ACTION_IF_FAILED])
+# enables the "--with-iphone" flag;
+# if the iPhoneSDK is detected, this will
+# - set the CC & CPP to the cross-compiler ( resp preprocessor)
+# - as well as the apropriate CFLAGS, INCLUDES and LDFLAGS
+# - these values can also be found in IPHONE_CC, IPHONE_CPP,
+# IPHONE_INCLUDES, IPHONE_ARCH, IPHONE_CFLAGS, IPHONE_LDFLAGS
+# it will then call ACTION_IF_FOUND
+# elif ACTION_IF_FAILED is set and the iPhoneSDK is not detected even though the user
+# requested it (by specifying a path, or simply saying "--with-iphone=yes"),
+# then ACTION_IF_FAILED is called
+# else
+# ACTION_IF_NOT_FOUND is called
+#
+# TODO: only run checks when architecture is right (x-compiling)
+# hc's code used "arm*darwin*"
+# --------------------------------------------------------------
+AC_DEFUN([PD_CHECK_IPHONE],
+[
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+
+define([iphonepath_default],[/Developer/Platforms/iPhoneOS.platform/Developer])
+define([iphoneversion_default],[3.0])
+
+AC_ARG_WITH([iphone],
+ AS_HELP_STRING( [--with-iphone=</path/to/sdk>],
+ [specify iPhone BaseDirectory (only used when building for iPhone) [iphonepath_default]]),
+ iphonepath=$withval)
+AC_ARG_WITH([iphoneversion],
+ AS_HELP_STRING( [--with-iphoneversion=<sdk-version>],
+ [specify iPhone SDK version (only used when building for iPhone) [iphoneversion_default]]),
+ iphone_version=$withval)
+
+
+case $host in
+ arm*darwin*)
+ ;;
+ *)
+ AC_MSG_NOTICE([iPhone SDK only available for arm-apple-darwin hosts, skipping tests])
+ with_iphone="no"
+ ;;
+esac
+
+if test "x${with_iphone}" != "xno" ; then
+ AC_MSG_CHECKING([iPhone SDK])
+
+ if test "x${iphonepath}" = "xyes" || test "x${iphonepath}" = "x"; then
+ iphonepath=iphonepath_default
+ fi
+ if test "x${iphone_version}" = "x"; then
+ iphone_version=iphoneversion_default
+ fi
+
+ IPHONE_CC="${iphonepath}/usr/bin/gcc"
+ IPHONE_CPP="${iphonepath}/usr/bin/cpp"
+ IPHONE_SYSROOT="${iphonepath}/SDKs/iPhoneOS${iphone_version}.sdk"
+
+#echo "sysroot = ${IPHONE_SYSROOT}"
+#echo "cpp = ${IPHONE_CPP}"
+#echo "cc = ${IPHONE_CC}"
+
+ if test -d "${IPHONE_SYSROOT}" &&
+ test -x "${IPHONE_CC}" &&
+ test -x "${IPHONE_CPP}"; then
+ CC="${IPHONE_CC}"
+ CPP="${IPHONE_CPP}"
+
+ IPHONE_ARCH="-arch armv6"
+ IPHONE_CFLAGS="-miphoneos-version-min=${iphone_version} -isysroot ${IPHONE_SYSROT}"
+ IPHONE_LDFLAGS=""
+
+ CFLAGS="${CFLAGS} ${IPHONE_CFLAGS} ${IPHONE_ARCH}"
+ LDFLAGS="${LDFLAGS} ${IPHONE_ARCH} ${LDFLAGS}"
+
+ # workaround for rpl_malloc/rpl_realloc bug in autoconf when cross-compiling
+ ac_cv_func_malloc_0_nonnull=yes
+ ac_cv_func_realloc_0_nonnull=yes
+
+ _iphone_result=yes
+
+ AC_MSG_RESULT([yes])
+ [$1]
+ else
+ _iphone_result=no
+ IPHONE_CC=""
+ IPHONE_CPP=""
+ IPHONE_SYSROOT=""
+
+ if test "x${with_iphone}" = "x"; then
+ with_iphone="no"
+ fi
+
+ AC_MSG_RESULT([no])
+ if test "x${with_iphone}" = "xno"; then
+ :
+ [$2]
+ else
+ :
+ ifelse([$3], , [$2], [$3])
+ fi
+ fi
+else
+# --without-iphone
+ [$2]
+fi
+
+undefine([iphonepath_default])
+undefine([iphoneversion_default])
+]) \ No newline at end of file
diff --git a/pd/m4/universal.m4 b/pd/m4/universal.m4
new file mode 100644
index 00000000..8ab7255d
--- /dev/null
+++ b/pd/m4/universal.m4
@@ -0,0 +1,89 @@
+dnl Copyright (C) 2005-2010 IOhannes m zmölnig
+dnl This file is free software; IOhannes m zmölnig
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# PD_CHECK_UNIVERSAL([VARIABLE-NAME], [ACTION-IF-SUCCESS], [ACTION-IF-NO-SUCCESS])
+# will enable the "--enable-universal=<ARCHS>" flag
+# if <ARCH> is "yes", platform defaults are used
+# the system tries to build a test program with the archs, on succes it calls ACTION-IF-SUCCESS, and ACTION-IF-NO-SUCCESS otherwise
+# on success it will also add the flags to:
+# [VARIABLE-NAME]_CFLAGS will hold a list of cflags to compile for all requested archs
+# [VARIABLE-NAME]_LDFLAGS will hold a list of ldflags to link for all requested archs
+
+AC_DEFUN([PD_CHECK_UNIVERSAL],
+[
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+
+AC_ARG_ENABLE(universal,
+ [ --enable-universal=<ARCHS>
+ build an Apple Multi Architecture Binary (MAB);
+ ARCHS is a comma-delimited list of architectures for
+ which to build; if ARCHS is omitted, then the package
+ will be built for all architectures supported by the
+ platform (e.g. "ppc,i386" for MacOS/X and Darwin);
+ if this option is disabled or omitted entirely, then
+ the package will be built only for the target
+ platform],
+ [universal_binary=$enableval], [universal_binary=no])
+
+if test "$universal_binary" != no; then
+ AC_MSG_CHECKING([target architectures])
+
+ # Respect TARGET_ARCHS setting from environment if available.
+ if test -z "$TARGET_ARCHS"; then
+ # Respect ARCH given to --enable-universal-binary if present.
+ if test "$universal_binary" != yes; then
+ TARGET_ARCHS=$(echo "$universal_binary" | tr ',' ' ')
+ else
+ # Choose a default set of architectures based upon platform.
+ case $host in
+ *darwin*)
+ TARGET_ARCHS="ppc i386"
+ ;;
+ *)
+ TARGET_ARCHS=""
+ ;;
+ esac
+ fi
+ fi
+ AC_MSG_RESULT([$TARGET_ARCHS])
+
+ # /usr/lib/arch_tool -archify_list $TARGET_ARCHS
+ _pd_universal=""
+ for archs in $TARGET_ARCHS
+ do
+ _pd_universal="$_pd_universal -arch $archs"
+ done
+
+dnl run checks whether the compiler linker like this...
+ if test "x$_pd_universal" != "x"; then
+ tmp_arch_cflags="$CFLAGS"
+ tmp_arch_ldflags="$LDFLAGS"
+
+ CFLAGS="$CFLAGS $_pd_universal"
+ LDFLAGS="$LDFLAGS $_universal"
+ AC_TRY_LINK([], [return 0;], [
+ if test "x$1" != "x"; then
+ $1[]_CFLAGS="$[]$1[]_CFLAGS $_pd_universal"
+ $1[]_LDFLAGS="$[]$1[]_LDFLAGS $_pd_universal"
+ AC_SUBST($1[]_CFLAGS)
+ AC_SUBST($1[]_LDFLAGS)
+ fi
+ [$2]
+ ], [
+ :
+ [$3]
+ ])
+
+ CFLAGS="$tmp_arch_cflags"
+ LDFLAGS="$tmp_arch_ldflags"
+ else
+ :
+ [$3]
+ fi
+else
+ :
+ [$3]
+fi
+])# GEM_CHECK_UNIVERSAL