[glib] build: Look for mkostemp when configuring



commit f40154e2182a868f66b63ae62b4fc9ff0ebb7566
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Oct 9 11:46:48 2017 +0100

    build: Look for mkostemp when configuring
    
    We use this function, but it may be missing on older Linux platforms.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788705

 config.h.meson |    3 +++
 configure.ac   |    2 +-
 meson.build    |    8 ++++++++
 3 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/config.h.meson b/config.h.meson
index ac0b5e0..6f0b7e4 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -376,6 +376,9 @@
 /* Define to 1 if you have the `statvfs' function. */
 #mesondefine HAVE_STATVFS
 
+/* Define to 1 if you have the `mkostemp' function. */
+#mesondefine HAVE_MKOSTEMP
+
 /* Define to 1 if you have the <stddef.h> header file. */
 #mesondefine HAVE_STDDEF_H
 
diff --git a/configure.ac b/configure.ac
index 39a90a9..21be55b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -880,7 +880,7 @@ int main ()
 AC_MSG_RESULT($glib_ssize_type)
 
 # Check for some functions
-AC_CHECK_FUNCS(lstat strsignal vsnprintf stpcpy strcasecmp strncasecmp poll vasprintf setenv unsetenv 
getc_unlocked readlink symlink fdwalk)
+AC_CHECK_FUNCS(lstat strsignal vsnprintf stpcpy strcasecmp strncasecmp poll vasprintf setenv unsetenv 
getc_unlocked readlink symlink fdwalk mkostemp)
 AC_CHECK_FUNCS(lchmod lchown fchmod fchown utimes getresuid)
 AC_CHECK_FUNCS(getmntent_r setmntent endmntent hasmntopt getfsstat getvfsstat fallocate)
 case $host_os in aix*) ac_cv_func_splice=no ;; esac # AIX splice() is something else
diff --git a/meson.build b/meson.build
index 65ab92f..b38123d 100644
--- a/meson.build
+++ b/meson.build
@@ -451,6 +451,14 @@ else
 endif
 message('Checking whether to use statfs or statvfs .. ' + stat_func_to_use)
 
+if host_system == 'linux'
+  if cc.has_function('mkostemp',
+                     prefix: '''#define _GNU_SOURCE
+                                #include <stdlib.h>''')
+    glib_conf.set('HAVE_MKOSTEMP', 1)
+  endif
+endif
+
 # Mac OS X Carbon support
 glib_have_carbon = cc.compiles('''#include <Carbon/Carbon.h>
                                   #include <CoreServices/CoreServices.h>''',


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]