I'm building my first autoconf managed package.
However I can't find any simple examples anywhere of how to specify a required library, and find that library where it might be in various different places.
I've currently got:
AC_CHECK_LIB(['event'], ['event_init'])
but:
/opt/local/lib
/opt/local/include
tooany help, or links to decent tutorials much appreciated...
autoconf script cannot guess the "optional" library locations, which may vary from one platform to another. So you can say
CPPFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib" ./configure
For AC_CHECK_LIB()
you need to specify the fail condition explicitly in "action-if-false" argument:
dnl This is simply print "no" and continue:
AC_CHECK_LIB([m], [sqrt123])
dnl This will stop:
AC_CHECK_LIB([m], [sqrt123], [], [AC_MSG_ERROR([sqrt123 was not found in libm])])
Output:
checking for sqrt123 in -lm... no
checking for sqrt123 in -lm... no
configure: error: sqrt123 was not found in libm
AC_CHECK_LIB()
does not fail by default on obvious reasons: one may check for several different libraries that provide similar functionality and choose one of them :)
Also have a look at this post for similar topic.