2010-05-09 18:19:11 +00:00
|
|
|
# autoconf template for the configure script
|
|
|
|
|
|
|
|
AC_INIT
|
2011-02-28 16:04:54 +00:00
|
|
|
LT_INIT
|
|
|
|
AC_CONFIG_MACRO_DIR([m4])
|
|
|
|
AC_CANONICAL_SYSTEM
|
2012-01-20 14:24:57 +00:00
|
|
|
|
|
|
|
#Override the OBJC variable if it is empty and CC is also set.
|
2012-01-20 14:38:55 +00:00
|
|
|
if test -n ""; then
|
|
|
|
if test -z "$OBJC"; then
|
2012-01-20 14:24:57 +00:00
|
|
|
OBJC="$CC"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2010-06-24 20:01:40 +00:00
|
|
|
AC_PROG_CC(clang gcc cc c1 egcs)
|
2012-08-16 18:37:50 +00:00
|
|
|
AC_PROG_CC_C99
|
2010-06-24 20:01:40 +00:00
|
|
|
AC_PROG_CPP
|
2012-01-20 14:24:57 +00:00
|
|
|
AC_PROG_OBJC(clang gcc objcc objc cc CC)
|
2010-06-24 20:01:40 +00:00
|
|
|
AC_LANG(Objective C)
|
2010-05-09 18:19:11 +00:00
|
|
|
PKG_PROG_PKG_CONFIG([])
|
2011-02-15 22:05:24 +00:00
|
|
|
AC_LANG_PUSH(C)
|
|
|
|
AC_MSG_CHECKING([whether the compiler supports atomic operations]);
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[typedef int atomic;]],
|
|
|
|
[[atomic x; atomic y; __sync_bool_compare_and_swap(&x, y, y + 1);]])],
|
|
|
|
have_atomic=yes,
|
|
|
|
have_atomic=no);
|
|
|
|
if test "$have_atomic" = "yes"; then
|
|
|
|
AC_MSG_RESULT([yes]);
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no]);
|
|
|
|
AC_MSG_ERROR([Please use a compiler that supports atomic operations.]);
|
|
|
|
fi
|
2011-02-28 16:04:54 +00:00
|
|
|
if test "$CC" = "gcc"; then
|
|
|
|
saved_CFLAGS="$CFLAGS";
|
|
|
|
ATOMIC_CFLAGS="";
|
|
|
|
case "$target_cpu" in
|
|
|
|
i586*|i686*|i786*)
|
|
|
|
ATOMIC_CFLAGS="-march=i586";
|
|
|
|
CFLAGS="$saved_CFLAGS $ATOMIC_CFLAGS";
|
|
|
|
esac
|
|
|
|
AC_MSG_CHECKING([checking whether atomic operations require an external library]);
|
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[typedef int atomic;]],
|
|
|
|
[[atomic x; atomic y; __sync_bool_compare_and_swap(&x, y, y + 1);]])],
|
|
|
|
need_linkage=no,
|
|
|
|
need_linkage=yes);
|
|
|
|
|
|
|
|
if test "$need_linkage" = "no"; then
|
|
|
|
AC_MSG_RESULT([no]);
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([yes]);
|
|
|
|
saved_LDFLAGS="$LDFLAGS";
|
|
|
|
LDFLAGS="$saved_LDFLAGS -lgcc";
|
|
|
|
AC_MSG_CHECKING([checking for atomic operations from libgcc]);
|
|
|
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[typedef int atomic;]],
|
|
|
|
[[atomic x; atomic y; __sync_bool_compare_and_swap(&x, y, y + 1);]])],
|
|
|
|
atomic_in_libgcc=yes,
|
|
|
|
atomic_in_libgcc=no);
|
|
|
|
if test "$atomic_in_libgcc" = "yes"; then
|
|
|
|
AC_MSG_RESULT([yes]);
|
|
|
|
MORE_LIBS="$MORE_LIBS -lgcc";
|
|
|
|
else
|
|
|
|
LDFLAGS="$saved_LDFLAGS";
|
|
|
|
AC_MSG_RESULT([no]);
|
|
|
|
AC_MSG_ERROR([Could not find library to link for atomic operations.]);
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
2011-02-15 22:05:24 +00:00
|
|
|
AC_LANG_POP(C)
|
2010-05-09 18:19:11 +00:00
|
|
|
|
2010-06-09 08:46:35 +00:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Check for libdbus
|
|
|
|
#--------------------------------------------------------------------
|
2010-05-09 18:19:11 +00:00
|
|
|
PKG_CHECK_MODULES(DBUS, dbus-1, HAVE_DBUS=1, HAVE_DBUS=0)
|
|
|
|
AC_SUBST(DBUS_CFLAGS)
|
|
|
|
AC_SUBST(DBUS_LIBS)
|
|
|
|
|
2012-08-16 09:21:24 +00:00
|
|
|
WARN_FLAGS="-Wall"
|
2010-06-09 08:46:35 +00:00
|
|
|
|
2012-08-17 08:38:33 +00:00
|
|
|
|
|
|
|
if test "$HAVE_DBUS" = "0"; then
|
|
|
|
AC_MSG_ERROR(DBusKit requires libdbus.)
|
|
|
|
fi
|
|
|
|
saved_CFLAGS="$CFLAGS"
|
|
|
|
saved_CPPFLAGS="$CPPFLAGS"
|
|
|
|
CFLAGS="$CFLAGS $DBUS_CFLAGS"
|
|
|
|
CPPFLAGS="$CPPFLAGS -Werror $DBUS_CFLAGS"
|
|
|
|
|
|
|
|
AC_CHECK_HEADERS(dbus/dbus.h,have_dbus_h=yes,have_dbus_h=no)
|
|
|
|
if test "$have_dbus_h" = "no"; then
|
|
|
|
AC_MSG_ERROR(pkg-config claims that libdbus is available but DBusKit is unable to use it.)
|
|
|
|
fi
|
|
|
|
|
|
|
|
CFLAGS="$saved_CFLAGS"
|
|
|
|
CPPFLAGS="$saved_CPPFLAGS"
|
|
|
|
|
2012-08-16 08:21:59 +00:00
|
|
|
AC_MSG_CHECKING(whether the compiler supports -Wno-deprecated-declarations)
|
|
|
|
saved_CFLAGS="$CFLAGS"
|
|
|
|
CFLAGS="$CFLAGS -Wno-deprecated-declarations"
|
|
|
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],HAS_W_NO_DEPRECATED_DECL=yes,HAS_W_NO_DEPRECATED_DECL=no)
|
|
|
|
CFLAGS="$saved_CFLAGS"
|
|
|
|
|
|
|
|
AC_MSG_RESULT($HAS_W_NO_DEPRECATED_DECL)
|
|
|
|
|
|
|
|
if test x"$HAS_W_NO_DEPRECATED_DECL" = x"yes"; then
|
|
|
|
WARN_FLAGS="$WARN_FLAGS -Wno-deprecated-declarations"
|
|
|
|
fi
|
|
|
|
|
2010-06-09 08:46:35 +00:00
|
|
|
AC_SUBST(WARN_FLAGS)
|
2011-02-28 16:04:54 +00:00
|
|
|
AC_SUBST(ATOMIC_CFLAGS)
|
2011-02-15 22:05:24 +00:00
|
|
|
|
2012-08-22 21:34:25 +00:00
|
|
|
HAVE_LIBCLANG=0
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(libclang,
|
|
|
|
[ --disable-libclang Disable use of libclang.],,)
|
|
|
|
|
|
|
|
if test "$enable_libclang" != "no"; then
|
|
|
|
AC_CHECK_HEADERS("clang-c/Index.h")
|
|
|
|
if test "$ac_cv_header_clang_c_Index_h" = "yes"; then
|
2013-07-01 15:47:21 +00:00
|
|
|
AC_CHECK_LIB(clang, clang_Cursor_getArgument)
|
|
|
|
if test "$ac_cv_lib_clang_clang_Cursor_getArgument" = "yes"; then
|
2012-08-22 21:34:25 +00:00
|
|
|
HAVE_LIBCLANG=1;
|
|
|
|
MORE_LIBS="$MORE_LIBS -lclang"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if test "$HAVE_LIBCLANG" = "0"; then
|
|
|
|
AC_MSG_WARN([Could not find a usable libclang. Please install libclang to enable advanced DBusKit features.])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_SUBST(HAVE_LIBCLANG)
|
|
|
|
|
|
|
|
|
|
|
|
# Setup variables for Objective-C tests:
|
2011-02-15 22:05:24 +00:00
|
|
|
|
2010-06-24 20:01:40 +00:00
|
|
|
saved_CFLAGS="$CFLAGS"
|
2012-08-16 18:37:50 +00:00
|
|
|
saved_CPPFLAGS="$CPPFLAGS"
|
2010-06-24 20:01:40 +00:00
|
|
|
saved_LDFLAGS="$LDFLAGS"
|
|
|
|
GS_OBJCFLAGS=`gnustep-config --objc-flags`
|
|
|
|
CFLAGS="$CFLAGS $GS_OBJCFLAGS"
|
|
|
|
CPPFLAGS="$CPPFLAGS $GS_OBJCFLAGS"
|
|
|
|
GS_LDFLAGS=`gnustep-config --objc-libs`
|
|
|
|
LDFLAGS="$LDFLAGS $GS_LDFLAGS"
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-08-16 18:37:50 +00:00
|
|
|
|
2010-06-24 20:01:40 +00:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Check whether we get runtime.h from libobjc2 or from the ObjectiveC2
|
|
|
|
# framework
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
2010-06-28 21:41:08 +00:00
|
|
|
CPPFLAGS="$CPPFLAGS -Werror"
|
|
|
|
AC_CHECK_HEADERS(ObjectiveC2/runtime.h,have_objectivec2_runtime_h=yes,have_objectivec2_runtime_h=no)
|
|
|
|
if test "$have_objectivec2_runtime_h" = "yes"; then
|
|
|
|
OBJC_RUNTIME_H="ObjectiveC2/runtime.h"
|
2010-06-24 20:01:40 +00:00
|
|
|
else
|
2010-06-28 21:41:08 +00:00
|
|
|
AC_CHECK_HEADERS(objc/runtime.h,have_libobjc2_runtime_h=yes,have_libobjc2_runtime_h=no)
|
|
|
|
if test "$have_libobjc2_runtime_h" = "yes"; then
|
|
|
|
OBJC_RUNTIME_H="objc/runtime.h"
|
2010-06-24 20:01:40 +00:00
|
|
|
else
|
|
|
|
AC_MSG_ERROR("could not find runtime.h. DBusKit requires gnustep-base >=1.20.")
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2012-08-16 08:21:59 +00:00
|
|
|
AC_CHECK_HEADERS([objc/encoding.h], [have_objc_encoding_h=yes], [have_objc_encoding_h=no],
|
|
|
|
[#ifdef HAVE_OBJC_RUNTIME_H
|
|
|
|
#include <objc/runtime.h>
|
|
|
|
#else
|
|
|
|
# ifdef HAVE_OBJECTIVEC2_RUNTIME_H
|
|
|
|
# include <ObjectiveC2/runtime.h>
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
])
|
|
|
|
|
|
|
|
if test "$have_objc_encoding_h" = "yes"; then
|
|
|
|
HAVE_OBJC_ENCODING_H=1
|
|
|
|
else
|
|
|
|
HAVE_OBJC_ENCODING_H=0
|
|
|
|
fi
|
|
|
|
|
2012-08-16 18:37:50 +00:00
|
|
|
CPPFLAGS="$saved_CPPFLAGS"
|
|
|
|
|
|
|
|
# We also need to set the libs because the order does sometimes matter.
|
|
|
|
LIBS=`gnustep-config --objc-libs`
|
|
|
|
AC_CHECK_FUNCS(sel_getType_np, [have_sel_getType_np=yes],
|
|
|
|
[have_sel_getType_np=no;
|
|
|
|
AC_CHECK_FUNCS(sel_getTypeEncoding, [have_sel_getTypeEncoding=yes],
|
|
|
|
[have_sel_getTypeEncoding=no])
|
|
|
|
]
|
|
|
|
)
|
|
|
|
|
|
|
|
USE_SEL_GETTYPEENCODING=0
|
|
|
|
DISABLE_TYPED_SELECTORS=0
|
|
|
|
if test "$have_sel_getType_np" = "no"; then
|
|
|
|
if test "$have_sel_getTypeEncoding" = "yes"; then
|
|
|
|
USE_SEL_GETTYPEENCODING=1;
|
|
|
|
else
|
|
|
|
DISABLE_TYPED_SELECTORS=1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
C99_FLAGS=$ac_cv_prog_cc_c99
|
|
|
|
AC_SUBST(C99_FLAGS)
|
2012-08-16 08:21:59 +00:00
|
|
|
AC_SUBST(HAVE_OBJC_ENCODING_H)
|
2010-06-24 20:01:40 +00:00
|
|
|
AC_SUBST(OBJC_RUNTIME_H)
|
2012-01-20 14:24:57 +00:00
|
|
|
AC_SUBST(OBJC)
|
2012-08-16 18:37:50 +00:00
|
|
|
AC_SUBST(USE_SEL_GETTYPEENCODING)
|
|
|
|
AC_SUBST(DISABLE_TYPED_SELECTORS)
|
|
|
|
|
2010-06-24 20:01:40 +00:00
|
|
|
CFLAGS="$saved_CFLAGS"
|
|
|
|
CPPFLAGS="$saved_CPPFLAGS"
|
|
|
|
LDFLAGS="$saved_LDFLAGS"
|
|
|
|
|
|
|
|
AC_SUBST(MORE_LIBS)
|
|
|
|
AC_CONFIG_FILES([config.make Source/config.h])
|
2010-05-09 18:19:11 +00:00
|
|
|
|
|
|
|
AC_OUTPUT
|