From bbd25fe4a2b8fdf9579f1b0ccc2cf1052a75a12f Mon Sep 17 00:00:00 2001 From: Jeremy Baxter Date: Sun, 18 Feb 2024 18:14:34 +1300 Subject: [PATCH] configure: include -lm and -DLUA_USE_POSIX in config.mk --- Makefile | 2 +- configure | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 124fe8d..c924000 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ LUADIR = external/lua CC = ${_CC} CFLAGS = ${_CFLAGS} -I${LUADIR} -pedantic -Wall -Wextra CPPFLAGS = -D_DEFAULT_SOURCE -LDFLAGS = -lm ${_LDFLAGS} +LDFLAGS = ${_LDFLAGS} OBJS = callisto.o lcl.o lenviron.o lextra.o lfs.o ljson.o \ lprocess.o util.o diff --git a/configure b/configure index c5b266c..be4b402 100755 --- a/configure +++ b/configure @@ -5,7 +5,10 @@ set -e 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 @@ -57,7 +60,7 @@ gen_CFLAGS () { ## flags used in the linking step gen_LDFLAGS () { if pkg-config readline; then - ldflags="$(pkg-config --libs readline)" + ldflags="$ldflags $(pkg-config --libs readline)" fi if present ld.lld; then ldflags="$ldflags -fuse-ld=lld" @@ -105,11 +108,13 @@ gen_LDFLAGS printf '# generated by configure -_CC = %s -_CFLAGS = %s -_LDFLAGS =%s -' \ - "$cc" \ - "$cflags" \ - "$ldflags"\ +_CC = %s +_CFLAGS = %s +_CPPFLAGS = %s +_LDFLAGS =%s +' \ + "$cc" \ + "$cflags" \ + "$cppflags"\ + "$ldflags" \ >"$mkf"