Commit 47be870b authored by Lennart Poettering's avatar Lennart Poettering
Browse files

build: basic autoconfization

parent a7334b09
......@@ -8,3 +8,20 @@ systemctl.c
systemd-interfaces.c
systemadm
systemadm.c
.deps/
Makefile.in
aclocal.m4
*.cache
compile
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
depcomp
install-sh
missing
stamp-*
*.stamp
CFLAGS=-Wall -Wextra -O0 -g -pipe -D_GNU_SOURCE -fdiagnostics-show-option -Wno-unused-parameter -DUNIT_PATH=\"/tmp/does/not/exist\" `pkg-config --cflags libudev dbus-1`
LIBS=-lrt -lcap `pkg-config --libs libudev dbus-1`
COMMON= \
unit.o \
util.o \
set.o \
hashmap.o \
strv.o \
job.o \
manager.o \
conf-parser.o \
load-fragment.o \
socket-util.o \
log.o \
service.o \
automount.o \
mount.o \
device.o \
target.o \
snapshot.o \
socket.o \
timer.o \
load-dropin.o \
execute.o \
ratelimit.o \
dbus.o \
dbus-manager.o \
dbus-unit.o \
dbus-job.o
all: systemd test-engine test-job-type systemd-logger systemctl systemadm
systemd: main.o $(COMMON)
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
systemd-logger: logger.o $(COMMON)
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
test-engine: test-engine.o $(COMMON)
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
test-job-type: test-job-type.o $(COMMON)
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
systemctl: systemctl.vala
valac -g --save-temps systemctl.vala systemd-interfaces.vala --pkg=dbus-glib-1 --pkg=posix
systemadm: systemadm.vala
valac -g --save-temps systemadm.vala systemd-interfaces.vala --pkg=dbus-glib-1 --pkg=posix --pkg gee-1.0 --pkg gtk+-2.0
clean:
rm -f *.o systemd test-engine systemctl systemadm
# This file is part of systemd.
#
# Copyright 2010 Lennart Poettering
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# systemd is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
ACLOCAL_AMFLAGS = -I m4
AM_CPPFLAGS = \
-include $(top_builddir)/config.h \
-DUNIT_PATH=\"/tmp/does/not/exist\"
sbin_PROGRAMS = \
systemd
bin_PROGRAMS = \
systemctl \
systemadm \
systemd-logger
noinst_PROGRAMS = \
test-engine \
test-job-type
BASIC_SOURCES= \
util.c \
hashmap.c \
set.c \
strv.c \
conf-parser.c \
socket-util.c \
log.c \
ratelimit.c
COMMON_SOURCES= \
$(BASIC_SOURCES) \
unit.c \
job.c \
manager.c \
load-fragment.c \
service.c \
automount.c \
mount.c \
device.c \
target.c \
snapshot.c \
socket.c \
timer.c \
load-dropin.c \
execute.c \
dbus.c \
dbus-manager.c \
dbus-unit.c \
dbus-job.c
systemd_SOURCES = \
$(COMMON_SOURCES) \
main.c
systemd_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(DBUS_CFLAGS) \
$(UDEV_CFLAGS)
systemd_LDADD = \
$(DBUS_LIBS) \
$(UDEV_LIBS)
test_engine_SOURCES = \
$(COMMON_SOURCES) \
test-engine.c
test_engine_CPPFLAGS = $(systemd_CPPFLAGS)
test_engine_LDADD = $(systemd_LDADD)
test_job_type_SOURCES = \
$(COMMON_SOURCES) \
test-engine.c
test_job_type_CPPFLAGS = $(systemd_CPPFLAGS)
test_job_type_LDADD = $(systemd_LDADD)
systemd_logger_SOURCES = \
$(BASIC_SOURCES) \
logger.c
VALAFLAGS = -g --save-temps --pkg=dbus-glib-1 --pkg=posix --pkg gee-1.0 --pkg gtk+-2.0
systemctl_SOURCES = \
systemctl.vala \
systemd-interfaces.vala
systemctl_CPPFLAGS = $(AM_CPPFLAGS) $(DBUSGLIB_CFLAGS)
systemctl_LDADD = $(DBUSGLIB_LIBS)
systemadm_SOURCES = \
systemadm.vala \
systemd-interfaces.vala
systemadm_CPPFLAGS = $(AM_CPPFLAGS) $(DBUSGLIB_CFLAGS) $(GTK_CFLAGS)
systemadm_LDADD = $(DBUSGLIB_LIBS) $(GTK_LIBS)
#!/bin/bash
# This file is part of systemd.
#
# Copyright 2010 Lennart Poettering
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# systemd is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
AM_VERSION=1.11
AC_VERSION=2.63
run_versioned() {
local P
local V
V=$(echo "$2" | sed -e 's,\.,,g')
if [ -e "`which $1$V 2> /dev/null`" ] ; then
P="$1$V"
else
if [ -e "`which $1-$2 2> /dev/null`" ] ; then
P="$1-$2"
else
P="$1"
fi
fi
shift 2
"$P" "$@"
}
set -ex
if [ -f .git/hooks/pre-commit.sample -a ! -f .git/hooks/pre-commit ] ; then
cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit && \
chmod +x .git/hooks/pre-commit && \
echo "Activated pre-commit hook."
fi
# We check for this here, because if pkg-config is not found in the
# system, it's likely that the pkg.m4 macro file is also not present,
# which will make PKG_PROG_PKG_CONFIG be undefined and the generated
# configure file faulty.
if ! pkg-config --version &>/dev/null; then
echo "pkg-config is required to bootstrap this program" &>/dev/null
exit 1
fi
if type -p colorgcc > /dev/null ; then
export CC=colorgcc
fi
if [ "x$1" = "xam" ] ; then
run_versioned automake "$VERSION" -a -c --foreign
./config.status
else
rm -rf autom4te.cache
rm -f config.cache
run_versioned aclocal "$AM_VERSION" -I m4
run_versioned autoconf "$AC_VERSION" -Wall
run_versioned autoheader "$AC_VERSION"
run_versioned automake "$AM_VERSION" --copy --foreign --add-missing
if [ "x$1" != "xac" ]; then
CFLAGS="$CFLAGS -g -O0" ./configure --sysconfdir=/etc --localstatedir=/var "$@"
make clean
fi
fi
# This file is part of systemd.
#
# Copyright 2010 Lennart Poettering
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# systemd is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
AC_PREREQ(2.63)
AC_INIT([systemd],[0],[mzflfgrzq (at) 0pointer (dot) net])
AC_CONFIG_SRCDIR([main.c])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax])
AC_SUBST(PACKAGE_URL, [http://git.0pointer.de/?p=systemd.git])
AC_CANONICAL_HOST
AM_SILENT_RULES([yes])
AC_CHECK_PROG([STOW], [stow], [yes], [no])
AS_IF([test "x$STOW" = "xyes" && test -d /usr/local/stow], [
AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
])
AC_PROG_CC
AC_PROG_CC_C99
AM_PROG_CC_C_O
AC_PROG_GCC_TRADITIONAL
AC_USE_SYSTEM_EXTENSIONS
CC_CHECK_CFLAGS_APPEND([-Wall -W -Wextra -pipe -Wno-long-long -Winline -Wvla -Wno-overlength-strings -Wunsafe-loop-optimizations -Wundef -Wformat=2 -Wlogical-op -Wsign-compare -Wformat-security -Wmissing-include-dirs -Wformat-nonliteral -Wold-style-definition -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-align -Wstrict-aliasing=2 -Wwrite-strings -Wno-unused-parameter -ffast-math -Wp,-D_FORTIFY_SOURCE=2 -fno-common -fdiagnostics-show-option -Wno-missing-field-initializers])
AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
PKG_CHECK_MODULES(UDEV, [ libudev ])
AC_SUBST(UDEV_CFLAGS)
AC_SUBST(UDEV_LIBS)
PKG_CHECK_MODULES(DBUS, [ dbus-1 ])
AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS)
PKG_CHECK_MODULES(DBUSGLIB, [ dbus-glib-1 ])
AC_SUBST(DBUSGLIB_CFLAGS)
AC_SUBST(DBUSGLIB_LIBS)
PKG_CHECK_MODULES(GEE, [ gee-1.0 ])
AC_SUBST(GEE_CFLAGS)
AC_SUBST(GEE_LIBS)
PKG_CHECK_MODULES(GTK, [ gtk+-2.0 ])
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
AM_PROG_VALAC()
AC_SUBST(VAPIDIR)
AC_OUTPUT([Makefile])
......@@ -142,7 +142,7 @@ oom:
return DBUS_HANDLER_RESULT_NEED_MEMORY;
}
DBusHandlerResult bus_job_message_handler(DBusConnection *connection, DBusMessage *message, void *data) {
static DBusHandlerResult bus_job_message_handler(DBusConnection *connection, DBusMessage *message, void *data) {
Manager *m = data;
Job *j;
int r;
......
......@@ -54,7 +54,7 @@
#define INTROSPECTION_END \
"</node>"
DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, DBusMessage *message, void *data) {
static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, DBusMessage *message, void *data) {
int r;
Manager *m = data;
DBusError error;
......@@ -172,7 +172,7 @@ DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, DBusM
goto oom;
HASHMAP_FOREACH_KEY(u, k, m->units, i) {
char *unit_path, *job_path;
char *u_path, *j_path;
const char *id, *description, *load_state, *active_state, *job_type;
DBusMessageIter sub2;
uint32_t job_id;
......@@ -188,21 +188,21 @@ DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, DBusM
load_state = unit_load_state_to_string(u->meta.load_state);
active_state = unit_active_state_to_string(unit_active_state(u));
if (!(unit_path = unit_dbus_path(u)))
if (!(u_path = unit_dbus_path(u)))
goto oom;
if (u->meta.job) {
job_id = (uint32_t) u->meta.job->id;
if (!(job_path = job_dbus_path(u->meta.job))) {
free(unit_path);
if (!(j_path = job_dbus_path(u->meta.job))) {
free(u_path);
goto oom;
}
job_type = job_type_to_string(u->meta.job->type);
} else {
job_id = 0;
job_path = unit_path;
j_path = u_path;
job_type = "";
}
......@@ -210,19 +210,19 @@ DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, DBusM
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_STRING, &description) ||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_STRING, &load_state) ||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_STRING, &active_state) ||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_OBJECT_PATH, &unit_path) ||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_OBJECT_PATH, &u_path) ||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_UINT32, &job_id) ||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_STRING, &job_type) ||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_OBJECT_PATH, &job_path)) {
free(unit_path);
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_OBJECT_PATH, &j_path)) {
free(u_path);
if (u->meta.job)
free(job_path);
free(j_path);
goto oom;
}
free(unit_path);
free(u_path);
if (u->meta.job)
free(job_path);
free(j_path);
if (!dbus_message_iter_close_container(&sub, &sub2))
goto oom;
......@@ -245,7 +245,7 @@ DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, DBusM
goto oom;
HASHMAP_FOREACH(j, m->jobs, i) {
char *unit_path, *job_path;
char *u_path, *j_path;
const char *unit, *state, *type;
uint32_t id;
DBusMessageIter sub2;
......@@ -258,11 +258,11 @@ DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, DBusM
state = job_state_to_string(j->state);
type = job_type_to_string(j->type);
if (!(job_path = job_dbus_path(j)))
if (!(j_path = job_dbus_path(j)))
goto oom;
if (!(unit_path = unit_dbus_path(j->unit))) {
free(job_path);
if (!(u_path = unit_dbus_path(j->unit))) {
free(j_path);
goto oom;
}
......@@ -270,15 +270,15 @@ DBusHandlerResult bus_manager_message_handler(DBusConnection *connection, DBusM
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_STRING, &unit) ||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_STRING, &type) ||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_STRING, &state) ||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_OBJECT_PATH, &job_path) ||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_OBJECT_PATH, &unit_path)) {
free(job_path);
free(unit_path);
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_OBJECT_PATH, &j_path) ||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_OBJECT_PATH, &u_path)) {
free(j_path);
free(u_path);
goto oom;
}
free(job_path);
free(unit_path);
free(j_path);
free(u_path);
if (!dbus_message_iter_close_container(&sub, &sub2))
goto oom;
......
......@@ -269,7 +269,7 @@ static int setup_output(const ExecContext *context, const char *ident) {
}
}
int setup_input(const ExecContext *context) {
static int setup_input(const ExecContext *context) {
int r;
assert(context);
......
......@@ -124,6 +124,8 @@ bool job_type_is_mergeable(JobType a, JobType b);
bool job_type_is_superset(JobType a, JobType b);
bool job_type_is_conflicting(JobType a, JobType b);
bool job_is_runnable(Job *j);
void job_schedule_run(Job *j);
int job_run_and_invalidate(Job *j);
int job_finish_and_invalidate(Job *j, bool success);
......
......@@ -472,7 +472,7 @@ static int config_parse_service_restart(
return 0;
}
int config_parse_bindtodevice(
static int config_parse_bindtodevice(
const char *filename,
unsigned line,
const char *section,
......@@ -501,7 +501,7 @@ int config_parse_bindtodevice(
return 0;
}
int config_parse_output(
static int config_parse_output(
const char *filename,
unsigned line,
const char *section,
......@@ -527,7 +527,7 @@ int config_parse_output(
return 0;
}
int config_parse_input(
static int config_parse_input(
const char *filename,
unsigned line,
const char *section,
......@@ -553,7 +553,7 @@ int config_parse_input(
return 0;
}
int config_parse_facility(
static int config_parse_facility(
const char *filename,
unsigned line,
const char *section,
......@@ -583,7 +583,7 @@ int config_parse_facility(
return 0;
}
int config_parse_level(
static int config_parse_level(
const char *filename,
unsigned line,
const char *section,
......@@ -612,7 +612,7 @@ int config_parse_level(
return 0;
}
int config_parse_io_class(
static int config_parse_io_class(
const char *filename,
unsigned line,
const char *section,
......@@ -643,7 +643,7 @@ int config_parse_io_class(
return 0;
}
int config_parse_io_priority(
static int config_parse_io_priority(
const char *filename,
unsigned line,
const char *section,
......@@ -671,7 +671,7 @@ int config_parse_io_priority(
return 0;
}
int config_parse_cpu_sched_policy(
static int config_parse_cpu_sched_policy(
const char *filename,
unsigned line,
const char *section,
......@@ -703,7 +703,7 @@ int config_parse_cpu_sched_policy(
return 0;
}
int config_parse_cpu_sched_prio(
static int config_parse_cpu_sched_prio(
const char *filename,
unsigned line,
const char *section,
......@@ -732,7 +732,7 @@ int config_parse_cpu_sched_prio(
return 0;
}
int config_parse_cpu_affinity(
static int config_parse_cpu_affinity(
const char *filename,
unsigned line,
const char *section,
......@@ -775,7 +775,7 @@ int config_parse_cpu_affinity(
return 0;
}
int config_parse_capabilities(
static int config_parse_capabilities(
const char *filename,
unsigned line,
const char *section,
......@@ -807,7 +807,7 @@ int config_parse_capabilities(
return 0;
}
int config_parse_secure_bits(
static int config_parse_secure_bits(
const char *filename,
unsigned line,
const char *section,
......@@ -848,7 +848,7 @@ int config_parse_secure_bits(
return 0;
}
int config_parse_bounding_set(
static int config_parse_bounding_set(
const char *filename,
unsigned line,
const char *section,
......
......@@ -155,7 +155,7 @@ static int stream_log(Stream *s, char *p, usec_t timestamp) {
IOVEC_SET_STRING(iovec[1], s->process);
IOVEC_SET_STRING(iovec[2], header_pid);
IOVEC_SET_STRING(iovec[3], p);
IOVEC_SET_STRING(iovec[4], "\n");
IOVEC_SET_STRING(iovec[4], (char*) "\n");
if (writev(s->server->kmsg_fd, iovec, ELEMENTSOF(iovec)) < 0)
return -errno;
......@@ -548,9 +548,9 @@ int main(int argc, char *argv[]) {
for (;;) {
struct epoll_event event;
int n;
int k;
if ((n = epoll_wait(server.epoll_fd,
if ((k = epoll_wait(server.epoll_fd,
&event, 1,
server.n_streams <= 0 ? TIMEOUT : -1)) < 0) {
......@@ -561,7 +561,7 @@ int main(int argc, char *argv[]) {
goto fail;
}
if (n <= 0)
if (k <= 0)
break;
if ((r = process_event(&server, &event)) < 0)
......
dnl Macros to check the presence of generic (non-typed) symbols.
dnl Copyright (c) 2006-2008 Diego Pettenò <flameeyes@gmail.com>
dnl Copyright (c) 2006-2008 xine project
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2, or (at your option)
dnl any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the