summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodor Tomov <ttomov@mm-sol.com>2011-02-03 10:50:48 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-02-07 16:32:44 +0100
commitd4968694e251f603e7c2b91608746cf4c382723a (patch)
tree6a46bfc59051f7469824108a8819dd08dd75f59e
parent14ddd592a6fcba2ceb751c0d4b0a3b5d46f2a59f (diff)
Use autotools
Use autoconf and automake for building. Quick instructions are added in INSTALL. Application source files are moved to src subdirectory. Signed-off-by: Todor Tomov <ttomov@mm-sol.com>
-rw-r--r--INSTALL26
-rw-r--r--Makefile18
-rw-r--r--Makefile.am2
-rw-r--r--configure.in61
-rw-r--r--src/Makefile.am3
-rw-r--r--src/main.c (renamed from main.c)0
-rw-r--r--src/media.c (renamed from media.c)0
-rw-r--r--src/media.h (renamed from media.h)0
-rw-r--r--src/options.c (renamed from options.c)0
-rw-r--r--src/options.h (renamed from options.h)0
-rw-r--r--src/subdev.c (renamed from subdev.c)0
-rw-r--r--src/subdev.h (renamed from subdev.h)0
-rw-r--r--src/tools.h (renamed from tools.h)0
13 files changed, 92 insertions, 18 deletions
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..98e1ef9
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,26 @@
+Building:
+---------
+
+Useful 'configure' options:
+ --with-kernel-headers=DIR path of Linux kernel headers,
+ default /usr/src/kernel-headers.
+
+ --host=TYPE host platform for cross-compilation.
+
+
+Building:
+$ autoreconf --install
+$ ./configure [--with-kernel-headers=DIR] [--host=TYPE]
+$ make
+
+
+Installing:
+-----------
+
+$ sudo make install
+
+
+Uninstalling:
+-------------
+
+$ sudo make uninstall
diff --git a/Makefile b/Makefile
deleted file mode 100644
index a89b79c..0000000
--- a/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-CROSS_COMPILE ?=
-KDIR ?=
-
-KINC := -I$(KDIR)/usr/include
-CC := $(CROSS_COMPILE)gcc
-
-CFLAGS += -O2 -Wall -fpic -I. $(KINC)
-OBJS = media.o main.o options.o subdev.o
-
-all: media-ctl
-
-media-ctl: $(OBJS)
- $(CC) $(CFLAGS) -o media-ctl $(OBJS)
- $(CROSS_COMPILE)strip media-ctl
-clean:
- rm -f $(OBJS) media-ctl
-
-.PHONY: clean all
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..f268924
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,2 @@
+SUBDIRS = src
+
diff --git a/configure.in b/configure.in
new file mode 100644
index 0000000..1b627bc
--- /dev/null
+++ b/configure.in
@@ -0,0 +1,61 @@
+AC_PREREQ([2.65])
+AC_INIT([media-ctl], [0.0.1], [laurent.pinchart@ideasonboard.com])
+AC_CONFIG_SRCDIR([src/main.c])
+AC_CONFIG_AUX_DIR([config])
+AC_CONFIG_HEADERS([config.h])
+
+AM_INIT_AUTOMAKE([-Wall -Werror foreign])
+
+# Checks for programs.
+AC_PROG_CC
+
+# Checks for libraries.
+
+# Kernel headers path.
+AC_ARG_WITH(kernel-headers,
+ [AC_HELP_STRING([--with-kernel-headers=DIR],
+ [specify path of Linux kernel headers [/usr/src/kernel-headers]])],
+ [case "${withval}" in
+ yes | no) AC_MSG_ERROR([bad value ${withval} for --with-kernel-headers]) ;;
+ *) KERNEL_HEADERS_DIR="${withval}" ;;
+ esac],
+ [KERNEL_HEADERS_DIR="/usr/src/kernel-headers"])
+
+CPPFLAGS="-I$KERNEL_HEADERS_DIR/include"
+
+# Checks for header files.
+AC_CHECK_HEADERS([linux/media.h \
+ linux/types.h \
+ linux/v4l2-mediabus.h \
+ linux/v4l2-subdev.h \
+ linux/videodev2.h],
+ [],
+ [echo "ERROR: Kernel header file not found or not usable!"; exit 1])
+
+AC_CHECK_HEADERS([fcntl.h \
+ stdlib.h \
+ string.h \
+ sys/ioctl.h \
+ sys/time.h \
+ unistd.h],
+ [],
+ [echo "ERROR: Header file not found or not usable!"; exit 1])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_INLINE
+AC_TYPE_SIZE_T
+AC_CHECK_MEMBERS([struct stat.st_rdev])
+
+# Checks for library functions.
+AC_HEADER_MAJOR
+AC_FUNC_MALLOC
+AC_FUNC_REALLOC
+AC_CHECK_FUNCS([memset strerror strrchr strtoul])
+
+AC_CONFIG_FILES([
+ Makefile
+ src/Makefile
+])
+
+AC_OUTPUT
+
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..b112ba6
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,3 @@
+bin_PROGRAMS = media-ctl
+media_ctl_SOURCES = main.c media.c media.h options.c options.h subdev.c subdev.h tools.h
+
diff --git a/main.c b/src/main.c
index aa4ced0..aa4ced0 100644
--- a/main.c
+++ b/src/main.c
diff --git a/media.c b/src/media.c
index 456b882..456b882 100644
--- a/media.c
+++ b/src/media.c
diff --git a/media.h b/src/media.h
index 80cf976..80cf976 100644
--- a/media.h
+++ b/src/media.h
diff --git a/options.c b/src/options.c
index 186425e..186425e 100644
--- a/options.c
+++ b/src/options.c
diff --git a/options.h b/src/options.h
index 2467fbe..2467fbe 100644
--- a/options.h
+++ b/src/options.h
diff --git a/subdev.c b/src/subdev.c
index 3960d05..3960d05 100644
--- a/subdev.c
+++ b/src/subdev.c
diff --git a/subdev.h b/src/subdev.h
index b5772e0..b5772e0 100644
--- a/subdev.h
+++ b/src/subdev.h
diff --git a/tools.h b/src/tools.h
index 0a0a948..0a0a948 100644
--- a/tools.h
+++ b/src/tools.h