* m4/debug.m4, m4/devel.m4, m4/gccoptim.m4, m4/ndebug.m4: New files.
* Makefile.am (EXTRA_DIST): Add them. * configure.ac: Call adl_ENABLE_DEVEL, adl_ENABLE_DEBUG, ad_GCC_OPTIM, and adl_NDEBUG.
This commit is contained in:
parent
2e97e6447b
commit
e5641f5b69
7 changed files with 98 additions and 3 deletions
20
m4/debug.m4
Normal file
20
m4/debug.m4
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
AC_DEFUN([adl_ENABLE_DEBUG],
|
||||
[AC_ARG_ENABLE([debug],
|
||||
[AC_HELP_STRING([--enable-debug],[enable debugging symbols])])
|
||||
case "${enable_debug}" in
|
||||
yes)
|
||||
AC_DEFINE([DEBUG],1,[Define if you want debugging code.])
|
||||
# We used to use -ggdb3 when supported, but not all tools
|
||||
# are able to grok the resulting debug infos.
|
||||
if test "${ac_cv_prog_cc_g}" = yes; then
|
||||
CFLAGS="$CFLAGS -g"
|
||||
fi
|
||||
;;
|
||||
no)
|
||||
;;
|
||||
*)
|
||||
if test "${ac_cv_prog_cc_g}" = yes; then
|
||||
CFLAGS="$CFLAGS -g"
|
||||
fi
|
||||
;;
|
||||
esac])
|
||||
21
m4/devel.m4
Normal file
21
m4/devel.m4
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
AC_DEFUN([adl_ENABLE_DEVEL],
|
||||
[AC_ARG_ENABLE([devel],
|
||||
[AC_HELP_STRING([--enable-devel],
|
||||
[turn on useful developer options])])
|
||||
|
||||
# Turn on devel options for development version, unless
|
||||
# explicitely turned off.
|
||||
if test -z "$enable_devel"; then
|
||||
case $VERSION in
|
||||
*[abcdefghijklmnopqrstuvwxyz])
|
||||
enable_devel=yes ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if test x"$enable_devel" = xyes; then
|
||||
enable_debug=${enable_debug-yes}
|
||||
enable_warnings=${enable_warnings-yes}
|
||||
enable_assert=${enable_assert-yes}
|
||||
enable_optimizations=${enable_optimizations--O}
|
||||
fi
|
||||
])
|
||||
33
m4/gccoptim.m4
Normal file
33
m4/gccoptim.m4
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
dnl Adapted from Akim Demaille <akim@epita.fr> ad_GCC_WARNINGS.
|
||||
AC_DEFUN([ad_GCC_OPTIM],
|
||||
[AC_ARG_ENABLE([optimizations],
|
||||
[AC_HELP_STRING([--disable-optimizations],
|
||||
[turn off aggressive optimizations])])
|
||||
if test -n "$GCC" -a "${enable_optimizations-yes}" = "yes"; then
|
||||
AC_CACHE_CHECK([for gcc optimization options], ac_cv_prog_gcc_opt_flags,
|
||||
[changequote(,)dnl
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line __oline__ "configure"
|
||||
int main(int argc, char *argv[]) { return argv[argc-1] == 0; }
|
||||
EOF
|
||||
changequote([,])dnl
|
||||
cf_save_CFLAGS="$CFLAGS"
|
||||
ac_cv_prog_gcc_opt_flags="-O3"
|
||||
for cf_opt in \
|
||||
ffast-math \
|
||||
fstrict-aliasing \
|
||||
fomit-frame-pointer
|
||||
do
|
||||
CFLAGS="$cf_save_CFLAGS $ac_cv_prog_gcc_opt_flags -$cf_opt"
|
||||
if AC_TRY_EVAL([ac_compile]); then
|
||||
ac_cv_prog_gcc_opt_flags="$ac_cv_prog_gcc_opt_flags -$cf_opt"
|
||||
fi
|
||||
done
|
||||
rm -f conftest*
|
||||
CFLAGS="$cf_save_CFLAGS $ac_cv_prog_gcc_opt_flags"])
|
||||
else
|
||||
case $enable_optimizations in
|
||||
no) ;;
|
||||
*) CFLAGS="$CFLAGS $enable_optimizations" ;;
|
||||
esac
|
||||
fi])
|
||||
6
m4/ndebug.m4
Normal file
6
m4/ndebug.m4
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
AC_DEFUN([adl_NDEBUG],
|
||||
[AC_ARG_ENABLE([assert],
|
||||
[AC_HELP_STRING([--enable-assert],[turn on assertions])])
|
||||
if test "$enable_assert" != yes; then
|
||||
CFLAGS="$CFLAGS -DNDEBUG"
|
||||
fi])
|
||||
Loading…
Add table
Add a link
Reference in a new issue