elementary: automatically detect if compiler can build quicklaunch binary.

This commit is contained in:
Cedric Bail 2013-11-04 20:14:47 +09:00
parent 1528f06298
commit 14a474b527
3 changed files with 27 additions and 5 deletions

View File

@ -213,6 +213,9 @@ AC_ARG_ENABLE([quick-launch],
[AC_HELP_STRING([--disable-quick-launch], [disable quick-launch support, @<:@default=detect@:>@])],
[want_quicklaunch=$enableval], [])
# Check if we can build binary with quicklaunch support
ELM_QUICKLAUNCH
if test "x$want_quicklaunch" != "xno"; then
AC_CHECK_FUNCS(fork, [
have_fork="yes"

View File

@ -0,0 +1,24 @@
dnl Copyright (C) 2013 Cedric Bail <cedric dot bail at samsung dot com>
dnl That code is public domain and can be freely used or copied
dnl Macro that check if -pie -rdynamic can be given to ld
dnl Usage: ELM_QUICKLAUNCH
dnl add -pie -rdynamic to LDFLAGS and -fpie to CFLAGS
AC_DEFUN([ELM_QUICKLAUNCH],
[
AC_MSG_CHECKING([If the compiler as what it takes to do quicklaunch (-pie -rdynamic)])
old_LDFLAGS="$LDFLAGS"
old_CFLAGS="$CFLAGS"
LDFLAGS="$LDFLAGS -pie -rdynamic"
CFLAGS="$CFLAGS -fpie"
AC_LINK_IFELSE([int main(){}],
[AC_MSG_RESULT([yes])],
[LDFLAGS="$old_LDFLAGS"
CFLAGS="$old_CFLAGS"
AC_MSG_RESULT([no])
])
])

View File

@ -160,11 +160,6 @@ elementary_test_LDADD = $(top_builddir)/src/lib/libelementary.la \
elementary_test_CFLAGS =
elementary_test_LDFLAGS =
if BUILD_QUICKLAUNCH
elementary_test_CFLAGS += -fpie
elementary_test_LDFLAGS += -pie -rdynamic
endif
elementary_config_SOURCES = \
config.c