From 5b8410f98b5a357af6eb3de846062d2f722ce683 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Wed, 4 Jun 2008 13:56:41 +0000 Subject: [PATCH] Start using autotools to build the project. --- Makefile.am | 1 + configure.ac | 45 ++++++++++++++++++++++++++++++++++ examples/Makefile.am | 36 ++++++++++++++++++++++++++++ src/Makefile.am | 57 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 139 insertions(+) create mode 100644 Makefile.am create mode 100644 configure.ac create mode 100644 examples/Makefile.am create mode 100644 src/Makefile.am diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..f0ad1ee --- /dev/null +++ b/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src examples diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..c946c68 --- /dev/null +++ b/configure.ac @@ -0,0 +1,45 @@ +AC_INIT([libdivecomputer], [0.1]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) +AC_PROG_CC +AC_PROG_CC_C99 +AC_LIBTOOL_WIN32_DLL +AC_PROG_LIBTOOL + +AC_MSG_CHECKING([for native Win32]) +case "$host" in + *-*-mingw*) + os_win32=yes + ;; + *) + os_win32=no + ;; +esac +AC_MSG_RESULT([$os_win32]) +AM_CONDITIONAL([OS_WIN32], [test "$os_win32" = "yes"]) + +AC_CHECK_HEADERS([winsock2.h af_irda.h], [irda_win32=yes], [irda_win32=no], [ +#if HAVE_WINSOCK2_H +# include +# endif +]) + +AC_CHECK_HEADERS([sys/socket.h linux/types.h linux/irda.h], [irda_linux=yes], [irda_linux=no], [ +#if HAVE_SYS_SOCKET_H +# include +# endif +#if HAVE_LINUX_TYPES_H +# include +# endif +]) + +AM_CONDITIONAL([IRDA], [test "$irda_win32" = "yes" || test "$irda_linux" = "yes"]) +AM_CONDITIONAL([IRDA_WIN32], [test "$irda_win32" = "yes"]) +AM_CONDITIONAL([IRDA_LINUX], [test "$irda_linux" = "yes"]) + +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_FILES([ + Makefile + src/Makefile + examples/Makefile +]) +AC_OUTPUT diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000..26e87cf --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,36 @@ +AM_CFLAGS = -I$(top_srcdir)/src +LDADD = $(top_builddir)/src/libdivecomputer.la + +bin_PROGRAMS = \ + eon \ + vyper \ + vyper2 \ + d9 \ + sensuspro \ + sensusultra \ + aladin \ + memomouse + +if IRDA +bin_PROGRAMS += smart +endif + +eon_SOURCES = suunto_eon_test.c + +vyper_SOURCES = suunto_vyper_test.c + +vyper2_SOURCES = suunto_vyper2_test.c + +d9_SOURCES = suunto_d9_test.c + +sensuspro_SOURCES = reefnet_sensuspro_test.c + +sensusultra_SOURCES = reefnet_sensusultra_test.c + +aladin_SOURCES = uwatec_aladin_test.c + +memomouse_SOURCES = uwatec_memomouse_test.c + +if IRDA +smart_SOURCES = uwatec_smart_test.c +endif diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..51a9ff4 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,57 @@ +# +# Public header files. +# + +libdivecomputerdir = $(includedir)/libdivecomputer +libdivecomputer_HEADERS = \ + utils.h \ + suunto.h \ + suunto_eon.h \ + suunto_vyper.h \ + suunto_vyper2.h \ + suunto_d9.h \ + reefnet.h \ + reefnet_sensuspro.h \ + reefnet_sensusultra.h \ + uwatec.h \ + uwatec_aladin.h \ + uwatec_memomouse.h \ + uwatec_smart.h + +# +# Source files. +# + +lib_LTLIBRARIES = libdivecomputer.la + +libdivecomputer_la_LDFLAGS = -no-undefined + +libdivecomputer_la_SOURCES = \ + suunto.h \ + suunto_common.h suunto_common.c \ + suunto_eon.h suunto_eon.c \ + suunto_vyper.h suunto_vyper.c \ + suunto_vyper2.h suunto_vyper2.c \ + suunto_d9.h suunto_d9.c \ + reefnet.h \ + reefnet_sensuspro.h reefnet_sensuspro.c \ + reefnet_sensusultra.h reefnet_sensusultra.c \ + uwatec.h \ + uwatec_aladin.h uwatec_aladin.c \ + uwatec_memomouse.h uwatec_memomouse.c \ + utils.h utils.c + +if OS_WIN32 +libdivecomputer_la_SOURCES += serial.h serial_win32.c +else +libdivecomputer_la_SOURCES += serial.h serial_posix.c +endif + +if IRDA +if IRDA_WIN32 +libdivecomputer_la_LIBADD = -lws2_32 +endif +libdivecomputer_la_SOURCES += \ + irda.h irda.c \ + uwatec_smart.h uwatec_smart.c +endif