Bläddra i källkod

Fix compile errors for FreeBSD

rdb 16 år sedan
förälder
incheckning
b614a05a12
3 ändrade filer med 10 tillägg och 12 borttagningar
  1. 2 2
      dtool/src/dtoolutil/load_dso.cxx
  2. 5 1
      makepanda/makepanda.py
  3. 3 9
      makepanda/makepandacore.py

+ 2 - 2
dtool/src/dtoolutil/load_dso.cxx

@@ -178,8 +178,8 @@ unload_dso(void *dso_handle) {
 
 string
 load_dso_error() {
-   char *message = dlerror();
-   if (message != (char *)NULL) {
+   const char *message = dlerror();
+   if (message != (const char *)NULL) {
     return std::string(message);
   }
   return "No error.";

+ 5 - 1
makepanda/makepanda.py

@@ -805,7 +805,9 @@ def CompileLink(dll, obj, opts):
             if (opt=="ALWAYS") or (opts.count(opt)): cmd = cmd + ' -L' + BracketNameWithQuotes(dir)
         for (opt, name) in LIBNAMES:
             if (opt=="ALWAYS") or (opts.count(opt)): cmd = cmd + ' ' + BracketNameWithQuotes(name)
-        cmd = cmd + " -lpthread -ldl"
+        cmd = cmd + " -lpthread"
+        if (not sys.platform.startswith("freebsd")):
+            cmd = cmd + " -ldl"
         if (sys.platform == "darwin"):
             cmd = cmd + " -isysroot " + SDK["MACOSX"] + " -Wl,-syslibroot," + SDK["MACOSX"] + " -arch ppc -arch i386"
         
@@ -1124,6 +1126,8 @@ def WriteConfigSettings():
     if (sys.platform.startswith("freebsd")):
         dtool_config["IS_LINUX"] = 'UNDEF'
         dtool_config["IS_FREEBSD"] = '1'
+        dtool_config["HAVE_ALLOCA_H"] = 'UNDEF'
+        dtool_config["HAVE_MALLOC_H"] = 'UNDEF'
     
     if (OPTIMIZE <= 3):
         if (dtool_config["HAVE_NET"] != 'UNDEF'):

+ 3 - 9
makepanda/makepandacore.py

@@ -10,6 +10,7 @@
 ########################################################################
 
 import sys,os,time,stat,string,re,getopt,cPickle,fnmatch,threading,Queue,signal,shutil,platform
+from distutils import sysconfig
 
 SUFFIX_INC=[".cxx",".c",".h",".I",".yxx",".lxx",".mm"]
 SUFFIX_DLL=[".dll",".dlo",".dle",".dli",".dlm",".mll",".exe",".pyd"]
@@ -895,15 +896,8 @@ def SdkLocatePython():
                 exit("Could not find the python framework!")
 
         else:
-            os.system("python -V > "+OUTPUTDIR+"/tmp/pythonversion 2>&1")
-            pv=ReadFile(OUTPUTDIR+"/tmp/pythonversion")
-            if (pv.startswith("Python ")==0):
-                exit("python -V did not produce the expected output")
-            pv = pv[7:10]
-            if (os.path.isdir("/usr/include/python"+pv)==0):
-                exit("Python reports version "+pv+" but /usr/include/python"+pv+" is not installed.")
-            SDK["PYTHON"]="/usr/include/python"+pv
-            SDK["PYTHONVERSION"]="python"+pv
+            SDK["PYTHON"]=sysconfig.get_python_inc()
+            SDK["PYTHONVERSION"]="python"+sysconfig.get_python_version()
 
 def SdkLocateVisualStudio():
     if (sys.platform != "win32"): return