Best Python code snippet using autotest_python
config_win.py
Source:config_win.py  
1"""Config on Windows"""2# **** The search part is broken. For instance, the png Visual Studio project3# places to dll in a directory not checked by this module.4try:5    from setup_win_common import get_definitions6except:7    from buildconfig.setup_win_common import get_definitions8import os, sys9import re10from glob import glob11from distutils.sysconfig import get_python_inc12try:13    raw_input14except NameError:15    raw_input = input16def get_ptr_size():17    return 64 if sys.maxsize > 2**32 else 3218def as_machine_type(size):19    """Return pointer bit size as a Windows machine type"""20    if size == 32:21        return "x86"22    if size == 64:23        return "x64"24    raise BuildError("Unknown pointer size {}".format(size))25def get_machine_type():26    return as_machine_type(get_ptr_size())27class Dependency(object):28    huntpaths = ['..', '..\\..', '..\\*', '..\\..\\*']29    inc_hunt = ['include']30    lib_hunt = ['VisualC\\SDL\\Release', 'VisualC\\Release', 'Release', 'lib']31    check_hunt_roots = True32    def __init__(self, name, wildcards, libs=None, required=0, find_header='', find_lib=''):33        if libs is None:34            libs = []35        self.name = name36        self.wildcards = wildcards37        self.required = required38        self.paths = []39        self.path = None40        self.inc_dir = None41        self.lib_dir = None42        self.find_header = find_header43        if not find_lib and libs:44            self.find_lib = "%s\.(a|lib)" % re.escape(libs[0])45        else:46            self.find_lib = find_lib47        self.libs = libs48        self.found = False49        self.cflags = ''50        self.prune_info = []51        self.fallback_inc = None52        self.fallback_lib = None53    def hunt(self):54        parent = os.path.abspath('..')55        for p in self.huntpaths:56            for w in self.wildcards:57                found = glob(os.path.join(p, w))58                found.sort() or found.reverse()  #reverse sort59                for f in found:60                    if f[:5] == '..'+os.sep+'..' and \61                        os.path.abspath(f)[:len(parent)] == parent:62                        continue63                    if os.path.isdir(f):64                        self.paths.append(f)65    def choosepath(self, print_result=True):66        if not self.paths:67            if self.fallback_inc and not self.inc_dir:68                self.inc_dir = self.fallback_inc[0]69            if self.fallback_lib and not self.lib_dir:70                self.lib_dir = self.fallback_lib[0]71                self.libs[0] = os.path.splitext(self.fallback_lib[2])[0]72            if self.inc_dir and self.lib_dir:73                if print_result:74                    print ("Path for %s found." % self.name)75                return True76            if print_result:77                print ("Path for %s not found." % self.name)78                for info in self.prune_info:79                    print(info)80                if self.required:81                    print ('Too bad that is a requirement! Hand-fix the "Setup"')82            return False83        elif len(self.paths) == 1:84            self.path = self.paths[0]85            if print_result:86                print ("Path for %s: %s" % (self.name, self.path))87        else:88            print ("Select path for %s:" % self.name)89            for i in range(len(self.paths)):90                print ("  %i=%s" % (i + 1, self.paths[i]))91            print ("  %i = <Nothing>" % 0)92            choice = raw_input("Select 0-%i (1=default):" % len(self.paths))93            if not choice: choice = 194            else: choice = int(choice)95            if(choice):96                self.path = self.paths[choice-1]97        return True98    def matchfile(self, path, match):99        try:100            entries = os.listdir(path)101        except:102            pass103        else:104            for e in entries:105                if match(e) and os.path.isfile(os.path.join(path, e)):106                    return e107    def findhunt(self, base, paths, header_match=None, lib_match=None):108        for h in paths:109            hh = os.path.join(base, h)110            if header_match:111                header_file = self.matchfile(hh, header_match)112                if not header_file:113                    continue114            else:115                header_file = None116            if lib_match:117                lib_file = self.matchfile(hh, lib_match)118                if not lib_file:119                    continue120            else:121                lib_file = None122            if os.path.isdir(hh):123                return hh.replace('\\', '/'), header_file, lib_file124    def prunepaths(self):125        lib_match = re.compile(self.find_lib, re.I).match if self.find_lib else None126        header_match = re.compile(self.find_header, re.I).match if self.find_header else None127        prune = []128        for path in self.paths:129            inc_info = self.findhunt(path, Dependency.inc_hunt, header_match=header_match)130            lib_info = self.findhunt(path, Dependency.lib_hunt, lib_match=lib_match)131            if not inc_info or not lib_info:132                if inc_info:133                    self.prune_info.append('...Found include dir but no library dir in %s.' % (134                          path))135                    self.fallback_inc = inc_info136                if lib_info:137                    self.prune_info.append('...Found library dir but no include dir in %s.' % (138                          path))139                    self.fallback_lib = lib_info140                prune.append(path)141            else:142                self.inc_dir = inc_info[0]143                self.lib_dir = lib_info[0]144                self.libs[0] = os.path.splitext(lib_info[2])[0]145        self.paths = [p for p in self.paths if p not in prune]146    def configure(self):147        self.hunt()148        if self.check_hunt_roots:149            self.paths.extend(self.huntpaths)150        self.prunepaths()151        self.choosepath()152        if self.path:153            lib_match = re.compile(self.find_lib, re.I).match if self.find_lib else None154            header_match = re.compile(self.find_header, re.I).match if self.find_header else None155            inc_info = self.findhunt(self.path, Dependency.inc_hunt, header_match=header_match)156            lib_info = self.findhunt(self.path, Dependency.lib_hunt, lib_match=lib_match)157            if inc_info:158                self.inc_dir = inc_info[0]159            if lib_info:160                self.lib_info = lib_info[0]161                if lib_info[2]:162                    self.libs[0] = os.path.splitext(lib_info[2])[0]163        if self.lib_dir and self.inc_dir:164            print("...Library directory for %s: %s" % (self.name, self.lib_dir))165            print("...Include directory for %s: %s" % (self.name, self.inc_dir))166            self.found = True167class DependencyPython(object):168    def __init__(self, name, module, header):169        self.name = name170        self.lib_dir = ''171        self.inc_dir = ''172        self.libs = []173        self.cflags = ''174        self.found = False175        self.ver = '0'176        self.module = module177        self.header = header178    def configure(self):179        self.found = True180        if self.module:181            try:182                self.ver = __import__(self.module).__version__183            except ImportError:184                self.found = False185        if self.found and self.header:186            fullpath = os.path.join(get_python_inc(0), self.header)187            if not os.path.isfile(fullpath):188                found = 0189            else:190                self.inc_dir = os.path.split(fullpath)[0]191        if self.found:192            print ("%-8.8s: found %s" % (self.name, self.ver))193        else:194            print ("%-8.8s: not found" % self.name)195class DependencyDLL(Dependency):196    def __init__(self, dll_regex, lib=None, wildcards=None, libs=None, link=None):197        if lib is None:198            lib = link.libs[0]199        Dependency.__init__(self, 'COPYLIB_' + lib, wildcards, libs)200        self.lib_name = lib201        self.test = re.compile(dll_regex, re.I).match202        self.lib_dir = '_'203        self.link = link204    def configure(self):205        if not self.path:206            if (self.link is None or not self.link.path) and self.wildcards:207                self.hunt()208                self.choosepath(print_result=False)209            else:210                self.path = self.link.path211        if self.path is not None:212            self.hunt_dll(self.lib_hunt, self.path)213        elif self.check_hunt_roots:214            self.check_roots()215        if self.lib_dir != '_':216            print ("DLL for %s: %s" % (self.lib_name, self.lib_dir))217            self.found = True218        else:219            print ("No DLL for %s: not found!" % (self.lib_name))220            if self.required:221                print ('Too bad that is a requirement! Hand-fix the "Setup"')222    def check_roots(self):223        parent = os.path.abspath('..')224        for p in self.huntpaths:225            if self.hunt_dll(self.lib_hunt, p):226                return True227        return False228    def hunt_dll(self, search_paths, root):229        for dir in search_paths:230            path = os.path.join(root, dir)231            try:232                entries = os.listdir(path)233            except:234                pass235            else:236                for e in entries:237                    if self.test(e) and os.path.isfile(os.path.join(path, e)):238                        # Found239                        self.lib_dir = os.path.join(path, e).replace('\\', '/')240                        return True241        return False242class DependencyDummy(object):243    def __init__(self, name):244        self.name = name245        self.inc_dir = None246        self.lib_dir = None247        self.libs = []248        self.found = True249        self.cflags = ''250    def configure(self):251        pass252class DependencyWin(object):253    def __init__(self, name, cflags):254        self.name = name255        self.inc_dir = None256        self.lib_dir = None257        self.libs = []258        self.found = True259        self.cflags = cflags260    def configure(self):261        pass262class DependencyGroup(object):263    def __init__(self):264        self.dependencies =[]265        self.dlls = []266    def add(self, name, lib, wildcards, dll_regex, libs=None, required=0, find_header='', find_lib=''):267        if libs is None:268            libs = []269        if dll_regex:270            dep = Dependency(name, wildcards, [lib], required, find_header, find_lib)271            self.dependencies.append(dep)272            dll = DependencyDLL(dll_regex, link=dep, libs=libs)273            self.dlls.append(dll)274            dep.dll = dll275        else:276            dep = Dependency(name, wildcards, [lib] + libs, required, find_header, find_lib)277            self.dependencies.append(dep)278        return dep279    def add_win(self, name, cflags):280        self.dependencies.append(DependencyWin(name, cflags))281    def add_dll(self, dll_regex, lib=None, wildcards=None, libs=None, link_lib=None):282        link = None283        if link_lib is not None:284            name = 'COPYLIB_' + link_lib285            for d in self.dlls:286                if d.name == name:287                    link = d288                    break289            else:290                raise KeyError("Link lib %s not found" % link_lib)291        dep = DependencyDLL(dll_regex, lib, wildcards, libs, link)292        self.dlls.append(dep)293        return dep294    def add_dummy(self, name):295        self.dependencies.append(DependencyDummy(name))296    def find(self, name):297        for dep in self:298            if dep.name == name:299                return dep300    def configure(self):301        for d in self.dependencies:302            if not getattr(d, '_configured', False):303                d.configure()304                d._configured = True305        for d in self.dlls:306            if not getattr(d, '_configured', False):307                d.configure()308                d._configured = True309                # create a lib310                if d.found and d.link and not d.link.lib_dir:311                    try:312                        from . import vstools313                    except ImportError:314                        from buildconfig import vstools315                    from os.path import splitext316                    nonext_name = splitext(d.lib_dir)[0]317                    def_file = '%s.def' % nonext_name318                    basename = os.path.basename(nonext_name)319                    print('Building lib from %s: %s.lib...' % (320                        os.path.basename(d.lib_dir),321                        basename322                    ))323                    vstools.dump_def(d.lib_dir, def_file=def_file)324                    vstools.lib_from_def(def_file)325                    d.link.lib_dir = os.path.dirname(d.lib_dir)326                    d.link.libs[0] = basename327                    d.link.configure()328    def __iter__(self):329        for d in self.dependencies:330            yield d331        for d in self.dlls:332            yield d333def _add_sdl2_dll_deps(DEPS):334    # MIXER335    DEPS.add_dll(r'(libvorbis-0|vorbis)\.dll$', 'vorbis', ['libvorbis-[1-9].*'],336                 ['ogg'])337    DEPS.add_dll(r'(libvorbisfile-3|vorbisfile)\.dll$', 'vorbisfile',338                 link_lib='vorbis', libs=['vorbis'])339    DEPS.add_dll(r'(libogg-0|ogg)\.dll$', 'ogg', ['libogg-[1-9].*'])340    DEPS.add_dll(r'(lib)?FLAC[-0-9]*\.dll$', 'flac', ['*FLAC-[0-9]*'])341    DEPS.add_dll(r'(lib)?modplug[-0-9]*\.dll$', 'modplug', ['*modplug-[0-9]*'])342    DEPS.add_dll(r'(lib)?mpg123[-0-9]*\.dll$', 'mpg123', ['*mpg123-[0-9]*'])343    DEPS.add_dll(r'(lib)?opus[-0-9]*\.dll$', 'opus', ['*opus-[0-9]*'])344    DEPS.add_dll(r'(lib)?opusfile[-0-9]*\.dll$', 'opusfile', ['*opusfile-[0-9]*'])345    # IMAGE346    DEPS.add_dll(r'(lib){0,1}tiff[-0-9]*\.dll$', 'tiff', ['tiff-[0-9]*'], ['jpeg', 'z'])347    DEPS.add_dll(r'(z|zlib1)\.dll$', 'z', ['zlib-[1-9].*'])348    DEPS.add_dll(r'(lib)?webp[-0-9]*\.dll$', 'webp', ['*webp-[0-9]*'])349def setup(sdl2):350    DEPS = DependencyGroup()351    if not sdl2:352        DEPS.add('SDL', 'SDL', ['SDL-[1-9].*'], r'(lib){0,1}SDL\.dll$', required=1,353                 find_header='SDL\.h')354        DEPS.add('FONT', 'SDL_ttf', ['SDL_ttf-[2-9].*'], r'(lib){0,1}SDL_ttf\.dll$', ['SDL', 'z'],355                 find_header='SDL_ttf\.h')356        DEPS.add('IMAGE', 'SDL_image', ['SDL_image-[1-9].*'], r'(lib){0,1}SDL_image\.dll$',357                 ['SDL', 'jpeg', 'png', 'tiff'], 0, find_header='SDL_image\.h'),358        DEPS.add('MIXER', 'SDL_mixer', ['SDL_mixer-[1-9].*'], r'(lib){0,1}SDL_mixer\.dll$',359                 ['SDL', 'vorbisfile'], find_header='SDL_mixer\.h')360        DEPS.add('PNG', 'png', ['libpng-[1-9].*'], r'(png|libpng)[-0-9]*\.dll$', ['z'])361        DEPS.add('JPEG', 'jpeg', ['jpeg-[6-9]*'], r'(lib){0,1}jpeg[-0-9]*\.dll$')362        DEPS.add('PORTMIDI', 'portmidi', ['portmidi'], r'portmidi\.dll$', find_header='portmidi\.h')363        #DEPS.add('PORTTIME', 'porttime', ['porttime'], r'porttime\.dll$')364        DEPS.add_dummy('PORTTIME')365        DEPS.add('FREETYPE', 'freetype', ['freetype-[1-9].*'], r'(lib){0,1}freetype[-0-9]*\.dll$',366                 find_header='ft2build\.h', find_lib='(lib)?freetype[-0-9]*\.lib')367        DEPS.configure()368        DEPS.add_dll(r'(lib){0,1}tiff[-0-9]*\.dll$', 'tiff', ['tiff-[3-9].*'], ['jpeg', 'z'])369        DEPS.add_dll(r'(z|zlib1)\.dll$', 'z', ['zlib-[1-9].*'])370        DEPS.add_dll(r'(libvorbis-0|vorbis)\.dll$', 'vorbis', ['libvorbis-[1-9].*'],371                     ['ogg'])372        DEPS.add_dll(r'(libvorbisfile-3|vorbisfile)\.dll$', 'vorbisfile',373                     link_lib='vorbis', libs=['vorbis'])374        DEPS.add_dll(r'(libogg-0|ogg)\.dll$', 'ogg', ['libogg-[1-9].*'])375        for d in get_definitions():376            DEPS.add_win(d.name, d.value)377        DEPS.configure()378    else:379        DEPS.add('SDL', 'SDL2', ['SDL2-[1-9].*'], r'(lib){0,1}SDL2\.dll$', required=1)380        DEPS.add('PORTMIDI', 'portmidi', ['portmidi'], r'portmidi\.dll$', find_header='portmidi\.h')381        #DEPS.add('PORTTIME', 'porttime', ['porttime'], r'porttime\.dll$')382        DEPS.add_dummy('PORTTIME')383        DEPS.add('MIXER', 'SDL2_mixer', ['SDL2_mixer-[1-9].*'], r'(lib){0,1}SDL2_mixer\.dll$',384                 ['SDL', 'vorbisfile'])385        DEPS.add('PNG', 'png', ['SDL2_image-[2-9].*', 'libpng-[1-9].*'], r'(png|libpng)[-0-9]*\.dll$', ['z'],386                 find_header='png\.h', find_lib='(lib)?png1[-0-9]*\.lib')387        DEPS.add('JPEG', 'jpeg', ['SDL2_image-[2-9].*', 'jpeg-9*'], r'(lib){0,1}jpeg-9\.dll$',388                 find_header='jpeglib\.h', find_lib='(lib)?jpeg-9\.lib')389        DEPS.add('IMAGE', 'SDL2_image', ['SDL2_image-[1-9].*'], r'(lib){0,1}SDL2_image\.dll$',390                 ['SDL', 'jpeg', 'png', 'tiff'], 0)391        DEPS.add('FONT', 'SDL2_ttf', ['SDL2_ttf-[2-9].*'], r'(lib){0,1}SDL2_ttf\.dll$', ['SDL', 'z', 'freetype'])392        DEPS.add('FREETYPE', 'freetype', ['freetype-[1-9].*'], r'(lib){0,1}freetype[-0-9]*\.dll$',393                 find_header='ft2build\.h', find_lib='(lib)?freetype[-0-9]*\.lib')394        DEPS.configure()395        _add_sdl2_dll_deps(DEPS)396        for d in get_definitions():397            DEPS.add_win(d.name, d.value)398        DEPS.configure()399    return list(DEPS)400def setup_prebuilt_sdl2(prebuilt_dir):401    Dependency.huntpaths[:] = [prebuilt_dir]402    Dependency.lib_hunt.extend([403        '',404        'lib',405        os.path.join('lib', get_machine_type()),406    ])407    Dependency.inc_hunt.append('')408    DEPS = DependencyGroup()409    DEPS.add('SDL', 'SDL2', ['SDL2-[1-9].*'], r'(lib){0,1}SDL2\.dll$', required=1)410    fontDep = DEPS.add('FONT', 'SDL2_ttf', ['SDL2_ttf-[2-9].*'], r'(lib){0,1}SDL2_ttf\.dll$', ['SDL', 'z', 'freetype'])411    imageDep = DEPS.add('IMAGE', 'SDL2_image', ['SDL2_image-[1-9].*'], r'(lib){0,1}SDL2_image\.dll$',412                        ['SDL', 'jpeg', 'png', 'tiff'], 0)413    mixerDep = DEPS.add('MIXER', 'SDL2_mixer', ['SDL2_mixer-[1-9].*'], r'(lib){0,1}SDL2_mixer\.dll$',414                        ['SDL', 'vorbisfile'])415    DEPS.add('PORTMIDI', 'portmidi', ['portmidi'], r'portmidi\.dll$', find_header='portmidi\.h')416    #DEPS.add('PORTTIME', 'porttime', ['porttime'], r'porttime\.dll$')417    DEPS.add_dummy('PORTTIME')418    DEPS.configure()419    # force use of the correct freetype DLL420    ftDep = DEPS.add('FREETYPE', 'freetype', ['SDL2_ttf-[2-9].*', 'freetype-[1-9].*'], r'(lib)?freetype[-0-9]*\.dll$',421                     find_header='ft2build\.h', find_lib='libfreetype[-0-9]*\.lib')422    ftDep.path = fontDep.path423    ftDep.inc_dir = [424        os.path.join(prebuilt_dir, 'include').replace('\\', '/')425    ]426    ftDep.inc_dir.append('%s/freetype2' % ftDep.inc_dir[0])427    ftDep.found = True428    png = DEPS.add('PNG', 'png', ['SDL2_image-[2-9].*', 'libpng-[1-9].*'], r'(png|libpng)[-0-9]*\.dll$', ['z'],429                   find_header='png\.h', find_lib='(lib)?png1[-0-9]*\.lib')430    png.path = imageDep.path431    png.inc_dir = [os.path.join(prebuilt_dir, 'include').replace('\\', '/')]432    png.found = True433    jpeg = DEPS.add('JPEG', 'jpeg', ['SDL2_image-[2-9].*', 'jpeg-9*'], r'(lib){0,1}jpeg-9\.dll$',434                   find_header='jpeglib\.h', find_lib='(lib)?jpeg-9\.lib')435    jpeg.path = imageDep.path436    jpeg.inc_dir = [os.path.join(prebuilt_dir, 'include').replace('\\', '/')]437    jpeg.found = True438    dllPaths = {439        'png': imageDep.path,440        'jpeg': imageDep.path,441        'tiff': imageDep.path,442        'z': imageDep.path,443        'webp': imageDep.path,444        'vorbis': mixerDep.path,445        'vorbisfile': mixerDep.path,446        'ogg': mixerDep.path,447        'flac': mixerDep.path,448        'modplug': mixerDep.path,449        'mpg123': mixerDep.path,450        'opus': mixerDep.path,451        'opusfile': mixerDep.path,452        'freetype': fontDep.path,453    }454    _add_sdl2_dll_deps(DEPS)455    for dll in DEPS.dlls:456        if dllPaths.get(dll.lib_name):457            dll.path = dllPaths.get(dll.lib_name)458    for d in get_definitions():459        DEPS.add_win(d.name, d.value)460    DEPS.configure()461    return list(DEPS)462def setup_prebuilt_sdl1(prebuilt_dir):463    setup_ = open('Setup', 'w')464    is_pypy = '__pypy__' in sys.builtin_module_names465    import platform466    is_python3 = platform.python_version().startswith('3')467    try:468        try:469            setup_win_in = open(os.path.join(prebuilt_dir, 'Setup_Win.in'))470        except IOError:471            raise IOError("%s missing required Setup_Win.in" % prebuilt_dir)472        # Copy Setup.in to Setup, replacing the BeginConfig/EndConfig473        # block with prebuilt\Setup_Win.in .474        setup_in = open(os.path.join('buildconfig', 'Setup.SDL1.in'))475        try:476            do_copy = True477            for line in setup_in:478                if line.startswith('#--StartConfig'):479                    do_copy = False480                    setup_.write(setup_win_in.read())481                    try:482                        setup_win_common_in = open(os.path.join('buildconfig', 'Setup_Win_Common.in'))483                    except:484                        pass485                    else:486                        try:487                            setup_.write(setup_win_common_in.read())488                        finally:489                            setup_win_common_in.close()490                elif line.startswith('#--EndConfig'):491                    do_copy = True492                elif do_copy:493                    setup_.write(line)494        finally:495            setup_in.close()496    finally:497        setup_.close()498    print("Wrote to \"Setup\".")499def main(sdl2=False):500    machine_type = get_machine_type()501    prebuilt_dir = 'prebuilt-%s' % machine_type502    use_prebuilt = '-prebuilt' in sys.argv503    auto_download = 'PYGAME_DOWNLOAD_PREBUILT' in os.environ504    if auto_download:505        auto_download = os.environ['PYGAME_DOWNLOAD_PREBUILT'] == '1'506    try:507        from . import download_win_prebuilt508    except ImportError:509        import download_win_prebuilt510    download_kwargs = {511        'x86': False,512        'x64': False,513        'sdl2': sdl2,514    }515    download_kwargs[machine_type] = True516    if not auto_download:517        if (not download_win_prebuilt.cached(**download_kwargs) or\518            not os.path.isdir(prebuilt_dir))\519            and download_win_prebuilt.ask(**download_kwargs):520            use_prebuilt = True521    else:522        download_win_prebuilt.update(**download_kwargs)523    if os.path.isdir(prebuilt_dir):524        if not use_prebuilt:525            if 'PYGAME_USE_PREBUILT' in os.environ:526                use_prebuilt = os.environ['PYGAME_USE_PREBUILT'] == '1'527            else:528                reply = raw_input('\nUse the SDL libraries in "%s"? [Y/n]' % prebuilt_dir)529                use_prebuilt = (not reply) or reply[0].lower() != 'n'530        if use_prebuilt:531            if sdl2:532                return setup_prebuilt_sdl2(prebuilt_dir)533            setup_prebuilt_sdl1(prebuilt_dir)534            raise SystemExit()535    else:536        print ("Note: cannot find directory \"%s\"; do not use prebuilts." % prebuilt_dir)537    return setup(sdl2)538if __name__ == '__main__':539    print ("""This is the configuration subscript for Windows.540Please run "config.py" for full configuration.""")541    import sys542    if "--download" in sys.argv:543        try:544            from . import download_win_prebuilt545        except ImportError:546            import download_win_prebuilt...SConstruct
Source:SConstruct  
...12##############################################################################13# Defaults.14version = '1.0.0'15pkgconfig.defaults()16pkgconfig.find_header('endian.h', 'HAVE_ENDIAN_H')17pkgconfig.find_header('machine/endian.h', 'HAVE_MACHINE_ENDIAN_H')18pkgconfig.find_header('sys/endian.h', 'HAVE_SYS_ENDIAN_H')19if pkgconfig.get_uname() == 'Linux':20	gnu_dl = pkgconfig.find_libwithheader('dl', 'dlfcn.h', 'HAVE_DLFCN_H')21else:22	gnu_dl = pkgconfig.find_header('dlfcn.h', 'HAVE_DLFCN_H')23# Just so we recognize it exists.24pkgconfig.find_header('GL/freeglut.h', 'USE_FREEGLUT')25# pthreads is neccessary.26pkgconfig.find_pthread()27if not gnu_dl or pkgconfig.get_uname() == 'Darwin':28	pkgconfig.find_sdl('1.2.4', '', True)29	pkgconfig.find_opengl('', True)30	pkgconfig.find_glut()31else:32	pkgconfig.find_header('SDL.h', 'HAVE_SDL_H')33	pkgconfig.find_header('SDL/SDL.h', 'HAVE_SDL_SDL_H')34	pkgconfig.add_cflag('-DDNLOAD_LIBM')35	pkgconfig.add_cflag('-DDNLOAD_LIBGL')36	pkgconfig.add_cflag('-DDNLOAD_LIBGLU')37	pkgconfig.add_cflag('-DDNLOAD_LIBGLUT')38	pkgconfig.add_cflag('-DDNLOAD_LIBSDL')39pkgconfig.add_cflag('-pedantic')40env = pkgconfig.get_env()...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
