Make libyasm a "real" library, including installing header files.
Start separating modules and frontends from libyasm internals.
svn path=/trunk/yasm/; revision=849
diff --git a/libyasm/mergesort.c b/libyasm/mergesort.c
index 3ec4b80..6014389 100644
--- a/libyasm/mergesort.c
+++ b/libyasm/mergesort.c
@@ -31,6 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
+#define YASM_LIB_INTERNAL
#include "util.h"
/*@unused@*/ RCSID("$IdPath$");
@@ -38,6 +39,11 @@
static char sccsid[] = "@(#)merge.c 8.2 (Berkeley) 2/14/94";
#endif /* LIBC_SCCS and not lint */
+#ifdef HAVE_MERGESORT
+#undef yasm__mergesort
+#endif
+
+#ifndef HAVE_MERGESORT
/*
* Hybrid exponential search/linear search merge sort with hybrid
* natural/pairwise first pass. Requires about .3% more comparisons
@@ -91,14 +97,18 @@
#define EVAL(p) (unsigned char **) \
((unsigned char *)0 + \
(((unsigned char *)p + PSIZE - 1 - (unsigned char *) 0) & ~(PSIZE - 1)))
+#endif /*HAVE_MERGESORT*/
/*
* Arguments are as for qsort.
*/
int
-mergesort(void *base, size_t nmemb, size_t size,
- int (*cmp)(const void *, const void *))
+yasm__mergesort(void *base, size_t nmemb, size_t size,
+ int (*cmp)(const void *, const void *))
{
+#ifdef HAVE_MERGESORT
+ return mergesort(base, nmemb, size, cmp);
+#else
size_t i;
int sense;
int big, iflag;
@@ -232,8 +242,11 @@
}
xfree(list2);
return (0);
+#endif /*HAVE_MERGESORT*/
}
+#ifndef HAVE_MERGESORT
+
#define swap(a, b) { \
s = b; \
i = size; \
@@ -348,3 +361,4 @@
swap(u, t);
}
}
+#endif /*HAVE_MERGESORT*/