feat: --enable-debug option
This commit is contained in:
parent
200aa643fa
commit
9f179fa596
1 changed files with 20 additions and 3 deletions
23
configure.ac
23
configure.ac
|
|
@ -5,10 +5,10 @@ AC_CONFIG_MACRO_DIRS([m4])
|
||||||
AM_INIT_AUTOMAKE([foreign -Wall -Werror subdir-objects])
|
AM_INIT_AUTOMAKE([foreign -Wall -Werror subdir-objects])
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
if test "x$ac_cv_env_CFLAGS_set" != "xset"; then
|
if test "x$ac_cv_env_CFLAGS_set" != "xset"; then
|
||||||
CFLAGS="-O2"
|
CFLAGS=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
STRICT_CFLAGS="-Wall -Wextra -Werror -pipe -Wpedantic -Wconversion -Wshadow"
|
STRICT_CFLAGS="-Wall -Wextra -Werror -pipe -Wpedantic -Wconversion -Wshadow -Wvla"
|
||||||
AC_SUBST([STRICT_CFLAGS])
|
AC_SUBST([STRICT_CFLAGS])
|
||||||
|
|
||||||
AM_PROG_AR
|
AM_PROG_AR
|
||||||
|
|
@ -35,6 +35,22 @@ AS_IF([test "x$enable_tests" = "xyes"], [
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
# --enable-debug
|
||||||
|
AC_ARG_ENABLE(
|
||||||
|
[debug],
|
||||||
|
[AS_HELP_STRING([--enable-debug], [Enable debug build: -g -O0 (default: no)])],
|
||||||
|
[enable_debug=$enableval],
|
||||||
|
[enable_debug=no]
|
||||||
|
)
|
||||||
|
AM_CONDITIONAL([ENABLE_DEBUG], [test "x$enable_debug" = "xyes"])
|
||||||
|
|
||||||
|
AS_IF([test "x$enable_debug" = "xyes"],
|
||||||
|
[CFLAGS="-g -O0"],
|
||||||
|
[CFLAGS="-O2"],
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_SUBST([DEBUG_CFLAGS])
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
Makefile
|
Makefile
|
||||||
src/Makefile
|
src/Makefile
|
||||||
|
|
@ -50,7 +66,8 @@ AC_MSG_NOTICE([
|
||||||
---------------
|
---------------
|
||||||
prefix : $prefix
|
prefix : $prefix
|
||||||
CC : $CC
|
CC : $CC
|
||||||
CFLAGS : $STRICT_CFLAGS
|
CFLAGS : $STRICT_CFLAGS $CFLAGS
|
||||||
tests : $enable_tests
|
tests : $enable_tests
|
||||||
|
debug : $enable_debug
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue