2012-06-08 11:48:09 -07:00
|
|
|
dnl Copyright (C) 2012 Vincent Torri <vincent dot torri at gmail dot com>
|
|
|
|
dnl This code is public domain and can be freely used or copied.
|
|
|
|
|
|
|
|
dnl Macro that check if compiler of linker flags are available
|
|
|
|
|
|
|
|
|
|
|
|
dnl Macro that checks for a compiler flag availability
|
|
|
|
dnl
|
2013-01-18 07:25:00 -08:00
|
|
|
dnl _EFL_CHECK_COMPILER_FLAGS(EFL, FLAGS)
|
2012-06-08 11:48:09 -07:00
|
|
|
dnl AC_SUBST : EFL_CFLAGS (EFL being replaced by its value)
|
2013-01-18 07:25:00 -08:00
|
|
|
dnl have_flag: yes or no.
|
|
|
|
AC_DEFUN([_EFL_CHECK_COMPILER_FLAGS],
|
|
|
|
[dnl
|
|
|
|
m4_pushdef([UPEFL], m4_translit([[$1]], [-a-z], [_A-Z]))dnl
|
2012-06-16 10:19:31 -07:00
|
|
|
|
|
|
|
dnl store in options -Wfoo if -Wno-foo is passed
|
2013-01-18 07:25:00 -08:00
|
|
|
option="m4_bpatsubst([[$2]], [-Wno-], [-W])"
|
2012-06-08 11:48:09 -07:00
|
|
|
CFLAGS_save="${CFLAGS}"
|
2012-06-16 10:19:31 -07:00
|
|
|
CFLAGS="${CFLAGS} ${option}"
|
2012-06-08 11:48:09 -07:00
|
|
|
AC_LANG_PUSH([C])
|
|
|
|
|
2013-01-18 07:25:00 -08:00
|
|
|
AC_MSG_CHECKING([whether the compiler supports $2])
|
2012-06-08 11:48:09 -07:00
|
|
|
AC_COMPILE_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([[]])],
|
|
|
|
[have_flag="yes"],
|
|
|
|
[have_flag="no"])
|
|
|
|
AC_MSG_RESULT([${have_flag}])
|
|
|
|
|
|
|
|
AC_LANG_POP([C])
|
2013-01-18 07:25:00 -08:00
|
|
|
CFLAGS="${CFLAGS_save}"
|
2012-06-19 09:35:18 -07:00
|
|
|
if test "x${have_flag}" = "xyes" ; then
|
|
|
|
UPEFL[_CFLAGS]="${UPEFL[_CFLAGS]} [$2]"
|
|
|
|
fi
|
2013-01-18 07:25:00 -08:00
|
|
|
AC_SUBST(UPEFL[_CFLAGS])dnl
|
|
|
|
m4_popdef([UPEFL])dnl
|
2012-06-08 11:48:09 -07:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl EFL_CHECK_COMPILER_FLAGS(EFL, FLAGS)
|
2013-01-18 07:25:00 -08:00
|
|
|
dnl Checks if FLAGS are supported and add to EFL_CLFAGS.
|
|
|
|
dnl
|
|
|
|
dnl It will first try every flag at once, if one fails will try them one by one.
|
2012-06-08 11:48:09 -07:00
|
|
|
AC_DEFUN([EFL_CHECK_COMPILER_FLAGS],
|
2013-01-18 07:25:00 -08:00
|
|
|
[dnl
|
|
|
|
_EFL_CHECK_COMPILER_FLAGS([$1], [$2])
|
|
|
|
if test "${have_flag}" != "yes"; then
|
|
|
|
m4_foreach_w([flag], [$2], [_EFL_CHECK_COMPILER_FLAGS([$1], m4_defn([flag]))])
|
|
|
|
fi
|
2012-06-15 22:47:25 -07:00
|
|
|
])
|
2012-09-16 03:57:48 -07:00
|
|
|
|
|
|
|
|
|
|
|
dnl Macro that checks for a linker flag availability
|
|
|
|
dnl
|
2013-01-18 07:25:00 -08:00
|
|
|
dnl _EFL_CHECK_LINKER_FLAGS(EFL, FLAGS)
|
2012-12-30 16:46:14 -08:00
|
|
|
dnl AC_SUBST : EFL_LDFLAGS (EFL being replaced by its value)
|
2013-01-18 07:25:00 -08:00
|
|
|
dnl have_flag: yes or no
|
|
|
|
AC_DEFUN([_EFL_CHECK_LINKER_FLAGS],
|
|
|
|
[dnl
|
|
|
|
m4_pushdef([UPEFL], m4_translit([[$1]], [-a-z], [_A-Z]))dnl
|
2012-09-16 03:57:48 -07:00
|
|
|
|
|
|
|
LDFLAGS_save="${LDFLAGS}"
|
|
|
|
LDFLAGS="${LDFLAGS} $2"
|
|
|
|
AC_LANG_PUSH([C])
|
|
|
|
|
2013-01-18 07:25:00 -08:00
|
|
|
AC_MSG_CHECKING([whether the linker supports $2])
|
2012-09-16 03:57:48 -07:00
|
|
|
AC_LINK_IFELSE(
|
|
|
|
[AC_LANG_PROGRAM([[]])],
|
|
|
|
[have_flag="yes"],
|
|
|
|
[have_flag="no"])
|
|
|
|
AC_MSG_RESULT([${have_flag}])
|
|
|
|
|
|
|
|
AC_LANG_POP([C])
|
2013-01-18 07:25:00 -08:00
|
|
|
LDFLAGS="${LDFLAGS_save}"
|
2012-09-16 03:57:48 -07:00
|
|
|
if test "x${have_flag}" = "xyes" ; then
|
2012-12-30 16:46:14 -08:00
|
|
|
UPEFL[_LDFLAGS]="${UPEFL[_LDFLAGS]} [$2]"
|
2012-09-16 03:57:48 -07:00
|
|
|
fi
|
2013-01-18 07:25:00 -08:00
|
|
|
AC_SUBST(UPEFL[_LDFLAGS])dnl
|
|
|
|
m4_popdef([UPEFL])dnl
|
2012-09-16 03:57:48 -07:00
|
|
|
])
|
|
|
|
|
|
|
|
dnl EFL_CHECK_LINKER_FLAGS(EFL, FLAGS)
|
2016-03-07 05:14:32 -08:00
|
|
|
dnl Checks if FLAGS are supported and add to EFL_LDLFAGS.
|
2013-01-18 07:25:00 -08:00
|
|
|
dnl
|
|
|
|
dnl It will first try every flag at once, if one fails will try them one by one.
|
2012-09-16 03:57:48 -07:00
|
|
|
AC_DEFUN([EFL_CHECK_LINKER_FLAGS],
|
2013-01-18 07:25:00 -08:00
|
|
|
[dnl
|
|
|
|
_EFL_CHECK_LINKER_FLAGS([$1], [$2])
|
|
|
|
if test "${have_flag}" != "yes"; then
|
|
|
|
m4_foreach_w([flag], [$2], [_EFL_CHECK_LINKER_FLAGS([$1], m4_defn([flag]))])
|
|
|
|
fi
|
|
|
|
])dnl
|