From: bet-frogger Date: Mon, 19 Apr 2010 12:12:18 +0000 (+0000) Subject: add autotools infrastructure X-Git-Url: http://rtime.felk.cvut.cz/gitweb/socketcan-devel.git/commitdiff_plain/3e727814a2b53b15c06658ff1f02ae27d41569b3 add autotools infrastructure Signed-off-by: Marc Kleine-Budde git-svn-id: svn://svn.berlios.de//socketcan/trunk@1174 030b6a49-0b11-0410-94ab-b0dab22257f2 --- diff --git a/can-utils/GNUmakefile.am b/can-utils/GNUmakefile.am new file mode 100644 index 0000000..668dc0f --- /dev/null +++ b/can-utils/GNUmakefile.am @@ -0,0 +1,79 @@ +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + $(linux_CFLAGS) + +# link every app against libcan, it's static so it wouldn't hurt +LDADD = \ + libcan.la + +noinst_HEADERS = \ + lib.h \ + terminal.h + + +noinst_LTLIBRARIES = \ + libcan.la + +libcan_la_SOURCES = \ + lib.c + + +bin_PROGRAMS = \ + asc2log \ + bcmserver \ + canbusload \ + candump \ + canfdtest \ + cangen \ + canlogserver \ + canplayer \ + cansend \ + cansniffer \ + log2asc \ + log2long \ + slcan_attach \ + slcand \ + slcanpty + +if CONFIG_GW +bin_PROGRAMS += \ + cangw +endif + +if CONFIG_ISOTP +bin_PROGRAMS += \ + isotpdump \ + isotprecv \ + isotpsend \ + isotpsniffer \ + isotptun +endif + +EXTRA_DIST = \ + autogen.sh + +MAINTAINERCLEANFILES = \ + configure \ + GNUmakefile.in \ + aclocal.m4 \ + config/autoconf/compile \ + config/autoconf/config.guess \ + config/autoconf/config.sub \ + config/autoconf/depcomp \ + config/autoconf/install-sh \ + config/autoconf/ltmain.sh \ + config/autoconf/mdate-sh \ + config/autoconf/missing \ + config/autoconf/texinfo.tex \ + config/m4/libtool.m4 \ + config/m4/ltoptions.m4 \ + config/m4/ltsugar.m4 \ + config/m4/ltversion.m4 \ + config/m4/lt~obsolete.m4 \ + $(DIST_ARCHIVES) + +maintainer-clean-local: + -chmod -R a+rw $(distdir) + -rm -fr $(distdir) + diff --git a/can-utils/autogen.sh b/can-utils/autogen.sh new file mode 100755 index 0000000..29db9c9 --- /dev/null +++ b/can-utils/autogen.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# +# usage: +# +# banner +# +banner() { + echo + TG=`echo $1 | sed -e "s,/.*/,,g"` + LINE=`echo $TG |sed -e "s/./-/g"` + echo $LINE + echo $TG + echo $LINE + echo +} + +banner "autoreconf" + +autoreconf --force --install --symlink -Wall || exit $? + +banner "Finished" diff --git a/can-utils/config/m4/.secret-world-domination-project b/can-utils/config/m4/.secret-world-domination-project new file mode 100644 index 0000000..e69de29 diff --git a/can-utils/configure.ac b/can-utils/configure.ac new file mode 100644 index 0000000..919ed5f --- /dev/null +++ b/can-utils/configure.ac @@ -0,0 +1,156 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. +AC_PREREQ(2.59) + +AC_INIT([can-utils], [trunk], [socketcan-core@lists.berlios.de]) +AC_CONFIG_SRCDIR([lib.c]) +AC_CONFIG_MACRO_DIR([config/m4]) +AC_CONFIG_AUX_DIR([config/autoconf]) +AC_CANONICAL_BUILD +AC_CANONICAL_HOST + +#AM_MAINTAINER_MODE + +CFLAGS="${CFLAGS} -Wall" + +# +# Checks for programs. +# +AC_PROG_CC +#AM_MISSING_PROG(PERL, perl, $missing_dir) +# libtool, old: +AC_LIBTOOL_WIN32_DLL +#AC_LIBTOOL_TAGS([]) +AC_PROG_LIBTOOL +# libtool, new: +# LT_INIT(win32-dll) + +AM_INIT_AUTOMAKE([foreign no-exeext dist-bzip2]) + + +# +# Checks for header files. +# +AC_CHECK_HEADERS([ \ + fcntl.h \ + limits.h \ + locale.h \ + stdint.h \ + stdlib.h \ + string.h \ + syslog.h \ + termios.h \ + unistd.h \ + \ + netinet/in.h \ + \ + sys/ioctl.h \ + sys/socket.h \ + sys/time.h \ +]) + + +# +# Checks for typedefs, structures, and compiler characteristics. +# +AC_C_INLINE +AC_TYPE_PID_T +AC_TYPE_UINT64_T + + +# +# Checks for library functions. +# +AC_FUNC_FORK +AC_FUNC_MKTIME +AC_CHECK_FUNCS([ \ + alarm \ + gettimeofday \ + localtime_r \ + memset \ + select \ + setlocale \ + socket \ + strchr \ + strerror \ + strstr \ + strtoul \ +]) + + +# +# check for SOCKETCAN specific defines and headers +# +AC_ARG_WITH(linux-headers, + AS_HELP_STRING([--with-linux-headers=/path/to/kernel/include], [path to linux kernel headers]), + [case "${withval}" in + (""|y|ye|yes|n|no) + AC_MSG_ERROR([You must supply a PATH as argument to --with-linux-headers]) ;; + (*) + LINUX_HEADERS_DIR="$(cd "${withval}" && pwd)" + if test $? -ne 0; then + AC_MSG_ERROR(["${withval}" seems to be an invalid path!]) + fi ;; + esac] +) + +maybe_linux_headers_dir="../kernel/2.6/include" +if test -z "${LINUX_HEADERS_DIR}" -a -e "${maybe_linux_headers_dir}"; then + LINUX_HEADERS_DIR="$(cd "${maybe_linux_headers_dir}" && pwd)" +fi +if test -n "${LINUX_HEADERS_DIR}"; then + linux_CFLAGS="-I${LINUX_HEADERS_DIR}" +fi +CPPFLAGS="${CPPFLAGS} ${linux_CFLAGS}" +AC_SUBST(linux_CFLAGS) + + +AC_CHECK_HEADERS([ \ + linux/can/gw.h \ + linux/can/isotp.h \ + ],[],[], +[ +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +]) + +AM_CONDITIONAL(CONFIG_GW, [test "${ac_cv_header_linux_can_gw_h}" = "yes"]) +AM_CONDITIONAL(CONFIG_ISOTP, [test "${ac_cv_header_linux_can_isotp_h}" = "yes"]) + + +AC_CHECK_DECL(SO_RXQ_OVFL,, + [AC_DEFINE([SO_RXQ_OVFL], [40], [SO_RXQ_OVFL])] +) +AC_CHECK_DECL(PF_CAN,, + [AC_DEFINE([PF_CAN], [29], [PF_CAN])] +) +AC_CHECK_DECL(AF_CAN,, + [AC_DEFINE([AF_CAN], [PF_CAN], [AF_CAN])] +) + + +# +# Debugging +# +AC_MSG_CHECKING([whether to enable debugging]) +AC_ARG_ENABLE(debug, + AS_HELP_STRING([--enable-debug], [enable debugging [[default=no]]]), + [case "$enableval" in + (y | yes) CONFIG_DEBUG=yes ;; + (*) CONFIG_DEBUG=no ;; + esac], + [CONFIG_DEBUG=no]) +AC_MSG_RESULT([${CONFIG_DEBUG}]) +if test "${CONFIG_DEBUG}" = "yes"; then + CFLAGS="${CFLAGS} -Wsign-compare -Wfloat-equal -Wformat-security -g -O1" + AC_DEFINE(DEBUG, 1, [debugging]) +else + CFLAGS="${CFLAGS} -O2" +fi + + +AC_CONFIG_FILES([ + GNUmakefile + ]) +AC_OUTPUT