~swag/armagetronad/0.2.9-sty+ct+ap-fork

« back to all changes in this revision

Viewing changes to acinclude.m4

  • Committer: luke-jr
  • Date: 2006-05-31 05:43:38 UTC
  • Revision ID: svn-v3-list-QlpoOTFBWSZTWZvbKhsAAAdRgAAQABK6798QIABURMgAAaeoNT1TxT1DQbKaeobXKiyAmlWT7Y5MkdJOtXDtB7w7DOGFBHiOBxaUIu7HQyyQSvxdyRThQkJvbKhs:7d95bf1e-0414-0410-9756-b78462a59f44:armagetronad%2Fbranches%2F0.2.8%2Farmagetronad:4650
I don't know if these are used, but just in case

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
AC_CONFIG_COMMANDS(universal_variables,[
64
64
# clear files
65
65
for f in src/tUniversalVariables.h.in.new universal_variables universal_variable_substitutions universal_variable_values.in universal_variable_values_makefile.new universal_variable_values_makefile_sed.new; do
66
 
    rm -f $f
67
 
    touch $f
 
66
    echo -n "" > $f
68
67
done
69
68
 
70
69
# prepare value inserting makefile:
99
98
 
100
99
    # add C macro to prototype file (later modified by the makefile
101
100
    # to contain the possibly modified variable values)
102
 
    printf "#ifndef %s\n    #define %s \"@%s@\"\n#endif\n" "${variable_u}" "${variable_u}" "${variable}" >> src/tUniversalVariables.h.in.new
 
101
    echo -e "#ifndef ${variable_u}\n    #define ${variable_u} \"@${variable}@\"\n#endif" >> src/tUniversalVariables.h.in.new
103
102
 
104
103
    # generate prototype for file containing the actual values of the variables
105
104
    # echo ${variable}=@${variable}@  >> universal_variable_values.in
152
151
AC_AA_PATH_NOSUFFIX_RAW($1)
153
152
AC_SUBST_UNIVERSAL($1_suffix)
154
153
AC_SUBST_UNIVERSAL(aa_$1)
155
 
aa_$1=\${$1}\${$1_suffix}\${progdir_suffix}
 
154
aa_$1=\${$1}\${$1_suffix}
156
155
])
157
156
 
158
157
# Fallback function if accustomdir is not included
176
175
# 2. the default value
177
176
# 3. a description of the purpose of the directory
178
177
# 4. human-form of the default value
179
 
AC_DEFUN([AC_AA_PATHOPT],
 
178
AC_DEFUN([AC_AA_PATH],
180
179
[
181
180
AC_ARG_DIR([$1],[$2],[$3],[$4])
 
181
AC_AA_PATH_RAW([$1])
182
182
AC_SUBST([$1])
183
183
]
184
184
)
191
191
]
192
192
)
193
193
 
194
 
AC_DEFUN([AC_AA_PATH_NOSUFFIX],
195
 
[
196
 
AC_AA_PATHOPT([$1],[$2],[$3],[$4])
197
 
AC_AA_PATH_NOSUFFIX_RAW([$1])
198
 
]
199
 
)
200
 
AC_DEFUN([AC_AA_PATH],
201
 
[
202
 
AC_AA_PATHOPT([$1],[$2],[$3],[$4])
203
 
AC_AA_PATH_RAW([$1])
204
 
]
205
 
)
206
 
 
207
194
# applies the registered path variables 
208
195
AC_DEFUN([AC_AA_REPLACEPATHS],
209
196
[
210
197
#echo ap=${ac_aa_pathvars}
211
198
# put the path names into a file
212
199
AC_CONFIG_COMMANDS(pathsubstitution,[
213
 
#clear the file
214
 
rm -f batch/relocate.in
215
 
touch batch/relocate.in
 
200
echo -n "" > batch/relocate.in
216
201
 
217
202
# generate path relocation sed script: replaces @foo_reloc@ with the
218
203
# output of `relocate @foo@`, where @foo@ itself is replaced during
338
323
        AC_SUBST(BINRELOC_CFLAGS)
339
324
        AC_SUBST(BINRELOC_LIBS)
340
325
])
341
 
 
342
 
dnl Modified ZThread test follows. This one works, the official one alone does not.
343
 
dnl Changes: hacked compiler temporarily to use CXX instead of CC
344
 
dnl          added zthread/ to include path
345
 
dnl          added #include "zthread/Task.h" and #include "zthread/Thread.h"
346
 
dnl          added HAVE_LIBZTHREAD define
347
 
 
348
 
dnl Copyright (c) 2005, Eric Crahen
349
 
dnl
350
 
dnl Permission is hereby granted, free of charge, to any person obtaining a copy
351
 
dnl of this software and associated documentation files (the "Software"), to deal
352
 
dnl in the Software without restriction, including without limitation the rights
353
 
dnl to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
354
 
dnl copies of the Software, and to permit persons to whom the Software is furnished
355
 
dnl to do so, subject to the following conditions:
356
 
dnl 
357
 
dnl The above copyright notice and this permission notice shall be included in all
358
 
dnl copies or substantial portions of the Software.
359
 
dnl 
360
 
dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
361
 
dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
362
 
dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
363
 
dnl AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
364
 
dnl WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
365
 
dnl CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
366
 
 
367
 
dnl Detect the library and include paths for ZThreads, perform some test
368
 
dnl compilations.
369
 
dnl
370
 
dnl Should be used in AC_PROG_CC mode before the swtich to C++ if any is made
371
 
dnl (eg before AC_LANG_CPLUSPLUS)
372
 
dnl
373
 
dnl --with-zthread-prefix : Skip detection, use this general path
374
 
dnl --with-zthread-exec-prefix : Skip detecting the zthread-config tool
375
 
dnl 
376
 
dnl Sets the following variables.
377
 
dnl
378
 
dnl ZTHREAD_CXXFLAGS
379
 
dnl ZTHREAD_LIBS
380
 
dnl 
381
 
AC_DEFUN([AM_PATH_ZTHREAD_AA],
382
 
[
383
 
 
384
 
 
385
 
AC_ARG_WITH(zthread-prefix,[  --with-zthread-prefix=PFX   Prefix where ZTHREAD is installed (optional)],
386
 
            zthread_prefix="$withval", zthread_prefix="")
387
 
AC_ARG_WITH(zthread-exec-prefix,[  --with-zthread-exec-prefix=PFX Exec prefix where ZTHREAD is installed (optional)],
388
 
            zthread_exec_prefix="$withval", zthread_exec_prefix="")
389
 
AC_ARG_ENABLE(zthreadtest, [  --disable-zthreadtest       Do not try to compile and run a test ZTHREAD program],
390
 
                    , enable_zthreadtest=yes)
391
 
 
392
 
  if test x$zthread_exec_prefix != x ; then
393
 
     zthread_args="$zthread_args --exec-prefix=$zthread_exec_prefix"
394
 
     if test x${ZTHREAD_CONFIG+set} != xset ; then
395
 
        ZTHREAD_CONFIG=$zthread_exec_prefix/bin/zthread-config
396
 
     fi
397
 
  fi
398
 
  if test x$zthread_prefix != x ; then
399
 
     zthread_args="$zthread_args --prefix=$zthread_prefix"
400
 
     if test x${ZTHREAD_CONFIG+set} != xset ; then
401
 
        ZTHREAD_CONFIG=$zthread_prefix/bin/zthread-config
402
 
     fi
403
 
  fi
404
 
 
405
 
  AC_PATH_PROG(ZTHREAD_CONFIG, zthread-config, no)
406
 
  min_zthread_version=ifelse([$1], ,0.11.0,$1)
407
 
  AC_MSG_CHECKING(for ZTHREAD - version >= $min_zthread_version)
408
 
  no_zthread=""
409
 
  if test "$ZTHREAD_CONFIG" = "no" ; then
410
 
    no_zthread=yes
411
 
  else
412
 
    ZTHREAD_CXXFLAGS=`$ZTHREAD_CONFIG $zthreadconf_args --cflags`
413
 
    ZTHREAD_LIBS=`$ZTHREAD_CONFIG $zthreadconf_args --libs`
414
 
 
415
 
    zthread_major_version=`$ZTHREAD_CONFIG $zthread_args --version | \
416
 
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
417
 
    zthread_minor_version=`$ZTHREAD_CONFIG $zthread_args --version | \
418
 
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
419
 
    zthread_micro_version=`$ZTHREAD_CONFIG $zthread_config_args --version | \
420
 
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
421
 
    if test "x$enable_zthreadtest" = "xyes" ; then
422
 
      ac_save_CXXFLAGS="$CXXFLAGS"
423
 
      ac_save_CFLAGS="$CFLAGS"
424
 
      ac_save_LIBS="$LIBS"
425
 
      CXXFLAGS="$CXXFLAGS $ZTHREAD_CXXFLAGS"
426
 
      CFLAGS="$CFLAGS $ZTHREAD_CXXFLAGS"
427
 
      LIBS="$LIBS $ZTHREAD_LIBS"
428
 
 
429
 
dnl
430
 
dnl Now check if the installed ZTHREAD is sufficiently new. (Also sanity
431
 
dnl checks the results of zthread-config to some extent
432
 
dnl
433
 
      rm -f conf.zthreadtest
434
 
      CC_OLD=${CC}
435
 
      CC=${CXX}
436
 
      for extra_flags in "NONE" "-fpermissive"; do
437
 
        if test NONE != ${extra_flags}; then
438
 
          ZTHREAD_CXXFLAGS="$ZTHREAD_CXXFLAGS ${extra_flags}"
439
 
          CXXFLAGS="$CXXFLAGS ${extra_flags}"
440
 
          CFLAGS="$CFLAGS ${extra_flags}"
441
 
        fi
442
 
        if test "x$no_zthread" = xyes || test NONE = ${extra_flags} ; then
443
 
        no_zthread=""
444
 
        AC_TRY_RUN([
445
 
 
446
 
 
447
 
#include <stdio.h>
448
 
#include <string.h>
449
 
#include <unistd.h>
450
 
#include "zthread/Task.h"
451
 
#include "zthread/Thread.h"
452
 
#include "zthread/ZThread.h"
453
 
 
454
 
int main (int argc, char *argv[]) {
455
 
 
456
 
  int major, minor, micro;
457
 
  char tmp_version[256];
458
 
 
459
 
  { FILE *fp = fopen("conf.zthreadtest", "a"); if ( fp ) fclose(fp); }
460
 
 
461
 
 
462
 
  /* HP/UX 9 (%@#!) writes to sscanf strings */
463
 
  strcpy(tmp_version, "$min_zthread_version");
464
 
  
465
 
  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
466
 
 
467
 
    printf("%s, bad version string\n", "$min_zthread_version");
468
 
    return 1;
469
 
 
470
 
  }
471
 
 
472
 
  if (($zthread_major_version > major) ||
473
 
     (($zthread_major_version == major) && ($zthread_minor_version > minor)) ||
474
 
     (($zthread_major_version == major) && ($zthread_minor_version == minor) && 
475
 
     ($zthread_micro_version >= micro))) {
476
 
      return 0;
477
 
  } else {
478
 
 
479
 
    printf("\n*** 'zthread-config --version' returned %d.%d.%d, but the minimum version\n", $zthread_major_version, $zthread_minor_version, $zthread_micro_version);
480
 
    printf("*** of ZThread required is %d.%d.%d. If zthread-config is correct, then it is\n", major, minor, micro);
481
 
    printf("*** best to upgrade to the required version.\n");
482
 
    printf("*** If zthread-config was wrong, set the environment variable ZTHREAD_CONFIG\n");
483
 
    printf("*** to point to the correct copy of zthread-config, and remove the file\n");
484
 
    printf("*** config.cache before re-running configure\n");
485
 
 
486
 
    return 1;
487
 
  }
488
 
 
489
 
}
490
 
 
491
 
],, no_zthread=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
492
 
      fi
493
 
    done
494
 
    CC=${CC_OLD}
495
 
    CXXFLAGS="$ac_save_CXXFLAGS"
496
 
    LIBS="$ac_save_LIBS"
497
 
    fi
498
 
  fi
499
 
 
500
 
  if test "x$no_zthread" = x ; then
501
 
    
502
 
     AC_DEFINE(HAVE_LIBZTHREAD,[], [Define if you have the library ZThread.])
503
 
     AC_MSG_RESULT(yes)
504
 
     ifelse([$2], , :, [$2])     
505
 
 
506
 
  else
507
 
 
508
 
     AC_MSG_RESULT(no)
509
 
 
510
 
     if test "$ZTHREAD_CONFIG" = "no" ; then
511
 
 
512
 
       echo "*** The zthread-config script installed by ZThread could not be found"
513
 
       echo "*** If ZThread was installed in PREFIX, make sure PREFIX/bin is in"
514
 
       echo "*** your path, or set the ZTHREAD_CONFIG environment variable to the"
515
 
       echo "*** full path to zthread-config."
516
 
 
517
 
     else
518
 
       if test -f conf.zthreadtest ; then
519
 
        :
520
 
       else
521
 
 
522
 
          echo "*** Could not run ZThread test program, checking why..."
523
 
          CC_OLD=${CC}
524
 
          CC=${CXX}
525
 
          CXXFLAGS="$CXXFLAGS $ZTHREAD_CXXFLAGS"
526
 
          LIBS="$LIBS $ZTHREAD_LIBS"
527
 
 
528
 
          echo $LIBS;
529
 
 
530
 
          AC_TRY_LINK([#include "zthread/Task.h"], 
531
 
                      [ return 0; ], [
532
 
          echo "*** The test program compiled, but did not run. This usually means"
533
 
          echo "*** that the run-time linker is not finding ZThread or finding the wrong"
534
 
          echo "*** version of ZThread. If it is not finding ZThread, you'll need to set your"
535
 
          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
536
 
          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
537
 
          echo "*** is required on your system"
538
 
                echo "***"
539
 
          echo "*** If you have an old version installed, it is best to remove it, although"
540
 
          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
541
 
        [ echo "*** The test program failed to compile or link. See the file config.log for the"
542
 
          echo "*** exact error that occured. This usually means ZThread was incorrectly installed"
543
 
          echo "*** or that you have moved ZThread since it was installed. In the latter case, you"
544
 
          echo "*** may want to edit the zthread-config script: $ZTHREAD_CONFIG" ])
545
 
 
546
 
          CC=${CC_OLD}
547
 
          CFLAGS="$ac_save_CFLAGS"
548
 
          CXXFLAGS="$ac_save_CXXFLAGS"
549
 
          LIBS="$ac_save_LIBS"
550
 
       fi
551
 
     fi
552
 
 
553
 
     ZTHREAD_CXXFLAGS=""
554
 
     ZTHREAD_LIBS=""
555
 
     ifelse([$3], , :, [$3])
556
 
 
557
 
  fi
558
 
 
559
 
  AC_SUBST(ZTHREAD_CXXFLAGS)
560
 
  AC_SUBST(ZTHREAD_LIBS)
561
 
 
562
 
  rm -f conf.zthreadtest
563
 
 
564
 
])
565
 
 
566
 
dnl Copyright � 2008 Steven G. Johnson <stevenj@alum.mit.edu> 
567
 
dnl 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 Free Software Foundation, either version 3 of the License, or (at your option) any later version. 
568
 
dnl This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 
569
 
dnl You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. 
570
 
dnl As a special exception, the respective Autoconf Macro's copyright owner gives unlimited permission to copy, distribute and modify the configure scripts that are the output of Autoconf when processing the Macro. You need not follow the terms of the GNU General Public License when using or distributing such scripts, even though portions of the text of the Macro appear in them. The GNU General Public License (GPL) does govern all other use of the material that constitutes the Autoconf Macro. 
571
 
dnl This special exception to the GPL applies to versions of the Autoconf Macro released by the Autoconf Macro Archive. When you make and distribute a modified version of the Autoconf Macro, you may extend this special exception to the GPL to apply to your modified version as well.
572
 
 
573
 
AC_DEFUN([ACX_PTHREAD], [
574
 
AC_REQUIRE([AC_CANONICAL_HOST])
575
 
AC_LANG_SAVE
576
 
AC_LANG_C
577
 
acx_pthread_ok=no
578
 
 
579
 
# We used to check for pthread.h first, but this fails if pthread.h
580
 
# requires special compiler flags (e.g. on True64 or Sequent).
581
 
# It gets checked for in the link test anyway.
582
 
 
583
 
# First of all, check if the user has set any of the PTHREAD_LIBS,
584
 
# etcetera environment variables, and if threads linking works using
585
 
# them:
586
 
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
587
 
        save_CFLAGS="$CFLAGS"
588
 
        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
589
 
        save_LIBS="$LIBS"
590
 
        LIBS="$PTHREAD_LIBS $LIBS"
591
 
        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
592
 
        AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
593
 
        AC_MSG_RESULT($acx_pthread_ok)
594
 
        if test x"$acx_pthread_ok" = xno; then
595
 
                PTHREAD_LIBS=""
596
 
                PTHREAD_CFLAGS=""
597
 
        fi
598
 
        LIBS="$save_LIBS"
599
 
        CFLAGS="$save_CFLAGS"
600
 
fi
601
 
 
602
 
# We must check for the threads library under a number of different
603
 
# names; the ordering is very important because some systems
604
 
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
605
 
# libraries is broken (non-POSIX).
606
 
 
607
 
# Create a list of thread flags to try.  Items starting with a "-" are
608
 
# C compiler flags, and other items are library names, except for "none"
609
 
# which indicates that we try without any flags at all, and "pthread-config"
610
 
# which is a program returning the flags for the Pth emulation library.
611
 
 
612
 
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
613
 
 
614
 
# The ordering *is* (sometimes) important.  Some notes on the
615
 
# individual items follow:
616
 
 
617
 
# pthreads: AIX (must check this before -lpthread)
618
 
# none: in case threads are in libc; should be tried before -Kthread and
619
 
#       other compiler flags to prevent continual compiler warnings
620
 
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
621
 
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
622
 
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
623
 
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
624
 
# -pthreads: Solaris/gcc
625
 
# -mthreads: Mingw32/gcc, Lynx/gcc
626
 
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
627
 
#      doesn't hurt to check since this sometimes defines pthreads too;
628
 
#      also defines -D_REENTRANT)
629
 
#      ... -mt is also the pthreads flag for HP/aCC
630
 
# pthread: Linux, etcetera
631
 
# --thread-safe: KAI C++
632
 
# pthread-config: use pthread-config program (for GNU Pth library)
633
 
 
634
 
case "${host_cpu}-${host_os}" in
635
 
        *solaris*)
636
 
 
637
 
        # On Solaris (at least, for some versions), libc contains stubbed
638
 
        # (non-functional) versions of the pthreads routines, so link-based
639
 
        # tests will erroneously succeed.  (We need to link with -pthreads/-mt/
640
 
        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
641
 
        # a function called by this macro, so we could check for that, but
642
 
        # who knows whether they'll stub that too in a future libc.)  So,
643
 
        # we'll just look for -pthreads and -lpthread first:
644
 
 
645
 
        acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
646
 
        ;;
647
 
esac
648
 
 
649
 
if test x"$acx_pthread_ok" = xno; then
650
 
for flag in $acx_pthread_flags; do
651
 
 
652
 
        case $flag in
653
 
                none)
654
 
                AC_MSG_CHECKING([whether pthreads work without any flags])
655
 
                ;;
656
 
 
657
 
                -*)
658
 
                AC_MSG_CHECKING([whether pthreads work with $flag])
659
 
                PTHREAD_CFLAGS="$flag"
660
 
                ;;
661
 
 
662
 
                pthread-config)
663
 
                AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
664
 
                if test x"$acx_pthread_config" = xno; then continue; fi
665
 
                PTHREAD_CFLAGS="`pthread-config --cflags`"
666
 
                PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
667
 
                ;;
668
 
 
669
 
                *)
670
 
                AC_MSG_CHECKING([for the pthreads library -l$flag])
671
 
                PTHREAD_LIBS="-l$flag"
672
 
                ;;
673
 
        esac
674
 
 
675
 
        save_LIBS="$LIBS"
676
 
        save_CFLAGS="$CFLAGS"
677
 
        LIBS="$PTHREAD_LIBS $LIBS"
678
 
        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
679
 
 
680
 
        # Check for various functions.  We must include pthread.h,
681
 
        # since some functions may be macros.  (On the Sequent, we
682
 
        # need a special flag -Kthread to make this header compile.)
683
 
        # We check for pthread_join because it is in -lpthread on IRIX
684
 
        # while pthread_create is in libc.  We check for pthread_attr_init
685
 
        # due to DEC craziness with -lpthreads.  We check for
686
 
        # pthread_cleanup_push because it is one of the few pthread
687
 
        # functions on Solaris that doesn't have a non-functional libc stub.
688
 
        # We try pthread_create on general principles.
689
 
        AC_TRY_LINK([#include <pthread.h>],
690
 
                    [pthread_t th; pthread_join(th, 0);
691
 
                    pthread_attr_init(0); pthread_cleanup_push(0, 0);
692
 
                    pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
693
 
                    [acx_pthread_ok=yes])
694
 
 
695
 
        LIBS="$save_LIBS"
696
 
        CFLAGS="$save_CFLAGS"
697
 
 
698
 
        AC_MSG_RESULT($acx_pthread_ok)
699
 
        if test "x$acx_pthread_ok" = xyes; then
700
 
                break;
701
 
        fi
702
 
 
703
 
        PTHREAD_LIBS=""
704
 
        PTHREAD_CFLAGS=""
705
 
done
706
 
fi
707
 
 
708
 
# Various other checks:
709
 
if test "x$acx_pthread_ok" = xyes; then
710
 
        save_LIBS="$LIBS"
711
 
        LIBS="$PTHREAD_LIBS $LIBS"
712
 
        save_CFLAGS="$CFLAGS"
713
 
        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
714
 
 
715
 
        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
716
 
        AC_MSG_CHECKING([for joinable pthread attribute])
717
 
        attr_name=unknown
718
 
        for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
719
 
            AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
720
 
                        [attr_name=$attr; break])
721
 
        done
722
 
        AC_MSG_RESULT($attr_name)
723
 
        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
724
 
            AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
725
 
                              [Define to necessary symbol if this constant
726
 
                                uses a non-standard name on your system.])
727
 
        fi
728
 
 
729
 
        AC_MSG_CHECKING([if more special flags are required for pthreads])
730
 
        flag=no
731
 
        case "${host_cpu}-${host_os}" in
732
 
            *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
733
 
            *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
734
 
        esac
735
 
        AC_MSG_RESULT(${flag})
736
 
        if test "x$flag" != xno; then
737
 
            PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
738
 
        fi
739
 
 
740
 
        LIBS="$save_LIBS"
741
 
        CFLAGS="$save_CFLAGS"
742
 
 
743
 
        # More AIX lossage: must compile with xlc_r or cc_r
744
 
        if test x"$GCC" != xyes; then
745
 
          AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
746
 
        else
747
 
          PTHREAD_CC=$CC
748
 
        fi
749
 
else
750
 
        PTHREAD_CC="$CC"
751
 
fi
752
 
 
753
 
AC_SUBST(PTHREAD_LIBS)
754
 
AC_SUBST(PTHREAD_CFLAGS)
755
 
AC_SUBST(PTHREAD_CC)
756
 
 
757
 
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
758
 
if test x"$acx_pthread_ok" = xyes; then
759
 
        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
760
 
        :
761
 
else
762
 
        acx_pthread_ok=no
763
 
        $2
764
 
fi
765
 
AC_LANG_RESTORE
766
 
])dnl ACX_PTHREAD
767
 
 
768
 
 
769
 
dnl GPLed checks whether the current version of GCC supports a certain flag
770
 
dnl source: http://autoconf-archive.cryp.to/ax_cflags_gcc_option.html
771
 
dnl Copyright � 2008 Guido U. Draheim <guidod@gmx.de>
772
 
 
773
 
AC_DEFUN([AX_CFLAGS_GCC_OPTION_OLD], [dnl
774
 
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
775
 
AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$2])dnl
776
 
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
777
 
VAR,[VAR="no, unknown"
778
 
 AC_LANG_SAVE
779
 
 AC_LANG_C
780
 
 ac_save_[]FLAGS="$[]FLAGS"
781
 
for ac_arg dnl
782
 
in "-pedantic -Werror % m4_ifval($2,$2,-option)"  dnl   GCC
783
 
   "-pedantic % m4_ifval($2,$2,-option) %% no, obsolete"  dnl new GCC
784
 
   #
785
 
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
786
 
   AC_TRY_COMPILE([],[return 0;],
787
 
   [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
788
 
done
789
 
 FLAGS="$ac_save_[]FLAGS"
790
 
 AC_LANG_RESTORE
791
 
])
792
 
case ".$VAR" in
793
 
     .ok|.ok,*) m4_ifvaln($3,$3) ;;
794
 
   .|.no|.no,*) m4_ifvaln($4,$4) ;;
795
 
   *) m4_ifvaln($3,$3,[
796
 
   if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
797
 
   then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
798
 
   else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
799
 
                      m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
800
 
   fi ]) ;;
801
 
esac
802
 
AS_VAR_POPDEF([VAR])dnl
803
 
AS_VAR_POPDEF([FLAGS])dnl
804
 
])
805
 
 
806
 
 
807
 
dnl the only difference - the LANG selection... and the default FLAGS
808
 
 
809
 
AC_DEFUN([AX_CXXFLAGS_GCC_OPTION_OLD], [dnl
810
 
AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
811
 
AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$2])dnl
812
 
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
813
 
VAR,[VAR="no, unknown"
814
 
 AC_LANG_SAVE
815
 
 AC_LANG_CPLUSPLUS
816
 
 ac_save_[]FLAGS="$[]FLAGS"
817
 
for ac_arg dnl
818
 
in "-pedantic -Werror % m4_ifval($2,$2,-option)"  dnl   GCC
819
 
   "-pedantic % m4_ifval($2,$2,-option) %% no, obsolete"  dnl new GCC
820
 
   #
821
 
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
822
 
   AC_TRY_COMPILE([],[return 0;],
823
 
   [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
824
 
done
825
 
 FLAGS="$ac_save_[]FLAGS"
826
 
 AC_LANG_RESTORE
827
 
])
828
 
case ".$VAR" in
829
 
     .ok|.ok,*) m4_ifvaln($3,$3) ;;
830
 
   .|.no|.no,*) m4_ifvaln($4,$4) ;;
831
 
   *) m4_ifvaln($3,$3,[
832
 
   if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
833
 
   then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
834
 
   else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
835
 
                      m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
836
 
   fi ]) ;;
837
 
esac
838
 
AS_VAR_POPDEF([VAR])dnl
839
 
AS_VAR_POPDEF([FLAGS])dnl
840
 
])
841
 
 
842
 
dnl -------------------------------------------------------------------------
843
 
 
844
 
AC_DEFUN([AX_CFLAGS_GCC_OPTION_NEW], [dnl
845
 
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
846
 
AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$1])dnl
847
 
AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)],
848
 
VAR,[VAR="no, unknown"
849
 
 AC_LANG_SAVE
850
 
 AC_LANG_C
851
 
 ac_save_[]FLAGS="$[]FLAGS"
852
 
for ac_arg dnl
853
 
in "-pedantic -Werror % m4_ifval($1,$1,-option)"  dnl   GCC
854
 
   "-pedantic % m4_ifval($1,$1,-option) %% no, obsolete"  dnl new GCC
855
 
   #
856
 
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
857
 
   AC_TRY_COMPILE([],[return 0;],
858
 
   [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
859
 
done
860
 
 FLAGS="$ac_save_[]FLAGS"
861
 
 AC_LANG_RESTORE
862
 
])
863
 
case ".$VAR" in
864
 
     .ok|.ok,*) m4_ifvaln($3,$3) ;;
865
 
   .|.no|.no,*) m4_ifvaln($4,$4) ;;
866
 
   *) m4_ifvaln($3,$3,[
867
 
   if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
868
 
   then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
869
 
   else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
870
 
                      m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
871
 
   fi ]) ;;
872
 
esac
873
 
AS_VAR_POPDEF([VAR])dnl
874
 
AS_VAR_POPDEF([FLAGS])dnl
875
 
])
876
 
 
877
 
 
878
 
dnl the only difference - the LANG selection... and the default FLAGS
879
 
 
880
 
AC_DEFUN([AX_CXXFLAGS_GCC_OPTION_NEW], [dnl
881
 
AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
882
 
AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$1])dnl
883
 
AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)],
884
 
VAR,[VAR="no, unknown"
885
 
 AC_LANG_SAVE
886
 
 AC_LANG_CPLUSPLUS
887
 
 ac_save_[]FLAGS="$[]FLAGS"
888
 
for ac_arg dnl
889
 
in "-pedantic -Werror % m4_ifval($1,$1,-option)"  dnl   GCC
890
 
   "-pedantic % m4_ifval($1,$1,-option) %% no, obsolete"  dnl new GCC
891
 
   #
892
 
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
893
 
   AC_TRY_COMPILE([],[return 0;],
894
 
   [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
895
 
done
896
 
 FLAGS="$ac_save_[]FLAGS"
897
 
 AC_LANG_RESTORE
898
 
])
899
 
case ".$VAR" in
900
 
     .ok|.ok,*) m4_ifvaln($3,$3) ;;
901
 
   .|.no|.no,*) m4_ifvaln($4,$4) ;;
902
 
   *) m4_ifvaln($3,$3,[
903
 
   if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
904
 
   then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
905
 
   else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
906
 
                      m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
907
 
   fi ]) ;;
908
 
esac
909
 
AS_VAR_POPDEF([VAR])dnl
910
 
AS_VAR_POPDEF([FLAGS])dnl
911
 
])
912
 
 
913
 
AC_DEFUN([AX_CFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1,
914
 
[AX_CFLAGS_GCC_OPTION_NEW($@)],[AX_CFLAGS_GCC_OPTION_OLD($@)])])
915
 
 
916
 
AC_DEFUN([AX_CXXFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1,
917
 
[AX_CXXFLAGS_GCC_OPTION_NEW($@)],[AX_CXXFLAGS_GCC_OPTION_OLD($@)])])