Branch
Hash :
6ec028a1
Author :
Thomas de Grivel
Date :
2024-11-27T22:40:40
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
#!/bin/sh
## kc3
## Copyright 2022-2024 kmx.io <contact@kmx.io>
##
## Permission is hereby granted to use this software granted the above
## copyright notice and this permission paragraph are included in all
## copies and substantial portions of this software.
##
## THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
## PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
## THIS SOFTWARE.
set -e
echo "$PWD/configure"
export SRC_TOP="$(dirname "$PWD")"
CONFIG_H_PREFIX=KC3_HTTPD_
. ../config.subr
PROG=kc3_httpd
PROG_ASAN=kc3_httpd_asan
PROG_COV=kc3_httpd_cov
PROG_DEBUG=kc3_httpd_debug
. ./sources.sh
# Common config for all targets
CPPFLAGS="-I .."
CFLAGS="$CFLAGS -W -Wall -Werror -std=c11 -pedantic -fPIC"
config_asan
config_gnu
config_i386
config_win32
pkg_config libbsd-overlay
pkg_config libffi
pkg_config libmd
config_lib libmd -lmd 2>/dev/null
config_lib dl -ldl 2>/dev/null
config_define PREFIX "\"${PREFIX}\""
if ! $HAVE_WIN32; then
LDFLAGS="$LDFLAGS -rdynamic"
fi
LIBS="$LIBS -pthread"
update_config_h
# Sources
OBJECTS="$(c2ext .main.lo "$SOURCES")"
echo "OBJECTS = $OBJECTS" >> ${CONFIG_MK}
OBJECTS_ASAN="$(c2ext .asan.lo "$SOURCES")"
echo "OBJECTS_ASAN = $OBJECTS_ASAN" >> ${CONFIG_MK}
OBJECTS_COV="$(c2ext .cov.lo "$SOURCES")"
echo "OBJECTS_COV = $OBJECTS_COV" >> ${CONFIG_MK}
OBJECTS_DEBUG="$(c2ext .debug.lo "$SOURCES")"
echo "OBJECTS_DEBUG = $OBJECTS_DEBUG" >> ${CONFIG_MK}
# Asan config
CPPFLAGS_ASAN="$CPPFLAGS"
CFLAGS_ASAN="$CFLAGS -DDEBUG -O1 -g"
CFLAGS_ASAN="$CFLAGS_ASAN -fsanitize=address -fno-omit-frame-pointer"
LDFLAGS_ASAN="$LDFLAGS"
LOCAL_LIBS_ASAN="../libkc3/libkc3_asan.la ../http/libkc3_http_asan.la"
LIBS_ASAN="$LOCAL_LIBS_ASAN $LIBS"
# Coverage config
CPPFLAGS_COV="$CPPFLAGS"
CFLAGS_COV="$CFLAGS -fprofile-arcs -ftest-coverage"
LDFLAGS_COV="$LDFLAGS --coverage"
LIBKC3_COV=
LOCAL_LIBS_COV="../libkc3/libkc3_cov.la ../http/libkc3_http_cov.la"
LIBS_COV="$LOCAL_LIBS_COV $LIBS -lgcov"
# Debug config
CPPFLAGS_DEBUG="$CPPFLAGS"
CFLAGS_DEBUG="$CFLAGS -DDEBUG -O0 -g"
LDFLAGS_DEBUG="$LDFLAGS"
LOCAL_LIBS_DEBUG="../libkc3/libkc3_debug.la ../http/libkc3_http_debug.la"
LIBS_DEBUG="$LOCAL_LIBS_DEBUG $LIBS"
# Main config
DEFAULT_CFLAGS="-O2 -fPIC"
if [ "x$ENV_CFLAGS" = "x" ]; then
CFLAGS="$CFLAGS $DEFAULT_CFLAGS"
fi
CFLAGS="$CFLAGS -DNDEBUG"
LOCAL_LIBS="../libkc3/libkc3.la ../http/libkc3_http.la"
LIBS="$LOCAL_LIBS $LIBS"
echo "HAVE_ASAN = $HAVE_ASAN" >> ${CONFIG_MK}
echo "CPPFLAGS = $CPPFLAGS" >> ${CONFIG_MK}
echo "CFLAGS = $CFLAGS" >> ${CONFIG_MK}
echo "LDFLAGS = $LDFLAGS" >> ${CONFIG_MK}
echo "LIBS = $LIBS" >> ${CONFIG_MK}
echo >> ${CONFIG_MK}
echo "CPPFLAGS_ASAN = $CPPFLAGS_ASAN" >> ${CONFIG_MK}
echo "CFLAGS_ASAN = $CFLAGS_ASAN" >> ${CONFIG_MK}
echo "LDFLAGS_ASAN = $LDFLAGS_ASAN" >> ${CONFIG_MK}
echo "LIBS_ASAN = $LIBS_ASAN" >> ${CONFIG_MK}
echo >> ${CONFIG_MK}
echo "CPPFLAGS_COV = $CPPFLAGS_COV" >> ${CONFIG_MK}
echo "CFLAGS_COV = $CFLAGS_COV" >> ${CONFIG_MK}
echo "LDFLAGS_COV = $LDFLAGS_COV" >> ${CONFIG_MK}
echo "LIBS_COV = $LIBS_COV" >> ${CONFIG_MK}
echo >> ${CONFIG_MK}
echo "CPPFLAGS_DEBUG = $CPPFLAGS_DEBUG" >> ${CONFIG_MK}
echo "CFLAGS_DEBUG = $CFLAGS_DEBUG" >> ${CONFIG_MK}
echo "LDFLAGS_DEBUG = $LDFLAGS_DEBUG" >> ${CONFIG_MK}
echo "LIBS_DEBUG = $LIBS_DEBUG" >> ${CONFIG_MK}
update_build
update_build_prog
build_lo
build_prog
update_config_mk