summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2016-05-18 19:30:34 -0400
committerMike Frysinger <vapier@gentoo.org>2016-05-18 19:30:34 -0400
commitf79d0a8bacc967682dd64a5e39bf17c09b8398dc (patch)
treef9275bfb04580046a9a88c8ce2d76d0f4947a28a /m4
parente6bf7714d7911e909bc9f239ef92bb4c5783d668 (diff)
downloadlibgd-f79d0a8bacc967682dd64a5e39bf17c09b8398dc.tar.gz
m4: use an older openmp macro
The newer one requires autoconf-2.69 but that version isn't available in Ubuntu Precise which is what the Travis CI bots run.
Diffstat (limited to 'm4')
-rw-r--r--m4/ax_openmp.m434
1 files changed, 12 insertions, 22 deletions
diff --git a/m4/ax_openmp.m4 b/m4/ax_openmp.m4
index 4d5d88b..8fe18c8 100644
--- a/m4/ax_openmp.m4
+++ b/m4/ax_openmp.m4
@@ -38,7 +38,6 @@
# LICENSE
#
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
-# Copyright (c) 2015 John W. Peterson <jwpeterson@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
@@ -66,10 +65,10 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 11
+#serial 9
AC_DEFUN([AX_OPENMP], [
-AC_PREREQ([2.69]) dnl for _AC_LANG_PREFIX
+AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX
AC_CACHE_CHECK([for OpenMP flag of _AC_LANG compiler], ax_cv_[]_AC_LANG_ABBREV[]_openmp, [save[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
ax_cv_[]_AC_LANG_ABBREV[]_openmp=unknown
@@ -84,27 +83,18 @@ for ax_openmp_flag in $ax_openmp_flags; do
none) []_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[] ;;
*) []_AC_LANG_PREFIX[]FLAGS="$save[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flag" ;;
esac
- AC_LINK_IFELSE([AC_LANG_SOURCE([[
-@%:@include <omp.h>
+ AC_TRY_LINK([#ifdef __cplusplus
+extern "C"
+#endif
+void omp_set_num_threads(int);], [const int N = 100000;
+ int i, arr[N];
-static void
-parallel_fill(int * data, int n)
-{
- int i;
-@%:@pragma omp parallel for
- for (i = 0; i < n; ++i)
- data[i] = i;
-}
-
-int
-main()
-{
- int arr[100000];
omp_set_num_threads(2);
- parallel_fill(arr, 100000);
- return 0;
-}
-]])],[ax_cv_[]_AC_LANG_ABBREV[]_openmp=$ax_openmp_flag; break],[])
+
+ #pragma omp parallel for
+ for (i = 0; i < N; i++) {
+ arr[i] = i;
+ }], [ax_cv_[]_AC_LANG_ABBREV[]_openmp=$ax_openmp_flag; break])
done
[]_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[]FLAGS
])