Commit f892fdba authored by Seblu's avatar Seblu
Browse files

Configure gere correctement les options

--with-debug
--without-error
--with-efence
parent 46609790
Loading
Loading
Loading
Loading
+39 −46
Original line number Diff line number Diff line
@@ -13,63 +13,56 @@ AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip])
# Check platform
AC_CANONICAL_HOST

CXXFLAGS='-Wall -W -ansi -pedantic -D_XOPEN_SOURCE=600'

# Check for C++ compiler
AC_LANG([C++])
AC_PROG_CXX
# without-error arg
AC_ARG_WITH([error],
  [AS_HELP_STRING([--without-error], [GCC warnings dont make compilation errors])],
  [],
  [with_error=yes]
)

# Check for Make
AC_PROG_MAKE_SET
# with-debug arg
AC_ARG_WITH([debug],
  [AS_HELP_STRING([--with-debug], [Use -g and don't use neither -DNDEBUG nor -O3])],
  [],
  [with_debug=no]
)

# check for ranlib
AC_PROG_RANLIB
# with-efence arg
AC_ARG_WITH([efence],
  [AS_HELP_STRING([--with-efence], [Link with efence library])],
  [],
  [with_efence=no]
)

# Check for lib efence
AC_CHECK_LIB([efence], [malloc], [EFENCELIB=-lefence])
AC_SUBST([EFENCELIB])
echo $with_efence

# Checks for library functions.
# Default CXX Flags
CXXFLAGS='-Wall -W -ansi -pedantic -D_XOPEN_SOURCE=600'

# Checks for typedefs, structures, and compiler characteristics.
# Set Error flags
AS_IF([test "x$with_error" != xno],[CXXFLAGS="$CXXFLAGS -Werror"])

# Check for headers
# Set Debug flags
AS_IF([test "x$with_debug" != xyes],[CXXFLAGS="$CXXFLAGS  -DNDEBUG -O3"], [CXXFLAGS="$CXXFLAGS -g"])

dnl Memo:
dnl AC ARG WITH(package, help-string, [action-if-given], [action-if-not-given])
# Check for C++ compiler
AC_LANG([C++])
AC_PROG_CXX

# Check for Make
AC_PROG_MAKE_SET

AC_ARG_WITH([noerror],
  [AS_HELP_STRING([--with-noerror], [Warning dont create compilation error])],
  [dnl action-if-given
       true
  ],
  [dnl action-if-not-given
       CXXFLAGS="$CXXFLAGS -Werror"
  ]
)
# Check for libs
AC_CHECK_LIB([sqlite3], [sqlite3_open],,[AC_MSG_ERROR([Library sqlite3 not found!])])
AC_CHECK_LIB([ssl], [SSL_library_init],,[AC_MSG_ERROR([Library ssl not found!])])

AC_ARG_WITH([debug],
  [AS_HELP_STRING([--with-debug], [use -g and don't use -DNDEBUG -O3])],
  [dnl action-if-given
       CXXFLAGS="$CXXFLAGS -g"
  ],
  [dnl action-if-not-given
      CXXFLAGS="$CXXFLAGS -DNDEBUG -O3"
  ]
)
# Set efence library
AS_IF([test "x$with_efence" = "xyes" ],
      [AC_CHECK_LIB([efence], [malloc],
		    [LDFLAGS="$LDFLAGS -lefence"; test -r "/usr/include/efence.h" && \
       		     CXXFLAGS="$CXXFLAGS -include stdlib.h -include efence.h"],
		    [AC_MSG_ERROR([Efence library not found!])])])

AC_ARG_WITH([efence],
  [AS_HELP_STRING([--with-efence], [link with lib efence])],
  [dnl action-if-given
       LDFLAGS="$LDFLAGS -lefence"
       test -r "/usr/include/efence.h" &&
       CXXFLAGS="$CXXFLAGS -include stdlib.h -include efence.h"
  ],
  [dnl action-if-not-given
       true
  ]
)

AC_SUBST([CXXFLAGS])
AC_SUBST([LDFLAGS])