From 31313a433075e12282cf27b8cd61b41d08bc9857 Mon Sep 17 00:00:00 2001 From: nveid Date: Sat, 15 Jan 2011 16:03:17 +0000 Subject: [PATCH] Fixed configure issues.. so it detects local in directory lua installation. Also fixed a couple things that barfed on -Werror Ignore-this: a8666c2bdf6480b911352dc0e40243e6 --- U/End.U | 4 +- U/Myinit.U | 2 +- U/d_lua.U | 107 +++++++++++++++++++++++++++++++++++++++++-------- U/d_sigchld.U | 4 +- U/libs.U | 2 +- src/division.c | 6 ++- src/funlist.c | 9 ++++- 7 files changed, 108 insertions(+), 26 deletions(-) diff --git a/U/End.U b/U/End.U index f961d34..002c1d5 100644 --- a/U/End.U +++ b/U/End.U @@ -18,9 +18,9 @@ ?X: To force any unit to be included, copy this unit to your private U directory ?X: and add the name of the unit desired to the ?MAKE: dependency line. ?X: -?MAKE:End: $W d_tcl MailList d_lua +?MAKE:End: $W d_tcl MailList ?MAKE: -pick add $@ %< -?LINT:use $W d_tcl MailList d_lua +?LINT:use $W d_tcl MailList : end of configuration questions echo " " echo "End of configuration questions." diff --git a/U/Myinit.U b/U/Myinit.U index 95e5324..abd5e02 100644 --- a/U/Myinit.U +++ b/U/Myinit.U @@ -26,5 +26,5 @@ ?LINT:set defvoidused libswanted toplev ?INIT:toplev=`cd ..;pwd` defvoidused=15 -libswanted='nsl socket m c crypt bind resolv ld dl tcl intl lua5.1' +libswanted='nsl socket m c crypt bind resolv ld dl tcl intl' diff --git a/U/d_lua.U b/U/d_lua.U index b4a91b5..35fd07e 100644 --- a/U/d_lua.U +++ b/U/d_lua.U @@ -1,19 +1,40 @@ ?MAKE: d_lua: Loc test xlibpth libpth Csym Setvar Inhdr libs ?MAKE: -pick add $@ %< +# Declare a function to check for loca LUA installation +# +checkLocalLua() { + myincs="lua5.1 lua-5.1.4" + otherincs="" + thisincl="" + for thisincl in $myincs; do + if $test -r "$toplev/$thisincl/src/lua.h" ; then + lua_h_path="$toplev/$thisincl/src" + elif $test -r "$toplev/$thisincl/lua.h" ; then + lua_h_path="$toplev/$thisincl" + else + otherincs="$otherincs $toplev/$thisincl $toplev/$thisincl/src" + echo "OI=$otherincs">&4 + fi + done + if $test "$lua_h_path" ; then + echo "Found -llua" >&4 + # try to link in local lua library into ldflags= + # Normally when you install the src in our directory it will be in the lua/src directory.. + if $test -f "$lua_h_path/liblua.a"; then + ldflags="$ldflags -L$lua_h_path" + libs="$libs -llua" + else + echo "Could not local LUA library. Either install LUA development global libraries or compile your local LUA installation"; + exit 1; + fi + fi + +} + # see if lua exists, otherwise end configure script echo " " -echo "Let's see if we have LUA (version 5.1)." >&4 - -case $libs in - *lua5.1*) - echo "We have the LUA 5.1 library, too." >&4 - ;; - *) - echo "Oops, no LUA 5.1 library. Check your LUA installation." >&4 - exit 1; - ;; -esac +echo "Let's search for LUA header files." >&4 myincs="/usr/include $locincpth" otherincs="" @@ -23,16 +44,70 @@ done lua_h_path="" for thisincl in $myincs $otherincs; do - if [ -r "$thisincl/lua.h" ]; then + if $test -r "$thisincl/lua.h"; then lua_h_path="$thisincl" fi done -if [ x"$lua_h_path" == "x" ]; then - echo "Unable to find lua.h header. Check your LUA installation." >&4 - echo "Looked in $myincs $otherincs for it" >&4 - exit 1 +if $test -z "$lua_h_path" ; then + echo "Unable to find global lua.h header. Checking local directories." >&4 + checkLocalLua +else + echo "Found LUA Header path at $lua_h_path">&4 + echo "Searching for LUA Library" + # Could probably make this a function in libs.U and cut down on this kludge + thislib="lua5.1" + if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then + echo "Found -l$thislib (shared)." + case " $libs " in + *"-l$thislib "*);; + *) libs="$libs -l$thislib";; + esac + elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then + echo "Found -l$thislib (shared)." + case " $libs " in + *"-l$thislib "*);; + *) libs="$libs -l$thislib";; + esac + elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then + echo "Found -l$thislib." + case " $libs " in + *"-l$thislib "*);; + *) libs="$libs -l$thislib";; + esac +?X: Don't forget about OS/2 where -lmalloc is spelled out malloc.a + elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then + echo "Found -l$thislib." + case " $libs " in + *"-l$thislib "*);; + *) libs="$libs -l$thislib";; + esac + elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then + echo "Found -l${thislib}_s." + case " $dflt " in + *"-l$thislib "*);; + *) libs="$libs -l${thislib}_s";; + esac + elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then + echo "Found -l$thislib." + case " $libs " in + *"-l$thislib "*);; + *) libs="$libs -l$thislib";; + esac + else + echo "Can't find global LUA Library. Checking Local." + checkLocalLua + fi + + +fi + +if test -z "$lua_h_path"; then + echo "I Give up..">&4 + echo "Looked in $otherincs for it" >&4 + exit 1; fi ccflags="$ccflags -I$lua_h_path" + diff --git a/U/d_sigchld.U b/U/d_sigchld.U index e91e995..0c712a2 100644 --- a/U/d_sigchld.U +++ b/U/d_sigchld.U @@ -3,7 +3,7 @@ ?RCS: Revision 3.0 1993/08/18 12:05:39 ram ?RCS: Baseline for dist 3.0 netwide release. ?RCS: -?MAKE:d_sigchld d_sigcld: Myread cat cc ccflags rm Setvar libs ldflags +?MAKE:d_sigchld d_sigcld: Myread cat cc ccflags rm Setvar libs ldflags d_lua ?MAKE: -pick add $@ %< ?S:d_sigchld: ?S: This variable is set if the system defines SIGCHLD @@ -33,7 +33,7 @@ ?M:#endif ?M:. ?T:val -?LINT:set d_sigchld d_sigcld +?LINT:set d_sigchld d_sigcld d_lua : see if we have SIGCHLD, SIGCLD, or both echo " " echo "How should a child signal a parent?" >&4 diff --git a/U/libs.U b/U/libs.U index a1849ea..d6feb23 100644 --- a/U/libs.U +++ b/U/libs.U @@ -58,7 +58,7 @@ ?X: Set proper libswanted in your private Myinit.U if needed. ?X: ?X:: default ordered library list -?X:libswanted='net socket inet nsl nm sdbm gdbm ndbm dbm malloc dl lua5.1' +?X:libswanted='net socket inet nsl nm sdbm gdbm ndbm dbm malloc dl' ?X:libswanted="$libswanted dld sun m c_s c posix cposix ndir dir ucb" ?X:libswanted="$libswanted bsd BSD PW x" ?X: diff --git a/src/division.c b/src/division.c index 8ca1efb..3e36acd 100644 --- a/src/division.c +++ b/src/division.c @@ -1570,6 +1570,7 @@ dbref create_div(dbref owner, const char *name) { char buf[BUFFER_LEN]; + char buf2[BUFFER_LEN]; dbref obj, loc; if(!can_pay_fees(owner, DIVISION_COST)) @@ -1607,9 +1608,10 @@ create_div(dbref owner, const char *name) } Parent(obj) = SDIV(owner).object; current_state.divisions++; - sprintf(buf, object_header(owner, obj)); + strcpy(buf, unparse_object(owner, obj)); + strcpy(buf2, unparse_object(owner, SDIV(obj).object)); notify_format(owner, T("Division created: %s Parent division: %s"), - buf, object_header(owner, SDIV(obj).object)); + buf, buf2); return obj; } diff --git a/src/funlist.c b/src/funlist.c index 9fb79e0..892573f 100644 --- a/src/funlist.c +++ b/src/funlist.c @@ -3134,7 +3134,6 @@ FUNCTION(fun_regreplace) char abuf[BUFFER_LEN], *abp; char prebuf[BUFFER_LEN], *prep; char postbuf[BUFFER_LEN], *postp; - pcre *old_re_code; int flags = 0, all = 0, match_offset = 0, len, funccount; int i; @@ -3142,6 +3141,7 @@ FUNCTION(fun_regreplace) int *old_re_offsets; char *old_re_from; + old_re_subpatterns = global_eval_context.re_subpatterns; old_re_offsets = global_eval_context.re_offsets; old_re_from = global_eval_context.re_from; @@ -3251,7 +3251,12 @@ FUNCTION(fun_regreplace) if (study) mush_free((Malloc_t) study, "pcre.extra"); - global_eval_context.re_code = old_re_code; + /* TODO: this was set to the declared variable "pcre **old_re_code".. + * it was initialized and set in this function. Should look into this more. + * For now just setting this variable to NULL instead + */ + + global_eval_context.re_code = NULL; global_eval_context.re_offsets = old_re_offsets; global_eval_context.re_subpatterns = old_re_subpatterns; global_eval_context.re_from = old_re_from; -- 2.30.2