Re: if vs. ifdef in Makefile.am

"ljh" via Discussion list for automake <[email protected]>
Newsgroups gmane.comp.sysutils.automake.general
Message-ID <[email protected]>
Hi,


I observed that it adds `NDEBUG` in `config.h`. I will need to include this `config.h`, right?


// config.h
#define NDEBUG 1



My current solution is like the following. I do not know if it can be simplified.


# src/configure.ac
AC_ARG_ENABLE(
&nbsp; &nbsp; [ndebug],
&nbsp; &nbsp; [AS_HELP_STRING([--enable-ndebug],
&nbsp; &nbsp; &nbsp; &nbsp; [ndebug means release and turns off assert])],
&nbsp; &nbsp; [enable_ndebug=yes]
)


AM_CONDITIONAL([NDEBUG], [test x$enable_ndebug = xyes])&nbsp;


---


# src/main/Makefile.am
if NDEBUG
CPPFLAGS += -DNDEBUG
CFLAGS += -O3 # .cpp
else
CFLAGS += -g # .cpp
LDFLAGS += -fsanitize=address
endif



---


// src/main/main.c


void handlerCont(int signum){
&nbsp; printf("SIGCONT %d\n", signum);
#ifndef NDEBUG
&nbsp; __lsan_do_recoverable_leak_check();
#endif
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.