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_GNU_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE" AX_CFLAGS_WARN_ALL([DEFINES]) AC_ARG_ENABLE([debug], AC_HELP_STRING([compile with debug options]), if test "x$enableval" = "xyes"; then DEFINES="$DEFINES -g -DDEBUG" 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 fi AM_CONDITIONAL([HAVE_PTHREAD], [test "x$have_pthread" = "x1"]) if test "x$have_pthread" = "x0"; then AC_MSG_ERROR([no thread implementation found]) fi # timeval # clock have_clock_gettime=0 have_clock_nanosleep=0 CLOCK_LIBS= AC_MSG_CHECKING([for clock_gettime]) AC_LINK_IFELSE([AC_LANG_CALL([], [clock_gettime])], AC_MSG_RESULT([yes]) have_clock_gettime=1, AC_MSG_RESULT([no]) OLDLIBS="$LIBS" LIBS="$LIBS -lrt" AC_MSG_CHECKING([for clock_gettime in -lrt]) AC_LINK_IFELSE([AC_LANG_CALL([], [clock_gettime])], AC_MSG_RESULT([yes]) have_clock_gettime=1 CLOCK_LIBS="$CLOCK_LIBS -lrt", AC_MSG_RESULT([no])) LIBS="$OLDLIBS") AC_DEFINE_UNQUOTED([HAVE_CLOCK_GETTIME], [$have_clock_gettime], [define to 1 if clock_gettime is available]) AC_MSG_CHECKING([for clock_nanosleep]) AC_LINK_IFELSE([AC_LANG_CALL([], [clock_nanosleep])], AC_MSG_RESULT([yes]) have_clock_nanosleep=1, AC_MSG_RESULT([no]) OLDLIBS="$LIBS" LIBS="$LIBS -lrt" AC_MSG_CHECKING([for clock_nanosleep in -lrt]) AC_LINK_IFELSE([AC_LANG_CALL([], [clock_nanosleep])], AC_MSG_RESULT([yes]) have_clock_nanosleep=1 CLOCK_LIBS="$CLOCK_LIBS -lrt", AC_MSG_RESULT([no])) LIBS="$OLDLIBS") AC_DEFINE_UNQUOTED([HAVE_CLOCK_NANOSLEEP], [$have_clock_nanosleep], [define to 1 if clock_nanosleep is available]) AC_SUBST([CLOCK_LIBS]) # 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])