Skip to content

Commit

Permalink
Do not touch CFLAGS in configure.ac
Browse files Browse the repository at this point in the history
This fixes an inconsistency between tests run by ./configure and actual make
  • Loading branch information
BenBE committed Dec 26, 2023
1 parent 179aeb0 commit 5c7cb91
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pixmap_DATA = htop.png
appicondir = $(datadir)/icons/hicolor/scalable/apps
appicon_DATA = htop.svg

AM_CFLAGS += -pedantic -std=c99 -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR="\"$(sysconfdir)\"" -I"$(top_srcdir)/$(my_htop_platform)"
AM_CFLAGS += -D_XOPEN_SOURCE_EXTENDED -DSYSCONFDIR="\"$(sysconfdir)\"" -I"$(top_srcdir)/$(my_htop_platform)"
AM_LDFLAGS =

myhtopsources = \
Expand Down
17 changes: 9 additions & 8 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ AC_PROG_CC
AM_PROG_CC_C_O
m4_version_prereq([2.70], [], [AC_PROG_CC_C99])
AS_IF([test "x$ac_cv_prog_cc_c99" = xno], [AC_MSG_ERROR([htop is written in C99. A newer compiler is required.])])
AM_CFLAGS="-std=c99 -pedantic"

# ----------------------------------------------------------------------

Expand Down Expand Up @@ -349,15 +350,15 @@ m4_define([HTOP_CHECK_SCRIPT],
htop_config_script_cflags=$([$4] --cflags 2> /dev/null)
fi
htop_script_success=no
htop_save_CFLAGS="$CFLAGS"
htop_save_CFLAGS="$AM_CFLAGS"
if test ! "x$htop_config_script_libs" = x; then
CFLAGS="$htop_config_script_cflags $CFLAGS"
AM_CFLAGS="$AM_CFLAGS $htop_config_script_cflags"
AC_CHECK_LIB([$1], [$2], [
AC_DEFINE([$3], 1, [The library is present.])
LIBS="$htop_config_script_libs $LIBS "
htop_script_success=yes
], [
CFLAGS="$htop_save_CFLAGS"
AM_CFLAGS="$htop_save_CFLAGS"
], [
$htop_config_script_libs
])
Expand Down Expand Up @@ -503,7 +504,7 @@ case "$enable_unwind" in
yes)
AC_CHECK_LIB([unwind], [backtrace], [], [AC_MSG_ERROR([can not find required library libunwind])])
AC_CHECK_HEADERS([libunwind.h], [], [
CFLAGS="$CFLAGS -I/usr/include/libunwind"
AM_CFLAGS="$AM_CFLAGS -I/usr/include/libunwind"
AC_CHECK_HEADERS([libunwind/libunwind.h], [], [AC_MSG_ERROR([can not find required header file libunwind.h])])
])
;;
Expand All @@ -529,7 +530,7 @@ case "$enable_hwloc" in
m4_ifdef([PKG_PROG_PKG_CONFIG], [
PKG_PROG_PKG_CONFIG()
PKG_CHECK_MODULES(HWLOC, hwloc, [
CFLAGS="$CFLAGS $HWLOC_CFLAGS"
AM_CFLAGS="$AM_CFLAGS $HWLOC_CFLAGS"
LIBS="$LIBS $HWLOC_LIBS"
AC_DEFINE([HAVE_LIBHWLOC], [1], [Define to 1 if you have the 'hwloc' library (-lhwloc).])
], [
Expand Down Expand Up @@ -654,7 +655,7 @@ case "$enable_delayacct" in
PKG_CHECK_MODULES(LIBNL3, libnl-3.0, [], [enable_delayacct=no])
PKG_CHECK_MODULES(LIBNL3GENL, libnl-genl-3.0, [], [enable_delayacct=no])
if test "$enable_delayacct" = yes; then
CFLAGS="$CFLAGS $LIBNL3_CFLAGS $LIBNL3GENL_CFLAGS"
AM_CFLAGS="$AM_CFLAGS $LIBNL3_CFLAGS $LIBNL3GENL_CFLAGS"
LIBS="$LIBS $LIBNL3_LIBS $LIBNL3GENL_LIBS"
AC_DEFINE([HAVE_DELAYACCT], [1], [Define if delay accounting support should be enabled.])
fi
Expand All @@ -669,7 +670,7 @@ case "$enable_delayacct" in
PKG_PROG_PKG_CONFIG()
PKG_CHECK_MODULES(LIBNL3, libnl-3.0, [], [AC_MSG_ERROR([can not find required library libnl3])])
PKG_CHECK_MODULES(LIBNL3GENL, libnl-genl-3.0, [], [AC_MSG_ERROR([can not find required library libnl3genl])])
CFLAGS="$CFLAGS $LIBNL3_CFLAGS $LIBNL3GENL_CFLAGS"
AM_CFLAGS="$AM_CFLAGS $LIBNL3_CFLAGS $LIBNL3GENL_CFLAGS"
LIBS="$LIBS $LIBNL3_LIBS $LIBNL3GENL_LIBS"
AC_DEFINE([HAVE_DELAYACCT], [1], [Define if delay accounting support should be enabled.])
], [
Expand Down Expand Up @@ -720,7 +721,7 @@ fi
# Checks for compiler warnings.
# ----------------------------------------------------------------------

AM_CFLAGS="\
AM_CFLAGS="$AM_CFLAGS\
-Wall\
-Wcast-align\
-Wcast-qual\
Expand Down

0 comments on commit 5c7cb91

Please sign in to comment.