diff mbox

[PATCHv2] support autoconf

Message ID 1403354287-11130-1-git-send-email-maxim.uvarov@linaro.org
State Superseded
Headers show

Commit Message

Maxim Uvarov June 21, 2014, 12:38 p.m. UTC
Implement ./configure using original odp Makefiles

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 v2: remove Makefile.inc from commit, it's generated file now.

 This is propose of patch to implement autoconf/automake for odp.
 If we already have all makefiles that might be no reason to use m4.
 And keep using configure.in and Makefile.in.

 Compilation now is standard procedure with autotools:
 autoreconf
 ./configure
 for KS2 ./configure --with-platform=linux-keystone2

 Best regards,
 Maxim.



 Makefile => Makefile.in                            |  0
 Makefile.inc => Makefileinc.in                     |  8 +--
 configure.in                                       | 60 ++++++++++++++++++++++
 platform/linux-generic/{Makefile => Makefile.in}   | 10 +---
 platform/linux-keystone2/{Makefile => Makefile.in} |  6 +--
 5 files changed, 66 insertions(+), 18 deletions(-)
 rename Makefile => Makefile.in (100%)
 rename Makefile.inc => Makefileinc.in (92%)
 create mode 100644 configure.in
 rename platform/linux-generic/{Makefile => Makefile.in} (94%)
 rename platform/linux-keystone2/{Makefile => Makefile.in} (95%)
diff mbox

Patch

diff --git a/Makefile b/Makefile.in
similarity index 100%
rename from Makefile
rename to Makefile.in
diff --git a/Makefile.inc b/Makefileinc.in
similarity index 92%
rename from Makefile.inc
rename to Makefileinc.in
index ff16043..5076384 100644
--- a/Makefile.inc
+++ b/Makefileinc.in
@@ -3,7 +3,7 @@ 
 #
 # SPDX-License-Identifier:	BSD-3-Clause
 
-PLATFORM ?= linux-generic
+PLATFORM ?= @PLATFORM@
 OBJ_DIR   = ./obj
 ODP_DIR   = $(ODP_ROOT)/platform/$(PLATFORM)
 
@@ -19,7 +19,7 @@  RM     := rm -f
 COPY   := cp -r
 SYNC   := rsync -a --delete
 
-ifneq ($(VERBOSE),yes)
+ifneq (@VERBOSE@,yes)
 Q          = @
 MAKEFLAGS += --no-print-directory
 endif
@@ -29,13 +29,13 @@  QUIET_LD   = $(Q:@=@echo    '     LD       '$@;)
 QUIET_AR   = $(Q:@=@echo    '     AR       '$@;)
 export Q QUIET_CC QUIET_LD QUIET_AR
 
-ifeq ($(ODP_DEBUG_PRINT),no)
+ifeq (@ODP_DEBUG_PRINT@,no)
 EXTRA_CFLAGS += -DODP_DEBUG_PRINT=0
 else
 EXTRA_CFLAGS += -DODP_DEBUG_PRINT=1
 endif
 
-ifeq ($(DEBUG),yes)
+ifeq (@DEBUG@,yes)
 EXTRA_CFLAGS += -O0 -g
 else
 EXTRA_CFLAGS += -O3
diff --git a/configure.in b/configure.in
new file mode 100644
index 0000000..fcfefc9
--- /dev/null
+++ b/configure.in
@@ -0,0 +1,60 @@ 
+AC_INIT([odp], 0.2)
+
+AC_MSG_CHECKING([checking for platform])
+AC_ARG_WITH([platform],
+[  --with-platform=PLAT    linux-generic (default)
+ 			  linux-keystone2 ],
+[if test x"$withval" != x ; then
+	PLATFORM="$withval"
+fi],
+[PLATFORM="linux-generic"])
+AC_MSG_RESULT($PLATFORM)
+AC_SUBST(PLATFORM)
+
+ODP_HAVE_NETMAP=""
+AC_ARG_ENABLE([reloc],
+	      AS_HELP_STRING([--enable-netmap], [compile netmap support (linux-generic only)]))
+AS_IF([test "x$enable_netmap" = "xyes"], [
+       ODP_HAVE_NETMAP="-DODP_HAVE_NETMAP"
+       ])
+AC_SUBST(ODP_HAVE_NETMAP)
+
+ODP_RELOC=""
+AC_ARG_ENABLE([reloc],
+    AS_HELP_STRING([--enable-reloc], [compile library with position independent code]))
+AS_IF([test "x$enable_reloc" = "xyes"], [
+  ODP_RELOC="-fpic"
+])
+AC_SUBST(ODP_RELOC)
+
+ODP_DEBUG_PRINT="yes"
+AC_ARG_ENABLE([debug_print],
+    AS_HELP_STRING([--disable-debug_print], [disable odp debug print]))
+AS_IF([test "x$enable_debug" = "xyes"], [
+ ODP_DEBUG_PRINT="no"
+])
+AC_SUBST(ODP_DEBUG_PRINT)
+
+DEBUG="no"
+AC_ARG_ENABLE([debug],
+    AS_HELP_STRING([--enable-debug], [compile code with debug info]))
+AS_IF([test "x$enable_debug" = "xyes"], [
+  DEBUG="yes"
+])
+AC_SUBST(DEBUG)
+
+VERBOSE="no"
+AC_ARG_ENABLE([debug],
+    AS_HELP_STRING([--enable-verbose], [enable compilation verbose]))
+AS_IF([test "x$enable_debug" = "xyes"], [
+  VERBOSE="yes"
+])
+AC_SUBST(VERBOSE)
+
+AC_CONFIG_FILES(platform/linux-generic/Makefile)
+AC_CONFIG_FILES(platform/linux-keystone2/Makefile)
+AC_CONFIG_FILES(Makefile.inc:Makefileinc.in)
+AC_CONFIG_FILES(Makefile)
+
+AC_PROG_CC
+AC_OUTPUT
diff --git a/platform/linux-generic/Makefile b/platform/linux-generic/Makefile.in
similarity index 94%
rename from platform/linux-generic/Makefile
rename to platform/linux-generic/Makefile.in
index 0737656..bb9b862 100644
--- a/platform/linux-generic/Makefile
+++ b/platform/linux-generic/Makefile.in
@@ -36,15 +36,7 @@  EXTRA_CFLAGS  += -I$(ODP_ROOT)/include
 EXTRA_CFLAGS  += -I./include
 EXTRA_CFLAGS  += -I./include/api
 
-# Option for shared libraries.
-# Decreases performance with static libraries.
-ifeq ($(ODP_RELOC),yes)
-EXTRA_CFLAGS  += -fpic
-endif
-
-ifeq ($(ODP_HAVE_NETMAP),yes)
-EXTRA_CFLAGS  += -DODP_HAVE_NETMAP
-endif
+EXTRA_CFLAGS  += @ODP_RELOC@ @ODP_HAVE_NETMAP@
 
 include $(ODP_ROOT)/Makefile.inc
 STATIC_LIB = ./lib/libodp.a
diff --git a/platform/linux-keystone2/Makefile b/platform/linux-keystone2/Makefile.in
similarity index 95%
rename from platform/linux-keystone2/Makefile
rename to platform/linux-keystone2/Makefile.in
index a0e2922..91e8162 100644
--- a/platform/linux-keystone2/Makefile
+++ b/platform/linux-keystone2/Makefile.in
@@ -13,11 +13,7 @@  DOC_DIR  = ./doc
 
 LINUX_GENERIC_DIR = ../linux-generic
 
-# Option for shared libraries.
-# Decreases performance with static libraries.
-ifeq ($(ODP_RELOC),yes)
-EXTRA_CFLAGS  += -fpic
-endif
+EXTRA_CFLAGS  += @ODP_RELOC@
 
 MY_PLATFORM  = DEVICE_K2K