configure.ac 7.07 KB
Newer Older
1
AC_PREREQ([2.68])
Sebastian Dröge's avatar
Sebastian Dröge committed
2
AC_INIT([orc], [0.4.24], [http://bugzilla.gnome.org/enter_bug.cgi?product=orc],[orc])
3
dnl don't forget to update libversion
4

5
AS_NANO(ORC_GIT=no,ORC_GIT=yes)
6

7 8 9 10 11 12 13
AC_CANONICAL_HOST()
AM_INIT_AUTOMAKE([-Wno-portability 1.11 no-dist-gzip dist-xz tar-ustar subdir-objects])

dnl use pretty build output with automake >= 1.11
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],
  [AM_DEFAULT_VERBOSITY=1
   AC_SUBST(AM_DEFAULT_VERBOSITY)])
14

15
ORC_MAJORMINOR=0.4
16 17
AC_SUBST(ORC_MAJORMINOR)

18
AC_CONFIG_HEADER(config.h)
19 20 21 22 23 24

dnl CURRENT, REVISION, AGE
dnl - library source changed -> increment REVISION
dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
dnl - interfaces added -> increment AGE
dnl - interfaces removed -> AGE = 0
Sebastian Dröge's avatar
Sebastian Dröge committed
25
ORC_LIBVERSION="23:0:23"
26
AC_SUBST(ORC_LIBVERSION)
27 28 29 30 31
LT_PREREQ([2.2.6])
LT_INIT([dlopen win32-dll disable-static])

AC_PROG_CC
AC_PROG_CC_STDC
32
AM_PROG_CC_C_O
33
AM_PROG_AS
34

David Schleef's avatar
David Schleef committed
35
AC_CONFIG_MACRO_DIR([m4])
36 37 38

AC_CONFIG_SRCDIR([orc/orc.h])

39 40
AM_MAINTAINER_MODE([enable])

41 42 43
ACLOCAL_AMFLAGS="-I m4 $ACLOCAL_AMFLAGS"
AC_SUBST(ACLOCAL_AMFLAGS)

David Schleef's avatar
David Schleef committed
44
AM_CONDITIONAL(CROSS_COMPILING, test "x$cross_compiling" = "xyes")
45
AC_CHECK_FUNCS([posix_memalign])
David Schleef's avatar
David Schleef committed
46

47 48 49 50 51 52 53
##################################################
# Check for gtk-doc.
##################################################

if test "x$cross_compiling" = "xyes" ; then
  enable_gtk_doc=no
fi
54
GTK_DOC_CHECK([1.12])
55 56 57 58 59 60 61

AS_HOST_DEFINES()

AC_C_BIGENDIAN

AC_FUNC_MMAP()

62
AC_HEADER_STDC
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
AC_CHECK_HEADERS([inttypes.h])
AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_HEADERS([unistd.h])

AC_CHECK_FUNCS([gettimeofday])
AC_CHECK_FUNCS([sigaction])
AC_CHECK_FUNCS([sigsetjmp])

AC_CHECK_LIBM
AC_SUBST(LIBM)

AC_CHECK_LIB(rt, clock_gettime,
   AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Defined if we have clock_gettime()])
   LIBRT=-lrt
   )
AC_SUBST(LIBRT)

80 81 82 83 84 85 86
dnl Android liblog
AC_CHECK_LIB(log, __android_log_print,
   AC_DEFINE(HAVE_ANDROID_LIBLOG, 1, [Defined if we have __android_log_print()])
   LIBLOG=-llog
   )
AC_SUBST(LIBLOG)

87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
AC_CACHE_CHECK(for monotonic clocks,
    orc_cv_monotonic_clock,AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <time.h>
#include <unistd.h>
int main() {
#if !(defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0 && defined(CLOCK_MONOTONIC))
        #error No monotonic clock
#endif
        return 0;
}
]])],orc_cv_monotonic_clock=yes,orc_cv_monotonic_clock=no))
if test "$orc_cv_monotonic_clock" = "yes"; then
  AC_DEFINE(HAVE_MONOTONIC_CLOCK,1,[Defined if we have a monotonic clock])
fi

102 103
AC_CHECK_HEADERS([valgrind/valgrind.h])

104
AS_COMPILER_FLAG(-Wall, ORC_CFLAGS="$ORC_CFLAGS -Wall")
105
if test "x$ORC_GIT" = "xyes"
106
then
107
  AS_COMPILER_FLAG(-Werror, ERROR_CFLAGS="-Werror")
108 109
fi

David Schleef's avatar
David Schleef committed
110
case "${host_os}" in
111
  nobody_is_using_this_currently)
112
    AC_DEFINE(HAVE_CODEMEM_MALLOC, 1, [Use malloc to allocate code for execution])
David Schleef's avatar
David Schleef committed
113
    ;;
114 115 116
  mingw*|pw32*|cygwin*)
    AC_DEFINE(HAVE_CODEMEM_VIRTUALALLOC, 1, [Use VirtualAlloc to allocate code for execution])
    ;;
117
  linux*|darwin*|solaris*|netbsd*|freebsd*|openbsd*|kfreebsd*|dragonfly*|gnu*)
118
    AC_DEFINE(HAVE_CODEMEM_MMAP, 1, [Use mmap to allocate code for execution])
David Schleef's avatar
David Schleef committed
119 120 121 122 123 124
    ;;
  *)
    AC_ERROR([no code allocation backend])
    ;;
esac

125 126 127 128
case "${host_os}" in
  mingw*|pw32*|cygwin*)
    AC_DEFINE(HAVE_THREAD_WIN32, 1, [Use Windows thread code])
    ;;
Sebastian Dröge's avatar
Sebastian Dröge committed
129 130 131 132 133
  *android*)
    AC_DEFINE(HAVE_THREAD_PTHREAD, 1, [Use pthread thread code])
    PTHREAD_CFLAGS=
    PTHREAD_LIBS=
    ;;
134 135
  *)
    AC_DEFINE(HAVE_THREAD_PTHREAD, 1, [Use pthread thread code])
David Schleef's avatar
David Schleef committed
136 137
    PTHREAD_CFLAGS=
    PTHREAD_LIBS=-lpthread
138 139
    ;;
esac
David Schleef's avatar
David Schleef committed
140 141
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_LIBS)
142

David Schleef's avatar
David Schleef committed
143
AC_ARG_ENABLE(backend,
144
  AC_HELP_STRING([--enable-backend],[sse,mmx,neon,mips,all (default all)]),
David Schleef's avatar
David Schleef committed
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
    [], [enable_backend=all])
case "${enable_backend}" in
  sse)
    ENABLE_BACKEND_SSE=yes
    AC_DEFINE(ENABLE_BACKEND_SSE, 1, [Enable SSE backend])
    ;;
  mmx)
    ENABLE_BACKEND_MMX=yes
    AC_DEFINE(ENABLE_BACKEND_MMX, 1, [Enable MMX backend])
    ;;
  altivec)
    ENABLE_BACKEND_ALTIVEC=yes
    AC_DEFINE(ENABLE_BACKEND_ALTIVEC, 1, [Enable Altivec backend])
    ;;
  neon)
    ENABLE_BACKEND_NEON=yes
    AC_DEFINE(ENABLE_BACKEND_NEON, 1, [Enable NEON backend])
    ;;
163 164 165 166 167
### ARM backend is disabled until it has decent coverage
#  arm)
#    ENABLE_BACKEND_ARM=yes
#    AC_DEFINE(ENABLE_BACKEND_ARM, 1, [Enable Arm backend])
#    ;;
David Schleef's avatar
David Schleef committed
168 169 170 171
  c64x)
    ENABLE_BACKEND_C64X=yes
    AC_DEFINE(ENABLE_BACKEND_C64X, 1, [Enable c64x backend])
    ;;
172 173 174 175
  mips)
    ENABLE_BACKEND_MIPS=yes
    AC_DEFINE(ENABLE_BACKEND_MIPS, 1, [Enable MIPS backend])
    ;;
David Schleef's avatar
David Schleef committed
176 177 178 179 180 181 182 183 184
  all|auto)
    ENABLE_BACKEND_SSE=yes
    AC_DEFINE(ENABLE_BACKEND_SSE, 1, [Enable SSE backend])
    ENABLE_BACKEND_MMX=yes
    AC_DEFINE(ENABLE_BACKEND_MMX, 1, [Enable MMX backend])
    ENABLE_BACKEND_ALTIVEC=yes
    AC_DEFINE(ENABLE_BACKEND_ALTIVEC, 1, [Enable Altivec backend])
    ENABLE_BACKEND_NEON=yes
    AC_DEFINE(ENABLE_BACKEND_NEON, 1, [Enable NEON backend])
185 186
#    ENABLE_BACKEND_ARM=yes
#    AC_DEFINE(ENABLE_BACKEND_ARM, 1, [Enable Arm backend])
David Schleef's avatar
David Schleef committed
187 188
    ENABLE_BACKEND_C64X=yes
    AC_DEFINE(ENABLE_BACKEND_C64X, 1, [Enable c64x backend])
189 190
    ENABLE_BACKEND_MIPS=yes
    AC_DEFINE(ENABLE_BACKEND_MIPS, 1, [Enable MIPS backend])
David Schleef's avatar
David Schleef committed
191 192 193 194 195 196 197 198
    ;;
esac
AM_CONDITIONAL(ENABLE_BACKEND_SSE, test "x$ENABLE_BACKEND_SSE" = "xyes")
AM_CONDITIONAL(ENABLE_BACKEND_MMX, test "x$ENABLE_BACKEND_MMX" = "xyes")
AM_CONDITIONAL(ENABLE_BACKEND_ALTIVEC, test "x$ENABLE_BACKEND_ALTIVEC" = "xyes")
AM_CONDITIONAL(ENABLE_BACKEND_NEON, test "x$ENABLE_BACKEND_NEON" = "xyes")
AM_CONDITIONAL(ENABLE_BACKEND_ARM, test "x$ENABLE_BACKEND_ARM" = "xyes")
AM_CONDITIONAL(ENABLE_BACKEND_C64X, test "x$ENABLE_BACKEND_C64X" = "xyes")
199
AM_CONDITIONAL(ENABLE_BACKEND_MIPS, test "x$ENABLE_BACKEND_MIPS" = "xyes")
David Schleef's avatar
David Schleef committed
200

201 202 203 204 205 206 207 208 209 210 211 212 213
dnl Check for -Bsymbolic-functions linker flag used to avoid
dnl intra-library PLT jumps, if available.
AC_ARG_ENABLE(Bsymbolic,
              [AS_HELP_STRING([--disable-Bsymbolic],[avoid linking with -Bsymbolic])],,
              [SAVED_LDFLAGS="${LDFLAGS}"
               AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
               LDFLAGS=-Wl,-Bsymbolic-functions
               AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int main (void) { return 0; }]])],[
                           AC_MSG_RESULT(yes)
                           enable_Bsymbolic=yes],[
                           AC_MSG_RESULT(no)
                           enable_Bsymbolic=no])
               LDFLAGS="${SAVED_LDFLAGS}"])
214

215 216
AC_DEFINE(ORC_EXPORTS, 1, [Defined for compiling internal code])

Olivier Crête's avatar
Olivier Crête committed
217
ORC_CFLAGS="$ORC_CFLAGS \$(ERROR_CFLAGS) -I\$(top_srcdir) -D_GNU_SOURCE"
218
AC_SUBST(ERROR_CFLAGS)
219 220
AC_SUBST(ORC_CFLAGS)

David Schleef's avatar
David Schleef committed
221
ORC_LIBS="\$(top_builddir)/orc/liborc-$ORC_MAJORMINOR.la $LIBM $LIBRT"
222 223
AC_SUBST(ORC_LIBS)

David Schleef's avatar
David Schleef committed
224 225
#CFLAGS=`echo $CFLAGS | sed s/O2/O0/`

226
ORC_LDFLAGS="-version-info \$(ORC_LIBVERSION) -no-undefined -export-symbols-regex \^orc_"
227 228 229 230 231
if test "x${enable_Bsymbolic}" = "xyes"; then
  ORC_LDFLAGS="$ORC_LDFLAGS -Wl,-Bsymbolic-functions"
fi
AC_SUBST(ORC_LDFLAGS)

232 233 234 235
pkgconfigdir="\$(libdir)/pkgconfig"
AC_SUBST(pkgconfigdir)

AC_CONFIG_FILES([
236
Makefile
237
doc/Makefile
David Schleef's avatar
David Schleef committed
238
doc/version.entities
239
orc/Makefile
David Schleef's avatar
David Schleef committed
240
orc-test/Makefile
241
testsuite/Makefile
David Schleef's avatar
David Schleef committed
242
testsuite/orcc/Makefile
David Schleef's avatar
David Schleef committed
243
testsuite/benchmorc/Makefile
244
examples/Makefile
David Schleef's avatar
David Schleef committed
245
tools/Makefile
246 247 248 249 250
orc-uninstalled.pc
orc.pc
])
AC_OUTPUT