Просмотр исходного кода

configure.ac:
- Fix white space for --help.
- Drop LCRSODIR as global and move it to local directory.

all */Makefile.am:
- export -DDIRECTORY_NAME as required (for now only LCRSO and
SYSCONFDIR)

top level Makefile.am:
- drop hardcoded ETCDIR that is just wrong and use the configured one

*.c files around:
- drop hardcoded ETCDIR and use configured one.



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1853 fd59a12c-fef9-0310-b244-a6a79926bd2f

Fabio M. Di Nitto 17 лет назад
Родитель
Сommit
20e0336de5
8 измененных файлов с 21 добавлено и 16 удалено
  1. 3 4
      Makefile.am
  2. 5 5
      configure.ac
  3. 1 0
      exec/Makefile.am
  4. 1 1
      exec/coroparse.c
  5. 1 1
      exec/totemconfig.c
  6. 1 0
      lcr/Makefile.am
  7. 2 0
      tools/Makefile.am
  8. 7 5
      tools/corosync-keygen.c

+ 3 - 4
Makefile.am

@@ -36,7 +36,6 @@ MAINTAINERCLEANFILES    = Makefile.in aclocal.m4 configure depcomp \
 			  config.guess config.sub missing install-sh \
 			  autoheader automake autoconf
 
-ETCDIR = /etc
 MANDIR = /usr/share/man
 SUBDIRS	= include lcr lib exec services tools test pkgconfig
 # man init conf
@@ -48,9 +47,9 @@ doxygen:
 	mkdir -p doc/api && doxygen
 
 install-exec-local:
-	$(INSTALL) -d $(DESTDIR)$(ETCDIR)
-	if [ ! -f $(DESTDIR)$(ETCDIR)/corosync.conf ] ; then 	   \
-		$(INSTALL) -m 644 $(srcdir)/conf/corosync.conf $(DESTDIR)$(ETCDIR) ; \
+	$(INSTALL) -d $(DESTDIR)${sysconfdir}
+	if [ ! -f $(DESTDIR)${sysconfdir}/corosync.conf ] ; then 	   \
+		$(INSTALL) -m 644 $(srcdir)/conf/corosync.conf $(DESTDIR)${sysconfdir} ; \
 	fi
 	mkdir -p $(DESTDIR)$(MANDIR)/man3
 	$(INSTALL) -m 644 $(srcdir)/man/*.3 $(DESTDIR)$(MANDIR)/man3

+ 5 - 5
configure.ac

@@ -122,11 +122,11 @@ SONAME="${SOMAJOR}.${SOMINOR}.${SOMICRO}"
 
 # local options
 AC_ARG_ENABLE([ansi],
-	[ --enable-ansi           : force to build with ANSI standards. ],
+	[  --enable-ansi           : force to build with ANSI standards. ],
 	[ default="no" ])
 
 AC_ARG_ENABLE([fatal-warnings],
-	[ --enable-fatal-warnings : enable fatal warnings. ],
+	[  --enable-fatal-warnings : enable fatal warnings. ],
 	[ default="no" ])
 
 AC_ARG_ENABLE([debug],
@@ -134,11 +134,11 @@ AC_ARG_ENABLE([debug],
 	[ default="no" ])
 
 AC_ARG_ENABLE([coverage],
-	[ --enable-coverage       : coverage analysis of the codebase. ],
+	[  --enable-coverage       : coverage analysis of the codebase. ],
 	[ default="no" ])
 
 AC_ARG_WITH([lcrso-dir],
-	[ --with-lcrso-dir=DIR    : corosync lcrso files. ],
+	[  --with-lcrso-dir=DIR    : corosync lcrso files. ],
 	[ LCRSODIR="$withval" ],
 	[ LCRSODIR="$libexecdir/lcrso" ])
 
@@ -277,7 +277,7 @@ fi
 # final build of *FLAGS
 CFLAGS="$ENV_CFLAGS $OPT_CFLAGS $GDB_FLAGS $OS_CFLAGS \
 	$COVERAGE_CFLAGS $EXTRA_WARNINGS $WERROR_CFLAGS"
-CPPFLAGS="$ENV_CPPFLAGS $ANSI_CPPFLAGS $OS_CPPFLAGS -DLCRSODIR=\\\"${LCRSODIR}\\\""
+CPPFLAGS="$ENV_CPPFLAGS $ANSI_CPPFLAGS $OS_CPPFLAGS"
 LDFLAGS="$ENV_LDFLAGS $COVERAGE_LDFLAGS $OS_LDFLAGS"
 
 # substitute what we need:

+ 1 - 0
exec/Makefile.am

@@ -32,6 +32,7 @@
 MAINTAINERCLEANFILES    = Makefile.in
 
 AM_CFLAGS	= -fPIC
+AM_CPPFLAGS	= -DSYSCONFDIR=\"${sysconfdir}\" -DLCRSODIR=\"${LCRSODIR}\"
 INCLUDES       	= -I$(top_builddir)/include  -I$(top_srcdir)/include
 
 LCR_SRC		= objdb.c vsf_ykd.c coroparse.c quorum.c vsf_quorum.c

+ 1 - 1
exec/coroparse.c

@@ -162,7 +162,7 @@ static int read_config_file_into_objdb(
 
 	filename = getenv ("COROSYNC_MAIN_CONFIG_FILE");
 	if (!filename)
-		filename = "/etc/corosync.conf";
+		filename = SYSCONFDIR "/corosync.conf";
 
 	fp = fopen (filename, "r");
 	if (fp == 0) {

+ 1 - 1
exec/totemconfig.c

@@ -667,7 +667,7 @@ int totem_config_keyread (
 	if (!got_key) {
 		char *filename = getenv("COROSYNC_TOTEM_AUTHKEY_FILE");
 		if (!filename)
-			filename = "/etc/ais/authkey";
+			filename = SYSCONFDIR "/ais/authkey";
 		res = read_keyfile(filename, totem_config, error_string);
 		if (res)
 			goto key_error;

+ 1 - 0
lcr/Makefile.am

@@ -31,6 +31,7 @@
 MAINTAINERCLEANFILES    = Makefile.in
 
 AM_CFLAGS		= -fPIC
+AM_CPPFLAGS		= -DLCRSODIR=\"${LCRSODIR}\"
 INCLUDES       		= -I$(top_builddir)/include  -I$(top_srcdir)/include
 
 LCRSO			= libtest_a.lcrso libtest_b.lcrso

+ 2 - 0
tools/Makefile.am

@@ -32,6 +32,8 @@
 MAINTAINERCLEANFILES    = Makefile.in
 INCLUDES       		= -I$(top_builddir)/include  -I$(top_srcdir)/include
 
+AM_CPPFLAGS		= -DSYSCONFDIR=\"${sysconfdir}\"
+
 sbin_PROGRAMS		= corosync-fplay corosync-cfgtool \
 			  corosync-keygen corosync-objctl \
 			  corosync-pload

+ 7 - 5
tools/corosync-keygen.c

@@ -40,6 +40,8 @@
 
 #include <netinet/in.h>
 
+#define KEYFILE SYSCONFDIR "/ais/authkey"
+
 int main (void) {
 	int authkey_fd;
 	int random_fd;
@@ -51,7 +53,7 @@ int main (void) {
 		printf ("Error: Authorization key must be generated as root user.\n");
 		exit (1);
 	}
-	mkdir ("/etc/ais", 0700);
+	mkdir (SYSCONFDIR "/ais", 0700);
 
 	printf ("Gathering %lu bits for key from /dev/random.\n", (unsigned long)(sizeof (key) * 8));
 	random_fd = open ("/dev/random", O_RDONLY);
@@ -72,9 +74,9 @@ int main (void) {
 	/*
 	 * Open key
 	 */
-	authkey_fd = open ("/etc/ais/authkey", O_CREAT|O_WRONLY, 600);
+	authkey_fd = open (KEYFILE, O_CREAT|O_WRONLY, 600);
 	if (authkey_fd == -1) {
-		perror ("Could not create /etc/ais/authkey");
+		perror ("Could not create " KEYFILE);
 		exit (1);
 	}
 	/*
@@ -83,14 +85,14 @@ int main (void) {
 	fchown (authkey_fd, 0, 0);
 	fchmod (authkey_fd, 0400);
 
-	printf ("Writing corosync key to /etc/ais/authkey.\n");
+	printf ("Writing corosync key to " KEYFILE ".\n");
 
 	/*
 	 * Write key
 	 */
 	res = write (authkey_fd, key, sizeof (key));
 	if (res == -1) {
-		perror ("Could not write /etc/ais/authkey");
+		perror ("Could not write " KEYFILE);
 		exit (1);
 	}