acinclude.m4 m4macros/Makefile.am new macro: GIMP_DETECT_CFLAGS; used to

2005-07-31  Manish Singh  <yosh@gimp.org>

        * acinclude.m4
        * m4macros/Makefile.am
        * m4macros/detectcflags.m4: new macro: GIMP_DETECT_CFLAGS; used
        to detect which of a set of compiler options a compiler supports.

        * configure.in: use the above for the altivec and -fno-strict-aliasing
        flags. Also, use it to detect the presence of -mmmx and -msse, since
        those are needed to compile even MMX/SSE assembly with gcc 4.0. Define
        MMX/SSE_EXTRA_CFLAGS.

        * app/composite/Makefile.am: compile each of the composite flavors
        into their own library, so we can use automake's per-target CFLAGS.
        Use MMX/SSE/ALTIVEC_EXTRA_CFLAGS in the appropriate places. Build
        libappcomposite.a out of the resulting objects.

        * app/composite/gimp-composite-3dnow.c
        * app/composite/gimp-composite-altivec.c
        * app/composite/gimp-composite-mmx.c
        * app/composite/gimp-composite-sse.c
        * app/composite/gimp-composite-sse2.c
        * app/composite/gimp-composite-vis.c
        * app/composite/make-installer.py: move the _init functions into
        the installers, so only actually mmx/sse/etc. code gets compiled
        under the appropriate CFLAGS.

        * app/composite/gimp-composite-3dnow-installer.c
        * app/composite/gimp-composite-altivec-installer.c
        * app/composite/gimp-composite-mmx-installer.c
        * app/composite/gimp-composite-sse-installer.c
        * app/composite/gimp-composite-sse2-installer.c
        * app/composite/gimp-composite-vis-installer.c: regenerated.

        * app/composite/gimp-composite.c: remove useless cpu-accel.h include.
This commit is contained in:
Manish Singh 2005-08-01 04:45:34 +00:00 committed by Manish Singh
parent 10f17471d2
commit b55753bb21
20 changed files with 288 additions and 152 deletions

View File

@ -1,3 +1,39 @@
2005-07-31 Manish Singh <yosh@gimp.org>
* acinclude.m4
* m4macros/Makefile.am
* m4macros/detectcflags.m4: new macro: GIMP_DETECT_CFLAGS; used
to detect which of a set of compiler options a compiler supports.
* configure.in: use the above for the altivec and -fno-strict-aliasing
flags. Also, use it to detect the presence of -mmmx and -msse, since
those are needed to compile even MMX/SSE assembly with gcc 4.0. Define
MMX/SSE_EXTRA_CFLAGS.
* app/composite/Makefile.am: compile each of the composite flavors
into their own library, so we can use automake's per-target CFLAGS.
Use MMX/SSE/ALTIVEC_EXTRA_CFLAGS in the appropriate places. Build
libappcomposite.a out of the resulting objects.
* app/composite/gimp-composite-3dnow.c
* app/composite/gimp-composite-altivec.c
* app/composite/gimp-composite-mmx.c
* app/composite/gimp-composite-sse.c
* app/composite/gimp-composite-sse2.c
* app/composite/gimp-composite-vis.c
* app/composite/make-installer.py: move the _init functions into
the installers, so only actually mmx/sse/etc. code gets compiled
under the appropriate CFLAGS.
* app/composite/gimp-composite-3dnow-installer.c
* app/composite/gimp-composite-altivec-installer.c
* app/composite/gimp-composite-mmx-installer.c
* app/composite/gimp-composite-sse-installer.c
* app/composite/gimp-composite-sse2-installer.c
* app/composite/gimp-composite-vis-installer.c: regenerated.
* app/composite/gimp-composite.c: remove useless cpu-accel.h include.
2005-07-31 DindinX <dindinx@gimp.org>
* app/dialogs/preferences-dialog.c: when the notebook page is changed

View File

@ -1,3 +1,4 @@
m4_include([m4macros/detectcflags.m4])
m4_include([m4macros/pythondev.m4])
m4_include([m4macros/gimpprint.m4])
m4_include([m4macros/alsa.m4])

View File

@ -4,15 +4,8 @@ libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la
AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"Gimp-Composite\" \
$(ALTIVEC_EXTRA_CFLAGS) \
@GTHREAD_CFLAGS@
AM_CCASFLAGS = \
-I$(top_builddir) \
-I$(top_srcdir) \
-I$(top_builddir)/app \
-I$(top_srcdir)/app
INCLUDES = \
-I$(top_builddir) \
-I$(top_srcdir) \
@ -21,29 +14,57 @@ INCLUDES = \
$(GLIB_CFLAGS) \
-I$(includedir)
noinst_LIBRARIES = libappcomposite.a
composite_libraries = \
libcomposite3dnow.a \
libcompositealtivec.a \
libcompositemmx.a \
libcompositesse.a \
libcompositesse2.a \
libcompositevis.a
libappcomposite_a_sources = \
noinst_LIBRARIES = $(composite_libraries) libcomposite.a
libcomposite3dnow_a_SOURCES = \
gimp-composite-3dnow.c \
gimp-composite-3dnow.h \
gimp-composite-3dnow.h
libcompositealtivec_a_CFLAGS = $(ALTIVEC_EXTRA_CFLAGS)
libcompositealtivec_a_SOURCES = \
gimp-composite-altivec.c \
gimp-composite-altivec.h \
gimp-composite-altivec.h
libcompositemmx_a_CFLAGS = $(MMX_EXTRA_CFLAGS)
libcompositemmx_a_SOURCES = \
gimp-composite-mmx.c \
gimp-composite-mmx.h
libcompositesse_a_CFLAGS = $(SSE_EXTRA_CFLAGS)
libcompositesse_a_SOURCES = \
gimp-composite-sse.c \
gimp-composite-sse.h
libcompositesse2_a_CFLAGS = $(SSE_EXTRA_CFLAGS)
libcompositesse2_a_SOURCES = \
gimp-composite-sse2.c \
gimp-composite-sse2.h
libcompositevis_a_SOURCES = \
gimp-composite-vis.c \
gimp-composite-vis.h
libcomposite_a_sources = \
gimp-composite-generic.c \
gimp-composite-generic.h \
gimp-composite-mmx.c \
gimp-composite-mmx.h \
gimp-composite-sse.c \
gimp-composite-sse.h \
gimp-composite-sse2.c \
gimp-composite-sse2.h \
gimp-composite-util.h \
gimp-composite-vis.c \
gimp-composite-vis.h \
gimp-composite-x86.h \
gimp-composite.c \
gimp-composite.h
libappcomposite_a_built_sources = \
libcomposite_a_built_sources = \
gimp-composite-3dnow-installer.c \
gimp-composite-altivec-installer.c \
gimp-composite-generic-installer.c \
@ -52,18 +73,34 @@ libappcomposite_a_built_sources = \
gimp-composite-sse2-installer.c \
gimp-composite-vis-installer.c
libappcomposite_a_SOURCES = \
$(libappcomposite_a_built_sources) \
$(libappcomposite_a_sources)
libcomposite_a_SOURCES = \
$(libcomposite_a_built_sources) \
$(libcomposite_a_sources)
## This is a huge hack
libappcomposite.a: $(noinst_LIBRARIES)
-rm -f libappcomposite.a
$(AR) $(ARFLAGS) libappcomposite.a $(libcomposite_a_OBJECTS) \
$(libcomposite3dnow_a_OBJECTS) \
$(libcompositealtivec_a_OBJECTS) \
$(libcompositemmx_a_OBJECTS) \
$(libcompositesse_a_OBJECTS) \
$(libcompositesse2_a_OBJECTS) \
$(libcompositevis_a_OBJECTS)
$(RANLIB) libappcomposite.a
all-local: libappcomposite.a
clean_libs = libappcomposite.a
regenerate: gimp-composite-generic.o gimp-composite-mmx.o gimp-composite-sse.o gimp-composite-sse2.o gimp-composite-3dnow.o gimp-composite-altivec.o gimp-composite-vis.o
$(srcdir)/make-installer.py -f gimp-composite-generic.o
$(srcdir)/make-installer.py -t -r 'defined(COMPILE_MMX_IS_OKAY)' -f gimp-composite-mmx.o
$(srcdir)/make-installer.py -t -r 'defined(COMPILE_SSE_IS_OKAY)' -f gimp-composite-sse.o
$(srcdir)/make-installer.py -t -r 'defined(COMPILE_SSE2_IS_OKAY)' -f gimp-composite-sse2.o
$(srcdir)/make-installer.py -t -r 'defined(COMPILE_3DNOW_IS_OKAY)' -f gimp-composite-3dnow.o
$(srcdir)/make-installer.py -t -r 'defined(COMPILE_ALTIVEC_IS_OKAY)' -f gimp-composite-altivec.o
$(srcdir)/make-installer.py -t -r 'defined(COMPILE_VIS_IS_OKAY)' -f gimp-composite-vis.o
$(srcdir)/make-installer.py -f gimp-composite-mmx.o -t -r 'defined(COMPILE_MMX_IS_OKAY)' -c 'X86_MMX'
$(srcdir)/make-installer.py -f gimp-composite-sse.o -t -r 'defined(COMPILE_SSE_IS_OKAY)' -c 'X86_SSE' -c 'X86_MMXEXT'
$(srcdir)/make-installer.py -f gimp-composite-sse2.o -t -r 'defined(COMPILE_SSE2_IS_OKAY)' -c 'X86_SSE2'
$(srcdir)/make-installer.py -f gimp-composite-3dnow.o -t -r 'defined(COMPILE_3DNOW_IS_OKAY)' -c 'X86_3DNOW'
$(srcdir)/make-installer.py -f gimp-composite-altivec.o -t -r 'defined(COMPILE_ALTIVEC_IS_OKAY)' -c 'PPC_ALTIVEC'
$(srcdir)/make-installer.py -f gimp-composite-vis.o -t -r 'defined(COMPILE_VIS_IS_OKAY)'
EXTRA_DIST = \
make-installer.py \
@ -85,7 +122,7 @@ TESTS = \
EXTRA_PROGRAMS = gimp-composite-test $(TESTS)
CLEANFILES = $(EXTRA_PROGRAMS)
CLEANFILES = $(EXTRA_PROGRAMS) $(clean_libs)
gimp_composite_test_SOURCES = \
gimp-composite-regression.c \

View File

@ -5,6 +5,7 @@
#include <stdlib.h>
#include <stdio.h>
#include "base/base-types.h"
#include "base/cpu-accel.h"
#include "gimp-composite.h"
#include "gimp-composite-3dnow.h"
@ -17,3 +18,16 @@ gimp_composite_3dnow_install (void)
return (FALSE);
}
gboolean
gimp_composite_3dnow_init (void)
{
#if defined(COMPILE_3DNOW_IS_OKAY)
if (cpu_accel () & CPU_ACCEL_X86_3DNOW)
{
return (TRUE);
}
#endif
return (FALSE);
}

View File

@ -28,7 +28,6 @@
#include <glib-object.h>
#include "base/base-types.h"
#include "base/cpu-accel.h"
#include "gimp-composite.h"
@ -37,15 +36,3 @@
#ifdef COMPILE_3DNOW_IS_OKAY
#endif
gboolean
gimp_composite_3dnow_init (void)
{
#ifdef COMPILE_3DNOW_IS_OKAY
if (cpu_accel () & CPU_ACCEL_X86_3DNOW)
{
return (TRUE);
}
#endif
return (FALSE);
}

View File

@ -50,3 +50,16 @@ gimp_composite_altivec_install (void)
return (FALSE);
}
gboolean
gimp_composite_altivec_init (void)
{
#if defined(COMPILE_ALTIVEC_IS_OKAY)
if (cpu_accel () & CPU_ACCEL_PPC_ALTIVEC)
{
return (TRUE);
}
#endif
return (FALSE);
}

View File

@ -26,7 +26,6 @@
#include <glib-object.h>
#include "base/base-types.h"
#include "base/cpu-accel.h"
#include "gimp-composite.h"
#include "gimp-composite-altivec.h"
@ -962,16 +961,3 @@ gimp_composite_dodge_rgba8_rgba8_rgba8_altivec (GimpCompositeContext *ctx)
}
#endif /* COMPILE_IS_OKAY */
gboolean
gimp_composite_altivec_init (void)
{
#ifdef COMPILE_ALTIVEC_IS_OKAY
if (cpu_accel () & CPU_ACCEL_PPC_ALTIVEC)
{
return (TRUE);
}
#endif
return (FALSE);
}

View File

@ -5,6 +5,7 @@
#include <stdlib.h>
#include <stdio.h>
#include "base/base-types.h"
#include "base/cpu-accel.h"
#include "gimp-composite.h"
#include "gimp-composite-mmx.h"
@ -50,3 +51,16 @@ gimp_composite_mmx_install (void)
return (FALSE);
}
gboolean
gimp_composite_mmx_init (void)
{
#if defined(COMPILE_MMX_IS_OKAY)
if (cpu_accel () & CPU_ACCEL_X86_MMX)
{
return (TRUE);
}
#endif
return (FALSE);
}

View File

@ -36,7 +36,6 @@
#include <glib-object.h>
#include "base/base-types.h"
#include "base/cpu-accel.h"
#include "gimp-composite.h"
#include "gimp-composite-mmx.h"
@ -2438,15 +2437,3 @@ xxxgimp_composite_valueonly_va8_va8_va8_mmx (GimpCompositeContext *_op)
#endif
#endif /* COMPILE_IS_OKAY */
gboolean
gimp_composite_mmx_init (void)
{
#ifdef COMPILE_MMX_IS_OKAY
if (cpu_accel () & CPU_ACCEL_X86_MMX)
{
return (TRUE);
}
#endif
return (FALSE);
}

View File

@ -5,6 +5,7 @@
#include <stdlib.h>
#include <stdio.h>
#include "base/base-types.h"
#include "base/cpu-accel.h"
#include "gimp-composite.h"
#include "gimp-composite-sse.h"
@ -48,3 +49,18 @@ gimp_composite_sse_install (void)
return (FALSE);
}
gboolean
gimp_composite_sse_init (void)
{
#if defined(COMPILE_SSE_IS_OKAY)
guint32 cpu = cpu_accel ();
if (cpu & CPU_ACCEL_X86_SSE || cpu & CPU_ACCEL_X86_MMXEXT)
{
return (TRUE);
}
#endif
return (FALSE);
}

View File

@ -36,7 +36,6 @@
#include <glib-object.h>
#include "base/base-types.h"
#include "base/cpu-accel.h"
#include "gimp-composite.h"
#include "gimp-composite-sse.h"
@ -2034,18 +2033,3 @@ xxxgimp_composite_valueonly_va8_va8_va8_sse (GimpCompositeContext *_op)
#endif
#endif /* COMPILE_SSE_IS_OKAY */
gboolean
gimp_composite_sse_init (void)
{
#ifdef COMPILE_SSE_IS_OKAY
guint32 cpu = cpu_accel ();
if (cpu & CPU_ACCEL_X86_SSE || cpu & CPU_ACCEL_X86_MMXEXT)
{
return (TRUE);
}
#endif
return (FALSE);
}

View File

@ -5,6 +5,7 @@
#include <stdlib.h>
#include <stdio.h>
#include "base/base-types.h"
#include "base/cpu-accel.h"
#include "gimp-composite.h"
#include "gimp-composite-sse2.h"
@ -44,3 +45,16 @@ gimp_composite_sse2_install (void)
return (FALSE);
}
gboolean
gimp_composite_sse2_init (void)
{
#if defined(COMPILE_SSE2_IS_OKAY)
if (cpu_accel () & CPU_ACCEL_X86_SSE2)
{
return (TRUE);
}
#endif
return (FALSE);
}

View File

@ -30,7 +30,6 @@
#include <glib-object.h>
#include "base/base-types.h"
#include "base/cpu-accel.h"
#include "gimp-composite.h"
#include "gimp-composite-sse2.h"
@ -672,17 +671,3 @@ gimp_composite_swap_rgba8_rgba8_rgba8_sse2 (GimpCompositeContext *_op)
}
#endif /* COMPILE_SSE2_IS_OKAY */
gboolean
gimp_composite_sse2_init (void)
{
#ifdef COMPILE_SSE2_IS_OKAY
guint32 cpu = cpu_accel ();
if (cpu & CPU_ACCEL_X86_SSE2)
{
return (TRUE);
}
#endif
return (FALSE);
}

View File

@ -17,3 +17,13 @@ gimp_composite_vis_install (void)
return (FALSE);
}
gboolean
gimp_composite_vis_init (void)
{
#if defined(COMPILE_VIS_IS_OKAY)
return (TRUE);
#else
return (FALSE);
#endif
}

View File

@ -35,13 +35,3 @@
#ifdef COMPILE_VIS_IS_OKAY
#endif
gboolean
gimp_composite_vis_init (void)
{
#ifdef COMPILE_VIS_IS_OKAY
return (TRUE);
#else
return (FALSE);
#endif
}

View File

@ -29,7 +29,6 @@
#include <glib-object.h>
#include "base/base-types.h"
#include "base/cpu-accel.h"
#include "gimp-composite.h"

View File

@ -435,6 +435,58 @@ def gimp_composite_installer_install2(fpout, name, function_table, requirements=
print >>fpout, '}'
pass
def gimp_composite_installer_install3(fpout, name, requirements=[], cpu_feature=[]):
if not requirements and not cpu_feature:
return
print >>fpout, ''
print >>fpout, 'gboolean'
print >>fpout, '%s_init (void)' % (functionnameify(name))
print >>fpout, '{'
need_endif = False
for r in requirements:
print >>fpout, '#if %s' % (r)
pass
if cpu_feature:
if len(cpu_feature) >= 2:
features = []
for f in cpu_feature:
features.append('cpu & CPU_ACCEL_%s' % f)
feature_test = ' || '.join(features)
print >>fpout, ' guint32 cpu = cpu_accel ();'
print >>fpout, ''
else:
feature_test = 'cpu_accel () & CPU_ACCEL_%s' % cpu_feature[0]
print >>fpout, ' if (%s)' % feature_test
print >>fpout, ' {'
print >>fpout, ' return (TRUE);'
print >>fpout, ' }'
if requirements:
print >>fpout, '#endif'
print >>fpout, ''
else:
print >>fpout, ' return (TRUE);'
if requirements:
print >>fpout, '#else'
need_endif = True
if requirements or cpu_feature:
print >>fpout, ' return (FALSE);'
if need_endif:
print >>fpout, '#endif'
print >>fpout, '}'
pass
def gimp_composite_hfile(fpout, name, function_table):
print >>fpout, '/* THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT */'
print >>fpout, '/* REGENERATE BY USING make-installer.py */'
@ -445,7 +497,7 @@ def gimp_composite_hfile(fpout, name, function_table):
return
def gimp_composite_cfile(fpout, name, function_table, requirements=[]):
def gimp_composite_cfile(fpout, name, function_table, requirements=[], cpu_feature=[]):
print >>fpout, '/* THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT */'
print >>fpout, '/* REGENERATE BY USING make-installer.py */'
print >>fpout, '#include "config.h"'
@ -453,6 +505,8 @@ def gimp_composite_cfile(fpout, name, function_table, requirements=[]):
print >>fpout, '#include <stdlib.h>'
print >>fpout, '#include <stdio.h>'
print >>fpout, '#include "base/base-types.h"'
if cpu_feature:
print >>fpout, '#include "base/cpu-accel.h"'
print >>fpout, '#include "gimp-composite.h"'
print >>fpout, ''
print >>fpout, '#include "%s.h"' % (filenameify(name))
@ -462,6 +516,8 @@ def gimp_composite_cfile(fpout, name, function_table, requirements=[]):
gimp_composite_installer_install2(fpout, name, function_table, requirements)
gimp_composite_installer_install3(fpout, name, requirements, cpu_feature)
return
###########################################
@ -477,11 +533,14 @@ op.add_option('-n', '--n-pixels', action='store', type="int", dest='n_pixel
help='number of pixels in each regression test iteration')
op.add_option('-r', '--requires', action='append', type='string', dest='requires', default=[],
help='cpp #if conditionals')
op.add_option('-c', '--cpu-feature', action='append', type='string', dest='cpu_feature', default=[],
help='cpu_accel feature tests')
options, args = op.parse_args()
table = load_function_table(options.file)
gimp_composite_cfile(open(filenameify(options.file) + "-installer.c", "w"), options.file, table, options.requires)
gimp_composite_cfile(open(filenameify(options.file) + "-installer.c", "w"), options.file, table, options.requires, options.cpu_feature)
if options.test == True:
gimp_composite_regression(open(filenameify(options.file) + "-test.c", "w"), table, options)

View File

@ -564,18 +564,27 @@ AC_ARG_ENABLE(sse,
enable_sse=$enable_mmx)
if test "x$enable_mmx" = xyes; then
GIMP_DETECT_CFLAGS(MMX_EXTRA_CFLAGS, '-mmmx')
SSE_EXTRA_CFLAGS=
AC_MSG_CHECKING(whether we can compile MMX code)
mmx_save_CFLAGS="$CFLAGS"
CFLAGS="$mmx_save_CFLAGS $MMX_EXTRA_CFLAGS"
AC_COMPILE_IFELSE([asm ("movq 0, %mm0");],
AC_DEFINE(USE_MMX, 1, [Define to 1 if MMX assembly is available.])
AC_MSG_RESULT(yes)
if test "x$enable_sse" = xyes; then
GIMP_DETECT_CFLAGS(sse_flag, '-msse')
SSE_EXTRA_CFLAGS="$MMX_EXTRA_CFLAGS $sse_flag"
AC_MSG_CHECKING(whether we can compile SSE code)
CFLAGS="$CFLAGS $sse_flag"
AC_COMPILE_IFELSE([asm ("movntps %xmm0, 0");],
AC_DEFINE(USE_SSE, 1, [Define to 1 if SSE assembly is available.])
AC_MSG_RESULT(yes)
@ -592,6 +601,10 @@ if test "x$enable_mmx" = xyes; then
AC_MSG_WARN([The assembler does not support the MMX command set.])
)
CFLAGS="$mmx_save_CFLAGS"
AC_SUBST(MMX_EXTRA_CFLAGS)
AC_SUBST(SSE_EXTRA_CFLAGS)
fi
@ -605,20 +618,7 @@ AC_ARG_ENABLE(altivec,
if test "x$enable_altivec" = xyes; then
altivec_flag=
for flag in '-faltivec' '-maltivec -mabi=altivec'; do
if test -z "$altivec_flag"; then
altivec_save_CFLAGS="$CFLAGS"
CFLAGS="$altivec_save_CFLAGS $flag"
AC_MSG_CHECKING([whether [$]CC understands [$]flag])
AC_TRY_COMPILE([], [], [altivec_flag_works=yes], [altivec_flag_works=no])
AC_MSG_RESULT($altivec_flag_works)
CFLAGS="$altivec_save_CFLAGS"
if test "x$altivec_flag_works" = "xyes"; then
altivec_flag="$flag"
fi
fi
done
GIMP_DETECT_CFLAGS(altivec_flag, '-faltivec' '-maltivec -mabi=altivec')
ALTIVEC_EXTRA_CFLAGS=
case "$altivec_flag" in
@ -1417,23 +1417,7 @@ if test "x$enable_python" != xno; then
AC_SUBST(PYGTK_DEFSDIR)
AC_MSG_RESULT($PYGTK_DEFSDIR)
dnl enable -fno-strict-aliasing if compiler supports it
PYGIMP_EXTRA_CFLAGS=
case " $CFLAGS " in
*@<:@\ \ @:>@-fno-strict-aliasing@<:@\ \ @:>@*)
;;
*)
pygimp_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fno-strict-aliasing"
AC_MSG_CHECKING([whether [$]CC understands -fno-strict-aliasing])
AC_TRY_COMPILE([], [], [pygimp_has_option=yes], [pygimp_has_option=no])
AC_MSG_RESULT($pygimp_has_option)
CFLAGS="$pygimp_save_CFLAGS"
if test "x$pygimp_has_option" = "xyes"; then
PYGIMP_EXTRA_CFLAGS="-fno-strict-aliasing"
fi
;;
esac
GIMP_DETECT_CFLAGS(PYGIMP_EXTRA_CFLAGS, '-fno-strict-aliasing')
AC_SUBST(PYGIMP_EXTRA_CFLAGS)
fi
AM_CONDITIONAL(BUILD_PYTHON, test "x$enable_python" != xno)

View File

@ -2,7 +2,7 @@
installed_m4 = gimp-2.0.m4
uinstalled_m4 = alsa.m4 gimpprint.m4 gtk-doc.m4 pythondev.m4
uinstalled_m4 = alsa.m4 gimpprint.m4 gtk-doc.m4 pythondev.m4 detectcflags.m4
EXTRA_DIST = $(installed_m4) $(uninstalled_m4)

20
m4macros/detectcflags.m4 Normal file
View File

@ -0,0 +1,20 @@
dnl GIMP_DETECT_CFLAGS(RESULT, FLAGSET)
dnl Detect if the compiler supports a set of flags
AC_DEFUN([GIMP_DETECT_CFLAGS],
[
$1=
for flag in $2; do
if test -z "[$]$1"; then
$1_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $flag"
AC_MSG_CHECKING([whether [$]CC understands [$]flag])
AC_TRY_COMPILE([], [], [$1_works=yes], [$1_works=no])
AC_MSG_RESULT([$]$1_works)
CFLAGS="[$]$1_save_CFLAGS"
if test "x[$]$1_works" = "xyes"; then
$1="$flag"
fi
fi
done
])