From bd244987b9175ae3edf7c5f7417340a0a37427a8 Mon Sep 17 00:00:00 2001 From: pjk Date: Wed, 28 Apr 2004 20:59:26 +0000 Subject: [PATCH] configure.ac: check for presence / add libgnugetopt to support getopt_long on FreeBSD algorithm.c, alloc.h: Wrap includes of alloca.h with #ifdef HAVE_ALLOCA_H. Some platforms (FreeBSD for example) have alloca in stdlib.h... Autoconf detects this in AC_FUNC_ALLOCA --- configure.ac | 1 + src/algorithm.c | 3 +++ src/alloc.h | 2 ++ 3 files changed, 6 insertions(+) diff --git a/configure.ac b/configure.ac index 5015f73a..69ac564b 100644 --- a/configure.ac +++ b/configure.ac @@ -30,6 +30,7 @@ AC_CHECK_LIB(gslcblas,main,,AC_MSG_ERROR([You must install libgslcblas])) AC_CHECK_LIB(gsl, gsl_cdf_chisq_Q,, AC_MSG_ERROR([You must install libgsl version 1.4 or later])) +AC_CHECK_LIB(gnugetopt,getopt_long) AC_CHECK_FUNC(getopt_long,, AC_MSG_ERROR(`This application depends upon getopt_long')) diff --git a/src/algorithm.c b/src/algorithm.c index 89e813de..230b1437 100644 --- a/src/algorithm.c +++ b/src/algorithm.c @@ -511,7 +511,10 @@ lexicographical_compare_3way (const void *array1, size_t count1, Engineering a sort function; Jon Bentley and M. Douglas McIlroy; Software - Practice and Experience; Vol. 23 (11), 1249-1265, 1993. */ +#ifdef HAVE_ALLOCA_H #include +#endif + #include #include #include diff --git a/src/alloc.h b/src/alloc.h index b1b34d0f..b44f0f38 100644 --- a/src/alloc.h +++ b/src/alloc.h @@ -30,7 +30,9 @@ char *xstrdup (const char *s); /* alloca() wrapper functions. */ #if defined (HAVE_ALLOCA) || defined (C_ALLOCA) +#ifdef HAVE_ALLOCA_H #include +#endif #define local_alloc(X) alloca (X) #define local_free(P) ((void) 0) #else -- 2.30.2