andy0130tw
7/15/2017 - 3:24 AM

Build protobuf-text-c without doxygen and automake dependency

Build protobuf-text-c without doxygen and automake dependency

#!/usr/bin/env sh

rm -f am/aminclude_doxygen.am
rm -f m4/ax_prog_doxygen.m4

sed -i '/^#/! s/\(^DX_.*$\)/# \1/' configure.ac
sed -i '/^#/! s/\(^.*aminclude_doxygen.*$\)/# \1/' Makefile.am
sed -i '/^#/! s/\(^.*ax_prog_doxygen.*$\)/# \1/' aclocal.m4

The build failure

When running autoreconf on protobuf-text-c will lead to a weird error message indicating that something is wrong with doxygen.

$ ./autogen.sh
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4 --install
aclocal: overwriting 'm4/ax_prog_doxygen.m4' with '/usr/share/aclocal/ax_prog_doxygen.m4'
aclocal: overwriting 'm4/libtool.m4' with '/usr/share/aclocal/libtool.m4'
aclocal: overwriting 'm4/ltoptions.m4' with '/usr/share/aclocal/ltoptions.m4'
aclocal: overwriting 'm4/ltversion.m4' with '/usr/share/aclocal/ltversion.m4'
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
libtoolize: copying file 'build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:19: installing 'build-aux/compile'
configure.ac:17: installing 'build-aux/missing'
am/aminclude_doxygen.am:7: error: DX_COND_doc does not appear in AM_CONDITIONAL
Makefile.am:122:   'am/aminclude_doxygen.am' included from here
am/aminclude_doxygen.am:13: error: DX_COND_html does not appear in AM_CONDITIONAL
Makefile.am:122:   'am/aminclude_doxygen.am' included from here
am/aminclude_doxygen.am:23: error: DX_COND_chm does not appear in AM_CONDITIONAL
Makefile.am:122:   'am/aminclude_doxygen.am' included from here
am/aminclude_doxygen.am:27: error: DX_COND_chi does not appear in AM_CONDITIONAL
Makefile.am:122:   'am/aminclude_doxygen.am' included from here
am/aminclude_doxygen.am:39: error: DX_COND_man does not appear in AM_CONDITIONAL
Makefile.am:122:   'am/aminclude_doxygen.am' included from here
am/aminclude_doxygen.am:49: error: DX_COND_rtf does not appear in AM_CONDITIONAL
Makefile.am:122:   'am/aminclude_doxygen.am' included from here
am/aminclude_doxygen.am:59: error: DX_COND_xml does not appear in AM_CONDITIONAL
Makefile.am:122:   'am/aminclude_doxygen.am' included from here
am/aminclude_doxygen.am:69: error: DX_COND_ps does not appear in AM_CONDITIONAL
Makefile.am:122:   'am/aminclude_doxygen.am' included from here
am/aminclude_doxygen.am:98: error: DX_COND_pdf does not appear in AM_CONDITIONAL
Makefile.am:122:   'am/aminclude_doxygen.am' included from here
am/aminclude_doxygen.am:127: error: DX_COND_latex does not appear in AM_CONDITIONAL
Makefile.am:122:   'am/aminclude_doxygen.am' included from here
Makefile.am: installing 'build-aux/depcomp'
autoreconf: automake failed with exit status: 1

The issue

The issue was encountered by myself when protobuf-text-c started to be a dependency of nsjail and my build had failed since then. After investigating, this issue was probably due to a mismatch version of aclocal (1.14 against 1.15). Unfortunately, I couldn't find a suitable version in my package repository. I was using Ubuntu 16.10 x86_64.

The solution

Because building the doc is not important for me (at least not important as a successful build), I decided to try to remove doxygen from the build script. It turned out to be very straightforward as removing some files and commenting out some lines suffice. I tried to automate this process by a tiny script.

I don't know why, but perhaps it is how automake works -- prepare everything for building even if you don't want to build them at all.