| 27 | dir_given = 0 |
| 28 | |
| 29 | include_dirs = [] |
| 30 | library_dirs = [] |
| 31 | |
| 32 | args = sys.argv[:] |
| 33 | if len(args) > 2: |
| 34 | for y in args: |
| 35 | found = y.find('--prefix=') |
| 36 | if(found > -1): |
| 37 | found = found + len('--prefix=') |
| 38 | z = y[found:] |
| 39 | include_dirs = [os.path.join(z, 'include')] |
| 40 | library_dirs = [os.path.join(z, 'lib')] |
| 41 | dir_given = 1 |
| 42 | sys.argv.remove(y) |
| 43 | found = y.find('--includedir=') |
| 44 | if (found > -1): |
| 45 | found = found + len('--includedir=') |
| 46 | z = y[found:] |
| 47 | include_dirs = [z] |
| 48 | dir_given = 1 |
| 49 | sys.argv.remove(y) |
| 50 | found = y.find('--libdir=') |
| 51 | if (found > -1 ): |
| 52 | found = found + len('--libdir=') |
| 53 | z = y[found:] |
| 54 | library_dirs = [z] |
| 55 | dir_given = 1 |
| 56 | sys.argv.remove(y) |
| 57 | else: |
| 58 | include_dirs = ['/usr/include/mysql', '/usr/local/include/mysql','/usr/local/mysql/include/mysql'] |
| 59 | library_dirs = ['/usr/lib/mysql', '/usr/local/lib/mysql','/usr/local/mysql/lib/mysql'] |
| 60 | |
51 | | if sys.platform == "netbsd1": |
52 | | include_dirs = ['/usr/pkg/include/mysql'] |
53 | | library_dirs = ['/usr/pkg/lib/mysql'] |
54 | | elif sys.platform in ("freebsd4", "openbsd3"): |
55 | | LOCALBASE = os.environ.get('LOCALBASE', '/usr/local') |
56 | | include_dirs = ['%s/include/mysql' % LOCALBASE] |
57 | | library_dirs = ['%s/lib/mysql' % LOCALBASE] |
58 | | elif sys.platform == "sunos5": # Solaris 2.8 + gcc |
59 | | runtime_library_dirs.append('/usr/local/lib:/usr/openwin/lib:/usr/dt/lib') |
60 | | extra_compile_args.append("-fPIC") |
61 | | elif sys.platform == "win32": # Ugh |
62 | | include_dirs = [r'c:\mysql\include'] |
63 | | library_dirs = [r'c:\mysql\lib\opt'] |
64 | | libraries = [mysqlclient, 'zlib', 'msvcrt', 'libcmt', |
65 | | 'wsock32', 'advapi32'] |
66 | | extra_objects = [r'c:\mysql\lib\opt\mysqlclient.lib'] |
67 | | elif sys.platform == "cygwin": |
68 | | include_dirs = ['/c/mysql/include'] |
69 | | library_dirs = ['/c/mysql/lib'] |
70 | | extra_compile_args.append('-DMS_WIN32') |
71 | | elif sys.platform[:6] == "darwin": # Mac OS X |
72 | | include_dirs.append('/sw/include') |
73 | | library_dirs.append('/sw/lib') |
74 | | extra_link_args.append('-flat_namespace') |
75 | | elif sys.platform == 'linux2' and os.environ.get('HOSTTYPE') == 'alpha': |
76 | | libraries.extend(['ots', 'cpml']) |
77 | | elif os.name == "posix": # UNIX-ish platforms not covered above |
78 | | pass # default should work |
| 77 | if(dir_given == 0): |
| 78 | if sys.platform == "netbsd1": |
| 79 | include_dirs = ['/usr/pkg/include/mysql'] |
| 80 | library_dirs = ['/usr/pkg/lib/mysql'] |
| 81 | elif sys.platform in ("freebsd4", "openbsd3"): |
| 82 | LOCALBASE = os.environ.get('LOCALBASE', '/usr/local') |
| 83 | include_dirs = ['%s/include/mysql' % LOCALBASE] |
| 84 | library_dirs = ['%s/lib/mysql' % LOCALBASE] |
| 85 | elif sys.platform == "sunos5": # Solaris 2.8 + gcc |
| 86 | runtime_library_dirs.append('/usr/local/lib:/usr/openwin/lib:/usr/dt/lib') |
| 87 | extra_compile_args.append("-fPIC") |
| 88 | elif sys.platform == "win32": # Ugh |
| 89 | include_dirs = [r'c:\mysql\include'] |
| 90 | library_dirs = [r'c:\mysql\lib\opt'] |
| 91 | libraries = [mysqlclient, 'zlib', 'msvcrt', 'libcmt', |
| 92 | 'wsock32', 'advapi32'] |
| 93 | extra_objects = [r'c:\mysql\lib\opt\mysqlclient.lib'] |
| 94 | elif sys.platform == "cygwin": |
| 95 | include_dirs = ['/c/mysql/include'] |
| 96 | library_dirs = ['/c/mysql/lib'] |
| 97 | extra_compile_args.append('-DMS_WIN32') |
| 98 | elif sys.platform[:6] == "darwin": # Mac OS X |
| 99 | include_dirs.append('/sw/include') |
| 100 | library_dirs.append('/sw/lib') |
| 101 | extra_link_args.append('-flat_namespace') |
| 102 | elif sys.platform == 'linux2' and os.environ.get('HOSTTYPE') == 'alpha': |
| 103 | libraries.extend(['ots', 'cpml']) |
| 104 | elif os.name == "posix": # UNIX-ish platforms not covered above |
| 105 | pass # default should work |
| 106 | else: |
| 107 | raise "UnknownPlatform", "sys.platform=%s, os.name=%s" % \ |
| 108 | (sys.platform, os.name) |