OSDN Git Service

Explicitly require C99 and define _GNU_SOURCE to enable all needed functions.
authorresver <resver@60bc1c72-a15a-11de-b98f-4500b42dc123>
Fri, 18 May 2012 16:05:13 +0000 (16:05 +0000)
committerresver <resver@60bc1c72-a15a-11de-b98f-4500b42dc123>
Fri, 18 May 2012 16:05:13 +0000 (16:05 +0000)
git-svn-id: http://exfat.googlecode.com/svn/trunk@288 60bc1c72-a15a-11de-b98f-4500b42dc123

SConstruct
libexfat/io.c

index f427de1..3206c54 100644 (file)
@@ -36,9 +36,9 @@ if 'CCFLAGS' in os.environ:
 # Set default CCFLAGS for known compilers
 if not conf.env['CCFLAGS']:
        if conf.env['CC'] == 'gcc':
-               conf.env.Replace(CCFLAGS = '-Wall -O2 -ggdb')
+               conf.env.Replace(CCFLAGS = '-Wall -O2 -ggdb -std=c99')
        elif conf.env['CC'] == 'clang':
-               conf.env.Replace(CCFLAGS = '-Wall -O2 -g')
+               conf.env.Replace(CCFLAGS = '-Wall -O2 -g -std=c99')
 if 'CPPFLAGS' in os.environ:
        conf.env.Replace(CPPFLAGS = os.environ['CPPFLAGS'])
 conf.env.Append(CPPDEFINES = {'_FILE_OFFSET_BITS' : 64})
@@ -47,6 +47,12 @@ if 'LDFLAGS' in os.environ:
        conf.env.Append(LINKFLAGS = os.environ['LDFLAGS'])
 conf.env.Append(LIBPATH = ['libexfat'])
 
+# GNU/Linux requires _BSD_SOURCE define for vsyslog(), _XOPEN_SOURCE >= 500 for
+# pread(), pwrite(), snprintf(), strdup(), etc. Everything needed is enabled by
+# _GNU_SOURCE.
+if platform.system() == 'Linux':
+       conf.env.Append(CPPDEFINES = '_GNU_SOURCE');
+
 # __DARWIN_64_BIT_INO_T=0 define is needed because since Snow Leopard inode
 # numbers are 64-bit by default, but libfuse operates 32-bit ones. This define
 # forces 32-bit inode declaration in system headers, but it's also possible to
index 8e9de8c..f0beddc 100644 (file)
@@ -18,7 +18,6 @@
        along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#define _XOPEN_SOURCE 500 /* for pread() and pwrite() in Linux */
 #include "exfat.h"
 #include <inttypes.h>
 #include <sys/types.h>