[Groonga-commit] groonga/groonga [master] define _*_SOURCE in configure.

Back to archive index

null+****@clear***** null+****@clear*****
2011年 10月 25日 (火) 16:12:20 JST


Kouhei Sutou	2011-10-25 07:12:20 +0000 (Tue, 25 Oct 2011)

  New Revision: 3992ac3ed61280893e10237c9bb2e278a3a45f60

  Log:
    define _*_SOURCE in configure.

  Modified files:
    configure.ac
    lib/groonga_in.h

  Modified: configure.ac (+31 -10)
===================================================================
--- configure.ac    2011-10-25 07:04:13 +0000 (2fe7b3e)
+++ configure.ac    2011-10-25 07:12:20 +0000 (c4d4da0)
@@ -39,6 +39,17 @@ AC_MSG_RESULT([$platform_win32])
 AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
 AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
 
+AC_MSG_CHECKING([for NetBSD.])
+case "$host_os" in
+  netbsd*)
+    netbsd=yes
+    ;;
+  *)
+    netbsd=no
+    ;;
+esac
+AC_MSG_RESULT([$netbsd])
+
 AC_C_BIGENDIAN
 AC_PROG_CXX
 AC_PROG_CC
@@ -174,6 +185,26 @@ AC_CONFIG_FILES([
   test/benchmark/lib/Makefile
 ])
 
+if test "$GCC" = "yes"; then
+  AC_DEFINE(_GNU_SOURCE, [1], [Define to 1 if you use GCC.])
+fi
+
+if test "$netbsd" = "yes"; then
+  AC_DEFINE(_NETBSD_SOURCE, [1], [Define to 1 if you are on NetBSD.])
+fi
+
+# AIO
+AC_ARG_ENABLE(aio,
+  [AS_HELP_STRING([--enable-aio],
+                  [use aio/dio based cache. [default=no]])],
+  ,
+  [enable_aio="no"])
+if test "x$enable_aio" != "xno"; then
+  AC_DEFINE(_XOPEN_SOURCE, [600], [Define to 600 for use AIO.])
+  AC_CHECK_LIB(rt, nanosleep, [], [AC_MSG_ERROR("No librt found")])
+  AC_DEFINE(USE_AIO, [1], [use AIO/DIO])
+fi
+
 AC_CHECK_HEADERS(sys/mman.h sys/time.h sys/timeb.h sys/param.h sys/types.h sys/resource.h)
 AC_CHECK_HEADERS(netdb.h sys/wait.h sys/socket.h netinet/in.h netinet/tcp.h)
 AC_CHECK_HEADERS(ucontext.h signal.h errno.h execinfo.h sys/sysctl.h)
@@ -252,16 +283,6 @@ AC_CHECK_LIB(nsl, gethostbyname, [NSL_LIBS="-lnsl"])
 AC_CHECK_LIB(socket, socket, [SOCKET_LIBS="-lsocket"])
 AC_CHECK_LIB(dl, dlopen, [NSL_LIBS="-ldl"])
 
-# aio
-AC_ARG_ENABLE(aio,
-  [AS_HELP_STRING([--enable-aio],
-    [use aio/dio based cache. [default=no]])],,
-  [enable_aio="no"])
-if test "x$enable_aio" != "xno"; then
-  AC_CHECK_LIB(rt, nanosleep, [], [AC_MSG_ERROR("No librt found")])
-  AC_DEFINE(USE_AIO, [1], [use AIO/DIO])
-fi
-
 # nfkc
 AC_ARG_ENABLE(nfkc,
   [AS_HELP_STRING([--enable-nfkc],

  Modified: lib/groonga_in.h (+0 -19)
===================================================================
--- lib/groonga_in.h    2011-10-25 07:04:13 +0000 (d1ea5fa)
+++ lib/groonga_in.h    2011-10-25 07:12:20 +0000 (c062402)
@@ -19,29 +19,10 @@
 #ifndef GROONGA_IN_H
 #define GROONGA_IN_H
 
-#ifdef __GNUC__
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif /* _GNU_SOURCE */
-#endif /* __GNUC__ */
-
-#if defined(__NetBSD__) && !defined(_NETBSD_SOURCE)
-#define _NETBSD_SOURCE 1
-#endif /* defined(__NetBSD__) && !defined(_NETBSD_SOURCE) */
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 
-#ifdef USE_AIO
-/* #define __USE_XOPEN2K 1 */
-#define _XOPEN_SOURCE 600
-#else
-#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__DragonFly__)
-#define _XOPEN_SOURCE 520
-#endif
-#endif /* USE_AIO */
-
 #ifdef __cplusplus
 #define __STDC_LIMIT_MACROS
 #endif




Groonga-commit メーリングリストの案内
Back to archive index