summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--configure.ac15
-rw-r--r--src/eval.c10
-rw-r--r--src/jobs.c9
4 files changed, 36 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 95e5140..38bf009 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-01-13  Mark Mentovai <mmentovai@gmail.com>
+
+	* Fixed build on OS X.
+
 2008-12-26  Aleksey Cheusov <vle@gmx.net>
 
 	* Fixed build on NetBSD.
diff --git a/configure.ac b/configure.ac
index 221b839..f46e260 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,6 +18,18 @@ fi
 AC_MSG_RESULT(${CC_FOR_BUILD})
 AC_SUBST(CC_FOR_BUILD)
 
+AC_MSG_CHECKING([for __attribute__((__alias__()))])
+dash_cv_have_attribute_alias=no
+AC_LINK_IFELSE([AC_LANG_PROGRAM([void t() {}
+                                 void a() __attribute__((__alias__("t")));],
+                                [a();])],
+               [dash_cv_have_attribute_alias=yes])
+AC_MSG_RESULT($dash_cv_have_attribute_alias)
+if test "x$dash_cv_have_attribute_alias" = xyes; then
+  AC_DEFINE([HAVE_ALIAS_ATTRIBUTE], 1,
+            [Define if __attribute__((__alias__())) is supported])
+fi
+
 AC_ARG_ENABLE(static, AS_HELP_STRING(--enable-static, \
 				     [Build statical linked program]))
 if test "$enable_static" = "yes"; then
@@ -60,6 +72,9 @@ AC_CHECK_FUNC(stat64,, [
 	AC_DEFINE(fstat64, fstat, [64-bit operations are the same as 32-bit])
 	AC_DEFINE(lstat64, lstat, [64-bit operations are the same as 32-bit])
 	AC_DEFINE(stat64, stat, [64-bit operations are the same as 32-bit])
+])
+
+AC_CHECK_FUNC(open64,, [
 	AC_DEFINE(open64, open, [64-bit operations are the same as 32-bit])
 ])
 
diff --git a/src/eval.c b/src/eval.c
index 77291b4..0b449ee 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -326,7 +326,15 @@ exexit:
 #if !defined(__alpha__) || (defined(__GNUC__) && __GNUC__ >= 3)
 STATIC
 #endif
-void evaltreenr(union node *, int) __attribute__ ((alias("evaltree")));
+void evaltreenr(union node *n, int flags)
+#ifdef HAVE_ATTRIBUTE_ALIAS
+	__attribute__ ((alias("evaltree")));
+#else
+{
+	evaltree(n, flags);
+	abort();
+}
+#endif
 
 
 STATIC void
diff --git a/src/jobs.c b/src/jobs.c
index 40dc8f6..2b6a752 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -361,7 +361,14 @@ fgcmd(int argc, char **argv)
 	return retval;
 }
 
-int bgcmd(int, char **) __attribute__((__alias__("fgcmd")));
+int bgcmd(int argc, char **argv)
+#ifdef HAVE_ALIAS_ATTRIBUTE
+	__attribute__((__alias__("fgcmd")));
+#else
+{
+	return fgcmd(argc, argv);
+}
+#endif
 
 
 STATIC int