summaryrefslogtreecommitdiff
path: root/configure.in
blob: 7ce5ce8b9ec39fcc34463088bace6079f022e5c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
AC_INIT([startup-notification], [0.10],
        [http://www.freedesktop.org/Software/startup-notification])
AC_CONFIG_SRCDIR(libsn/sn-launchee.c)

AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)

# Honor aclocal flags
AC_SUBST(ACLOCAL_AMFLAGS, "\${ACLOCAL_FLAGS}")

AM_MAINTAINER_MODE

AC_PROG_CC
AC_ISC_POSIX
AC_HEADER_STDC
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL

changequote(,)dnl
if test "x$GCC" = "xyes"; then
  case " $CFLAGS " in
  *[\ \	]-Wall[\ \	]*) ;;
  *) CFLAGS="$CFLAGS -Wall" ;;
  esac
fi
changequote([,])dnl

AC_PATH_XTRA

if test x$no_x = xyes ; then
  AC_MSG_ERROR([X11 development libraries/headers not found])
fi


dnl (check from glib)
dnl ok, here we try to check whether the systems prototypes for
dnl malloc and friends actually match the prototypes provided
dnl by sn-common.h (keep in sync). i currently only know how to check
dnl this reliably with gcc (-Werror), improvements for other
dnl compilers are appreciated.
SANE_MALLOC_PROTOS=no
AC_MSG_CHECKING([if malloc() and friends prototypes are sn-util.h compatible])
lf_save_CFLAGS=$CFLAGS
if test "x$GCC" = "xyes"; then
  CFLAGS="$CFLAGS -Werror"
  AC_TRY_COMPILE([#include <stdlib.h>], [
    void* (*my_calloc_p)  (size_t, size_t) = calloc;
    void* (*my_malloc_p)  (size_t)         = malloc;
    void  (*my_free_p)    (void*)          = free;
    void* (*my_realloc_p) (void*, size_t)  = realloc;
    my_calloc_p = 0;
    my_malloc_p = 0;
    my_free_p = 0;
    my_realloc_p = 0;
  ],
    AC_DEFINE(SANE_MALLOC_PROTOS, 1,
              [Define if you have correct malloc prototypes])
    SANE_MALLOC_PROTOS=yes)
fi
AC_MSG_RESULT($SANE_MALLOC_PROTOS)
CFLAGS=$lf_save_CFLAGS

dnl *** check for sane realloc() ***
AC_CACHE_CHECK([whether realloc (NULL,) will work],lf_cv_sane_realloc,[
        AC_TRY_RUN([
        #include <stdlib.h>
        int main() {
          return realloc (0, sizeof (int)) == 0;
        }],
        [lf_cv_sane_realloc=yes],
        [lf_cv_sane_realloc=no],
	[])
])
if test x$lf_cv_sane_realloc = xyes; then
  AC_DEFINE(REALLOC_0_WORKS,1,[whether realloc (NULL,) works])
fi

## try definining HAVE_BACKTRACE
AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)])

LIBSN_CFLAGS=$X_CFLAGS
LIBSN_LIBS=" $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
AC_SUBST(LIBSN_CFLAGS)
AC_SUBST(LIBSN_LIBS)

AC_CONFIG_FILES([
Makefile
libsn/Makefile
test/Makefile
doc/Makefile
libstartup-notification-1.0.pc
])

AC_OUTPUT