added autoconf switches for debugging and geonames support

This commit is contained in:
Steffen Vogel 2012-12-23 04:44:16 +01:00
parent aeb5928aa2
commit b56e108178
4 changed files with 48 additions and 7 deletions

View File

@ -26,4 +26,37 @@ AC_CONFIG_FILES([
src/Makefile
])
# geonames.org support
AC_ARG_ENABLE(
[geonames],
[AS_HELP_STRING([--enable-geonames], [enable support geonames.org geocoding (def=yes)])],
[enable_geonames=$enableval],
[enable_geonames=yes]
)
AM_CONDITIONAL([GEONAMES_SUPPORT], [test x"$enable_geonames" = x"yes"])
if test x"$enable_geonames" = x"yes"; then
AC_DEFINE([GEONAMES_SUPPORT], [], [Geonames geocoding])
PKG_CHECK_MODULES([DEPS_GEONAMES], [libcurl >= 7.21, json >= 0.9])
fi
AC_DEFINE([GEONAMES_SUPPORT], [1], [compile with geonames.org lookup capabilities])
# debug compilation support
AC_ARG_ENABLE(
[debug],
[AS_HELP_STRING([--enable-debug], [enable debug data generation (def=no)])],
[debug=$enableval],
[debug=no]
)
if test x"$debug" = x"yes"; then
AC_DEFINE([DEBUG], [], [enable debugging])
AM_CXXFLAGS="$AM_CXXFLAGS -g -Wall -Werror -Wno-uninitialized -O0 -fno-omit-frame-pointer -Woverloaded-virtual -Wno-system-headers"
else
AM_CXXFLAGS="$AM_CXXFLAGS -O3"
fi
AC_OUTPUT

View File

@ -1,7 +1,16 @@
bin_PROGRAMS = sun geonames
bin_PROGRAMS = sun
sun_SOURCES = sun_main.c sun.c geonames.c
sun_LDADD = -lm -lcurl -ljson
sun_SOURCES = sun_main.c sun.c
sun_LDADD = -lm
geonames_SOURCES = geonames_main.c geonames.c
geonames_LDADD = -lcurl -ljson
if GEONAMES_SUPPORT
bin_PROGRAMS += geonames
geonames_SOURCES = geonames_main.c geonames.c
geonames_LDADD = $(DEPS_GEONAMES_LIBS)
sun_SOURCES += geonames.c
sun_LDADD += $(DEPS_GEONAMES_LIBS)
AM_CFLAGS = $(DEPS_GEONAMES_CFLAGS)
endif

View File

@ -26,6 +26,7 @@
#include <math.h>
#include <stdio.h>
#include "../config.h"
#include "sun.h"
double deg2rad(double deg) {

View File

@ -34,8 +34,6 @@ struct coords { double lat, lon; };
struct sun_coords { double dk, ra; };
//#define DEBUG 1
#define GEONAMES_SUPPORT 1
#define M_2PI (M_PI * 2)
enum mode { RISE, SET, NOON, DAYTIME, NIGHTTIME };