summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2017-11-28 15:39:56 +0100
committerWerner Koch <wk@gnupg.org>2017-11-28 15:54:59 +0100
commit4a2538e69dd35377bce0fb584f72322c69a111b3 (patch)
tree97123f5455bbde9057cf06aab2d95bd1e573ce1e /m4
parent241e9a73891fcd12f124aab1a299c2cf4f8eebc4 (diff)
downloadlibgpg-error-4a2538e69dd35377bce0fb584f72322c69a111b3.tar.gz
core: New API functions gpgrt_mkdir, gpgrt_chdir, gpgrt_getcwd.
* src/gpg-error.h.in (gpgrt_mkdir, gpgrt_chdir, gpgrt_getcwd): New. * src/visibility.c, src/visibility.h: Add wrappers. * src/gpg-error.vers, src/gpg-error.def.in: Add them. * src/sysutils.c (modestr_to_mode): New. (_gpgrt_mkdir, _gpgrt_chdir, _gpgrt_getcwd): New. * m4/gnupg-misc.m4: New. * m4/Makefile.am (EXTRA_DIST): Add new M4 file. * configure.ac: Call new GNUPG_FUNC_MKDIR_TAKES_ONE_ARG. (AC_CHECK_FUNCS): Add stat. -- The code has been taken from GnuPG. _gpgrt_mkdir was originally written by me as gnupg_mkdir and here relicensed to LGPLv2.1+. _gpgrt_getcwd was originally written by in 2007 and also here relicensed to LGPLv2.1. The new M4 macro was also written by me for use in in GnuPG; it has been taken from GnUPG's acinclude.m4, moved to its own file here, and relicensed to FSFULLR. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'm4')
-rw-r--r--m4/Makefile.am2
-rw-r--r--m4/gnupg-misc.m435
2 files changed, 36 insertions, 1 deletions
diff --git a/m4/Makefile.am b/m4/Makefile.am
index f92d115..b7b1963 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -1,3 +1,3 @@
EXTRA_DIST = inttypes-h.m4 lock.m4 visibility.m4 glibc2.m4 intmax.m4 longdouble.m4 longlong.m4 printf-posix.m4 signed.m4 size_max.m4 wchar_t.m4 wint_t.m4 xsize.m4 ac_prog_cc_for_build.m4 nls.m4 po.m4 codeset.m4 gettext.m4 glibc21.m4 iconv.m4 intdiv0.m4 inttypes.m4 inttypes_h.m4 inttypes-pri.m4 isc-posix.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 progtest.m4 stdint_h.m4 uintmax_t.m4 ulonglong.m4
-EXTRA_DIST += autobuild.m4 estream.m4 readline.m4
+EXTRA_DIST += autobuild.m4 estream.m4 readline.m4 gnupg-misc.m4
diff --git a/m4/gnupg-misc.m4 b/m4/gnupg-misc.m4
new file mode 100644
index 0000000..12f86d8
--- /dev/null
+++ b/m4/gnupg-misc.m4
@@ -0,0 +1,35 @@
+dnl gnupg-misc.m4 - Autoconf macros originally from GnuPG
+dnl Copyright (C) 2017 g10 Code GmbH
+dnl
+dnl This file is free software; as a special exception the author gives
+dnl unlimited permission to copy and/or distribute it, with or without
+dnl modifications, as long as this notice is preserved.
+dnl
+dnl This file is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+dnl SPDX-License-Identifier: FSFULLR
+
+
+dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
+dnl of the usual 2.
+AC_DEFUN([GNUPG_FUNC_MKDIR_TAKES_ONE_ARG],
+[AC_CHECK_HEADERS(sys/stat.h unistd.h direct.h)
+AC_CACHE_CHECK([if mkdir takes one argument], gnupg_cv_mkdir_takes_one_arg,
+[AC_TRY_COMPILE([
+#include <sys/types.h>
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#ifdef HAVE_DIRECT_H
+# include <direct.h>
+#endif], [mkdir ("foo", 0);],
+ gnupg_cv_mkdir_takes_one_arg=no, gnupg_cv_mkdir_takes_one_arg=yes)])
+if test $gnupg_cv_mkdir_takes_one_arg = yes ; then
+ AC_DEFINE(MKDIR_TAKES_ONE_ARG,1,
+ [Defined if mkdir() does not take permission flags])
+fi
+])