Got it working at last. I had to specify library path through CFLAGS ... I had previously no experience with commandline building, so this was like exploration of the new world for me.
sudo ./configure CFLAGS="-I/opt/homebrew/include -L/opt/homebrew/lib"
sudo make CFLAGS="-I/opt/homebrew/include -L/opt/homebrew/lib"