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