gmyth/configure.ac
author renatofilho
Fri May 25 18:22:59 2007 +0100 (2007-05-25)
branchtrunk
changeset 714 03f2acbda6b1
parent 656 49f79548b1cc
child 821 411a01dfcd21
permissions -rw-r--r--
[svn r720] try parse newsegment with byte 0
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
rosfran@698
   152
AC_ARG_ENABLE(upnp,
rosfran@698
   153
        AS_HELP_STRING([--enable-upnp],
rosfran@698
   154
                [enable clinkc's UPnP library (default = no)]),
rosfran@698
   155
                [
rosfran@698
   156
                        if test $enableval = no; then
rosfran@698
   157
                                USE_UPNP=no;
rosfran@698
   158
                        else
rosfran@698
   159
                                USE_UPNP=yes;
rosfran@698
   160
                        fi
rosfran@698
   161
                ],[
rosfran@698
   162
                        USE_UPNP=no;
rosfran@698
   163
                ]
rosfran@698
   164
)
rosfran@698
   165
leo_sobral@1
   166
# Check for pkgconfig
leo_sobral@1
   167
AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
leo_sobral@1
   168
# Give error and exit if we don't have pkgconfig
leo_sobral@1
   169
if test "x$HAVE_PKGCONFIG" = "xno"; then
leo_sobral@1
   170
  AC_MSG_ERROR(you need to have pkgconfig installed !)
leo_sobral@1
   171
fi
leo_sobral@1
   172
leo_sobral@1
   173
# Check for Glib2.0
leo_sobral@1
   174
PKG_CHECK_MODULES(GLIB, glib-2.0, HAVE_GLIB=yes,HAVE_GLIB=no)
leo_sobral@1
   175
leo_sobral@1
   176
# Give error and exit if we don't have glib
leo_sobral@1
   177
if test "x$HAVE_GLIB" = "xno"; then
leo_sobral@1
   178
  AC_MSG_ERROR(you need glib-2.0 installed)
leo_sobral@1
   179
fi
leo_sobral@1
   180
leo_sobral@1
   181
# make GLIB_CFLAGS and GLIB_LIBS available
leo_sobral@1
   182
AC_SUBST(GLIB_CFLAGS)
leo_sobral@1
   183
AC_SUBST(GLIB_LIBS)
leo_sobral@1
   184
leo_sobral@1
   185
# Check for GObject2.0
leo_sobral@1
   186
PKG_CHECK_MODULES(GOBJECT,
leo_sobral@1
   187
  gobject-2.0,
leo_sobral@1
   188
  HAVE_GOBJECT=yes, HAVE_GOBJECT=no)
leo_sobral@1
   189
leo_sobral@1
   190
# Give error and exit if we don't have gobject
leo_sobral@1
   191
if test "x$HAVE_GOBJECT" = "xno"; then
leo_sobral@1
   192
  AC_MSG_ERROR(you need gobject-2.0 installed)
leo_sobral@1
   193
fi
leo_sobral@1
   194
leo_sobral@1
   195
# make GOBJECT_CFLAGS and GOBJECT_LIBS available
leo_sobral@1
   196
AC_SUBST(GOBJECT_CFLAGS)
leo_sobral@1
   197
AC_SUBST(GOBJECT_LIBS)
leo_sobral@1
   198
rosfran@564
   199
# Check for GThread 
rosfran@564
   200
PKG_CHECK_MODULES(GTHREAD, gthread-2.0, HAVE_GTHREAD=yes,HAVE_GTHREAD=no)
rosfran@564
   201
rosfran@564
   202
# Give error and exit if we don't have glib
rosfran@564
   203
if test "x$HAVE_GTHREAD" = "xno"; then
rosfran@564
   204
  AC_MSG_ERROR(you need gthread+-2.0 installed)
rosfran@564
   205
fi
rosfran@564
   206
rosfran@564
   207
# make GTHREAD_CFLAGS and GTHREAD_LIBS available
rosfran@564
   208
AC_SUBST(GTHREAD_CFLAGS)
rosfran@564
   209
AC_SUBST(GTHREAD_LIBS)
rosfran@564
   210
leo_sobral@1
   211
# Check for libxml-2.0
leo_sobral@1
   212
PKG_CHECK_MODULES(LIBXML, libxml-2.0, HAVE_LIBXML=yes,HAVE_LIBXML=no)
leo_sobral@1
   213
renatofilho@18
   214
# Give error and exit if we don't have libxml
leo_sobral@1
   215
if test "x$HAVE_LIBXML" = "xno"; then
leo_sobral@1
   216
  AC_MSG_ERROR(you need libxml-2.0 installed)
leo_sobral@1
   217
fi
leo_sobral@1
   218
leo_sobral@1
   219
# make LIBXML_CFLAGS and LIBXML_LIBS available
leo_sobral@1
   220
AC_SUBST(LIBXML_CFLAGS)
leo_sobral@1
   221
AC_SUBST(LIBXML_LIBS)
leo_sobral@1
   222
morphbr@268
   223
# Check for libcurl
morphbr@268
   224
PKG_CHECK_MODULES(LIBCURL, libcurl, HAVE_LIBCRUL=yes, HAVE_LIBCURL=no)
morphbr@268
   225
morphbr@268
   226
# Give error and exit if we don't have libcurl
morphbr@268
   227
if test "x$HAVE_LIBCURL" = "xno"; then
morphbr@268
   228
  AC_MSG_ERROR(you need libcurl installed)
morphbr@268
   229
fi
morphbr@268
   230
morphbr@268
   231
# make LIBCURL_CFLAGS and LIBCURL_LIBS available
morphbr@268
   232
AC_SUBST(LIBCURL_CFLAGS)
morphbr@268
   233
AC_SUBST(LIBCURL_LIBS)
morphbr@268
   234
rosfran@698
   235
if [ test $USE_UPNP = yes ]; then
rosfran@698
   236
	# checks if the gmyth-upnp library can be found
rosfran@698
   237
	PKG_CHECK_MODULES(UPNP, gmyth-upnp, HAVE_UPNP=yes, HAVE_UPNP=no)
rosfran@698
   238
	if test "x$HAVE_UPNP" = "xyes"; then
rosfran@698
   239
		AC_DEFINE(HAVE_UPNP, 1, [GMyth UPnP library found!])
rosfran@698
   240
		CFLAGS="$CFLAGS -DHAVE_UPNP"
rosfran@698
   241
	fi
rosfran@698
   242
fi
rosfran@698
   243
rosfran@698
   244
AM_CONDITIONAL(HAVE_UPNP, test "x$HAVE_UPNP" = "xyes")
leo_sobral@1
   245
leo_sobral@1
   246
#
leo_sobral@1
   247
# mysql libraries
leo_sobral@1
   248
#
melunko@257
   249
AC_CHECK_PROG(MYSQL_CFLAGS,mysql_config,`mysql_config --cflags`)
melunko@257
   250
if test -z "$MYSQL_CFLAGS"; then
melunko@257
   251
        AC_MSG_ERROR([Could not find mysql_config script. Make sure the mysql client libraries are installed])
melunko@257
   252
fi
melunko@257
   253
AC_SUBST(MYSQL_CFLAGS)
rosfran@246
   254
melunko@257
   255
AC_CHECK_PROG(MYSQL_LIBS,mysql_config,`mysql_config --libs`)
melunko@257
   256
if test -z "$MYSQL_LIBS"; then
melunko@257
   257
        AC_MSG_ERROR([Could not find mysql_config script. Make sure the mysql client libraries are installed])
melunko@257
   258
fi
leo_sobral@1
   259
AC_SUBST(MYSQL_LIBS)
leo_sobral@1
   260
leo_sobral@1
   261
#dnl Enable gtk-doc
leo_sobral@1
   262
#GTK_DOC_CHECK(1.4)
leo_sobral@1
   263
rosfran@639
   264
# checks if the indent tool can be found
rosfran@639
   265
AC_CHECK_PROG(HAVE_INDENT, indent, [Found!])
rosfran@656
   266
if test -n "$HAVE_INDENT"; then
rosfran@639
   267
	AC_DEFINE(HAVE_INDENT, 1, [AutoIndent found!])
rosfran@639
   268
fi
rosfran@639
   269
rosfran@656
   270
AM_CONDITIONAL(HAVE_INDENT, test -n "$HAVE_INDENT")
rosfran@639
   271
rosfran@639
   272
# checks if the gprof tool can be found
rosfran@639
   273
AC_CHECK_PROG(HAVE_GPROF, gprof, [Found!])
rosfran@656
   274
if test -n "$HAVE_GPROF"; then
rosfran@639
   275
	AC_DEFINE(HAVE_GPROF, 1, [Gnu Profiling tool found!])
rosfran@639
   276
fi
rosfran@639
   277
rosfran@656
   278
AM_CONDITIONAL(HAVE_GPROF, test -n "$HAVE_GPROF")
rosfran@639
   279
rosfran@639
   280
# checks if the gcov tool can be found
rosfran@639
   281
AC_CHECK_PROG(HAVE_GCOV, gcov, [Found!])
rosfran@656
   282
if test -n "$HAVE_GCOV"; then
rosfran@639
   283
	AC_DEFINE(HAVE_GCOV, 1, [Gnu Coverage tool found!])
rosfran@639
   284
fi
rosfran@639
   285
rosfran@656
   286
AM_CONDITIONAL(HAVE_GCOV, test -n "$HAVE_GCOV")
rosfran@639
   287
rosfran@639
   288
# checks if the genhtml tool can be found
rosfran@639
   289
AC_CHECK_PROG(HAVE_GENHTML, genhtml, [Found!])
rosfran@656
   290
if test -n "$HAVE_GENHTML"; then
rosfran@639
   291
	AC_DEFINE(HAVE_GENHTML, 1, [Gnu Coverage HTML report generator found!])
rosfran@639
   292
fi
rosfran@639
   293
rosfran@656
   294
AM_CONDITIONAL(HAVE_GENHTML, test -n "$HAVE_GENHTML")
rosfran@639
   295
rosfran@246
   296
AC_SUBST(CFLAGS)
rosfran@246
   297
AC_SUBST(LDFLAGS)
rosfran@246
   298
AC_SUBST(LIBS)
rosfran@246
   299
renatofilho@131
   300
AC_OUTPUT([
renatofilho@131
   301
Makefile
renatofilho@131
   302
src/Makefile
melunko@579
   303
samples/Makefile
renatofilho@148
   304
tests/Makefile
renatofilho@131
   305
gmyth.pc])
renatofilho@131
   306
rosfran@261
   307
if test "x$enable_debug" != "xno"; then
renatofilho@131
   308
    AC_MSG_NOTICE([Debug: Enabled])
renatofilho@131
   309
else
renatofilho@131
   310
    AC_MSG_NOTICE([Debug: Disabled])
renatofilho@131
   311
fi          
renatofilho@131
   312