Gentoo Archives: gentoo-commits

From: "Sebastien Fabbro (bicatali)" <bicatali@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sci-libs/cfitsio/files: cfitsio-3.240-autotools.patch cfitsio-3.230-autotools.patch cfitsio-3.210-autotools.patch
Date: Mon, 01 Feb 2010 22:10:52
Message-Id: E1Nc4Tp-00017t-Nx@stork.gentoo.org
1 bicatali 10/02/01 22:10:49
2
3 Added: cfitsio-3.240-autotools.patch
4 Removed: cfitsio-3.230-autotools.patch
5 cfitsio-3.210-autotools.patch
6 Log:
7 Version bump. Removed some older buggy versions
8 (Portage version: 2.2_rc61/cvs/Linux x86_64)
9
10 Revision Changes Path
11 1.1 sci-libs/cfitsio/files/cfitsio-3.240-autotools.patch
12
13 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sci-libs/cfitsio/files/cfitsio-3.240-autotools.patch?rev=1.1&view=markup
14 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sci-libs/cfitsio/files/cfitsio-3.240-autotools.patch?rev=1.1&content-type=text/plain
15
16 Index: cfitsio-3.240-autotools.patch
17 ===================================================================
18 --- cfitsio.pc.in.orig 2009-11-27 06:39:03.000000000 +0000
19 +++ cfitsio.pc.in 2010-01-04 18:51:00.000000000 +0000
20 @@ -1,11 +1,11 @@
21 prefix=@prefix@
22 exec_prefix=@exec_prefix@
23 -libdir=${exec_prefix}/lib
24 -includedir=${prefix}/include
25 +libdir=@libdir@
26 +includedir=@includedir@
27
28 -Name: cfitsio
29 +Name: @PACKAGE_NAME@
30 Description: FITS File Subroutine Library
31 -Version: 3.24
32 +Version: @PACKAGE_VERSION@
33 Libs: -L${libdir} -lcfitsio @LIBS@
34 Libs.private: -lm
35 Cflags: -I${includedir}
36 --- configure.ac.orig 1970-01-01 01:00:00.000000000 +0100
37 +++ configure.ac 2010-01-04 18:39:51.000000000 +0000
38 @@ -0,0 +1,195 @@
39 +AC_PREREQ(2.62)
40 +AC_INIT([cfitsio], [3.230], [pence@×××××××××××××××.gov])
41 +AC_CONFIG_SRCDIR([fitscore.c])
42 +AM_INIT_AUTOMAKE([foreign])
43 +
44 +AC_MSG_CHECKING([whether to enable POSIX threads])
45 +AC_ARG_ENABLE([threads],
46 + [AS_HELP_STRING([--enable-threads], [Enable POSIX threads [default=yes]])],
47 + [enable_threads=$enableval],
48 + [enable_threads=no])
49 +
50 +sinclude(ax_pthread.m4)
51 +AX_PTHREAD(,[enable_threads=no])
52 +if test x"$enable_threads" != xno; then
53 + LIBS="$PTHREAD_LIBS $LIBS"
54 + CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
55 + CC="$PTHREAD_CC"
56 + AC_DEFINE(_REENTRANT)
57 +fi
58 +
59 +AC_PROG_LIBTOOL
60 +dnl no api version info, so simply copy package version
61 +SHARED_VERSION_INFO="3:0:0"
62 +AC_SUBST(SHARED_VERSION_INFO)
63 +
64 +AC_PROG_YACC
65 +AC_PROG_LEX
66 +
67 +AC_MSG_CHECKING([whether to enable fortran interface])
68 +AC_ARG_ENABLE([fortran],
69 + [AS_HELP_STRING([--enable-fortran], [Compile the fortran interface [default=yes]])],
70 + [ENABLE_FORTRAN=$enableval])
71 +
72 +case x"$ENABLE_FORTRAN" in
73 + xno)
74 + ENABLE_FORTRAN=no
75 + AC_MSG_RESULT([no])
76 + ;;
77 + *)
78 + ENABLE_FORTRAN=yes
79 + AC_MSG_RESULT([yes])
80 + AC_PROG_F77
81 + if test x$F77 = xg77; then
82 + cfortran_def=g77Fortran
83 + elif test x$F77 = xifort ; then
84 + cfortran_def=INTEL_COMPILER
85 + elif test x$F77 = xgfortran ; then
86 + cfortran_def=gFortran
87 + elif test x$F77 = xpgf77 ; then
88 + cfortran_def=pgiFortran
89 + else
90 + cfortran_def=f2cFortran
91 + fi
92 + CPPFLAGS_FORTRAN="-D$cfortran_def"
93 + AC_SUBST(CPPFLAGS_FORTRAN)
94 + ;;
95 +esac
96 +
97 +AC_SUBST([ENABLE_FORTRAN])
98 +AM_CONDITIONAL([ENABLE_FORTRAN], test "x$ENABLE_FORTRAN" = "xyes")
99 +
100 +AC_CANONICAL_HOST
101 +case $host in
102 + *apple*darwin*)
103 + dnl may break Absoft compilers
104 + AC_DEFINE(_LARGEFILE_SOURCE, [1],
105 + [Define to 1 if you have large file support])
106 + AC_DEFINE(_FILE_OFFSET_BITS, [64],
107 + [Offsets bits in files])
108 + ;;
109 + *hppa*)
110 + CPPFLAGS_EXTRA="-DPG_PPU"
111 + ;;
112 + *sunos5*)
113 + AC_DEFINE(_LARGEFILE_SOURCE, [1],
114 + [Define to 1 if you have large file support])
115 + AC_DEFINE(_FILE_OFFSET_BITS, [64],
116 + [Offsets bits in files])
117 + CPPFLAGS_EXTRA="-DHAVE_ALLOCA_H -DHAVE_POSIX_SIGNALS"
118 + ;;
119 + *irix*)
120 + CPPFLAGS_EXTRA="-DHAVE_POSIX_SIGNALS"
121 + ;;
122 + *linux*)
123 + AC_DEFINE(_LARGEFILE_SOURCE, [1],
124 + [Define to 1 if you have large file support])
125 + AC_DEFINE(_FILE_OFFSET_BITS, [64],
126 + [Offsets bits in files])
127 + ;;
128 + *cygwin*)
129 + CPPFLAGS_EXTRA="-DHAVE_POSIX_SIGNALS"
130 + ;;
131 + *)
132 + ;;
133 +esac
134 +AC_SUBST(CPPFLAGS_EXTRA)
135 +
136 +AC_CHECK_FUNCS([ftruncate])
137 +AC_CHECK_FUNCS([shmat shmdt shmget],
138 + AC_DEFINE(HAVE_SHMEM_SERVICES, [1],
139 + [Define to yes if you have shared memory functions])
140 +)
141 +AC_CHECK_FUNCS([gethostbyname connect],
142 + [AC_DEFINE(HAVE_NET_SERVICES, [1],
143 + [Define to 1 if you have network functions])]
144 +)
145 +AC_CHECK_TYPE(long long,
146 + [AC_DEFINE(HAVE_LONGLONG, [1],
147 + [Define to 1 if your compiler supports long long])]
148 +)
149 +dnl check for flock_t
150 +AC_MSG_CHECKING([for flock_t in sys/fcntl.h])
151 +AC_COMPILE_IFELSE(
152 + [AC_LANG_PROGRAM([[
153 +#include <sys/fcntl.h>
154 + ]], [[
155 +flock_t filler;
156 + ]])],
157 + [AC_DEFINE(HAVE_FLOCK_T, 1, [if you have flock_t])
158 + AC_MSG_RESULT([yes])],
159 + [AC_MSG_RESULT([no]) ])
160 +
161 +if test "$HAVE_FLOCK_T" != 1; then
162 + AC_MSG_CHECKING([for flock_t in sys/flock.h])
163 + AC_COMPILE_IFELSE([
164 + AC_LANG_PROGRAM([[
165 +#include <sys/flock.h>
166 + ]], [[
167 +flock_t filler;
168 + ]])],
169 + [AC_DEFINE(HAVE_FLOCK_T, 1, [if you have flock_t])
170 + AC_MSG_RESULT([yes])],
171 + [AC_MSG_RESULT([no]) ])
172 +fi
173 +
174 +# check for union semun type
175 +AC_CHECK_TYPE(union semun,
176 + AC_DEFINE(HAVE_UNION_SEMUN, [1],
177 + [Define to 1 if you have semun in sys/sem.h]),,[
178 +#include <sys/types.h>
179 +#include <sys/ipc.h>
180 +#include <sys/sem.h>
181 + ]
182 +)
183 +
184 +dnl this quick check will add -lm to LIBS
185 +AC_CHECK_LIB(m, cos)
186 +
187 +AC_ARG_WITH([gsiftp-flavour],
188 + [AC_HELP_STRING([--with-gsiftp-flavour[=PATH]], [Compile with a given Globus Toolkit gsiftp protocol flavour])],
189 + ,
190 + [withval=no])
191 +
192 +case x$withval in
193 + xno)
194 + AC_MSG_CHECKING([for Globus flavor])
195 + AC_MSG_RESULT([none])
196 + ;;
197 + xyes)
198 + AC_MSG_RESULT([yes])
199 + ;;
200 + *)
201 + AC_MSG_RESULT([$withval])
202 + GSIFTP_FLAVOUR=$withval
203 + AC_DEFINE(GSIFTP_FLAVOUR, [1],
204 + [Define to 1 if you want Globus Toolkit architecture])
205 + ;;
206 +esac
207 +
208 +AC_ARG_WITH(gsiftp,
209 + [AC_HELP_STRING([--with-gsiftp[=PATH]], [Compile with Globus Toolkit gsiftp protocol support [default=no]])],
210 + ,
211 + [withval=no])
212 +case "x$withval" in
213 + xno)
214 + AC_MSG_CHECKING([for Globus Toolkit])
215 + AC_MSG_RESULT([no])
216 + ;;
217 + xyes)
218 + AC_MSG_RESULT([yes])
219 + ;;
220 + *)
221 + AC_MSG_RESULT([yes])
222 + CPPFLAGS_GLOBUS="-I${withval}/include/${GSIFTP_FLAVOUR}"
223 + LIBS_GLOBUS="-L${withval}/lib -lglobus_ftp_client_${GSIFTP_FLAVOUR}"
224 + HAVE_GSIFTP=yes
225 + AC_DEFINE(HAVE_GSIFTP, [1],
226 + [Define if you want Globus Toolkit gsiftp protocol support])
227 + ;;
228 +esac
229 +
230 +AC_SUBST(CPPFLAGS_GLOBUS)
231 +AC_SUBST(LIBS_GLOBUS)
232 +AC_CONFIG_FILES([Makefile cfitsio.pc])
233 +AC_OUTPUT
234 --- Makefile.am.orig 1970-01-01 01:00:00.000000000 +0100
235 +++ Makefile.am 2009-12-08 19:00:18.000000000 +0000
236 @@ -0,0 +1,86 @@
237 +lib_LTLIBRARIES = libcfitsio.la
238 +
239 +C_SOURCES = \
240 + buffers.c cfileio.c checksum.c compress.c drvrfile.c drvrmem.c \
241 + drvrnet.c drvrsmem.c drvrgsiftp.c editcol.c edithdu.c eval_l.c \
242 + eval_y.c eval_f.c fitscore.c getcol.c getcolb.c getcold.c getcole.c \
243 + getcoli.c getcolj.c getcolk.c getcoll.c getcols.c getcolsb.c \
244 + getcoluk.c getcolui.c getcoluj.c getkey.c group.c grparser.c \
245 + histo.c iraffits.c \
246 + modkey.c putcol.c putcolb.c putcold.c putcole.c putcoli.c \
247 + putcolj.c putcolk.c putcoluk.c putcoll.c putcols.c putcolsb.c \
248 + putcolu.c putcolui.c putcoluj.c putkey.c region.c scalnull.c \
249 + swapproc.c wcssub.c wcsutil.c imcompress.c quantize.c ricecomp.c \
250 + pliocomp.c fits_hcompress.c fits_hdecompress.c
251 +
252 +F77_SOURCES=
253 +if ENABLE_FORTRAN
254 +F77_SOURCES += f77_wrap1.c f77_wrap2.c f77_wrap3.c f77_wrap4.c f77_wrap.h
255 +endif
256 +AM_YFLAGS = -d -v
257 +
258 +include_HEADERS = fitsio.h fitsio2.h longnam.h drvrsmem.h
259 +noinst_HEADERS = cfortran.h drvrgsiftp.h eval_defs.h f77_wrap.h group.h \
260 + compress.h eval_tab.h fpack.h grparser.h region.h
261 +
262 +libcfitsio_la_SOURCES = $(C_SOURCES) $(F77_SOURCES) $(include_HEADERS)
263 +libcfitsio_la_LDFLAGS = -no-undefined -version-info @SHARED_VERSION_INFO@
264 +libcfitsio_la_CPPFLAGS = @CPPFLAGS_FORTRAN@ @CPPFLAGS_EXTRA@ @CPPFLAGS_GLOBUS@
265 +libcfitsio_la_LIBADD = @LIBS_GLOBUS@
266 +
267 +
268 +pkgconfigdir = $(libdir)/pkgconfig
269 +pkgconfig_DATA = cfitsio.pc
270 +
271 +LDADD = libcfitsio.la
272 +bin_PROGRAMS = fitscopy imcopy listhead fpack funpack
273 +fitscopy_SOURCES = fitscopy.c
274 +listhead_SOURCES = listhead.c
275 +imcopy_SOURCES = imcopy.c
276 +fpack_SOURCES = fpack.c fpackutil.c
277 +funpack_SOURCES = funpack.c fpackutil.c
278 +
279 +# tests
280 +check_PROGRAMS = testprog
281 +noinst_PROGRAMS = speed cookbook smem
282 +testprog_SOURCES = testprog.c
283 +speed_SOURCES = speed.c
284 +cookbook_SOURCES = cookbook.c
285 +smem_SOURCES = smem.c
286 +
287 +if ENABLE_FORTRAN
288 +check_PROGRAMS += testf77
289 +testf77_SOURCES = testf77.f
290 +endif
291 +
292 +EXTRA_DIST = README README.MacOS README.win32 License.txt changes.txt cfitsio.doc fitsio.doc cfitsio.tex fitsio.tex quick.tex
293 +
294 +check-local: $(check_PROGRAMS)
295 + @total=0; failed=0; \
296 + for i in $(check_PROGRAMS); do \
297 + echo "--- Testing $$i ---"; \
298 + ./$$i${EXEEXT} > my_$$i.out; \
299 + diff $$i.out my_$$i.out; \
300 + cmp $$i.fit $$i.std; \
301 + if [ "x$$?" = "x0" ]; then \
302 + echo "Test \`$$i' PASSED."; \
303 + else \
304 + echo "Test \`$$i' FAILED!!!"; \
305 + failed=$$(($$failed + 1)); \
306 + fi; \
307 + total=$$(($$total + 1)); \
308 + done; \
309 + if [ $$failed -gt 0 ]; then \
310 + echo "*** ERROR: $$failed/$$total tests failed!!!"; \
311 + echo ""; \
312 + exit 1; \
313 + fi
314 +
315 +eval:
316 + @$(LEX) -t eval.l > eval_l.c1; \
317 + sed -e 's/yy/ff/g' -e 's/YY/FF/g' eval_l.c1 > eval_l.c; \
318 + rm -f eval_l.c1; \
319 + $(YACC) -d -v -y eval.y; \
320 + sed -e 's/yy/ff/g' -e 's/YY/FF/g' y.tab.c > eval_y.c; \
321 + sed -e 's/yy/ff/g' -e 's/YY/FF/g' y.tab.h > eval_tab.h; \
322 + rm -f y.tab.c y.tab.h
323 --- ax_pthread.m4.orig 1970-01-01 01:00:00.000000000 +0100
324 +++ ax_pthread.m4 2010-01-04 19:00:08.000000000 +0000
325 @@ -0,0 +1,272 @@
326 +# ===========================================================================
327 +# http://www.nongnu.org/autoconf-archive/ax_pthread.html
328 +# ===========================================================================
329 +#
330 +# SYNOPSIS
331 +#
332 +# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
333 +#
334 +# DESCRIPTION
335 +#
336 +# This macro figures out how to build C programs using POSIX threads. It
337 +# sets the PTHREAD_LIBS output variable to the threads library and linker
338 +# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
339 +# flags that are needed. (The user can also force certain compiler
340 +# flags/libs to be tested by setting these environment variables.)
341 +#
342 +# Also sets PTHREAD_CC to any special C compiler that is needed for
343 +# multi-threaded programs (defaults to the value of CC otherwise). (This
344 +# is necessary on AIX to use the special cc_r compiler alias.)
345 +#
346 +# NOTE: You are assumed to not only compile your program with these flags,
347 +# but also link it with them as well. e.g. you should link with
348 +# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
349 +#
350 +# If you are only building threads programs, you may wish to use these
351 +# variables in your default LIBS, CFLAGS, and CC:
352 +#
353 +# LIBS="$PTHREAD_LIBS $LIBS"
354 +# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
355 +# CC="$PTHREAD_CC"
356 +#
357 +# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
358 +# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
359 +# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
360 +#
361 +# ACTION-IF-FOUND is a list of shell commands to run if a threads library
362 +# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
363 +# is not found. If ACTION-IF-FOUND is not specified, the default action
364 +# will define HAVE_PTHREAD.
365 +#
366 +# Please let the authors know if this macro fails on any platform, or if
367 +# you have any other suggestions or comments. This macro was based on work
368 +# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
369 +# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
370 +# Alejandro Forero Cuervo to the autoconf macro repository. We are also
371 +# grateful for the helpful feedback of numerous users.
372 +#
373 +# LICENSE
374 +#
375 +# Copyright (c) 2008 Steven G. Johnson <stevenj@××××××××.edu>
376 +#
377 +# This program is free software: you can redistribute it and/or modify it
378 +# under the terms of the GNU General Public License as published by the
379 +# Free Software Foundation, either version 3 of the License, or (at your
380 +# option) any later version.
381 +#
382 +# This program is distributed in the hope that it will be useful, but
383 +# WITHOUT ANY WARRANTY; without even the implied warranty of
384 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
385 +# Public License for more details.
386 +#
387 +# You should have received a copy of the GNU General Public License along
388 +# with this program. If not, see <http://www.gnu.org/licenses/>.
389 +#
390 +# As a special exception, the respective Autoconf Macro's copyright owner
391 +# gives unlimited permission to copy, distribute and modify the configure
392 +# scripts that are the output of Autoconf when processing the Macro. You
393 +# need not follow the terms of the GNU General Public License when using
394 +# or distributing such scripts, even though portions of the text of the
395 +# Macro appear in them. The GNU General Public License (GPL) does govern
396 +# all other use of the material that constitutes the Autoconf Macro.
397 +#
398 +# This special exception to the GPL applies to versions of the Autoconf
399 +# Macro released by the Autoconf Archive. When you make and distribute a
400 +# modified version of the Autoconf Macro, you may extend this special
401 +# exception to the GPL to apply to your modified version as well.
402 +
403 +AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
404 +AC_DEFUN([AX_PTHREAD], [
405 +AC_REQUIRE([AC_CANONICAL_HOST])
406 +AC_LANG_SAVE
407 +AC_LANG_C
408 +ax_pthread_ok=no
409 +
410 +# We used to check for pthread.h first, but this fails if pthread.h
411 +# requires special compiler flags (e.g. on True64 or Sequent).
412 +# It gets checked for in the link test anyway.
413 +
414 +# First of all, check if the user has set any of the PTHREAD_LIBS,
415 +# etcetera environment variables, and if threads linking works using
416 +# them:
417 +if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
418 + save_CFLAGS="$CFLAGS"
419 + CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
420 + save_LIBS="$LIBS"
421 + LIBS="$PTHREAD_LIBS $LIBS"
422 + AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
423 + AC_TRY_LINK_FUNC(pthread_join, ax_pthread_ok=yes)
424 + AC_MSG_RESULT($ax_pthread_ok)
425 + if test x"$ax_pthread_ok" = xno; then
426 + PTHREAD_LIBS=""
427 + PTHREAD_CFLAGS=""
428 + fi
429 + LIBS="$save_LIBS"
430 + CFLAGS="$save_CFLAGS"
431 +fi
432 +
433 +# We must check for the threads library under a number of different
434 +# names; the ordering is very important because some systems
435 +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
436 +# libraries is broken (non-POSIX).
437 +
438 +# Create a list of thread flags to try. Items starting with a "-" are
439 +# C compiler flags, and other items are library names, except for "none"
440 +# which indicates that we try without any flags at all, and "pthread-config"
441 +# which is a program returning the flags for the Pth emulation library.
442 +
443 +ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
444 +
445 +# The ordering *is* (sometimes) important. Some notes on the
446 +# individual items follow:
447 +
448 +# pthreads: AIX (must check this before -lpthread)
449 +# none: in case threads are in libc; should be tried before -Kthread and
450 +# other compiler flags to prevent continual compiler warnings
451 +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
452 +# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
453 +# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
454 +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
455 +# -pthreads: Solaris/gcc
456 +# -mthreads: Mingw32/gcc, Lynx/gcc
457 +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
458 +# doesn't hurt to check since this sometimes defines pthreads too;
459 +# also defines -D_REENTRANT)
460 +# ... -mt is also the pthreads flag for HP/aCC
461 +# pthread: Linux, etcetera
462 +# --thread-safe: KAI C++
463 +# pthread-config: use pthread-config program (for GNU Pth library)
464 +
465 +case "${host_cpu}-${host_os}" in
466 + *solaris*)
467 +
468 + # On Solaris (at least, for some versions), libc contains stubbed
469 + # (non-functional) versions of the pthreads routines, so link-based
470 + # tests will erroneously succeed. (We need to link with -pthreads/-mt/
471 + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
472 + # a function called by this macro, so we could check for that, but
473 + # who knows whether they'll stub that too in a future libc.) So,
474 + # we'll just look for -pthreads and -lpthread first:
475 +
476 + ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
477 + ;;
478 +esac
479 +
480 +if test x"$ax_pthread_ok" = xno; then
481 +for flag in $ax_pthread_flags; do
482 +
483 + case $flag in
484 + none)
485 + AC_MSG_CHECKING([whether pthreads work without any flags])
486 + ;;
487 +
488 + -*)
489 + AC_MSG_CHECKING([whether pthreads work with $flag])
490 + PTHREAD_CFLAGS="$flag"
491 + ;;
492 +
493 + pthread-config)
494 + AC_CHECK_PROG(ax_pthread_config, pthread-config, yes, no)
495 + if test x"$ax_pthread_config" = xno; then continue; fi
496 + PTHREAD_CFLAGS="`pthread-config --cflags`"
497 + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
498 + ;;
499 +
500 + *)
501 + AC_MSG_CHECKING([for the pthreads library -l$flag])
502 + PTHREAD_LIBS="-l$flag"
503 + ;;
504 + esac
505 +
506 + save_LIBS="$LIBS"
507 + save_CFLAGS="$CFLAGS"
508 + LIBS="$PTHREAD_LIBS $LIBS"
509 + CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
510 +
511 + # Check for various functions. We must include pthread.h,
512 + # since some functions may be macros. (On the Sequent, we
513 + # need a special flag -Kthread to make this header compile.)
514 + # We check for pthread_join because it is in -lpthread on IRIX
515 + # while pthread_create is in libc. We check for pthread_attr_init
516 + # due to DEC craziness with -lpthreads. We check for
517 + # pthread_cleanup_push because it is one of the few pthread
518 + # functions on Solaris that doesn't have a non-functional libc stub.
519 + # We try pthread_create on general principles.
520 + AC_TRY_LINK([#include <pthread.h>],
521 + [pthread_t th; pthread_join(th, 0);
522 + pthread_attr_init(0); pthread_cleanup_push(0, 0);
523 + pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
524 + [ax_pthread_ok=yes])
525 +
526 + LIBS="$save_LIBS"
527 + CFLAGS="$save_CFLAGS"
528 +
529 + AC_MSG_RESULT($ax_pthread_ok)
530 + if test "x$ax_pthread_ok" = xyes; then
531 + break;
532 + fi
533 +
534 + PTHREAD_LIBS=""
535 + PTHREAD_CFLAGS=""
536 +done
537 +fi
538 +
539 +# Various other checks:
540 +if test "x$ax_pthread_ok" = xyes; then
541 + save_LIBS="$LIBS"
542 + LIBS="$PTHREAD_LIBS $LIBS"
543 + save_CFLAGS="$CFLAGS"
544 + CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
545 +
546 + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
547 + AC_MSG_CHECKING([for joinable pthread attribute])
548 + attr_name=unknown
549 + for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
550 + AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
551 + [attr_name=$attr; break])
552 + done
553 + AC_MSG_RESULT($attr_name)
554 + if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
555 + AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
556 + [Define to necessary symbol if this constant
557 + uses a non-standard name on your system.])
558 + fi
559 +
560 + AC_MSG_CHECKING([if more special flags are required for pthreads])
561 + flag=no
562 + case "${host_cpu}-${host_os}" in
563 + *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
564 + *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
565 + esac
566 + AC_MSG_RESULT(${flag})
567 + if test "x$flag" != xno; then
568 + PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
569 + fi
570 +
571 + LIBS="$save_LIBS"
572 + CFLAGS="$save_CFLAGS"
573 +
574 + # More AIX lossage: must compile with xlc_r or cc_r
575 + if test x"$GCC" != xyes; then
576 + AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
577 + else
578 + PTHREAD_CC=$CC
579 + fi
580 +else
581 + PTHREAD_CC="$CC"
582 +fi
583 +
584 +AC_SUBST(PTHREAD_LIBS)
585 +AC_SUBST(PTHREAD_CFLAGS)
586 +AC_SUBST(PTHREAD_CC)
587 +
588 +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
589 +if test x"$ax_pthread_ok" = xyes; then
590 + ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
591 + :
592 +else
593 + ax_pthread_ok=no
594 + $2
595 +fi
596 +AC_LANG_RESTORE
597 +])dnl AX_PTHREAD