Set up GNU Autotools as build system.

This commit is contained in:
Barra Ó Catháin 2023-08-24 00:12:27 +01:00
parent 0814e437cd
commit 080e46fe99
4 changed files with 83 additions and 6 deletions

60
.gitignore vendored
View File

@ -49,4 +49,62 @@
modules.order modules.order
Module.symvers Module.symvers
Mkfile.old Mkfile.old
dkms.conf dkms.conf
# http://www.gnu.org/software/automake
Makefile.in
/ar-lib
/mdate-sh
/py-compile
/test-driver
/ylwrap
.deps/
.dirstamp
# http://www.gnu.org/software/autoconf
autom4te.cache
/autoscan.log
/autoscan-*.log
/aclocal.m4
/compile
/config.cache
/config.guess
/config.h.in
/config.log
/config.status
/config.sub
/configure
/configure.scan
/depcomp
/install-sh
/missing
/stamp-h1
# https://www.gnu.org/software/libtool/
/ltmain.sh
# http://www.gnu.org/software/texinfo
/texinfo.tex
# http://www.gnu.org/software/m4/
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
# Generated Makefile
# (meta build system like autotools,
# can automatically generate from config.status script
# (which is called by configure script))
Makefile
SilverMUDServer
config.h
config.h.in
stamp-h1

8
Makefile.am Normal file
View File

@ -0,0 +1,8 @@
bin_PROGRAMS = SilverMUDServer
dist_doc_DATA = README.org
SilverMUDServer_CFLAGS = -I/usr/include/guile/3.0 -I/usr -lguile-3.0 -lgc -lpthread -ldl -lgnutls
SilverMUDServer_SOURCES = \
source/server/connections.c \
source/server/scheme-integration.c \
source/server/main.c

8
configure.ac Normal file
View File

@ -0,0 +1,8 @@
AC_INIT([SilverMUD], [0.0.1], [barra@ocathain.ie])
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
AC_PROG_CC
AC_CONFIG_HEADERS([source/config.h])
AC_CONFIG_FILES([
Makefile
])
AC_OUTPUT

View File

@ -81,6 +81,8 @@ int main (int argc, char ** argv)
fprintf(stderr, "Failed to create epoll instance. Aborting.\n"); fprintf(stderr, "Failed to create epoll instance. Aborting.\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
// Setup the epoll events we want to watch for:
struct epoll_event watchedEvents; struct epoll_event watchedEvents;
watchedEvents.events = EPOLLIN; watchedEvents.events = EPOLLIN;
watchedEvents.data.fd = masterSocket; watchedEvents.data.fd = masterSocket;
@ -132,12 +134,14 @@ int main (int argc, char ** argv)
gnutls_transport_set_int(*tlsSession, newSocket); gnutls_transport_set_int(*tlsSession, newSocket);
// Perform a TLS handshake: // Perform a TLS handshake:
volatile int handshakeReturnValue = 0; int handshakeReturnValue = 0;
do do
{ {
handshakeReturnValue = gnutls_handshake(*tlsSession); handshakeReturnValue = gnutls_handshake(*tlsSession);
} while (handshakeReturnValue < 0 && gnutls_error_is_fatal(handshakeReturnValue) == 0); } while (handshakeReturnValue < 0 && gnutls_error_is_fatal(handshakeReturnValue) == 0);
// If the handshake was unsuccessful, close the connection:
if (handshakeReturnValue < 0) if (handshakeReturnValue < 0)
{ {
printf("%d", handshakeReturnValue); printf("%d", handshakeReturnValue);
@ -147,11 +151,10 @@ int main (int argc, char ** argv)
close(newSocket); close(newSocket);
break; break;
} }
// Setup the epoll events we want to watch for:
watchedEvents.events = EPOLLIN; watchedEvents.events = EPOLLIN;
watchedEvents.data.fd = newSocket; watchedEvents.data.fd = newSocket;
// Add the completed file descriptor to the set:
epoll_ctl(connectedClients, EPOLL_CTL_ADD, newSocket, &watchedEvents); epoll_ctl(connectedClients, EPOLL_CTL_ADD, newSocket, &watchedEvents);
// Add the connection to the list: // Add the connection to the list: