Changeset 3436702


Ignore:
Timestamp:
10/26/05 16:32:07 (15 years ago)
Author:
Daniel Lawson <dlawson@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
767bd50
Parents:
6f75b9d
Message:

autoconf test for attribute((pure))

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • configure.in

    r437d002 r3436702  
    121121AC_PROG_GCC_TRADITIONAL
    122122AC_CHECK_FUNCS(socket strdup)
     123
     124# configure time option for __attribute__((pure))
     125test_pure=true
     126AC_ARG_WITH(pure,
     127            AC_HELP_STRING([--with-pure],
     128                           [use __attribute__((pure)) for optimisation]),
     129[
     130        if test "$withval" = no
     131        then
     132                test_pure=false
     133        else
     134                test_pure=true
     135        fi
     136],[
     137        test_pure=true
     138])
     139
     140libtrace_pure=false
     141if test "$test_pure" = true; then
     142        AC_MSG_CHECKING([if compiler supports __attribute__((pure))])
     143        AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
     144                           [[#define SIMPLE_FUNCTION __attribute__((pure))]])],
     145                [AC_DEFINE(HAVE_ATTR_PURE,1,[define to test for __attribute__((pure)) support]) libtrace_pure=true],
     146                [AC_DEFINE(HAVE_ATTR_PURE,0,[define to test for __attribute__((pure)) support]) libtrace_pure=false])
     147
     148        AC_MSG_RESULT($libtrace_pure)
     149fi
    123150
    124151# configure time options for man pages
     
    288315reportopt "Compiled with PCAP support" $libtrace_pcap
    289316reportopt "Compiled with compressed trace (zlib) support" $libtrace_zlib
     317reportopt "Compiled with __attribute__((pure))" $libtrace_pure
    290318reportopt "Compiled with DAG support (libdag)" $libtrace_dag
    291319reportopt "Compiled with DAG support (DAG 2.4)" $libtrace_dag2_4
  • lib/libtrace.h

    r6f75b9d r3436702  
    3434#include <sys/types.h>
    3535#include <netinet/in.h>
     36#include "config.h"
    3637
    3738/** API version as 2 byte hex digits, eg 0xXXYYZZ */
     
    4546 * parameters, used to hint gcc's optimisations
    4647 */
    47 #define SIMPLE_FUNCTION __attribute__((pure))
     48#ifdef HAVE_ATTR_PURE
     49#  define SIMPLE_FUNCTION __attribute__((pure))
     50#else
     51#  define SIMPLE_FUNCTION
     52#endif
     53       
    4854
    4955/** @file
Note: See TracChangeset for help on using the changeset viewer.