Skip to content

Commit

Permalink
use autoconf / automake to find libraries and make it more portable
Browse files Browse the repository at this point in the history
  • Loading branch information
apmon committed Jan 15, 2012
1 parent f4ea5dc commit 070df38
Show file tree
Hide file tree
Showing 10 changed files with 536 additions and 164 deletions.
95 changes: 0 additions & 95 deletions Makefile

This file was deleted.

28 changes: 28 additions & 0 deletions Makefile.am
@@ -0,0 +1,28 @@
AUTOMAKE_OPTIONS = foreign
SUBDIRS = iniparser3.0b

ACLOCAL_AMFLAGS = -I m4

AM_CPPFLAGS = $(FT2_CFLAGS) $(PTHREAD_CFLAGS)

bin_PROGRAMS = render_old render_expired render_list speedtest render_old renderd convert_meta

renderd_SOURCES = protocol.h store.c daemon.h daemon.c gen_tile.h gen_tile.cpp dir_utils.c render_config.h dir_utils.h store.h iniparser3.0b/libiniparser.la
renderd_LDADD = $(FT2_LIBS) $(PTHREAD_CFLAGS) $(MAPNIK_LDFLAGS) -Liniparser3.0b/.libs -liniparser
speedtest_SOURCES = render_config.h protocol.h dir_utils.c dir_utils.h speedtest.cpp
render_list_SOURCES = render_config.h protocol.h dir_utils.c dir_utils.h render_list.c
render_list_LDADD = $(PTHREAD_CFLAGS)
render_expired_SOURCES = render_config.h protocol.h dir_utils.c dir_utils.h render_expired.c
render_expired_LDADD = $(PTHREAD_CFLAGS)
render_old_SOURCES = render_config.h protocol.h dir_utils.c dir_utils.h render_old.c
render_old_LDADD = $(PTHREAD_CFLAGS)
convert_meta_SOURCES = render_config.h protocol.h dir_utils.c dir_utils.h store.c convert_meta.c

all-local:
$(APXS) -c $(DEF_LDLIBS) $(AM_CFLAGS) $(AM_LDFLAGS) @srcdir@/mod_tile.c @srcdir@/store.c @srcdir@/dir_utils.c

install-exec-local:
mkdir -p $(DESTDIR)`$(APXS) -q LIBEXECDIR`
$(APXS) -S LIBEXECDIR=$(DESTDIR)`$(APXS) -q LIBEXECDIR` -c -i $(DEF_LDLIBS) $(AM_CFLAGS) $(AM_LDFLAGS) @srcdir@/mod_tile.c @srcdir@/store.c @srcdir@/dir_utils.c


2 changes: 2 additions & 0 deletions autogen.sh
@@ -0,0 +1,2 @@
#!/bin/sh
autoreconf -vfi
57 changes: 57 additions & 0 deletions configure.ac
@@ -0,0 +1,57 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.68])
AX_CONFIG_NICE
AC_INIT(mod_tile, 0.1, http://trac.openstreetmap.org)
AM_INIT_AUTOMAKE(mod_tile,0.1)
LT_INIT
AC_CONFIG_SRCDIR([convert_meta.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CC_C99

# Checks for libraries.

# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stdint.h stdlib.h string.h sys/socket.h sys/time.h syslog.h unistd.h utime.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_TYPE_MODE_T
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T

# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MKTIME
AC_CHECK_FUNCS([bzero gethostbyname gettimeofday inet_ntoa memset mkdir pow select socket strchr strdup strerror strrchr strstr strtol strtoul utime])
AC_CHECK_FT2
AX_PTHREAD(,[AC_MSG_ERROR([no])])
AX_LIB_MAPNIK

AC_ARG_WITH(apxs,
[ --with-apxs=PATH path to Apache apxs],
[
if test "$withval" = "yes"; then
AC_CHECK_PROGS(APXS, apxs2 /usr/sbin/apxs2, reject)
else
APXS=$withval
AC_SUBST(APXS)
fi
],
[
AC_CHECK_PROGS(APXS, apxs2 /usr/sbin/apxs2, reject)
])
if test "$APXS" = "reject"; then
AC_MSG_ERROR([Could not find apxs on the path.])
fi

AC_CONFIG_FILES(Makefile iniparser3.0b/Makefile)
AC_OUTPUT
12 changes: 6 additions & 6 deletions daemon.c
Expand Up @@ -25,9 +25,9 @@

#define PIDFILE "/var/run/renderd/renderd.pid"

extern "C" {
// extern "C" {
#include "iniparser3.0b/src/iniparser.h"
}
// }

static pthread_t *render_threads;
static pthread_t *slave_threads;
Expand Down Expand Up @@ -308,8 +308,8 @@ enum protoCmd rx_request(const struct protocol *req, int fd)

// Upgrade version 1 to version 2
if (req->ver == 1) {
reqnew = (struct protocol *)malloc(sizeof(protocol));
memcpy(reqnew, req, sizeof(protocol_v1));
reqnew = (struct protocol *)malloc(sizeof(struct protocol));
memcpy(reqnew, req, sizeof(struct protocol_v1));
reqnew->xmlname[0] = 0;
req = reqnew;
}
Expand Down Expand Up @@ -721,8 +721,8 @@ void *slave_thread(void * arg) {
struct protocol * resp;
struct protocol * req_slave;

req_slave = (struct protocol *)malloc(sizeof(protocol));
resp = (struct protocol *)malloc(sizeof(protocol));
req_slave = (struct protocol *)malloc(sizeof(struct protocol));
resp = (struct protocol *)malloc(sizeof(struct protocol));
bzero(req_slave, sizeof(struct protocol));
bzero(resp, sizeof(struct protocol));

Expand Down
8 changes: 7 additions & 1 deletion daemon.h
@@ -1,6 +1,10 @@
#ifndef DAEMON_H
#define DEEMON_H

#ifdef __cplusplus
extern "C" {
#endif

#include <limits.h> /* for PATH_MAX */

#include "protocol.h"
Expand Down Expand Up @@ -45,5 +49,7 @@ typedef struct {
void statsRenderFinish(int z, long time);
void request_exit(void);


#ifdef __cplusplus
}
#endif
#endif
62 changes: 0 additions & 62 deletions iniparser3.0b/Makefile

This file was deleted.

3 changes: 3 additions & 0 deletions iniparser3.0b/Makefile.am
@@ -0,0 +1,3 @@
lib_LTLIBRARIES = libiniparser.la
libiniparser_la_SOURCES = src/iniparser.c src/dictionary.c
libiniparser_la_LDFLAGS = -version-info 3

0 comments on commit 070df38

Please sign in to comment.