Re: if vs. ifdef in Makefile.am

2023-03-03 Thread Jan Engelhardt
On Friday 2023-03-03 13:14, ljh wrote: >Thanks for the hint. I did not know this before. > >Found it here, autoconf manual 16.3: >> cd to the directory where you want the object files and executables to >> go and run the configure script. configure automatically checks for >> the source code in

Re: if vs. ifdef in Makefile.am

2023-03-03 Thread ljh
Hi, Thanks for the hint. I did not know this before. Found it here, autoconf manual 16.3: > cd to the directory where you want the object files and executables to > go and run the configure script. configure automatically checks for > the source code in the directory that configure is in and in

Re: if vs. ifdef in Makefile.am

2023-03-03 Thread Jan Engelhardt
On Friday 2023-03-03 11:13, ljh wrote: >ifdef is not wrong. But ifdef is not portable.

Re: if vs. ifdef in Makefile.am

2023-03-03 Thread ljh
ifdef is not wrong. In GCC, `-DFOO=1` means `-DFOO` -D name Predefine name as a macro, with definition 1. -D name=definition

Re: if vs. ifdef in Makefile.am

2023-03-03 Thread Jan Engelhardt
On Friday 2023-03-03 10:40, ljh wrote: >--disable-assert is 1/3 of the way and cd is the other 2/3.

Re: if vs. ifdef in Makefile.am

2023-03-03 Thread ljh
Hi, --disable-assert is 1/3 of the way

Re: if vs. ifdef in Makefile.am

2023-03-03 Thread Jan Engelhardt
On Friday 2023-03-03 09:36, ljh wrote: >Jacob Bachmeyer wrote: >>$ (mkdir test-build; cd ./test-build && ../src/configure --enable-assert ...) >> >>$ (mkdir release-build; cd ./release-build && ../src/configure >>--disable-assert ...)

Re: if vs. ifdef in Makefile.am

2023-03-03 Thread ljh
Hi, It seems the other project is on the right way. I do not know if Autotools can be used as easily like this? # cmake -S . -B debug_dir -DCMAKE_BUILD_TYPE=Debug # cmake -S . -B release_dir -DCMAKE_BUILD_TYPE= Release It sets -g in Debug, -O3 in Release for build command. It sets -DNDEBUG in Re

Re: if vs. ifdef in Makefile.am

2023-03-02 Thread Jacob Bachmeyer
Bogdan wrote: [...] Probably Nick's suggestion (a new option to ./configure or the AC_HEADER_ASSERT macro) would be the most future-proof, but it requires running ./configure each time you wish to change the build type (which maybe is not a bad idea, it depends). That would probably be a ve

Re: if vs. ifdef in Makefile.am

2023-03-02 Thread ljh
Hi, Is there a way, in Makefile.am, to check if a variable is empty or defined on command line. # Makefile.am if $(FOOBAR) --- $ make FOOBAR=1 Thanks

Re: if vs. ifdef in Makefile.am

2023-03-02 Thread ljh
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(     [ndebug],     [AS_HELP_STRING([--enable-

Re: if vs. ifdef in Makefile.am

2023-03-02 Thread Bogdan
ljh via Discussion list for automake , Wed Mar 01 2023 19:50:56 GMT+0100 (Central European Standard Time) Hi community, I want to build debug or release with  ``` $ make # NDEBUG=1 $ make NDEBUG=1 ``` Can I have automake.am to define and convey something like this to the output Makefile:

Re: if vs. ifdef in Makefile.am

2023-03-02 Thread Peter Johansson
On 2/3/23 16:07, ljh via Discussion list for automake wrote: Hi, It seems I can not use `--disable-assert` on Debian 11.  You need to call macro AC_HEADER_ASSERT in your 'configure.ac' https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.71/autoconf.html#Particular-Headers

Re: if vs. ifdef in Makefile.am

2023-03-01 Thread ljh
Hi, It seems I can not use `--disable-assert` on Debian 11.  ``` $ ./configure --disable-assert ... configure: WARNING: unrecognized options: --disable-assert ``` $ autoconf --version autoconf (GNU Autoconf) 2.69 $  $ automake --version automake (GNU automake) 1.16.3 $ 

Re: if vs. ifdef in Makefile.am

2023-03-01 Thread Nick Bowler
On 2023-03-01, Jan Engelhardt wrote: > You can utilize the same mechanism behind automake's `make V=1`: > > NDEBUG = 0 > my_CPPFLAGS_0 = > my_CPPFLAGS_1 = -NDEBUG > my_CFLAGS_0 = -O3 > my_CFLAGS_1 = > AM_CPPFLAGS = ${my_CPPFLAGS_${NDEBUG}} > AM_CFLAGS = ${my_CFLAGS_${NDEBUG}} This syntax is not s

Re: if vs. ifdef in Makefile.am

2023-03-01 Thread Arsen Arsenović
Hi ljh, "ljh" via Discussion list for automake writes: > Hi community, > > > I want to build debug or release with  > > > ``` > $ make # NDEBUG=1 > $ make NDEBUG=1 > ``` > > > Can I have automake.am to define and convey something like this to the output > Makefile: > > > ``` > ifdef NDEBUG    

Re: if vs. ifdef in Makefile.am

2023-03-01 Thread Jan Engelhardt
On Wednesday 2023-03-01 19:50, ljh via Discussion list for automake wrote: >``` >$ make # NDEBUG=1 >$ make NDEBUG=1 >``` > >Can I have automake.am to define and convey something like this to the output >Makefile: >``` >ifdef NDEBUG             # if vs. ifdef >CPPFLAGS += -DNDEBUG >CFLAGS += -O3

if vs. ifdef in Makefile.am

2023-03-01 Thread ljh
Hi community, I want to build debug or release with  ``` $ make # NDEBUG=1 $ make NDEBUG=1 ``` Can I have automake.am to define and convey something like this to the output Makefile: ``` ifdef NDEBUG             # if vs. ifdef CPPFLAGS += -DNDEBUG CFLAGS += -O3 # .cpp else CFLAGS += -g # .