gmyth/configure.ac
author morphbr
Thu May 17 21:58:17 2007 +0100 (2007-05-17)
branchtrunk
changeset 686 b29ea6deb6f8
parent 639 b2ebfaeb18c1
child 698 9019388af980
permissions -rw-r--r--
[svn r692] * Gmyth:
- Print size in gmyth_cat

* GMyth-Streamer:
- Bug fix to get size
leo_sobral@1
     1
#                                               -*- Autoconf -*-
leo_sobral@1
     2
# Process this file with autoconf to produce a configure script.
leo_sobral@1
     3
leo_sobral@1
     4
AC_PREREQ(2.50)
leo_sobral@1
     5
renatofilho@510
     6
AC_INIT([gmyth],[0.3])
leo_sobral@1
     7
rosfran@618
     8
AC_CONFIG_SRCDIR([src/gmyth.h])
leo_sobral@1
     9
AC_CONFIG_HEADER(config.h)
leo_sobral@1
    10
leo_sobral@1
    11
dnl when going to/from release please set the nano (fourth number) right !
leo_sobral@1
    12
dnl releases only do Wall, SVN and prerelease does Werror too
renatofilho@510
    13
AS_VERSION(gmyth, GMYTH, 0, 3, 0, 0, GMYTH_SVN="no", GMYTH_SVN="yes")
rosfran@134
    14
GMYTH_MAJORMINOR=$GMYTH_MAJOR_VERSION.$GMYTH_MINOR_VERSION
rosfran@134
    15
AC_SUBST(GMYTH_MAJORMINOR)
leo_sobral@1
    16
leo_sobral@1
    17
dnl AM_MAINTAINER_MODE provides the option to enable maintainer mode
leo_sobral@1
    18
AM_MAINTAINER_MODE
leo_sobral@1
    19
dnl make aclocal work in maintainer mode
leo_sobral@1
    20
AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
leo_sobral@1
    21
leo_sobral@1
    22
# Checks for programs.
leo_sobral@1
    23
# check for tools
leo_sobral@1
    24
# Make sure CFLAGS is defined to stop AC_PROC_CC adding -g
leo_sobral@1
    25
CFLAGS="$CFLAGS -Wall"
leo_sobral@1
    26
AC_PROG_CC
leo_sobral@1
    27
AC_PROG_LIBTOOL
leo_sobral@1
    28
leo_sobral@1
    29
dnl Generate doxygen documentation
leo_sobral@1
    30
DX_HTML_FEATURE(ON)
leo_sobral@1
    31
DX_CHM_FEATURE(OFF)
leo_sobral@1
    32
DX_CHI_FEATURE(OFF)
leo_sobral@1
    33
DX_MAN_FEATURE(OFF)
leo_sobral@1
    34
DX_RTF_FEATURE(OFF)
leo_sobral@1
    35
DX_XML_FEATURE(OFF)
leo_sobral@1
    36
DX_PDF_FEATURE(OFF)
leo_sobral@1
    37
DX_PS_FEATURE(OFF)
leo_sobral@1
    38
DX_INIT_DOXYGEN(gmyth, doxygen.cfg, docs)
leo_sobral@1
    39
leo_sobral@1
    40
# Checks for libraries.
leo_sobral@1
    41
leo_sobral@1
    42
# Checks for header files.
leo_sobral@1
    43
AC_HEADER_STDC
leo_sobral@1
    44
AC_CHECK_HEADERS([fcntl.h stdint.h stdlib.h string.h sys/ioctl.h sys/socket.h unistd.h])
leo_sobral@1
    45
leo_sobral@1
    46
# Checks for typedefs, structures, and compiler characteristics.
leo_sobral@1
    47
AC_C_CONST
leo_sobral@1
    48
AC_TYPE_PID_T
leo_sobral@1
    49
AC_STRUCT_TM
rosfran@134
    50
AC_HEADER_TIME
rosfran@134
    51
AC_HEADER_STDBOOL
rosfran@134
    52
leo_sobral@1
    53
# Checks for library functions.
leo_sobral@1
    54
AC_FUNC_FORK
rosfran@134
    55
AC_FUNC_STRFTIME
rosfran@134
    56
AC_FUNC_SELECT_ARGTYPES
leo_sobral@1
    57
AC_PROG_GCC_TRADITIONAL
leo_sobral@1
    58
AC_FUNC_MALLOC
leo_sobral@1
    59
AC_FUNC_MKTIME
rosfran@215
    60
AC_FUNC_STRFTIME
leo_sobral@1
    61
AC_FUNC_VPRINTF
rosfran@215
    62
AC_CHECK_FUNCS([memset socket stime strstr strtoul gethostname inet_ntoa localtime_r select strrchr localtime strptime])
leo_sobral@1
    63
rosfran@261
    64
##############################
rosfran@261
    65
# Checks for Network functions
rosfran@261
    66
##############################
rosfran@261
    67
rosfran@261
    68
AC_CHECK_FUNCS([socket])
rosfran@261
    69
AC_CHECK_FUNCS([inet_ntoa])
rosfran@261
    70
AC_CHECK_HEADERS([ifaddrs.h])
rosfran@261
    71
AC_CHECK_FUNCS([getifaddrs])
rosfran@261
    72
AC_CHECK_FUNCS([time])
rosfran@261
    73
leo_sobral@1
    74
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
leo_sobral@1
    75
rosfran@246
    76
CFLAGS="$CFLAGS -I/usr/include"
rosfran@246
    77
LDFLAGS="$LDFLAGS -L/usr/lib"
rosfran@246
    78
leo_sobral@1
    79
# Checks required packages
leo_sobral@1
    80
rosfran@486
    81
dnl Test if --enable-debug given
leo_sobral@1
    82
AC_ARG_ENABLE(debug,
rosfran@491
    83
        [AC_HELP_STRING([--enable-debug], [enable debugging mode])],
rosfran@491
    84
        enable_debug="$enableval",
rosfran@486
    85
        enable_debug=no)
rosfran@423
    86
rosfran@486
    87
if test "x$enable_debug" = "xyes" ; then
rosfran@486
    88
    AC_DEFINE(GMYTH_USE_DEBUG, 1, [Debug enabled!])
renatofilho@131
    89
    CFLAGS="$CFLAGS -g -DGMYTH_USE_DEBUG"
leo_sobral@1
    90
else
renatofilho@131
    91
    CFLAGS="$CFLAGS -O2 -DG_DISABLE_CHECKS"
rosfran@486
    92
fi
rosfran@486
    93
rosfran@486
    94
AM_CONDITIONAL(GMYTH_USE_DEBUG, test "x$enable_debug" = "xyes")
leo_sobral@1
    95
rosfran@597
    96
AC_ARG_ENABLE(coverage,
rosfran@597
    97
        AS_HELP_STRING([--enable-coverage],
rosfran@597
    98
                [enable coverage (default = no)]),
rosfran@597
    99
                [
rosfran@597
   100
                        if test $enableval = no; then
rosfran@597
   101
                                USE_COVERAGE=no;
rosfran@597
   102
                        else
rosfran@597
   103
                                USE_COVERAGE=yes;
rosfran@597
   104
                        fi
rosfran@597
   105
                ],[
rosfran@597
   106
                        USE_COVERAGE=no;
rosfran@597
   107
                ]
rosfran@597
   108
)
rosfran@597
   109
rosfran@597
   110
if [ test $USE_COVERAGE = yes ]; then
rosfran@597
   111
        CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage -O0"
rosfran@597
   112
        LDFLAGS="$LDFLAGS -lgcov"
rosfran@597
   113
fi
rosfran@597
   114
rosfran@601
   115
AC_ARG_ENABLE(mudflap-debug,
rosfran@601
   116
        AS_HELP_STRING([--enable-mudflap-debug],
rosfran@601
   117
                [enable libmudflap debug (default = no)]),
rosfran@601
   118
                [
rosfran@601
   119
                        if test $enableval = no; then
rosfran@601
   120
                                USE_MUDFLAP_DEBUG=no;
rosfran@601
   121
                        else
rosfran@601
   122
                                USE_MUDFLAP_DEBUG=yes;
rosfran@601
   123
                        fi
rosfran@601
   124
                ],[
rosfran@601
   125
                        USE_MUDFLAP_DEBUG=no;
rosfran@601
   126
                ]
rosfran@601
   127
)
rosfran@601
   128
rosfran@601
   129
if [ test $USE_MUDFLAP_DEBUG = yes ]; then
rosfran@601
   130
        CFLAGS="$CFLAGS -fmudflap -fmudflapth -O0"
rosfran@601
   131
        LDFLAGS="$LDFLAGS -lmudflapth"
rosfran@601
   132
fi
rosfran@601
   133
rosfran@639
   134
AC_ARG_ENABLE(profiling,
rosfran@639
   135
        AS_HELP_STRING([--enable-profiling],
rosfran@639
   136
                [enable GNU profiling (default = no)]),
rosfran@639
   137
                [
rosfran@639
   138
                        if test $enableval = no; then
rosfran@639
   139
                                USE_PROFILING=no;
rosfran@639
   140
                        else
rosfran@639
   141
                                USE_PROFILING=yes;
rosfran@639
   142
                        fi
rosfran@639
   143
                ],[
rosfran@639
   144
                        USE_PROFILING=no;
rosfran@639
   145
                ]
rosfran@639
   146
)
rosfran@639
   147
rosfran@639
   148
if [ test $USE_PROFILING = yes ]; then
rosfran@639
   149
        CFLAGS="$CFLAGS -pg"
rosfran@639
   150
fi
rosfran@639
   151
leo_sobral@1
   152
# Check for pkgconfig
leo_sobral@1
   153
AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
leo_sobral@1
   154
# Give error and exit if we don't have pkgconfig
leo_sobral@1
   155
if test "x$HAVE_PKGCONFIG" = "xno"; then
leo_sobral@1
   156
  AC_MSG_ERROR(you need to have pkgconfig installed !)
leo_sobral@1
   157
fi
leo_sobral@1
   158
leo_sobral@1
   159
# Check for Glib2.0
leo_sobral@1
   160
PKG_CHECK_MODULES(GLIB, glib-2.0, HAVE_GLIB=yes,HAVE_GLIB=no)
leo_sobral@1
   161
leo_sobral@1
   162
# Give error and exit if we don't have glib
leo_sobral@1
   163
if test "x$HAVE_GLIB" = "xno"; then
leo_sobral@1
   164
  AC_MSG_ERROR(you need glib-2.0 installed)
leo_sobral@1
   165
fi
leo_sobral@1
   166
leo_sobral@1
   167
# make GLIB_CFLAGS and GLIB_LIBS available
leo_sobral@1
   168
AC_SUBST(GLIB_CFLAGS)
leo_sobral@1
   169
AC_SUBST(GLIB_LIBS)
leo_sobral@1
   170
leo_sobral@1
   171
# Check for GObject2.0
leo_sobral@1
   172
PKG_CHECK_MODULES(GOBJECT,
leo_sobral@1
   173
  gobject-2.0,
leo_sobral@1
   174
  HAVE_GOBJECT=yes, HAVE_GOBJECT=no)
leo_sobral@1
   175
leo_sobral@1
   176
# Give error and exit if we don't have gobject
leo_sobral@1
   177
if test "x$HAVE_GOBJECT" = "xno"; then
leo_sobral@1
   178
  AC_MSG_ERROR(you need gobject-2.0 installed)
leo_sobral@1
   179
fi
leo_sobral@1
   180
leo_sobral@1
   181
# make GOBJECT_CFLAGS and GOBJECT_LIBS available
leo_sobral@1
   182
AC_SUBST(GOBJECT_CFLAGS)
leo_sobral@1
   183
AC_SUBST(GOBJECT_LIBS)
leo_sobral@1
   184
rosfran@564
   185
# Check for GThread 
rosfran@564
   186
PKG_CHECK_MODULES(GTHREAD, gthread-2.0, HAVE_GTHREAD=yes,HAVE_GTHREAD=no)
rosfran@564
   187
rosfran@564
   188
# Give error and exit if we don't have glib
rosfran@564
   189
if test "x$HAVE_GTHREAD" = "xno"; then
rosfran@564
   190
  AC_MSG_ERROR(you need gthread+-2.0 installed)
rosfran@564
   191
fi
rosfran@564
   192
rosfran@564
   193
# make GTHREAD_CFLAGS and GTHREAD_LIBS available
rosfran@564
   194
AC_SUBST(GTHREAD_CFLAGS)
rosfran@564
   195
AC_SUBST(GTHREAD_LIBS)
rosfran@564
   196
leo_sobral@1
   197
# Check for libxml-2.0
leo_sobral@1
   198
PKG_CHECK_MODULES(LIBXML, libxml-2.0, HAVE_LIBXML=yes,HAVE_LIBXML=no)
leo_sobral@1
   199
renatofilho@18
   200
# Give error and exit if we don't have libxml
leo_sobral@1
   201
if test "x$HAVE_LIBXML" = "xno"; then
leo_sobral@1
   202
  AC_MSG_ERROR(you need libxml-2.0 installed)
leo_sobral@1
   203
fi
leo_sobral@1
   204
leo_sobral@1
   205
# make LIBXML_CFLAGS and LIBXML_LIBS available
leo_sobral@1
   206
AC_SUBST(LIBXML_CFLAGS)
leo_sobral@1
   207
AC_SUBST(LIBXML_LIBS)
leo_sobral@1
   208
morphbr@268
   209
# Check for libcurl
morphbr@268
   210
PKG_CHECK_MODULES(LIBCURL, libcurl, HAVE_LIBCRUL=yes, HAVE_LIBCURL=no)
morphbr@268
   211
morphbr@268
   212
# Give error and exit if we don't have libcurl
morphbr@268
   213
if test "x$HAVE_LIBCURL" = "xno"; then
morphbr@268
   214
  AC_MSG_ERROR(you need libcurl installed)
morphbr@268
   215
fi
morphbr@268
   216
morphbr@268
   217
# make LIBCURL_CFLAGS and LIBCURL_LIBS available
morphbr@268
   218
AC_SUBST(LIBCURL_CFLAGS)
morphbr@268
   219
AC_SUBST(LIBCURL_LIBS)
morphbr@268
   220
leo_sobral@1
   221
leo_sobral@1
   222
#
leo_sobral@1
   223
# mysql libraries
leo_sobral@1
   224
#
melunko@257
   225
AC_CHECK_PROG(MYSQL_CFLAGS,mysql_config,`mysql_config --cflags`)
melunko@257
   226
if test -z "$MYSQL_CFLAGS"; then
melunko@257
   227
        AC_MSG_ERROR([Could not find mysql_config script. Make sure the mysql client libraries are installed])
melunko@257
   228
fi
melunko@257
   229
AC_SUBST(MYSQL_CFLAGS)
rosfran@246
   230
rosfran@240
   231
melunko@257
   232
AC_CHECK_PROG(MYSQL_LIBS,mysql_config,`mysql_config --libs`)
melunko@257
   233
if test -z "$MYSQL_LIBS"; then
melunko@257
   234
        AC_MSG_ERROR([Could not find mysql_config script. Make sure the mysql client libraries are installed])
melunko@257
   235
fi
leo_sobral@1
   236
AC_SUBST(MYSQL_LIBS)
leo_sobral@1
   237
leo_sobral@1
   238
#dnl Enable gtk-doc
leo_sobral@1
   239
#GTK_DOC_CHECK(1.4)
leo_sobral@1
   240
rosfran@639
   241
# checks if the indent tool can be found
rosfran@639
   242
AC_CHECK_PROG(HAVE_INDENT, indent, [Found!])
rosfran@656
   243
if test -n "$HAVE_INDENT"; then
rosfran@639
   244
	AC_DEFINE(HAVE_INDENT, 1, [AutoIndent found!])
rosfran@639
   245
fi
rosfran@639
   246
rosfran@656
   247
AM_CONDITIONAL(HAVE_INDENT, test -n "$HAVE_INDENT")
rosfran@639
   248
rosfran@639
   249
# checks if the gprof tool can be found
rosfran@639
   250
AC_CHECK_PROG(HAVE_GPROF, gprof, [Found!])
rosfran@656
   251
if test -n "$HAVE_GPROF"; then
rosfran@639
   252
	AC_DEFINE(HAVE_GPROF, 1, [Gnu Profiling tool found!])
rosfran@639
   253
fi
rosfran@639
   254
rosfran@656
   255
AM_CONDITIONAL(HAVE_GPROF, test -n "$HAVE_GPROF")
rosfran@639
   256
rosfran@639
   257
# checks if the gcov tool can be found
rosfran@639
   258
AC_CHECK_PROG(HAVE_GCOV, gcov, [Found!])
rosfran@656
   259
if test -n "$HAVE_GCOV"; then
rosfran@639
   260
	AC_DEFINE(HAVE_GCOV, 1, [Gnu Coverage tool found!])
rosfran@639
   261
fi
rosfran@639
   262
rosfran@656
   263
AM_CONDITIONAL(HAVE_GCOV, test -n "$HAVE_GCOV")
rosfran@639
   264
rosfran@639
   265
# checks if the genhtml tool can be found
rosfran@639
   266
AC_CHECK_PROG(HAVE_GENHTML, genhtml, [Found!])
rosfran@656
   267
if test -n "$HAVE_GENHTML"; then
rosfran@639
   268
	AC_DEFINE(HAVE_GENHTML, 1, [Gnu Coverage HTML report generator found!])
rosfran@639
   269
fi
rosfran@639
   270
rosfran@656
   271
AM_CONDITIONAL(HAVE_GENHTML, test -n "$HAVE_GENHTML")
rosfran@639
   272
rosfran@246
   273
AC_SUBST(CFLAGS)
rosfran@246
   274
AC_SUBST(LDFLAGS)
rosfran@246
   275
AC_SUBST(LIBS)
rosfran@246
   276
renatofilho@131
   277
AC_OUTPUT([
renatofilho@131
   278
Makefile
renatofilho@131
   279
src/Makefile
melunko@579
   280
samples/Makefile
renatofilho@148
   281
tests/Makefile
renatofilho@131
   282
gmyth.pc])
renatofilho@131
   283
rosfran@261
   284
if test "x$enable_debug" != "xno"; then
renatofilho@131
   285
    AC_MSG_NOTICE([Debug: Enabled])
renatofilho@131
   286
else
renatofilho@131
   287
    AC_MSG_NOTICE([Debug: Disabled])
renatofilho@131
   288
fi          
renatofilho@131
   289