aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--config/open-axiom.m48
-rw-r--r--config/openaxiom-c-macros.h.in12
-rwxr-xr-xconfigure41
-rw-r--r--src/ChangeLog7
-rw-r--r--src/Makefile.am2
-rw-r--r--src/Makefile.in2
-rw-r--r--src/gui/gui.pro.in14
-rw-r--r--src/lib/cfuns-c.c10
9 files changed, 94 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index e69de29b..36816a0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -0,0 +1,5 @@
+2014-02-02 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * config/open-axiom.m4 (OPENAXIOM_CHECK_IO): Prefer mktemp,
+ mkdtemp, mkstemp over tempnam.
+
diff --git a/config/open-axiom.m4 b/config/open-axiom.m4
index 2218be2c..410923b1 100644
--- a/config/open-axiom.m4
+++ b/config/open-axiom.m4
@@ -848,7 +848,13 @@ dnl ------------------------
dnl -- OPENAXIOM_CHECK_IO --
dnl ------------------------
AC_DEFUN([OPENAXIOM_CHECK_IO],[
-AC_CHECK_DECLS([tempnam],[],[],[#include <stdio.h>])
+# Utility for temporary pathnames.
+if test -n $ac_cv_header_unistd_h; then
+ AC_CHECK_DECLS([mktemp, mkdtemp, mkstemp], [], [], [[#include <unistd.h>]])
+fi
+if test -n $ac_cv_have_decl_mktemp; then
+ AC_CHECK_DECLS([tempnam],[],[],[[#include <stdio.h>]])
+fi
# Honor support for large files
AC_SYS_LARGEFILE
# What about long file names?
diff --git a/config/openaxiom-c-macros.h.in b/config/openaxiom-c-macros.h.in
index 6a93a786..571fd4d3 100644
--- a/config/openaxiom-c-macros.h.in
+++ b/config/openaxiom-c-macros.h.in
@@ -33,6 +33,18 @@
*/
#undef HAVE_DECL_KILL
+/* Define to 1 if you have the declaration of `mkdtemp', and to 0 if you
+ don't. */
+#undef HAVE_DECL_MKDTEMP
+
+/* Define to 1 if you have the declaration of `mkstemp', and to 0 if you
+ don't. */
+#undef HAVE_DECL_MKSTEMP
+
+/* Define to 1 if you have the declaration of `mktemp', and to 0 if you don't.
+ */
+#undef HAVE_DECL_MKTEMP
+
/* Define to 1 if you have the declaration of `openpty', and to 0 if you
don't. */
#undef HAVE_DECL_OPENPTY
diff --git a/configure b/configure
index 879658f5..1c674e1f 100755
--- a/configure
+++ b/configure
@@ -18443,7 +18443,45 @@ _ACEOF
#OPENAXIOM_CHECK_GMP
-ac_fn_cxx_check_decl "$LINENO" "tempnam" "ac_cv_have_decl_tempnam" "#include <stdio.h>
+# Utility for temporary pathnames.
+if test -n $ac_cv_header_unistd_h; then
+ ac_fn_cxx_check_decl "$LINENO" "mktemp" "ac_cv_have_decl_mktemp" "#include <unistd.h>
+"
+if test "x$ac_cv_have_decl_mktemp" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_MKTEMP $ac_have_decl
+_ACEOF
+ac_fn_cxx_check_decl "$LINENO" "mkdtemp" "ac_cv_have_decl_mkdtemp" "#include <unistd.h>
+"
+if test "x$ac_cv_have_decl_mkdtemp" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_MKDTEMP $ac_have_decl
+_ACEOF
+ac_fn_cxx_check_decl "$LINENO" "mkstemp" "ac_cv_have_decl_mkstemp" "#include <unistd.h>
+"
+if test "x$ac_cv_have_decl_mkstemp" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_MKSTEMP $ac_have_decl
+_ACEOF
+
+fi
+if test -n $ac_cv_have_decl_mktemp; then
+ ac_fn_cxx_check_decl "$LINENO" "tempnam" "ac_cv_have_decl_tempnam" "#include <stdio.h>
"
if test "x$ac_cv_have_decl_tempnam" = xyes; then :
ac_have_decl=1
@@ -18455,6 +18493,7 @@ cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_TEMPNAM $ac_have_decl
_ACEOF
+fi
# Honor support for large files
# Check whether --enable-largefile was given.
if test "${enable_largefile+set}" = set; then :
diff --git a/src/ChangeLog b/src/ChangeLog
index e69de29b..6faf0d71 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -0,0 +1,7 @@
+2014-02-02 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
+ * Makefile.am (all-gui): Depend on all-syntax.
+ * gui/gui.pro.in: Fix qmake idiocy on mac os.
+ * lib/cfuns-c.c (make_c_str): New helper.
+ (oa_acquire_temporary_pathname): Use it. Prefer mktemp.
+
diff --git a/src/Makefile.am b/src/Makefile.am
index fe1f8387..41bae540 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -119,7 +119,7 @@ all-clef: all-lib
all-sman: all-lib all-driver
cd sman && $(MAKE) $(AM_MAKEFLAGS) $@
-all-gui: all-driver all-io all-rt
+all-gui: all-driver all-io all-rt all-syntax
cd gui && $(MAKE) $(AM_MAKEFLAGS)
all-hyper: all-lib all-io
diff --git a/src/Makefile.in b/src/Makefile.in
index 72b95864..7890895f 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -770,7 +770,7 @@ all-clef: all-lib
all-sman: all-lib all-driver
cd sman && $(MAKE) $(AM_MAKEFLAGS) $@
-all-gui: all-driver all-io all-rt
+all-gui: all-driver all-io all-rt all-syntax
cd gui && $(MAKE) $(AM_MAKEFLAGS)
all-hyper: all-lib all-io
diff --git a/src/gui/gui.pro.in b/src/gui/gui.pro.in
index c67666d6..a34f55cc 100644
--- a/src/gui/gui.pro.in
+++ b/src/gui/gui.pro.in
@@ -18,6 +18,17 @@ macx {
CONFIG -= app_bundle
}
+macx-g++ {
+ QMAKE_CFLAGS -= -Xarch_x86_64
+ QMAKE_CFLAGS_X86_64 -= -Xarch_x86_64
+
+ QMAKE_CXXFLAGS -= -Xarch_x86_64
+ QMAKE_CXXFLAGS_X86_64 -= -Xarch_x86_64
+
+ QMAKE_LFLAGS -= -Xarch_x86_64
+ QMAKE_LFLAGS_X86_64 -= -Xarch_x86_64
+}
+
## We are building a GUI application.
TEMPLATE = app
@@ -43,5 +54,6 @@ SOURCES += server.cc conversation.cc main-window.cc debate.cc main.cc
LIBS += $$OA_RT_LIB $$OA_SYNTAX_LIB $$OA_LIB $$OA_IOLIB
## C++ compiler
-#QMAKE_CXX = @CXX@
+QMAKE_CXX = @CXX@
QMAKE_CXXFLAGS += -std=c++11
+QMAKE_LINK = @CXX@
diff --git a/src/lib/cfuns-c.c b/src/lib/cfuns-c.c
index ec9a139d..856e4bcc 100644
--- a/src/lib/cfuns-c.c
+++ b/src/lib/cfuns-c.c
@@ -79,6 +79,11 @@
#endif
namespace OpenAxiom {
+ // Make a copy of string data on free store.
+ static char*
+ copy_c_str(const std::string& s) {
+ return strdup(s.c_str());
+ }
OPENAXIOM_C_EXPORT int
addtopath(char *dir)
@@ -500,11 +505,12 @@ oa_acquire_temporary_pathname() {
exit(1);
}
return strdup(buf);
+#elif HAVE_DECL_MKTEMP
+ return mktemp(copy_c_str(std::string{ oa_get_tmpdir() } + "/oa-XXXXXX"));
#elif HAVE_DECL_TEMPNAM
return tempnam(oa_get_tmpdir(), "oa-");
#else
- std::string s = "oa-" + std::to_string(random());
- return strdup(s.c_str());
+ return copy_c_str("oa-" + std::to_string(random()));
#endif
}