diff --git a/configure.ac b/configure.ac index 04536e910..a483c4aa3 100644 --- a/configure.ac +++ b/configure.ac @@ -117,6 +117,54 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", AC_CANONICAL_HOST +AC_MSG_CHECKING([for GDK pixel operations target architecture]) +case "$host_cpu" in + i?86 | x86_64 | amd64) + gdk_pixelops_arch=x86 + ;; + arm* | aarch64*) + gdk_pixelops_arch=arm + ;; + powerpc* | ppc*) + gdk_pixelops_arch=powerpc + ;; + mips*) + gdk_pixelops_arch=mips + ;; + riscv*) + gdk_pixelops_arch=riscv + ;; + loongarch*) + gdk_pixelops_arch=loongarch + ;; + sparc*) + gdk_pixelops_arch=sparc + ;; + alpha*) + gdk_pixelops_arch=alpha + ;; + hppa* | parisc*) + gdk_pixelops_arch=hppa + ;; + m68k*) + gdk_pixelops_arch=m68k + ;; + s390*) + gdk_pixelops_arch=s390 + ;; + sh*) + gdk_pixelops_arch=sh + ;; + *) + gdk_pixelops_arch=generic + ;; +esac +AC_MSG_RESULT([$gdk_pixelops_arch]) + +AM_CONDITIONAL(GDK_PIXELOPS_X86, + test "$gdk_pixelops_arch" = x86) + + MATH_LIB=-lm AC_MSG_CHECKING([for native Win32]) LIB_EXE_MACHINE_FLAG=X86 diff --git a/gdk/Makefile.am b/gdk/Makefile.am index c0c7d5178..19576c369 100644 --- a/gdk/Makefile.am +++ b/gdk/Makefile.am @@ -119,8 +119,15 @@ gdk_private_headers = \ gdkpoly-generic.h \ gdkregion-generic.h +gdk_pixelops_arch_sources = + +if GDK_PIXELOPS_X86 +gdk_pixelops_arch_sources += gdkpixelops-x86.c +endif + gdk_pixelops_private_sources = \ - gdkpixelops-generic.c + gdkpixelops-generic.c \ + $(gdk_pixelops_arch_sources) gdk_c_sources = \ $(medialib_sources) \ diff --git a/gdk/gdkpixelops-x86.c b/gdk/gdkpixelops-x86.c new file mode 100644 index 000000000..ee2ba2833 --- /dev/null +++ b/gdk/gdkpixelops-x86.c @@ -0,0 +1,13 @@ +/* GDK - The GIMP Drawing Kit + * + * x86 pixel operation backend. + * + * This file is selected at build time only for x86 targets. + */ + +#include "config.h" + +#if !defined(__i386__) && !defined(__x86_64__) && \ + !defined(_M_IX86) && !defined(_M_X64) +#error "gdkpixelops-x86.c must only be built for an x86 target" +#endif diff --git a/gdk/makefile.msc b/gdk/makefile.msc index 502bf65f1..c1fb0afe8 100644 --- a/gdk/makefile.msc +++ b/gdk/makefile.msc @@ -74,6 +74,7 @@ gdk_OBJECTS = \ gdkdraw.obj \ gdkpixelops.obj \ gdkpixelops-generic.obj \ + gdkpixelops-x86.obj \ gdkenumtypes.obj \ gdkevents.obj \ gdkfont.obj \