Configure Quirks
Zero exit status doesn't guarantee you that configure script did not stumble upon any problems. When making a port, you should carefully examine its output, looking for any problems and trying to understand every "... no" the script encounters.
ac_compile vs ac_cpp
Synopsis
checking vorbis/codec.h usability... yes checking vorbis/codec.h presence... no configure: WARNING: vorbis/codec.h: accepted by the compiler, rejected by the preprocessor! configure: WARNING: vorbis/codec.h: proceeding with the compiler's result
Under the hood
ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
Workaround
CFLAGS+= -I${LOCALBASE}/include LDFLAGS+= -L${LOCALBASE}/lib CONFIGURE_ENV+= CPPFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
Notice CPPFLAGS instead of CFLAGS in CONFIGURE_ENV
Comparisons
Synopsis
checking for netcdf library... test: x/usr/local/lib: unexpected operator test: x/usr/local/lib: unexpected operator test: x-L/usr/local/lib -lnetcdf: unexpected operator -L/usr/local/lib -lnetcdf
Under the hood
if test x"${netcdf_lib_dir}" == x ;
Workaround
Here are some hardcore substitutions:
@${REINPLACE_CMD} -E \ -e 's/test x(\".*\") ==? x([^:_."[:alnum:]-]|$$)/[ -z \1 ]\2/' \ -e 's/test x(\".*\") != x([^:_."[:alnum:]-]|$$)/[ -n \1 ]\2/' \ -e 's/test \"x(.*\") ==? x([^:_."[:alnum:]-]|$$)/[ -z \"\1 ]\2/' \ -e 's/test \"x(.*\") != x([^:_."[:alnum:]-]|$$)/[ -n \"\1 ]\2/' \ -e 's/test (\".*)\+set(.*)\" ==? set([^:_."[:alnum:]-]|$$)/[ -n \1\2\" ]\3/' \ -e 's/test (\".*)\+set(.*)\" != set([^:_."[:alnum:]-]|$$)/[ -z \1\2\" ]\3/' \ -e 's/test (.*) ==/test \1 =/' ${WRKSRC}/configure
In fact a simple '/test/s|==|=|g' is sufficient in many cases. Other ones are beautifiers.