summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2013-02-27 12:39:21 +0100
committerKarel Zak <kzak@redhat.com>2013-03-01 10:32:36 +0100
commitd4050fa3978508ec2b7cc4900efcaf5639fa4af3 (patch)
tree9b751eb4484e87d40a28d9ad74dff4bf48c4377f
parent99726daeeef24bee047f966aeb5c9207626f22b1 (diff)
build-sys: add stuff for $ARCH
- add m4/arch.m4 to setup ARCH_<NAME> automake conditionals - use "if ARCH_<NAME>" in build system rather than make ifeq Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r--.gitignore3
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac20
-rw-r--r--m4/arch.m413
4 files changed, 37 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 715cdae..cb47f30 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,3 +31,6 @@ compile
depcomp
install-sh
missing
+
+# wanted files
+!m4/arch.m4
diff --git a/Makefile.am b/Makefile.am
index 0636cd3..e0de815 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,5 +23,5 @@ AM_CPPFLAGS = -include config.h
AM_CFLAGS =
AM_LDFLAGS =
-
EXTRA_DIST = autogen.sh README LICENSE
+
diff --git a/configure.ac b/configure.ac
index 2d05338..c31780e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -42,6 +42,23 @@ AC_PROG_GCC_TRADITIONAL
AC_PROG_MKDIR_P
AC_PATH_PROG([XSLTPROC], [xsltproc])
+dnl Define ARCH_<NAME> conditionals
+SET_ARCH(I686, i686*)
+SET_ARCH(X86_64, x86_64*)
+SET_ARCH(IA64, ia64*)
+
+ARCH=`echo $host | sed "s/\(-\).*$//"`
+
+AM_COND_IF(ARCH_I686, [
+ ARCH=ia32
+ MACHINE_TYPE_NAME=ia32])
+
+AM_COND_IF(ARCH_X86_64, [
+ MACHINE_TYPE_NAME=x64])
+
+AC_SUBST([ARCH])
+AC_SUBST([MACHINE_TYPE_NAME])
+
# ------------------------------------------------------------------------------
AC_ARG_ENABLE(blkid, AS_HELP_STRING([--disable-blkid], [disable blkid support]))
if test "x$enable_blkid" != "xno"; then
@@ -63,6 +80,9 @@ AC_OUTPUT
AC_MSG_RESULT([
$PACKAGE_NAME $VERSION
+ arch: $ARCH
+ machine type: $MACHINE_TYPE_NAME
+
prefix: ${prefix}
libdir: ${libdir}
diff --git a/m4/arch.m4 b/m4/arch.m4
new file mode 100644
index 0000000..f17b427
--- /dev/null
+++ b/m4/arch.m4
@@ -0,0 +1,13 @@
+
+dnl SET_ARCH(ARCHNAME, PATTERN)
+dnl
+dnl Define ARCH_<archname> condition if the pattern match with the current
+dnl architecture
+dnl
+AC_DEFUN([SET_ARCH], [
+ cpu_$1=false
+ case "$host" in
+ $2) cpu_$1=true ;;
+ esac
+ AM_CONDITIONAL(AS_TR_CPP(ARCH_$1), [test "x$cpu_$1" = xtrue])
+])