# -*- mode:Shell-script -*- AC_PREREQ(2.57) AC_INIT AC_CONFIG_SRCDIR([configure.in]) AC_CONFIG_AUX_DIR(config) AC_CONFIG_MACRO_DIR([config]) AM_CONFIG_HEADER(src/config.h) LOG4C_MAJOR_VERSION=1 LOG4C_MINOR_VERSION=2 LOG4C_MICRO_VERSION=4 VERSION=$LOG4C_MAJOR_VERSION.$LOG4C_MINOR_VERSION.$LOG4C_MICRO_VERSION${SNAPSHOT:+.$SNAPSHOT} # +1 : ? : +1 == new interface that does not break old one # +1 : ? : 0 == new interface that breaks old one # ? : ? : 0 == no new interfaces, but breaks apps # ? :+1 : ? == just some internal changes, nothing breaks but might work # better # CURRENT : REVISION : AGE LT_VERSION=6:1:3 AC_SUBST(LOG4C_MAJOR_VERSION) AC_SUBST(LOG4C_MINOR_VERSION) AC_SUBST(LOG4C_MICRO_VERSION) AC_SUBST(LT_VERSION) AM_INIT_AUTOMAKE("log4c", $VERSION) AC_CANONICAL_HOST # Need this to get pthread etc. AC_DEFINE(_GNU_SOURCE,1,"POSIXandGNU extensions") ##################### # Checks for programs #. AC_PROG_YACC AC_PROG_CC AC_PROG_CPP AC_PROG_CXX AM_PROG_LEX AC_PROG_AWK AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_PROG_LIBTOOL # platform idioms case "$host" in *-hp-hpux*) CFLAGS="-g" ;; *-mingw*) dnl required to create shared libraries LDFLAGS_NOUNDEFINED="-no-undefined" l4c_have_win=yes ;; *) ;; esac AC_SUBST([LDFLAGS_NOUNDEFINED]) AM_CONDITIONAL([WIN32], test "x$l4c_have_win" = "xyes") if test "x$GCC" = "xyes"; then case " $CFLAGS " in *[\ \ ]-Wall[\ \ ]*) ;; *) CFLAGS="$CFLAGS -Wall" ;; esac fi ########################## # Enable debug if required # AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [LOG4C: turn on debugging (default=no)])) if test x$enable_debug = xyes; then CFLAGS="$CFLAGS -D__SD_DEBUG__ -D__LOG4C_DEBUG__" fi ######################## # Enable reread if flagged # AC_ARG_ENABLE(reread, AC_HELP_STRING([--enable-reread], [LOG4C: turn on re-read of log4crc file(default=no)]i), if test x$enable_reread = xyes; then AC_MSG_NOTICE([Enabled automatic reread of log4crc file]) AC_DEFINE([__ENABLE_REREAD__], [], [Enable automatic reread of log4crc file]) fi ) #################################################################### # Test for pthread and enable rollingfile code which depends on that # if we find it # AC_CHECK_HEADER(pthread.h,[ AC_CHECK_LIB(pthread,pthread_mutex_init,[ LIBS="$LIBS -lpthread" AC_DEFINE([WITH_ROLLINGFILE], [], [Define if we found pthread.h libpthread]) AC_MSG_NOTICE([Compile with rollingfile code]) with_rollingfile=true],[AC_MSG_NOTICE([No pthread--not compiling rollingfile code])] ) ]) AM_CONDITIONAL(WITH_ROLLINGFILE, test "x$with_rollingfile" = "xtrue") ##################################### # Enable test compilation if required # AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test], [LOG4C: compile test programs (default=no)])) AM_CONDITIONAL(TEST, test x$enable_test = xyes) ##################################### # Checks for libraries. # ##################################### # Checks for header files. # AC_HEADER_STDC AC_CHECK_HEADERS([alloc.h fcntl.h inttypes.h langinfo.h limits.h malloc.h stddef.h stdint.h \ stdlib.h string.h sys/time.h syslog.h unistd.h stdarg.h varargs.h getopt.h \ pthread.h]) dnl These tests don't work properly, on MinGW the functions are not detected dnl even they are available. But replacement functions are good enough. :-) AC_CHECK_FUNCS([sleep gmtime_r localtime_r]) AC_CHECK_DECLS([sleep], [], [], [[#include ]]) AC_CHECK_DECLS([gmtime_r, localtime_r], [], [], [[#include ]]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_TYPE_SIZE_T AC_HEADER_TIME AC_STRUCT_TM # Checks for library functions. AC_FUNC_ALLOCA dnl nonportable or buggy (we want cross-compilation) dnl AC_FUNC_MALLOC AC_FUNC_MMAP dnl nonportable or buggy (we want cross-compilation) dnl AC_FUNC_REALLOC AC_FUNC_UTIME_NULL AC_FUNC_VPRINTF AC_CHECK_FUNCS([gettimeofday memset munmap nl_langinfo strdup strerror strncasecmp strrchr strstr utime sbrk]) LOG4C_FUNC_GETHOSTNAME LOG4C_VA_COPY # enable mmap appender only when mmap() function found AM_CONDITIONAL(WITH_MMAP, test "x$ac_cv_func_mmap_fixed_mapped" = "xyes") ############### # Documentation # AC_ARG_ENABLE(doc, AC_HELP_STRING([--enable-doc], [LOG4C: create documentation with doxygen--html/man/pdf (default=no)])) # Checks for doxygen AC_PATH_PROG(DOXYGEN, doxygen, ) if test x$DOXYGEN = x; then enable_doc=no fi AM_CONDITIONAL(DOC, test x$enable_doc = xyes) # # Checks for the graphviz tool 'dot' used to generate graphs # of the class dependencies. Probably not useful # for c programs. If we don't find dot in the path # then set HAVE_DOT to NO in Doxyfile.in # HAVE_DOT=YES AC_PATH_PROG(DOT, dot, ) if test x$DOT = x; then HAVE_DOT=NO fi AC_SUBST(HAVE_DOT) # Similar for latex HAVE_LATEX=YES AC_PATH_PROG(LATEX, latex, ) if test x$LATEX = x; then HAVE_LATEX=NO fi # This variable is used to turn LATEX on and off in the Doxyfile AC_SUBST(HAVE_LATEX) # This variable is used in doc/Makefile.am to set the target to make # the doc with latex or not AM_CONDITIONAL(HAVE_LATEX, test x$HAVE_LATEX = xYES) # # Documentation ############### AC_ARG_ENABLE(constructors, AC_HELP_STRING([--enable-constructors], [LOG4C: build with initialization constructors [default=no]])) if test "x$enable_constructors" = "xyes"; then AC_DEFINE([WITH_CONSTRUCTORS], 1, [build log4c with initialization constructors]) AC_MSG_NOTICE([using constructors to initialize log4c]) fi # ################### ################### # Test for libexpat # AC_ARG_WITH(expat, AC_HELP_STRING([--without-expat], [LOG4C: build without expat (default=no). Set this option to yes if you do not want Log4C to use expat for parsing the configuration file. If without-expat is set to yes then none of the other options related to expat have any effect and Log4C uses some bundled yacc/lex code for parsing it's configuration file. ]), with_expat=no, with_expat=yes) if test x$with_expat = xyes ; then use_expat=yes AM_PATH_EXPAT(1.95.1) fi dnl AC_MSG_NOTICE([value of with_expat = $with_expat no_expat = $no_expat use_expat= $use_expat]) AM_CONDITIONAL(USE_EXPAT, test "x$use_expat" = "xyes" ) # ################### AC_CONFIG_FILES([ Makefile log4c-config log4c.pc log4crc.sample log4c.spec config/Makefile doc/Makefile doc/Doxyfile doc/main.doc src/Makefile src/log4c/Makefile src/log4c/version.h src/sd/Makefile tests/Makefile tests/log4c/Makefile examples/Makefile examples/log4crc examples/helloworld/Makefile examples/helloworld1/Makefile ]) AC_CONFIG_COMMANDS([default],[[ chmod +x log4c-config ]],[[]]) AC_OUTPUT