AC_INIT([timer], [0.1], [the_jk@yahoo.com]) AC_CONFIG_MACRO_DIR([m4]) AC_ISC_POSIX AC_HEADER_STDC AC_C_CONST AC_C_INLINE #AC_C_BIGENDIAN AC_C___ATTRIBUTE__ #AC_PROG_RANLIB AM_INIT_AUTOMAKE([dist-bzip2 foreign color-tests parallel-tests]) AM_SILENT_RULES([yes]) AC_PROG_CC AM_PROG_CC_C_O DEFINES="-D_DEFAULT_SOURCE -D_GNU_SOURCE -D_XOPEN_SOURCE" AX_CFLAGS_WARN_ALL([DEFINES]) AC_ARG_ENABLE([debug], AC_HELP_STRING([compile with debug options]), use_debug="$enableval", use_debug=no) if test "x$use_debug" = "xyes"; then DEFINES="$DEFINES -g -DDEBUG" else DEFINES="$DEFINES -DNDEBUG" fi AC_SUBST([DEFINES]) # Common AC_HEADER_STDBOOL AC_SEARCH_LIBS([round], [m],, AC_MSG_ERROR([need round])) # Threads AC_CHECK_HEADER([pthread.h],have_pthread=1,have_pthread=0) if test "x$have_pthread" = "x1"; then OLDCFLAGS="$CFLAGS" OLDLDFLAGS="$LDFLAGS" CFLAGS="$OLDCFLAGS -pthread" LDFLAGS="$OLDLDFLAGS -pthread" AC_SEARCH_LIBS([pthread_create], [pthread],, have_pthread=0) LDFLAGS="$OLDLDFLAGS" CFLAGS="$OLDCFLAGS" if test "x$have_pthread" = "x1"; then DEFINES="$DEFINES -pthread" LIBS="$LIBS -pthread" fi OLDCFLAGS="$CFLAGS" CFLAGS="$OLDCFLAGS $DEFINES" AC_CHECK_FUNC([pthread_yield],[have_pthread_yield=1],[have_pthread_yield=0]) AC_DEFINE_UNQUOTED([HAVE_PTHREAD_YIELD],[$have_pthread_yield],[define to 1 if pthread_yield is available]) if test "x$have_pthread_yield" = "x1"; then AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include ]],[[ return pthread_yield(); ]])],pthread_yield_void=0, pthread_yield_void=1) AC_DEFINE_UNQUOTED([PTHREAD_YIELD_VOID],[$pthread_yield_void],[define to 1 if pthread_yield returns void]) fi CFLAGS="$OLDCFLAGS" fi AM_CONDITIONAL([HAVE_PTHREAD], [test "x$have_pthread" = "x1"]) AC_DEFINE_UNQUOTED([HAVE_PTHREAD],[$have_pthread],[define to 1 if pthread is available]) if test "x$have_pthread" = "x0"; then AC_MSG_ERROR([no thread implementation found]) fi # timeval AC_CHECK_TYPES([struct timespec],,,[[#include ]]) # clock AC_SEARCH_LIBS([clock_gettime], [rt], [have_clock_gettime=1], [have_clock_gettime=0]) AC_DEFINE_UNQUOTED([HAVE_CLOCK_GETTIME], [$have_clock_gettime], [Define to 1 if clock_gettime is available]) # XCB PKG_PROG_PKG_CONFIG() xcb_modules="xcb xcb-event xcb-keysyms" PKG_CHECK_EXISTS([xcb-icccm >= 0.3.8], [have_xcb_icccm=1 xcb_modules="$xcb_modules xcb-icccm"],[have_xcb_icccm=0]) PKG_CHECK_MODULES([XCB], [$xcb_modules]) AC_DEFINE_UNQUOTED([HAVE_XCB_ICCCM],[$have_xcb_icccm],[define to 1 if xcb-icccm is available]) # Finish up AC_CONFIG_HEADERS([config.h]) AC_OUTPUT([Makefile src/Makefile])