--- ./mesonbuild/mesonlib.py_orig	2020-01-11 02:09:38 +0000
+++ ./mesonbuild/mesonlib.py	2020-01-11 02:10:08 +0000
@@ -466,6 +466,9 @@
 def is_freebsd() -> bool:
     return platform.system().lower() == 'freebsd'
 
+def is_aix() -> bool:
+    return platform.system().lower() == 'aix'
+ 
 def exe_exists(arglist: typing.List[str]) -> bool:
     try:
         if subprocess.run(arglist, timeout=10).returncode == 0:
--- ./mesonbuild/linkers.py_orig	2020-01-11 02:10:12 +0000
+++ ./mesonbuild/linkers.py	2020-01-11 02:12:47 +0000
@@ -974,3 +974,25 @@
                         suffix: str, soversion: str, darwin_versions: typing.Tuple[str, str],
                         is_shared_module: bool) -> typing.List[str]:
         return []
+
+class AIXDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
+
+    def get_output_args(self, outname: str) -> typing.List[str]:
+        return ['-o', outname]
+
+    def get_search_args(self, dirname: str) -> typing.List[str]:
+        return ['-L', dirname]
+
+    def fatal_warnings(self) -> typing.List[str]:
+        return ['--warning-as-error']
+
+    def get_allow_undefined_args(self) -> typing.List[str]:
+        return []
+
+    def get_soname_args(self, env: 'Environment', prefix: str, shlib_name: str,
+                        suffix: str, soversion: str, darwin_versions: typing.Tuple[str, str],
+                        is_shared_module: bool) -> typing.List[str]:
+        return []
+
+    def get_std_shared_lib_args(self) -> typing.List[str]:
+        return ['-shared']
--- ./mesonbuild/environment.py_orig	2020-01-11 02:12:57 +0000
+++ ./mesonbuild/environment.py	2020-01-11 02:15:51 +0000
@@ -58,6 +58,7 @@
     XildLinuxDynamicLinker,
     XilinkDynamicLinker,
     CudaLinker,
+    AIXDynamicLinker,
 )
 from functools import lru_cache
 from .compilers import (
@@ -312,7 +313,7 @@
     """
     if mesonlib.is_windows():
         trial = detect_windows_arch(compilers)
-    elif mesonlib.is_freebsd() or mesonlib.is_netbsd() or mesonlib.is_openbsd():
+    elif mesonlib.is_freebsd() or mesonlib.is_netbsd() or mesonlib.is_openbsd() or mesonlib.is_aix():
         trial = platform.processor().lower()
     else:
         trial = platform.machine().lower()
@@ -357,7 +358,7 @@
 def detect_cpu(compilers: CompilersDict):
     if mesonlib.is_windows():
         trial = detect_windows_arch(compilers)
-    elif mesonlib.is_freebsd() or mesonlib.is_netbsd() or mesonlib.is_openbsd():
+    elif mesonlib.is_freebsd() or mesonlib.is_netbsd() or mesonlib.is_openbsd() or mesonlib.is_aix():
         trial = platform.processor().lower()
     else:
         trial = platform.machine().lower()
@@ -825,7 +826,11 @@
         elif 'Solaris' in e or 'Solaris' in o:
             linker = SolarisDynamicLinker(
                 compiler, for_machine, 'solaris', prefix,
-                version=search_version(e))
+               version=search_version(e))
+        elif 'aix' in e or 'aix' in o:
+            linker = AIXDynamicLinker(
+                compiler, for_machine, 'aix', prefix,
+               version=search_version(e))
         else:
             raise MesonException('Unable to determine dynamic linker.')
         return linker
--- ./mesonbuild/compilers/compilers.py_orig	2020-01-11 02:15:54 +0000
+++ ./mesonbuild/compilers/compilers.py	2020-01-11 02:17:59 +0000
@@ -16,7 +16,7 @@
 import typing
 from typing import Optional, Tuple, List
 
-from ..linkers import StaticLinker, GnuLikeDynamicLinkerMixin, SolarisDynamicLinker
+from ..linkers import StaticLinker, GnuLikeDynamicLinkerMixin, SolarisDynamicLinker, AIXDynamicLinker
 from .. import coredata
 from .. import mlog
 from .. import mesonlib
@@ -533,7 +533,7 @@
         # TODO: this could probably be added to the DynamicLinker instead
         if (hasattr(self.compiler, 'linker') and
                 self.compiler.linker is not None and
-                isinstance(self.compiler.linker, (GnuLikeDynamicLinkerMixin, SolarisDynamicLinker))):
+                isinstance(self.compiler.linker, (GnuLikeDynamicLinkerMixin, SolarisDynamicLinker, AIXDynamicLinker))):
             group_start = -1
             group_end = -1
             for i, each in enumerate(new):
@@ -544,10 +544,10 @@
                 if group_start < 0:
                     # First occurrence of a library
                     group_start = i
-            if group_start >= 0:
+            #if group_start >= 0:
                 # Last occurrence of a library
-                new.insert(group_end + 1, '-Wl,--end-group')
-                new.insert(group_start, '-Wl,--start-group')
+            #    new.insert(group_end + 1, '-Wl,--end-group')
+            #    new.insert(group_start, '-Wl,--start-group')
         # Remove system/default include paths added with -isystem
         if hasattr(self.compiler, 'get_default_include_dirs'):
             default_dirs = self.compiler.get_default_include_dirs()
