autoconf/automake: conditional compilation based on presence of library?
问题 I need to conditionally compile some code based on the presence of a library. Seems like this should be easy with autoconf/automake but I can't figure it out. For example, if there is a PNG library present, I want to include code to use it. My configure.ac has: AC_CHECK_LIB([png], [png_create_write_struct_2]) and my Makefile.am has: if USE_LIBPNG libdev_la_SOURCES += png.c endif (which adds png.c to the list of sources for libdev so it gets compiled). An automake conditional like USE_LIBPNG