Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Michal Zima
coincer
Commits
f0144a75
Commit
f0144a75
authored
Jun 24, 2018
by
xHire
Browse files
Add --enable-debug option to configure
parent
4fa80e03
Changes
3
Hide whitespace changes
Inline
Side-by-side
autogen.sh
View file @
f0144a75
#!/bin/sh
cd
"
`
dirname
$0
`
"
mkdir
-p
m4
autoreconf
-i
configure.ac
View file @
f0144a75
...
...
@@ -17,7 +17,7 @@ AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror])
AC_CONFIG_FILES([Makefile])
dnl Compiler flags
AM_CFLAGS="-std=c89 -pedantic -Wall -Wextra"
AM_CFLAGS="-std=c89 -pedantic -Wall -Wextra
-pipe
"
dnl Checks for programs.
dnl C compiler
...
...
@@ -35,6 +35,19 @@ dnl Checks for typedefs, structures, and compiler characteristics.
dnl Checks for library functions.
dnl Configuration option.
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug], [enable debugging]),
[debug=$enableval],
[debug=no])
if test "x$debug" = "xyes"; then
AS_COMPILER_FLAGS(AM_CFLAGS, "${AM_CFLAGS} -g -ggdb -O0 -Waggregate-return -Wcast-align -Wdeclaration-after-statement -Wformat-nonliteral -Wformat-security -Winit-self -Winline -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wno-missing-field-initializers -Wno-unused-parameter -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-enum -Wundef -Wunsafe-loop-optimizations -Wwrite-strings")
AC_DEFINE([DEBUG], [], [Turn on debug mode])
else
AS_COMPILER_FLAGS(AM_CFLAGS, "${AM_CFLAGS} -O2")
fi
dnl Do final output.
AC_SUBST([AM_CFLAGS])
AC_OUTPUT
m4/as-compiler-flag.m4
0 → 100644
View file @
f0144a75
dnl as-compiler-flag.m4 0.1.0
dnl autostars m4 macro for detection of compiler flags
dnl David Schleef <ds@schleef.org>
dnl $Id: as-compiler-flag.m4,v 1.1 2005/12/15 23:35:19 ds Exp $
dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
dnl Tries to compile with the given CFLAGS.
dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags,
dnl and ACTION-IF-NOT-ACCEPTED otherwise.
AC_DEFUN([AS_COMPILER_FLAG],
[
AC_MSG_CHECKING([to see if compiler understands $1])
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $1"
AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
CFLAGS="$save_CFLAGS"
if test "X$flag_ok" = Xyes ; then
m4_ifvaln([$2],[$2])
true
else
m4_ifvaln([$3],[$3])
true
fi
AC_MSG_RESULT([$flag_ok])
])
dnl AS_COMPILER_FLAGS(VAR, FLAGS)
dnl Tries to compile with the given CFLAGS.
AC_DEFUN([AS_COMPILER_FLAGS],
[
list=$2
flags_supported=""
flags_unsupported=""
AC_MSG_CHECKING([for supported compiler flags])
for each in $list
do
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $each"
AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
CFLAGS="$save_CFLAGS"
if test "X$flag_ok" = Xyes ; then
flags_supported="$flags_supported $each"
else
flags_unsupported="$flags_unsupported $each"
fi
done
AC_MSG_RESULT([$flags_supported])
if test "X$flags_unsupported" != X ; then
AC_MSG_WARN([unsupported compiler flags: $flags_unsupported])
fi
$1="$$1 $flags_supported"
])
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment