Changeset: 359b380e0446 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=359b380e0446 Modified Files: configure.ag Branch: default Log Message:
Use modern autoconf features. See the start of configure.ag for an explanation of the syntax used. The big advantage of using these relatively new features is that editing becomes easier: parentheses are balanced. diffs (truncated from 4634 to 300 lines): diff --git a/configure.ag b/configure.ag --- a/configure.ag +++ b/configure.ag @@ -7,15 +7,50 @@ dnl file, You can obtain one at http://m dnl dnl Copyright 1997 - July 2008 CWI, August 2008 - 2016 MonetDB B.V. -# Process this file with autoconf to produce a configure script. +dnl Process this file with autoconf to produce a configure script. -AC_PREREQ([2.60]) +dnl Some help with the syntax: +dnl AS_IF(test, body [, test, body]* [, body]) +dnl All tests are executed in order until one returns true, then +dnl the corresponding body is executed, if no tests succeed, the +dnl last body (if present) is executed. +dnl This translates to a shell if statement with a bunch of elif +dnl clauses and an else clause. + +dnl AS_CASE(word [, pattern, body]* [,body]) +dnl The word is tested against each successive pattern, the body +dnl of the first matching pattern is executed, if no patterns +dnl match, the final body (if present) is executed. +dnl This translates to a shell case command with patterns and +dnl bodies, the final body gets the pattern *. + +dnl AS_VERSION_COMPARE(version1, version2, lt-body, eq-body, gt-body) +dnl The two versions are compared, the body corresponding with +dnl whether the first version is less than, equal to, or greater +dnl than the second version is executed. + +dnl AS_VAR_IF(var, word, eq-body, ne-body) +dnl If $var is equal to word, execute eq-body, else execute ne-body. + +dnl @%:@ +dnl This is a quadrigraph for #. We use this in C preprocessor +dnl code that we inline in the script so that it doesn't get +dnl confused with a start-of-comment. + +dnl Note that by using this syntax, there should not be any +dnl unbalanced parentheses (due to there not being loose case +dnl statements). This makes editing easier. + +dnl Also note that comments that start with # are copied to the +dnl configure file, whereas comments starting with dnl are elided. + +AC_PREREQ([2.63]) AC_INIT([MonetDB], [11.24.0], [https://bugs.monetdb.org/], [MonetDB], [https://www.monetdb.org/]) AC_CONFIG_AUX_DIR([buildtools/conf]) AC_CONFIG_MACRO_DIR([buildtools/conf]) AC_CANONICAL_HOST AC_CANONICAL_TARGET -dnl use tar-ustar since we have long (longer than 99 characters) file names +dnl use tar-ustar since we have long (longer than 99 characters) file names AM_INIT_AUTOMAKE([tar-ustar no-dist-gzip dist-bzip2]) AC_CONFIG_SRCDIR([gdk/gdk.h]) AC_CONFIG_HEADERS([monetdb_config.h]) @@ -26,9 +61,8 @@ AC_DEFINE_UNQUOTED([HOST], ["$HOST"], [H AC_DEFINE([MONETDB_RELEASE], ["unreleased"], [Release name or "unreleased"]) -if test x"$target_os" = xcygwin; then - AC_DEFINE([WIN32], 1, [Define on Microsoft Windows (also under Cygwin)]) -fi +AS_VAR_IF([target_os], [cygwin], + [AC_DEFINE([WIN32], 1, [Define on Microsoft Windows (also under Cygwin)])]) AM_CONDITIONAL([NOT_WIN32], [test x"$target_os" != xcygwin]) AM_CONDITIONAL([NATIVE_WIN32], [false]) @@ -41,21 +75,16 @@ m4_ifndef([PKG_PROG_PKG_CONFIG], PKG_PROG_PKG_CONFIG -if test x"$PKG_CONFIG" = x ; then - AC_MSG_ERROR([pkg-config is required to configure MonetDB]) -fi +AS_VAR_IF([PKG_CONFIG], [], + [AC_MSG_ERROR([pkg-config is required to configure MonetDB])]) -dnl VERSION_TO_NUMBER macro (copied from libxslt) -AC_DEFUN([MONETDB_VERSION_TO_NUMBER], -[`$1 | sed 's|[[_\-]][[a-zA-Z0-9]]*$||' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`]) +dnl BUILD and SOURCE are *only* used for testing. -# BUILD and SOURCE are *only* used for testing. - -# The Q versions of various variables are used in places where \'s -# need to be escapes with an extra \. Configure does not support \'s -# in path names, so there is no need to do anything special here -# except set the variables. The command to set them in case we do -# need to escape the \'s is Qvar=`echo "$var" | sed 's/\\\\/\\\\\\\\/g'` +dnl The Q versions of various variables are used in places where \'s +dnl need to be escapes with an extra \. Configure does not support \'s +dnl in path names, so there is no need to do anything special here +dnl except set the variables. The command to set them in case we do +dnl need to escape the \'s is Qvar=`echo "$var" | sed 's/\\\\/\\\\\\\\/g'` BUILD=[`pwd`] AC_SUBST([BUILD]) @@ -68,61 +97,55 @@ AC_SUBST([MAPI_VERSION]) AC_SUBST([MONETDB5_VERSION]) AC_SUBST([STREAM_VERSION]) -# if no --prefix option, we must set Qprefix to the default value -# the problem is that prefix is set very late in the process if it -# wasn't set by --prefix -if test "${prefix}x" = "NONEx"; then - Qprefix="${ac_default_prefix}" -else - Qprefix="${prefix}" -fi +dnl if no --prefix option, we must set Qprefix to the default value +dnl the problem is that prefix is set very late in the process if it +dnl wasn't set by --prefix +AS_VAR_IF([prefix], [NONE], + [Qprefix="${ac_default_prefix}"]. + [Qprefix="${prefix}"]) + Qprefix="`echo "$Qprefix" | sed 's/\\\\/\\\\\\\\/g'`" AC_SUBST([Qprefix]) -# exec_prefix is created very late, so let make do the expansion -if test "${exec_prefix}x" = "NONEx"; then - Qexec_prefix='${prefix}' -else - Qexec_prefix="`echo "$exec_prefix" | sed 's/\\\\/\\\\\\\\/g'`" -fi +dnl exec_prefix is created very late, so let make do the expansion +AS_VAR_IF([exec_prefix], [NONE], + [Qexec_prefix='${prefix}'], + [Qexec_prefix="`echo "$exec_prefix" | sed 's/\\\\/\\\\\\\\/g'`"]) AC_SUBST([Qexec_prefix]) -dnl small hack to get icc -no-gcc, done here because AC_PROG_CC shouldn't -dnl set GCC=yes if we use icc. -case "$CC" in -*icc*-no-gcc*) ;; -*icc*) - dnl Since version 8.0, ecc/ecpc are also called icc/icpc, - dnl and icc/icpc requires "-no-gcc" to avoid predefining - dnl __GNUC__, __GNUC_MINOR__, and __GNUC_PATCHLEVEL__ macros. - icc_ver="`$CC -dumpversion 2>/dev/null`" - case $icc_ver in - 8.*) CC="$CC -no-gcc";; - 9.*) CC="$CC -no-gcc";; - 10.*) CC="$CC -no-gcc";; - 11.*) CC="$CC -no-gcc";; - 15.*) CC="$CC -no-gcc";; - *) AC_MSG_WARN([icc ($CC) $icc_ver not handled, yet]);; - esac - ;; -esac +dnl small hack to get icc -no-gcc, done here because AC_PROG_CC shouldn't +dnl set GCC=yes if we use icc. +AS_CASE(["$CC"], + [*icc*-no-gcc*], [], + [*icc*], [ + dnl Since version 8.0, ecc/ecpc are also called icc/icpc, + dnl and icc/icpc requires "-no-gcc" to avoid predefining + dnl __GNUC__, __GNUC_MINOR__, and __GNUC_PATCHLEVEL__ macros. + icc_ver="`$CC -dumpversion 2>/dev/null`" + AS_CASE([$icc_ver], + [8.*], [CC="$CC -no-gcc"], + [9.*], [CC="$CC -no-gcc"], + [10.*], [CC="$CC -no-gcc"], + [11.*], [CC="$CC -no-gcc"], + [15.*], [CC="$CC -no-gcc"], + [AC_MSG_WARN([icc ($CC) $icc_ver not handled, yet])])]) -if test -f "$srcdir"/vertoo.data; then +AS_IF([test -f "$srcdir"/vertoo.data], + [ dnl Developers compiling from Mercurial: dnl default is --enable-strict --enable-assert --enable-debug --disable-optimize --enable-developer dft_strict=yes dft_assert=yes dft_debug=yes dft_optimize=no - dft_developer=yes -else + dft_developer=yes], + [ dnl Users compiling from source tarball(s): dnl default is --disable-strict --disable-assert --disable-debug --disable-optimize --disable-developer dft_strict=no dft_assert=no dft_debug=no dft_optimize=no - dft_developer=no -fi + dft_developer=no]) dft_gdk=yes AC_ARG_ENABLE([gdk], @@ -137,15 +160,11 @@ AC_ARG_ENABLE([monetdb5], [enable support for MonetDB5 (default=yes)])], [enable_monetdb5=$enableval], [enable_monetdb5=$dft_monetdb5]) -case "$enable_gdk-$enable_monetdb5" in -no-yes) - AC_MSG_ERROR([MonetDB5 requires GDK.]) - ;; -no-auto) - enable_monetdb5=no - disable_monetdb5="(MonetDB5 requires GDK.)" - ;; -esac +AS_CASE(["$enable_gdk-$enable_monetdb5"], + [no-yes], [AC_MSG_ERROR([MonetDB5 requires GDK.])], + [no-auto], [ + enable_monetdb5=no + disable_monetdb5="(MonetDB5 requires GDK.)"]) dft_fits=auto AC_ARG_ENABLE([fits], @@ -174,15 +193,12 @@ AC_ARG_ENABLE([sql], [enable support for MonetDB/SQL (default=yes)])], [enable_sql=$enableval], [enable_sql=$dft_sql]) -case "$enable_monetdb5-$enable_sql" in -no-yes) - AC_MSG_ERROR([MonetDB/SQL requires MonetDB5.]) - ;; -no-auto) +AS_CASE(["$enable_monetdb5-$enable_sql"], +[no-yes], [ + AC_MSG_ERROR([MonetDB/SQL requires MonetDB5.])], +[no-auto], [ enable_sql=no - disable_sql="(MonetDB/SQL requires MonetDB5.)" - ;; -esac + disable_sql="(MonetDB/SQL requires MonetDB5.)"]) dft_geom=auto AC_ARG_ENABLE([geom], @@ -190,15 +206,12 @@ AC_ARG_ENABLE([geom], [enable support for geom module (default=auto)])], [enable_geom=$enableval], [enable_geom=$dft_geom]) -case "$enable_monetdb5-$enable_geom" in -no-yes) - AC_MSG_ERROR([geom module requires MonetDB5]) - ;; -no-auto) +AS_CASE(["$enable_monetdb5-$enable_geom"], +[no-yes], [ + AC_MSG_ERROR([geom module requires MonetDB5])], +[no-auto], [ enable_geom=no - disable_geom="(geom module requires MonetDB5)" - ;; -esac + disable_geom="(geom module requires MonetDB5)"]) dft_shp=auto AC_ARG_ENABLE([shp], @@ -206,15 +219,12 @@ AC_ARG_ENABLE([shp], [enable support for ESRI Shapefiles (default=auto)])], [have_shp=$enableval], [have_shp=$dft_shp]) -case "$enable_geom-$have_shp" in -no-yes) - AC_MSG_ERROR([ESRI Shapefile vault requires the geom module]) - ;; -no-auto) +AS_CASE(["$enable_geom-$have_shp"], +[no-yes], [ + AC_MSG_ERROR([ESRI Shapefile vault requires the geom module])], +[no-auto], [ have_shp=no - disable_shp="(ESRI Shapefile vault requires the geom module)" - ;; -esac + disable_shp="(ESRI Shapefile vault requires the geom module)"]) dft_mapi=yes AC_ARG_ENABLE([mapi], @@ -223,9 +233,8 @@ AC_ARG_ENABLE([mapi], [enable_mapi=$enableval], [enable_mapi=$dft_mapi]) AM_CONDITIONAL([HAVE_MAPI], [test x$enable_mapi != xno]) -if test "x$enable_mapi" != xno; then - AC_DEFINE([HAVE_MAPI], 1, [Enable MAPI]) -fi +AS_VAR_IF([enable_mapi], [no], [], + [AC_DEFINE([HAVE_MAPI], 1, [Enable MAPI])]) dft_embedded=no AC_ARG_ENABLE([embedded], @@ -234,9 +243,8 @@ AC_ARG_ENABLE([embedded], [enable_embedded=$enableval], [enable_embedded=$dft_embedded]) AM_CONDITIONAL([HAVE_EMBEDDED], [test x$enable_embedded != xno]) -if test "x$enable_embedded" != xno; then - AC_DEFINE([HAVE_EMBEDDED], 1, [Support for MonetDB as a library]) -fi +AS_VAR_IF([enable_embedded], [no], [], + [AC_DEFINE([HAVE_EMBEDDED], 1, [Support for MonetDB as a library])]) dft_embedded_r=no _______________________________________________ checkin-list mailing list [email protected] https://www.monetdb.org/mailman/listinfo/checkin-list
