2

So I've this project which depends on Google's Protocol Buffers compiler and libraries. Checking for the libraries is easy as a pkg-config file is provided, thus the checking process is reduced to PKG_CHECK_MODULES([protobuf], protobuf). Yet I'd like to check for the protoc compiler, or similar tool (in order to auto-magically build my .proto files).

Could anyone please provide some form of macro, or good tutorial on macro making (I haven't found anything useful so far...).

Julian.

Danilo Piazzalunga
  • 7,590
  • 5
  • 49
  • 75
Misguided
  • 1,302
  • 1
  • 14
  • 22

1 Answers1

1

To check for the presence of particular programs, you should use either AC_CHECK_PROG or AC_PATH_PROG. See the GNU Autoconf Manual.

AC_PATH_PROG(PROTOC, protoc, no)
if test "x$PROTOC" = "xno" ; then
  AC_MSG_ERROR([protoc is not found])
fi

See also this other question.

Community
  • 1
  • 1
Danilo Piazzalunga
  • 7,590
  • 5
  • 49
  • 75