This list all the available platforms looking for
 platform/*/m4/configure.m4 and generate the appropriate m4
 file for the configure.ac to include

Signed-off-by: Nicolas Morey-Chaisemartin <nmo...@kalray.eu>
---
 bootstrap    | 25 +++++++++++++++++++++++++
 configure.ac | 11 +----------
 2 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/bootstrap b/bootstrap
index 6fd91c8..274ce2a 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,5 +1,30 @@
 #! /bin/sh
 set -x
+
+# Auto generate the platform list
+PLATFORMS=$(ls platform/*/m4/configure.m4 | awk -F '/' '{ print $2}')
+GEN_M4="m4/platforms.m4"
+
+prefix=""
+echo "# Auto-Generated platform list" > $GEN_M4
+for platform in $PLATFORMS; do
+       cat << EOF >> $GEN_M4
+${prefix}if test "\${with_platform}" == "${platform}";
+then
+       m4_include([./platform/${platform}/m4/configure.m4])
+EOF
+       if [ -f test/${platform}/m4/configure.m4 ]; then
+           echo "      m4_include([./test/${platform}/m4/configure.m4])" >> 
$GEN_M4
+       fi
+       prefix="el"
+done
+cat << EOF >> $GEN_M4
+else
+    echo "UNSUPPORTED PLATFORM: \${with_platform}"
+    exit 1
+fi
+EOF
+
 aclocal -I config -I m4
 libtoolize --copy
 autoheader
diff --git a/configure.ac b/configure.ac
index 86173f4..c5cd9f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -132,16 +132,7 @@ AC_SUBST([platform_with_platform], 
["platform/${with_platform}"])
 ##########################################################################
 # Run platform specific checks and settings
 ##########################################################################
-IMPLEMENTATION_NAME=""
-if test "${with_platform}" == "linux-generic";
-then
-    m4_include([./platform/linux-generic/m4/configure.m4])
-    m4_include([./test/linux-generic/m4/configure.m4])
-    IMPLEMENTATION_NAME="odp-linux"
-else
-    echo "UNSUPPORTED PLATFORM: ${with_platform}"
-    exit 1
-fi
+m4_include([m4/platforms.m4])
 
 ODP_CFLAGS="$ODP_CFLAGS -DIMPLEMENTATION_NAME=$IMPLEMENTATION_NAME"
 
-- 
2.10.1.4.g0ffc436


Reply via email to