add packaging
[platform/upstream/libpthread-stubs.git] / configure.ac
1 AC_INIT([libpthread-stubs],
2         0.3,
3         [xcb@lists.freedesktop.org])
4 AC_CONFIG_SRCDIR([pthread-stubs.pc.in])
5 AM_INIT_AUTOMAKE([foreign dist-bzip2])
6
7 AC_CONFIG_HEADERS([config.h])
8
9 AC_PROG_LIBTOOL
10 AC_PROG_CC
11
12
13 dnl Detection code for compilers supporting the __attribute__((weak, alias))
14 dnl feature. Original code present in unieject's repository
15 dnl Diego Pettenò <flameeyes@gentoo.org>
16 ac_save_CFLAGS="$CFLAGS"
17 CFLAGS="$CFLAGS -Werror"
18 AC_CACHE_CHECK([if compiler supports __attribute__((weak, alias))],
19         [cc_cv_attribute_alias],
20         [AC_COMPILE_IFELSE([
21                 void other_function(void *foo) { }
22                 void some_function(void *foo) __attribute__((weak, alias("other_function")));
23                 ],
24                 [cc_cv_attribute_alias=yes],
25                 [cc_cv_attribute_alias=no])
26         ])
27 CFLAGS="$ac_save_CFLAGS"
28 if test "x$cc_cv_attribute_alias" = "xyes"; then
29         AC_DEFINE([SUPPORT_ATTRIBUTE_ALIAS], 1, [Define this if the compiler supports the alias attribute])
30 fi
31
32
33 PKG_CONFIG_LIBS=
34 AC_CHECK_FUNCS([pthread_self pthread_mutex_init pthread_mutex_destroy pthread_mutex_lock pthread_mutex_unlock pthread_cond_init pthread_cond_destroy pthread_condattr_init pthread_condattr_destroy pthread_cond_wait pthread_cond_timedwait pthread_cond_signal pthread_cond_broadcast pthread_equal pthread_exit],
35                [], [PKG_CONFIG_LIBS='-L${libdir} -lpthread-stubs'])
36 AC_SUBST([PKG_CONFIG_LIBS])
37 AM_CONDITIONAL(BUILD_LIB, test "x$PKG_CONFIG_LIBS" != x)
38
39 AC_CONFIG_FILES([Makefile pthread-stubs.pc])
40 AC_OUTPUT