Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions Makefile

This file was deleted.

1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUBDIRS = src
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ Ubuntu will likely work without any changes. Other flavors of Linux should
work with little to no effort. Other Unix-like operating systems are untested
and unsupported, for now.

To compile lua-fastcgi:

autoreconf --install
./configure
make

running
-------
Expand Down
22 changes: 22 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
m4_define([LF_MAJOR], 1)
m4_define([LF_MINOR], 0)
m4_define([LF_PATCH], 0)
m4_define([LF_BUGS], [])

AC_PREREQ([2.64])
AC_INIT([lua-fastcgi], [LF_MAJOR.LF_MINOR.LF_PATCH], [LF_BUGS])
AC_CONFIG_SRCDIR([src/lua-fastcgi.c])

AM_INIT_AUTOMAKE([foreign -Wall -Werror])
AM_CONFIG_HEADER([config.h])

AC_LANG([C])
AC_PROG_CC

AC_CHECK_HEADERS([ctype.h errno.h fcgiapp.h fcgi_config.h fcntl.h inttypes.h])
AC_CHECK_HEADERS([lua5.1/lauxlib.h lua5.1/lua.h lua5.1/lualib.h])
AC_CHECK_HEADERS([pthread.h stdint.h stdio.h stdlib.h string.h sys/mman.h])
AC_CHECK_HEADERS([sys/resource.h sys/stat.h sys/time.h time.h unistd.h])

AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT
15 changes: 15 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
AM_CFLAGS =
AM_CFLAGS += -std=gnu99 -Wall -O2

bin_PROGRAMS = lua-fastcgi

lua_fastcgi_LDADD =
lua_fastcgi_LDADD += -lfcgi -llua5.1 -lm -lpthread


lua_fastcgi_SOURCES = \
lfconfig.c lfconfig.h \
lfuncs.c lfuncs.h \
lua.c lua.h \
lua-fastcgi.c lua-fastcgi.h

2 changes: 1 addition & 1 deletion src/config.c → src/lfconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <lua5.1/lauxlib.h>
#include <lua5.1/lualib.h>

#include "config.h"
#include "lfconfig.h"


// Checks if a file exists
Expand Down
5 changes: 5 additions & 0 deletions src/config.h → src/lfconfig.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifndef LFCONFIG_H
#define LFCONFIG_H

typedef struct {
char *listen;
int backlog;
Expand All @@ -14,3 +17,5 @@ typedef struct {

LF_config *LF_createconfig();
int LF_loadconfig(LF_config *, char *);

#endif
5 changes: 5 additions & 0 deletions src/lfuncs.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifndef LFUNCS_H
#define LFUNCS_H

// Writes FCGI output followed by a carriage return
int LF_print(lua_State *);

Expand All @@ -12,3 +15,5 @@ int LF_loadfile(lua_State *);

// dofile() function with sandboxing security measures
int LF_dofile(lua_State *);

#endif
2 changes: 1 addition & 1 deletion src/lua-fastcgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <pthread.h>

#include "lua.h"
#include "config.h"
#include "lfconfig.h"
#include "lua-fastcgi.h"


Expand Down
4 changes: 4 additions & 0 deletions src/lua-fastcgi.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#ifndef LUA_FASTCGI_H
#define LUA_FASTCGI_H

typedef struct {
LF_config *config;
int socket;
} LF_params;

#endif
5 changes: 5 additions & 0 deletions src/lua.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifndef LUA_H
#define LUA_H

#define LF_ERRNONE 0
#define LF_ERRANY 1
#define LF_ERRACCESS 2
Expand Down Expand Up @@ -29,3 +32,5 @@ void LF_emptystack(lua_State *);
int LF_fileload(lua_State *, const char *, char *);
int LF_loadscript(lua_State *);
void LF_closestate(lua_State *);

#endif