Permalink
Browse files

added support for 2 additional configure

flags, --disable-pam and --with-extrainclude=DIR

Worked the Makefiles to properly support DESTDIR. This is
useful for packagers (deb, rpm ...)


git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk/yaws@960 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information...
1 parent 1126a33 commit c9778e01b3032d8b35d21e6e85e862efa861f0f0 @klacke committed Apr 27, 2006
Showing with 310 additions and 127 deletions.
  1. +2 −2 Makefile
  2. +32 −7 README
  3. +10 −8 c_src/Makefile
  4. +43 −4 configure
  5. +22 −6 configure.in
  6. +12 −3 include.mk.in
  7. +5 −5 man/Makefile
  8. +5 −3 man/yaws.1
  9. +8 −2 man/yaws.conf.5
  10. +6 −0 man/yaws_api.5
  11. +31 −20 scripts/Install
  12. +7 −7 scripts/Makefile
  13. +2 −2 scripts/yaws.template
  14. +17 −15 src/Makefile
  15. +4 −5 src/yaws.erl
  16. +11 −1 src/yaws_api.erl
  17. +1 −1 src/yaws_cgi.erl
  18. +1 −1 src/yaws_config.erl
  19. +65 −32 src/yaws_ctl.erl
  20. +23 −0 src/yaws_generated.template
  21. +1 −1 vsn.mk
  22. +1 −1 www/code/Makefile
  23. +1 −1 www/shopingcart/Makefile
View
@@ -11,10 +11,10 @@ all debug clean:
install: all
- @yrun=`yaws -S 2> /dev/null`; \
+ @yrun=`yaws --status 2> /dev/null`; \
case $$yrun in \
*Uptime*) \
- echo "ERROR Can't install while a yaws system is already running, would wreak havoc with /tmp/yaws"; \
+ echo "ERROR Can't install while a yaws system is already running"; \
exit;; \
*) \
true;; \
View
39 README
@@ -8,19 +8,44 @@ To build and install
1. Get and install an erlang system (http://www.erlang.org)
2. ./configure --prefix=/usr/local
+ This will install everything under /usr/local including var files
+ in /usr/local/var/run/yaws and etc files in
+ /usr/local/etc/yaws.*
-Note: If can also change the target directory for etc and var
+ A plain ./configure will install executables under
+ /usr/local/bin and libs in /usr/local/lib/yaws. /etc and
+ /var files will end up under /etc and /var
+
+
+Note: We can also change the target directory for etc and var
directories by using:
+
--localstatedir=DIR for files that should go in /var
--sysconfdir=DIR for files that should go in /etc
-This way you can precisely control where you install the software (This is
+ --disable-pam If we for some reason do not want pam support
+ --with-extrainclude=DIR Will add DIR to the include path
+ May be useful if e.g. pam is installed
+ somewhere where its usually not found
+ --with-defaultcharset=String Will set the default charset used
+ in generated page headers. Usually never needed.
+
+This way you can precisely control where you install Yaws (This is
usefull for computers where you do not have right access to the
-standard systemdirs). It is now possible to install everything in a
-single directory and use Stow to create symlinks to /usr/local
+standard systemdirs).
+
For example:
./configure --prefix=/home/install/yaws-1.01 --localstatedir=/home/install/yaws-1.01/var --sysconfdir=/home/install/yaws-1.01/etc
+2b. Note to packagers (rpm, deb ...) All install targets support the
+ DESTDIR variable.
+ Thus, if we do ./configure --prefix=/usr; make
+ we can subsequently do:
+ DESTDIR=/foo/bar make install
+ All yaws files will be installed under DESTDIR, but all
+ code will assume yaws should be installed under /usr
+
+
3. make
This will build the system
@@ -47,9 +72,9 @@ For example:
9. Create content in /var/yaws
-10a. Start as /usr/local/bin/yaws -D -heart
- This will start a daemon (-D) which will be autorestarted when/if
- it crashes or hangs (-heart)
+10a. Start as /usr/local/bin/yaws --daemon --heart
+ This will start a daemon (--daemon) which will be autorestarted when/if
+ it crashes or hangs (--heart)
10b. Or start interactive system as /usr/local/bin/yaws -i
View
@@ -2,19 +2,21 @@ include ../include.mk
# don't c-compile anything on win32 (yet)
-# I don't know how to make linked in driver using gcc
+# I don't know how to make a linked in driver using gcc, or any
+# other compiler there, and have no intentions of finding out
ifdef WIN32
PRIV_FILES=../priv/.foo
else
- PRIV_FILES= ../priv/setuid_drv.$(DLL) ../priv/epam
+# don't make pam if configured out with --disable-pam
+ PRIV_FILES= ../priv/setuid_drv.$(DLL) $(EPAM)
endif
CFLAGS += -I"${ERLDIR}/usr/include"
# and for MacOs + possibly others ...
-CFLAGS += -I/usr/include/pam/
+CFLAGS += -I/usr/include/pam/ $(EXTRAINCLUDE)
#
# Targets
@@ -25,13 +27,13 @@ all: $(PRIV_FILES)
clean:
-rm -f $(PRIV_FILES) setuid_drv.$(OBJ)
-install:
- $(INSTALL) -d $(INSTALLPREFIX)/lib/yaws/priv
- $(INSTALL) $(PRIV_FILES) $(INSTALLPREFIX)/lib/yaws/priv
+install: $(PRIV_FILES)
+ $(INSTALL) -d $(DESTDIR)$(PREFIX)/lib/yaws/priv
+ $(INSTALL) $(PRIV_FILES) $(DESTDIR)$(PREFIX)/lib/yaws/priv
ifndef WIN32
if [ `id -u` = "0" ]; then \
- chown root $(INSTALLPREFIX)/lib/yaws/priv/epam; \
- chmod a+s $(INSTALLPREFIX)/lib/yaws/priv/epam; \
+ chown root $(DESTDIR)$(PREFIX)/lib/yaws/priv/epam; \
+ chmod a+s $(DESTDIR)$(PREFIX)/lib/yaws/priv/epam; \
fi
endif
View
@@ -272,7 +272,7 @@ PACKAGE_STRING=
PACKAGE_BUGREPORT=
ac_unique_file="Makefile"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os ERL ERLC DEFAULT_CHARSET ERL_DLL_LIB ERLDIR CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP MATHLIB EXE DLL OBJ LINKER OUT DLL_LIBS SET_MAKE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LD_SHARED FPIC BSDI WERL WIN32 LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os ERL ERLC DEFAULT_CHARSET EXTRAINCLUDE EPAM ERL_DLL_LIB ERLDIR CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP MATHLIB EXE DLL OBJ LINKER OUT DLL_LIBS SET_MAKE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LD_SHARED FPIC BSDI WERL WIN32 LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -682,13 +682,13 @@ echo X"$0" |
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
srcdir=$ac_confdir
- if test ! -r $srcdir/$ac_unique_file; then
+ if test ! -r "$srcdir/$ac_unique_file"; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
-if test ! -r $srcdir/$ac_unique_file; then
+if test ! -r "$srcdir/$ac_unique_file"; then
if test "$ac_srcdir_defaulted" = yes; then
{ echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
{ (exit 1); exit 1; }; }
@@ -697,7 +697,7 @@ if test ! -r $srcdir/$ac_unique_file; then
{ (exit 1); exit 1; }; }
fi
fi
-(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+(cd $srcdir && test -r "./$ac_unique_file") 2>/dev/null ||
{ echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
{ (exit 1); exit 1; }; }
srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
@@ -805,10 +805,16 @@ if test -n "$ac_init_help"; then
cat <<\_ACEOF
+Optional Features:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+--disable-pam disables pam auth
+
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-defaultcharset=String specify default charset, i.e UTF-8
+ --with-extrainclude= dir to include if e.g. pam is installed in some odd place
Some influential environment variables:
CC C compiler command
@@ -1458,6 +1464,37 @@ fi
+# Check whether --with-extrainclude or --without-extrainclude was given.
+if test "${with_extrainclude+set}" = set; then
+ withval="$with_extrainclude"
+
+fi;
+
+
+if test "x$with_extrainclude" = "x" ; then
+ EXTRAINCLUDE=
+else
+ EXTRAINCLUDE=-I${with_extrainclude}
+fi
+
+
+
+
+
+# Check whether --enable-pam or --disable-pam was given.
+if test "${enable_pam+set}" = set; then
+ enableval="$enable_pam"
+ EPAM=
+else
+ EPAM=../priv/epam
+fi;
+
+
+
+
+
+
+
case "$target_os" in
*cygwin*)
@@ -3641,6 +3678,8 @@ s,@target_os@,$target_os,;t t
s,@ERL@,$ERL,;t t
s,@ERLC@,$ERLC,;t t
s,@DEFAULT_CHARSET@,$DEFAULT_CHARSET,;t t
+s,@EXTRAINCLUDE@,$EXTRAINCLUDE,;t t
+s,@EPAM@,$EPAM,;t t
s,@ERL_DLL_LIB@,$ERL_DLL_LIB,;t t
s,@ERLDIR@,$ERLDIR,;t t
s,@CC@,$CC,;t t
View
@@ -28,6 +28,27 @@ fi
AC_SUBST(DEFAULT_CHARSET)
+
+
+AC_ARG_WITH(extrainclude,
+[ --with-extrainclude= dir to include if e.g. pam is installed in some odd place ])
+
+
+if test "x$with_extrainclude" = "x" ; then
+ EXTRAINCLUDE=
+else
+ EXTRAINCLUDE=-I${with_extrainclude}
+fi
+
+AC_SUBST(EXTRAINCLUDE)
+
+
+
+AC_ARG_ENABLE(pam, [--disable-pam disables pam auth], EPAM=, EPAM=../priv/epam)
+AC_SUBST(EPAM)
+
+
+
dnl ----------------------------------------------------------------------
dnl
dnl BT_ERL_LIB_VSN figures out version of an erlang application
@@ -103,8 +124,6 @@ EOF
DLL_LIBS="-lc \"$ERL_DLL_LIB\""
- AC_SUBST(MATHLIB)
-
EXE=.exe
AC_SUBST(EXE)
@@ -125,12 +144,8 @@ EOF
OUT="-o "
AC_SUBST(OUT)
- MATHLIB=-lm
- AC_SUBST(MATHLIB)
-
DLL=so
AC_SUBST(DLL)
-
OBJ=o
AC_SUBST(OBJ)
@@ -149,6 +164,7 @@ dnl Sigh, pam headers do not seem to have a standard place. On FreeBSD and
dnl Linuces I've seen they are in /usr/include/security, but MacOS has them
dnl in /usr/include/pam... I'm to sick of M4 at this very moment to write
dnl a test that searches for the files, so hard coded for now...
+dnl or use --with-extrainclude=....
CFLAGS="$CFLAGS -I/usr/include/security"
case "$target_os" in
View
@@ -2,15 +2,24 @@
PREFIX = @prefix@
-ETCDIR = $(DESTDIR)@sysconfdir@
-VARDIR = $(DESTDIR)@localstatedir@
-INSTALLPREFIX = $(DESTDIR)$(PREFIX)
+ETCDIR = @sysconfdir@
+VARDIR = @localstatedir@
+
+ifeq ($(DESTDIR),)
+ DESTDIR=/
+endif
+
+## DESTDIR is handled separately in the individual Makefiles
ERL=@ERL@
WERL=@WERL@
ERLC=@ERLC@
EMULATOR=beam
DEFAULT_CHARSET=@DEFAULT_CHARSET@
+EPAM = @EPAM@
+EXTRAINCLUDE = @EXTRAINCLUDE@
+
+
ifdef debug
ERLC_FLAGS+=-Ddebug
View
@@ -2,10 +2,10 @@
include ../include.mk
install:
- install -d $(INSTALLPREFIX)/share/man/man1
- install -d $(INSTALLPREFIX)/share/man/man5
- cp yaws.1 $(INSTALLPREFIX)/share/man/man1
- cp yaws.conf.5 $(INSTALLPREFIX)/share/man/man5
- cp yaws_api.5 $(INSTALLPREFIX)/share/man/man5
+ install -d $(DESTDIR)/$(PREFIX)/share/man/man1
+ install -d $(DESTDIR)/$(PREFIX)/share/man/man5
+ cp yaws.1 $(DESTDIR)/$(PREFIX)/share/man/man1
+ cp yaws.conf.5 $(DESTDIR)/$(PREFIX)/share/man/man5
+ cp yaws_api.5 $(DESTDIR)/$(PREFIX)/share/man/man5
all debug clean:
View
@@ -98,13 +98,15 @@ Pass STRING as an additional argument to the "erl" program.
This flag sets the id. If we're starting a daemon (or an interactive
system) it gives the Yaws server the identity ID. This means that the
server will write all internal files into the directory
-$HOME/.yaws/ID. In particular it will write a file called
-$HOME/.yaws/ID/ctl which contains the portnumber the daemon
+$HOME/.yaws/ID.
+
+Yaws also creates a file called
+${VARDIR}/run/yaws/ctl-${ID} which contains the portnumber the daemon
is listening on for control request by the control command such
as "yaws --hup" etc.
If we're invoking a control command which should perform some
-control function on the daemon, we mau have to give the --id flag also
+control function on the daemon, we may have to give the --id flag also
to the control command. If we don't do this the control command
may interact with the wrong daemon due to finding the wrong "ctl" file.
View
@@ -54,8 +54,8 @@ as:
.fi
To stop the Yaws server with id "foobar". Each Yaws server will write
its internals data into a file called $HOME/.yaws/yaws/ID where ID the
-identity of the server. In particular it will write a file called
-$HOME/.yaws/yaws/ID/ctl which contain the portnumber where the server is
+identity of the server. Yaws also creates a file called
+${VARDIR}/run/yaws/ctl-${ID} which contain the portnumber where the server is
listening for control commands.
.TP
@@ -100,6 +100,12 @@ The logs written by yaws are all wrap logs, the default value at the
size where they wrap around and the original gets renamed to File.old
is 1000000, 1 M. This value can changed.
+.TP
+\fB tmpdir = Dir\fR
+Yaws generates files when generating dynamic content, i.e. when
+processing .yaws pages. These files end up in tmpdir. Default
+is $HOME/.yaws
+
.TP
\fB log_resolve_hostname = Bool\fR
View
@@ -216,6 +216,12 @@ This function is automatically included from yaws_api in all
.yaws pages. It is used to search for a variable in the
POSTed data from the client. Returns {ok, Val} or undefined.
+.TP
+\fBgetvar(Arg, VarName)\fR
+This function looks at the HTTP request method from the
+client and invokes postvar/2 if it is a POST from the client
+and queryvar/2 if it is a GET request from the client.
+
.TP
\fBparse_multipart_post(Arg)\fR
Oops, something went wrong.

0 comments on commit c9778e0

Please sign in to comment.