Fixed configure.ac file to let the user specify his custom CFLAGS

This commit is contained in:
Francesco Lannutti 2014-05-07 21:57:15 +02:00
parent 2b96cc6bef
commit e26f0b10d3
1 changed files with 18 additions and 15 deletions

View File

@ -32,6 +32,10 @@ AC_CONFIG_HEADER([src/include/ngspice/config.h])
AM_INIT_AUTOMAKE([-Wall -Werror nostdinc])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
ext_CFLAGS="${CFLAGS+yes}"
AC_PROG_CC
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AC_SUBST([AM_CPPFLAGS], ['-I. -I$(srcdir) -I$(top_builddir)/src/include'])
@ -301,28 +305,27 @@ AM_MAINTAINER_MODE
# Compiler checks
# ---------------
# To have an empty CFLAGS variable after AC_PROG_CC, instead of "-g -O2"
: ${CFLAGS=""}
AC_PROG_CC
# Work on compiler options according to system:
# Set default CFLAGS - only use -Wall if we have gcc
if test "x$enable_debug" = xno; then
if test "x$GCC" = xyes; then
if test "x$ext_CFLAGS" != xyes; then
if test "x$enable_debug" = xno; then
AC_MSG_WARN([Removing debugging option!])
CFLAGS="-O2 -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs -Wold-style-definition -Wredundant-decls -Wconversion -s"
if test "x$GCC" = xyes; then
CFLAGS="-O2 -s"
else
CFLAGS="-O2"
fi
else
AC_MSG_WARN([Removing debugging option!])
CFLAGS="-O2"
AC_DEFINE([NGDEBUG], [1], [Compile with debug info])
if test "x$GCC" = xyes; then
CFLAGS="-g -O1"
else
CFLAGS="-g"
fi
fi
else
AC_DEFINE([NGDEBUG], [1], [Compile with debug info])
if test "x$GCC" = xyes; then
CFLAGS="-g -O1 -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs -Wold-style-definition -Wredundant-decls -Wconversion"
else
CFLAGS="-g"
CFLAGS+=" -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs -Wold-style-definition -Wredundant-decls -Wconversion"
fi
fi