configure: include -lm and -DLUA_USE_POSIX in config.mk

This commit is contained in:
Jeremy Baxter 2024-02-18 18:14:34 +13:00
parent 331c6acbd2
commit bbd25fe4a2
2 changed files with 15 additions and 10 deletions

View file

@ -7,7 +7,7 @@ LUADIR = external/lua
CC = ${_CC} CC = ${_CC}
CFLAGS = ${_CFLAGS} -I${LUADIR} -pedantic -Wall -Wextra CFLAGS = ${_CFLAGS} -I${LUADIR} -pedantic -Wall -Wextra
CPPFLAGS = -D_DEFAULT_SOURCE CPPFLAGS = -D_DEFAULT_SOURCE
LDFLAGS = -lm ${_LDFLAGS} LDFLAGS = ${_LDFLAGS}
OBJS = callisto.o lcl.o lenviron.o lextra.o lfs.o ljson.o \ OBJS = callisto.o lcl.o lenviron.o lextra.o lfs.o ljson.o \
lprocess.o util.o lprocess.o util.o

9
configure vendored
View file

@ -5,7 +5,10 @@
set -e set -e
mkf=config.mk mkf=config.mk
cflags='-std=c99' # set here to apply to all subtrees # these also apply to all libraries in external/
cflags='-std=c99'
cppflags='-DLUA_USE_POSIX'
ldflags='-lm'
# utility functions # utility functions
@ -57,7 +60,7 @@ gen_CFLAGS () {
## flags used in the linking step ## flags used in the linking step
gen_LDFLAGS () { gen_LDFLAGS () {
if pkg-config readline; then if pkg-config readline; then
ldflags="$(pkg-config --libs readline)" ldflags="$ldflags $(pkg-config --libs readline)"
fi fi
if present ld.lld; then if present ld.lld; then
ldflags="$ldflags -fuse-ld=lld" ldflags="$ldflags -fuse-ld=lld"
@ -107,9 +110,11 @@ printf '# generated by configure
_CC = %s _CC = %s
_CFLAGS = %s _CFLAGS = %s
_CPPFLAGS = %s
_LDFLAGS =%s _LDFLAGS =%s
' \ ' \
"$cc" \ "$cc" \
"$cflags" \ "$cflags" \
"$cppflags"\
"$ldflags" \ "$ldflags" \
>"$mkf" >"$mkf"