Linux build : fix undefined pragma
[scilab.git] / scilab / m4 / largefile.m4
1 dnl This code comes from evolution-data-server
2 dnl License LGPL
3
4 AC_DEFUN([AC_CUSTOM_LARGE_FILE], [
5 dnl *************************************
6 dnl *** Checks for large file support ***
7 dnl *************************************
8     AC_SYS_LARGEFILE
9     AC_CACHE_CHECK([for _LARGEFILE64_SOURCE value needed for large files], largefile64_cv_source,
10     [
11         AC_TRY_COMPILE([
12                 #include <sys/types.h>
13                 #include <sys/stat.h>
14                 #include <fcntl.h>
15         ],[
16                 int fd = open ("__o_largefile", O_CREAT | O_RDWR | O_LARGEFILE, 0644);
17         ],[
18                 largefile64_source="no"
19         ],[
20                 AC_TRY_COMPILE([
21                         #define _LARGEFILE64_SOURCE
22                         #include <sys/types.h>
23                         #include <sys/stat.h>
24                         #include <fcntl.h>
25                 ],[
26                         int fd = open ("__o_largefile", O_CREAT | O_RDWR | O_LARGEFILE, 0644);
27                 ],[
28                         largefile64_source="yes"
29                 ],[
30                         largefile64_source="unknown"
31                 ])
32         ])
33     ])
34
35     if test "x$largefile64_source" = "xyes"; then
36         LARGEFILE_CFLAGS="-D_LARGEFILE64_SOURCE"
37         enable_largefile="yes"
38     elif test "x$largefile64_source" = "xunknown"; then
39         AC_DEFINE(O_LARGEFILE, 0, [Define to 0 if your system does not have the O_LARGEFILE flag])
40     fi
41
42     if test -n "$ac_cv_sys_large_files" -a "x$ac_cv_sys_large_files" != "xno"; then
43         LARGEFILE_CFLAGS="$LARGEFILE_CFLAGS -D_LARGE_FILES"
44         enable_largefile="yes"
45     fi
46
47     if test "x$ac_cv_sys_file_offset_bits" != "xno"; then
48         LARGEFILE_CFLAGS="$LARGEFILE_CFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
49         enable_largefile="yes"
50     fi
51
52 ])