summaryrefslogtreecommitdiff
path: root/src/configure.in
blob: 1c4ab8765a7a2ba49e98bc6aa0993714022b4dce (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
dnl $Id: configure.in,v 1.42 2008-07-21 18:51:56 spotspot Exp $
dnl Process this file with autoconf to produce a configure script.

AC_INIT(flam3-animate.c)
AM_CONFIG_HEADER(config.h)
AC_ARG_ENABLE(pthread, [  --enable-pthread        compile FLAM3 with threads enabled (default=yes)])
AC_ARG_ENABLE(atomic_ops, [  --enable-atomic-ops     compile FLAM3 with atom ops enabled (default=yes, independently checks for 32 and 64 bit sizes)])
AM_INIT_AUTOMAKE(flam3,"3.0")

AC_CONFIG_MACRO_DIR([m4])

# Save CFLAGS from the environment
save_CFLAGS=$CFLAGS

AC_PROG_CC

CFLAGS=$save_CFLAGS

AC_PROG_INSTALL
AC_PROG_MAKE_SET
AM_DISABLE_SHARED
AC_PROG_LIBTOOL
AC_HEADER_STDC
AC_C_CONST
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_CHECK_LIB([z],[deflateInit_],,[AC_MSG_ERROR([zlib is required.])])
AC_CHECK_LIB([png],[png_write_image],,[AC_MSG_ERROR([The png library is required.])])
AC_CHECK_LIB([xml2],[xmlParseFile],,[AC_MSG_ERROR([The xml2 library is required.])])


if test "${enable_atomic_ops}" = "" ; then
  enable_atomic_ops=yes
fi

if test "${enable_atomic_ops}" = "yes" ; then

  AC_MSG_CHECKING([whether $CC knows 32-bit __sync_bool_compare_and_swap()])
  AC_LANG_CONFTEST([#include <stdint.h>
  int main() { uint32_t a = 4;
  __sync_bool_compare_and_swap(&a, 4, 5); }])
  $CC conftest.c $CFLAGS -o conftest > /dev/null 2> /dev/null
  ret=$?
  rm -f conftest.o conftest
  if test $ret -eq 0 ; then
     AC_DEFINE([HAVE_GCC_ATOMIC_OPS], 1, [Have 32-bit __sync_bool_compare_and_swap() and friends.])
     AC_MSG_RESULT([yes])
  else
     AC_MSG_RESULT([no - try specifying CFLAGS=-march={your_arch}])
  fi

  AC_MSG_CHECKING([whether $CC knows 64-bit __sync_bool_compare_and_swap()])
  AC_LANG_CONFTEST([#include <stdint.h>
  int main() { uint64_t a = 4; __sync_bool_compare_and_swap(&a, 4, 5); }])
  $CC conftest.c $CFLAGS -o conftest > /dev/null 2> /dev/null
  ret=$?
  rm -f conftest.o conftest
  if test $ret -eq 0 ; then
     AC_DEFINE([HAVE_GCC_64BIT_ATOMIC_OPS], 1, [Have 64-bit __sync_bool_compare_and_swap() and friends.])
     AC_MSG_RESULT([yes])
  else
     AC_MSG_RESULT([no - try specifying CFLAGS=-march={your_arch}])
  fi
fi

if test "${enable_pthread}" = "" ; then
  enable_pthread=yes
fi

if test "${enable_pthread}" = "yes" ; then
  AC_CHECK_LIB([pthread],[pthread_create],,[AC_MSG_WARN([Pthread library not found - threads disabled.])])
fi
AC_CHECK_LIB([jpeg],[jpeg_start_compress],,[AC_MSG_ERROR([The jpeg library is required.])])
AC_PATH_PROG(XML2_CONFIG,xml2-config, no, $PATH:/bin:/usr/bin:/usr/local/bin)

if test "$XML2_CONFIG" != "no"
then
   CPPFLAGS="`$XML2_CONFIG --cflags` $CPPFLAGS"
fi

AC_OUTPUT([
Makefile
flam3.pc
])