convert.c: ENDIAN condition removed, tiftoimage and imagetotif updated (ALPHA added...
[openjpeg.git] / m4 / opj_compiler_flag.m4
1 dnl Copyright (C) 2010 Vincent Torri <vtorri at univ-evry dot fr>
2 dnl                and Albin Tonnerre <albin dot tonnerre at gmail dot com>
3 dnl That code is public domain and can be freely used or copied.
4
5 dnl Macro that checks if a compiler flag is supported by the compiler.
6
7 dnl Usage: OPJ_COMPILER_FLAG(flag)
8 dnl flag is added to CFLAGS if supported.
9
10 AC_DEFUN([OPJ_COMPILER_FLAG],
11 [
12
13 CFLAGS_save="${CFLAGS}"
14 CFLAGS="${CFLAGS} $1"
15
16 AC_LANG_PUSH([C])
17 AC_MSG_CHECKING([whether the compiler supports $1])
18
19 AC_COMPILE_IFELSE(
20    [AC_LANG_PROGRAM([[]])],
21    [have_flag="yes"],
22    [have_flag="no"])
23 AC_MSG_RESULT([${have_flag}])
24
25 if test "x${have_flag}" = "xno" ; then
26    CFLAGS="${CFLAGS_save}"
27 fi
28 AC_LANG_POP([C])
29
30 ])