#-*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.60)
AC_INIT([reflex], [0.1])
AM_INIT_AUTOMAKE
PKG_PROG_PKG_CONFIG
# Remember externally set CFLAGS
EXTERNAL_CFLAGS="$CFLAGS"
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
# Reset the externally set CFLAGS after calling AC_PROG*
CFLAGS="$EXTERNAL_CFLAGS"
# Use the C language and compiler for the following checks
AC_LANG([C])
# Checks for libraries.
AM_PROG_LIBTOOL
# Set shared libraries
AC_DISABLE_STATIC
AC_ENABLE_SHARED
#check and include libraries
AC_CHECK_LIB(pthread,pthread_create)
AC_CHECK_LIB(pthread, pthread_attr_init)
# Add debug support
AC_ARG_ENABLE(debug,
AS_HELP_STRING(
[--enable-debug],
[enable debugging, default: no]),
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
esac],
[debug=false])
AM_CONDITIONAL(DEBUG, test x"$debug" = x"true")
AM_COND_IF(DEBUG,
AC_DEFINE(DEBUG, 1, [Define to 0 if this is a release build]),
AC_DEFINE(DEBUG, 0, [Define to 1 or higher if this is a debug build]))
# Enable local libraries for local build
AC_ARG_ENABLE(local_lib,
AS_HELP_STRING(
[--enable-local-lib],
[enable local library, default: no]),
[case "${enableval}" in
yes) local_lib=true ;;
no) local_lib=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-local-lib]) ;;
esac],
[debug=false])
AM_CONDITIONAL(LOCAL_LIB, test x"$local_lib" = x"true")
AM_COND_IF(LOCAL_LIB,
AC_DEFINE(LOCAL_LIB, 1, [Define to 0 if this is a release build]),
AC_DEFINE(LOCAL_LIB, 0, [Define to 1 or higher if this is a debug build]))
# Enable GCOV code coverage conditionally
AC_ARG_ENABLE(gcov,
AS_HELP_STRING(
[--enable-gcov],
[enable code coverage, default: no]),
[case "${enableval}" in
yes) gcov_enable=true ;;
no) gcov_enable=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-gcov]) ;;
esac],
[debug=false])
AM_CONDITIONAL(GCOV_ENABLE, test x"$gcov_enable" = x"true")
AM_COND_IF(GCOV_ENABLE,
AC_DEFINE(GCOV_ENABLE, 1, [Define to 0 if this is a release build]),
AC_DEFINE(GCOV_ENABLE, 0, [Define to 1 or higher if this is a debug build]))
# Check libraries
AM_COND_IF(LOCAL_LIB,
[],
[AC_CHECK_LIB(rabbitmq, amqp_basic_publish)])
# Enable local libraries for REUSE build
AC_ARG_ENABLE(reuse_lib,
AS_HELP_STRING(
[--enable-reuse-lib],
[enable reuse library, default: no]),
[case "${enableval}" in
yes) reuse_lib=true ;;
no) reuse_lib=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-reuse-lib]) ;;
esac],
[debug=false])
AM_CONDITIONAL(REUSE_LIB, test x"$reuse_lib" = x"true")
AM_COND_IF(REUSE_LIB,
AC_DEFINE(REUSE_LIB, 1, [Define to 0 if this is a release build]),
AC_DEFINE(REUSE_LIB, 0, [Define to 1 or higher if this is a debug build]))
AC_CONFIG_FILES([
Makefile
src/Makefile
])
AC_OUTPUT
Assistant
Here's the converted Meson build file:
python
import meson
def configure(conf):
conf.autodetect()
conf.set('default_library', 'static')
conf.set('disable_rpath', True)
if meson.environment.is_packager():
conf.set('enable_install_doc', True)
conf.set('enable_install_info', True)
# Check for required libraries
conf.check_library('pthread', ['pthread_create', 'pthread_attr_init'])
# Configure debug and local library support
conf.def_option('debug', True, ['bool', 'Debug mode, default: no'], ['true', 'false'])
conf.def_option('local_lib', False, ['bool', 'Enable local library, default: no'], ['true', 'false'])
conf.def_option('gcov', False, ['bool', 'Enable code coverage, default: no'], ['true', 'false'])
conf.def_option('reuse_lib', False, ['bool', 'Enable reuse library, default: no'], ['true', 'false'])
# Set the default include directories
conf.set_include_dirs([conf.get_source_dir(), '/usr/local/include'])
# Set the default library directories
conf.set_library_dirs([conf.get_source_dir()])
# Set the default runtime library directories
conf.set_runtime_library_dirs([conf.get_source_dir()])
# Run the configuration
configure(meson.initialize())
This Meson build file should work similarly to the original Autoconf file. It sets the default options and checks for required libraries.