Initial port to autoconf

Signed-off-by: Lon Hohberger <lhh@redhat.com>
This commit is contained in:
Lon Hohberger 2009-09-15 11:25:02 -04:00
parent 2ecd68297f
commit 906b0f62b9
9 changed files with 78 additions and 8 deletions

6
autogen.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
aclocal
autoconf
autoheader
automake -a

View File

@ -9,12 +9,14 @@
##
###############################################################################
###############################################################################
include ../Makefile.top
LEX=@LEX@
YACC=@YACC@
TARGETS=libsimpleconfig.a
libsimpleconfig_a_SOURCE= config.tab.c \
libsimpleconfig_a_SOURCE= y.tab.c \
config.c simpleconfig.c
INCLUDES=-I../include \
@ -33,11 +35,11 @@ all: ${TARGETS}
libsimpleconfig.a: ${libsimpleconfig_a_SOURCE:.c=.o}
ar rc $@ $^
config.tab.c config.tab.h: config.y
bison -d $^
y.tab.c y.tab.h: config.y
$(YACC) -d $^
config.c: config.tab.h config.l
flex -oconfig.c config.l
config.c: y.tab.h config.l
$(LEX) -oconfig.c config.l
%.o: %.c
gcc $(CFLAGS) -c -o $@ $^ $(INCLUDES)

View File

@ -4,7 +4,7 @@
#include <errno.h>
#include <assert.h>
#include "config-stack.h"
#include "config.tab.h"
#include "y.tab.h"
#include "simpleconfig.h"
struct value *val_list = NULL;

59
configure.in Normal file
View File

@ -0,0 +1,59 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(fence_virt, 0.1, lon@metamorphism.com)
AC_CONFIG_SRCDIR([server/main.c])
AC_CONFIG_HEADER([include/config.h])
# Checks for programs.
AC_PROG_YACC
AC_PROG_CC
AC_PROG_LEX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
# Checks for libraries.
# FIXME: Replace `main' with a function in `-lSaCkpt':
AC_CHECK_LIB([SaCkpt], [saCkptCheckpointOpen])
# FIXME: Replace `main' with a function in `-lccs':
AC_CHECK_LIB([ccs], [ccs_get])
# FIXME: Replace `main' with a function in `-lnss3':
AC_CHECK_LIB([nss3], [NSS_NoDB_Init])
# FIXME: Replace `main' with a function in `-lpthread':
AC_CHECK_LIB([pthread], [pthread_create])
# FIXME: Replace `main' with a function in `-lvirt':
AC_CHECK_LIB([virt], [virConnectOpen])
# FIXME: Replace `main' with a function in `-lxml2':
AC_CHECK_LIB([xml2], [main])
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([arpa/inet.h fcntl.h malloc.h netdb.h netinet/in.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h syslog.h termios.h unistd.h openais/cpg.h corosync/cpg.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
# Checks for library functions.
AC_FUNC_CLOSEDIR_VOID
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_CHECK_FUNCS([gettimeofday memmove memset select socket strcasecmp strchr strdup strerror])
AC_CONFIG_FILES([Makefile
client/Makefile
common/Makefile
config/Makefile
server/Makefile])
AC_OUTPUT

View File

@ -19,6 +19,7 @@
/*
* Author: Lon Hohberger <lhh at redhat.com>
*/
#include <config.h>
#include <stdio.h>
#include <simpleconfig.h>
#include <sys/types.h>
@ -29,11 +30,13 @@
#include <malloc.h>
#include <errno.h>
#include <libvirt.h>
#ifdef OPENAIS
#ifdef HAVE_OPENAIS_CPG_H
#include <openais/cpg.h>
#else
#ifdef HAVE_COROSYNC_CPG_H
#include <corosync/cpg.h>
#endif
#endif
#define NAME "checkpoint"