[PATCH 6/6] better m4 quoting

Jim Meyering meyering at redhat.com
Mon Jan 26 16:24:10 UTC 2009


---
 configure.ac |  126 +++++++++++++++++++++++++++++-----------------------------
 m4/parted.m4 |   24 ++++++------
 2 files changed, 75 insertions(+), 75 deletions(-)

diff --git a/configure.ac b/configure.ac
index 996e96a..65ddedc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,17 +3,17 @@ dnl Copyright (C) 1998-2002, 2005-2008 Free Software Foundation, Inc.
 dnl
 dnl This file may be modified and/or distributed without restriction.

-AC_PREREQ(2.61)
+AC_PREREQ([2.61])
 AC_INIT([GNU parted], m4_esyscmd([build-aux/git-version-gen .version]),
         [bug-parted at gnu.org])

 # When the most recent signed tag is v1.8.8.1,
 # the above might set e.g., PACKAGE_VERSION='1.8.8.1.1-0bfc'

-AC_CONFIG_SRCDIR(include/parted/parted.h)
+AC_CONFIG_SRCDIR([include/parted/parted.h])

 AC_CONFIG_HEADERS([lib/config.h:lib/config.h.in])
-AC_CONFIG_AUX_DIR(build-aux)
+AC_CONFIG_AUX_DIR([build-aux])

 dnl Versioning
 dnl Shamelessly pulled straight from glib's configure.in ...
@@ -47,10 +47,10 @@ LT_RELEASE=$PED_MAJOR_VERSION.$PED_MINOR_VERSION
 LT_CURRENT=`expr $PED_MICRO_VERSION - $PED_INTERFACE_AGE`
 LT_REVISION=$PED_INTERFACE_AGE
 LT_AGE=`expr $PED_BINARY_AGE - $PED_INTERFACE_AGE`
-AC_SUBST(LT_RELEASE)
-AC_SUBST(LT_CURRENT)
-AC_SUBST(LT_REVISION)
-AC_SUBST(LT_AGE)
+AC_SUBST([LT_RELEASE])
+AC_SUBST([LT_CURRENT])
+AC_SUBST([LT_REVISION])
+AC_SUBST([LT_AGE])

 AM_INIT_AUTOMAKE([1.10 dist-bzip2])

@@ -61,20 +61,20 @@ case "$host_os" in
 	beos*)	OS=beos ;;
 	*)	AC_MSG_ERROR([Unknown or unsupported OS "$host_os".  Only "linux", "gnu" and "beos" are supported in this version of GNU Parted.]) ;;
 esac
-AC_SUBST(OS)
+AC_SUBST([OS])

 dnl Command-line options
-AC_ARG_WITH(readline,
+AC_ARG_WITH([readline],
 	[  --with-readline         support fancy command line editing], ,
 	with_readline=yes
 )

-AC_ARG_ENABLE(mtrace,
+AC_ARG_ENABLE([mtrace],
 	[  --enable-mtrace         enable malloc() debugging], ,
 	enable_mtrace=no
 )
 if test "$enable_mtrace" = yes; then
-	AC_DEFINE(ENABLE_MTRACE, 1, [Mtrace malloc() debugging])
+	AC_DEFINE([ENABLE_MTRACE], [1], [Mtrace malloc() debugging])
 fi

 AC_SUBST([ENABLE_DEVICE_MAPPER])
@@ -87,21 +87,21 @@ if test $ENABLE_DEVICE_MAPPER = yes; then
                   1, [device mapper (libdevmapper) support])
 fi

-AC_ARG_ENABLE(selinux,
+AC_ARG_ENABLE([selinux],
 	[  --enable-selinux        enable SELinux support [default=no]], ,
 	enable_selinux=no
 )

-AC_ARG_ENABLE(discover-only,
+AC_ARG_ENABLE([discover-only],
 	[  --enable-discover-only  support only reading/probing [default=no]], ,
 	enable_discover_only=no
 )
 if test "$enable_discover_only" = yes; then
-	AC_DEFINE(DISCOVER_ONLY, 1, [Probing functionality only])
+	AC_DEFINE([DISCOVER_ONLY], [1], [Probing functionality only])
 fi

 PARTED_LIBS=""
-AC_ARG_ENABLE(dynamic-loading,
+AC_ARG_ENABLE([dynamic-loading],
 [  --enable-dynamic-loading  support dynamic fs libraries [default=yes]], ,
 	if test "$enable_discover_only" = yes; then
 		enable_dynamic_loading=no
@@ -115,57 +115,57 @@ if test "$enable_discover_only" = yes -a "$enable_dynamic_loading" = yes; then
 	)
 fi

-AC_ARG_ENABLE(fs,
+AC_ARG_ENABLE([fs],
 	[  --enable-fs             include filesystem support [default=yes]], ,
 	enable_fs=yes
 )
 if test "$enable_fs" = yes; then
-	AC_DEFINE(ENABLE_FS, 1,
+	AC_DEFINE([ENABLE_FS], [1],
 		  [Include file system support.  i.e. libparted/fs_...])
 fi

-AC_ARG_ENABLE(debug,
+AC_ARG_ENABLE([debug],
 	[  --enable-debug          compile in assertions [default=yes]], ,
 	enable_debug=yes
 )

 if test "$enable_debug" = yes; then
-	AC_DEFINE(DEBUG, 1, [Enable assertions, etc.])
+	AC_DEFINE([DEBUG], [1], [Enable assertions, etc.])
 fi

-AC_ARG_ENABLE(read-only,
+AC_ARG_ENABLE([read-only],
 	[  --enable-read-only      disable writing (for debugging) [default=no]]
 	, ,
 	enable_read_only=no
 )
 if test "$enable_read_only" = yes; then
-	AC_DEFINE(READ_ONLY, 1, [Disable all writing code])
+	AC_DEFINE([READ_ONLY], [1], [Disable all writing code])
 fi

 PARTEDLDFLAGS=
-AC_SUBST(PARTEDLDFLAGS)
+AC_SUBST([PARTEDLDFLAGS])

-AC_ARG_ENABLE(pc98,
+AC_ARG_ENABLE([pc98],
 	[  --enable-pc98          build with pc98 support [default=yes]], ,
 	enable_pc98=yes
 )
 if test "$enable_pc98" = yes; then
-	AC_DEFINE(ENABLE_PC98, 1,
+	AC_DEFINE([ENABLE_PC98], [1],
 		  [Include PC98 partition tables.  (Sometimes excluded to avoid
 		   collisions with msdos partition tables])
 fi

-AC_ARG_ENABLE(Werror,
+AC_ARG_ENABLE([Werror],
 	[  --enable-Werror         build with gcc -Werror [default=yes]], ,
 	enable_Werror=yes
 )

-AC_ARG_ENABLE(hfs-extract-fs,
+AC_ARG_ENABLE([hfs-extract-fs],
 	[  --enable-hfs-extract-fs Extract special HFS files for debugging [default=no]], ,
 	enable_hfs_extract_fs=no
 )
 if test "$enable_hfs_extract_fs" = yes; then
-       AC_DEFINE(HFS_EXTRACT_FS, 1,
+       AC_DEFINE([HFS_EXTRACT_FS], [1],
                  [Extract low level special HFS(+) files for debugging purposes
                   when using the "check" command (NOT FOR PACKAGING)])
 fi
@@ -190,7 +190,7 @@ AC_SYS_LARGEFILE

 gl_INIT

-AC_CHECK_SIZEOF(off_t, 64, [
+AC_CHECK_SIZEOF([off_t], [64], [
 	#include <stdio.h>
 	#include <sys/types.h>
 	#include <unistd.h>
@@ -225,20 +225,20 @@ fi
 dnl Check for libdl, if we are doing dynamic loading
 DL_LIBS=""
 if test "$enable_dynamic_loading" = yes; then
-	AC_CHECK_LIB(dl, dlopen,
+	AC_CHECK_LIB([dl], [dlopen],
 		DL_LIBS="-ldl"
 		PARTED_LIBS="$PARTED_LIBS -ldl"
-		AC_DEFINE(DYNAMIC_LOADING, 1, [Lazy linking to fs libs]),
+		AC_DEFINE([DYNAMIC_LOADING], [1], [Lazy linking to fs libs]),
 		AC_MSG_ERROR(
 			[-ldl not found!  Try using --disable-dynamic-loading]
 		)
 	)
 fi
-AC_SUBST(DL_LIBS)
+AC_SUBST([DL_LIBS])

 dnl Check for libuuid
 UUID_LIBS=""
-AC_CHECK_LIB(uuid, uuid_generate, UUID_LIBS="-luuid",
+AC_CHECK_LIB([uuid], [uuid_generate], [UUID_LIBS="-luuid"],
 	AC_MSG_ERROR(
 GNU Parted requires libuuid - a part of the e2fsprogs package (but
 sometimes distributed separately in uuid-devel or similar)
@@ -250,7 +250,7 @@ If you compile e2fsprogs yourself then you need to do 'make install' and
 'make install-libs'.
 	)
 )
-AC_SUBST(UUID_LIBS)
+AC_SUBST([UUID_LIBS])

 dnl Check for libdevmapper
 DM_LIBS=
@@ -260,38 +260,38 @@ if test $ENABLE_DEVICE_MAPPER = yes; then
     [AC_MSG_ERROR([libdevmapper not found!  Try using --disable-device-mapper])
       ])
 fi
-AC_SUBST(DM_LIBS)
+AC_SUBST([DM_LIBS])

 dnl Check for SELinux
 SELINUX_LIBS=""
 if test "$enable_selinux" = yes; then
 	SELINUX_LIBS="-lselinux -lsepol"
 fi
-AC_SUBST(SELINUX_LIBS)
+AC_SUBST([SELINUX_LIBS])

 dnl Check for libreiserfs
 REISER_LIBS=""
 if test "$enable_dynamic_loading" = no -a "$enable_discover_only" = no; then
 	OLD_LIBS="$LIBS"
-	AC_CHECK_LIB(dal, dal_equals,
+	AC_CHECK_LIB([dal], [dal_equals],
 		LIBS="-ldal"
-		AC_CHECK_LIB(reiserfs, reiserfs_fs_probe,
+		AC_CHECK_LIB([reiserfs], [reiserfs_fs_probe],
 			REISER_LIBS="-ldal -lreiserfs"
-			AC_DEFINE(HAVE_LIBREISERFS, 1, [Have libreiserfs])
+			AC_DEFINE([HAVE_LIBREISERFS], [1], [Have libreiserfs])
 		)
-		AC_CHECK_LIB(reiserfs, reiserfs_fs_check,
-			AC_DEFINE(HAVE_REISERFS_FS_CHECK, 1, [Have reiserfs_fs_check()])
+		AC_CHECK_LIB([reiserfs], [reiserfs_fs_check],
+			AC_DEFINE([HAVE_REISERFS_FS_CHECK], [1], [Have reiserfs_fs_check()])
 		)
 	)
 	LIBS="$OLD_LIBS"
 fi
-AC_SUBST(REISER_LIBS)
+AC_SUBST([REISER_LIBS])

 dnl Check for termcap
 if test "$with_readline" = yes; then
 	OLD_LIBS="$LIBS"
 	LIBS=""
-	AC_SEARCH_LIBS(tgetent, tinfo ncurses curses termcap termlib,
+	AC_SEARCH_LIBS([tgetent], [tinfo ncurses curses termcap termlib],
 		PARTED_LIBS="$PARTED_LIBS $LIBS",
 		AC_MSG_ERROR(
 termcap could not be found which is required for the
@@ -315,7 +315,7 @@ if test "$with_readline" = yes; then
 	OLD_LIBS="$LIBS"
 	LIBS="$LIBS $PARTED_LIBS"
 	found_working_libreadline=no
-	AC_CHECK_LIB(readline, readline,
+	AC_CHECK_LIB([readline], [readline],
 		found_working_libreadline=yes,
 		AC_MSG_ERROR(
 GNU Readline could not be found which is required for the
@@ -360,19 +360,19 @@ Consider upgrading to version 5.2 or newer.)

 	if test $found_working_libreadline = yes; then
 		PARTED_LIBS="-lreadline $PARTED_LIBS"
-		AC_DEFINE(HAVE_LIBREADLINE, 1, [have readline])
+		AC_DEFINE([HAVE_LIBREADLINE], [1], [have readline])
 	fi
 	LIBS="$OLD_LIBS"
 fi

-AC_SUBST(PARTED_LIBS)
+AC_SUBST([PARTED_LIBS])

 dnl Check for OS specific libraries

 dnl GNU/Hurd:
 if test "$OS" = gnu; then
 dnl libshouldbeinlibc
-	AC_CHECK_LIB(shouldbeinlibc, vm_deallocate,
+	AC_CHECK_LIB([shouldbeinlibc], [vm_deallocate],
 		OS_LIBS="$OS_LIBS -lshouldbeinlibc",
 		AC_MSG_ERROR(
 GNU Parted requires libshouldbeinlibc when running on
@@ -385,10 +385,10 @@ dnl Aren't circular dependencies wonderful?
 	OLD_LIBS="$LIBS"
 	LIBS=

-	AC_CHECK_LIB(parted, ped_device_read)
+	AC_CHECK_LIB([parted], [ped_device_read])

 dnl libstore
-	AC_CHECK_LIB(store, store_open,
+	AC_CHECK_LIB([store], [store_open],
 		OS_LIBS="$OS_LIBS -lstore",
 		AC_MSG_ERROR(
 GNU Parted requires libstore when running on GNU/Hurd
@@ -408,17 +408,17 @@ if test "$OS" = beos; then
 	OS_LIBS="$OS_LIBS -lsocket"
 fi

-AC_SUBST(OS_LIBS)
+AC_SUBST([OS_LIBS])

 dnl One day, gettext might support libtool...
 dnl if test "$USE_INCLUDED_LIBINTL" = "yes"; then
 dnl	INTLINCS='-I$(top_srcdir)/intl'
 dnl fi
-AC_SUBST(INTLINCS)
+AC_SUBST([INTLINCS])


 dnl Checks for header files.
-AC_CHECK_HEADER(uuid/uuid.h, ,
+AC_CHECK_HEADER([uuid/uuid.h], ,
 	AC_MSG_ERROR(
 GNU Parted requires libuuid - a part of the e2fsprogs package.
 You seem to have the library installed but not the headers.  These are usually
@@ -428,15 +428,15 @@ If you can't find one try:
 )
 )

-AC_CHECK_HEADERS(getopt.h)
+AC_CHECK_HEADERS([getopt.h])

 dnl required for libparted/llseek.c  (TODO: make linux-x86 only)
 if test "$OS" = linux; then
-	AC_CHECK_HEADER(linux/unistd.h)
+	AC_CHECK_HEADER([linux/unistd.h])
 fi

 if test "$with_readline" = yes; then
-	AC_CHECK_HEADERS(readline/readline.h readline/history.h, ,
+	AC_CHECK_HEADERS([readline/readline.h readline/history.h], ,
 		AC_MSG_ERROR(
 The headers for GNU Readline could not be found which
 are required for the --with-readline option.  You seem to have the GNU readline
@@ -449,10 +449,10 @@ Alternatively you can disable readline support with --without-readline
 	)
 fi

-AC_CHECK_HEADERS(termcap.h)
+AC_CHECK_HEADERS([termcap.h])

 if test "$USE_NLS" = yes; then
-	AC_CHECK_HEADERS(wctype.h, ,
+	AC_CHECK_HEADERS([wctype.h], ,
 		AC_MSG_ERROR(
 One or more of the header files that are required for
 native language support (wctype.h) could not be found.  Either get a newer
@@ -464,8 +464,8 @@ Or disable native language support with the --disable-nls option
 fi

 AC_CHECK_HEADER([execinfo.h], [
-	AC_CHECK_LIB(c, backtrace, [
-		AC_DEFINE(HAVE_BACKTRACE, 1, [Has backtrace support])
+	AC_CHECK_LIB([c], [backtrace], [
+		AC_DEFINE([HAVE_BACKTRACE], [1], [Has backtrace support])
 		LDFLAGS="$LDFLAGS -rdynamic"
 	])
 ])
@@ -488,8 +488,8 @@ AC_C_CONST
 AC_C_RESTRICT

 dnl Checks for library functions.
-AC_CHECK_FUNCS(sigaction)
-AC_CHECK_FUNCS(getuid)
+AC_CHECK_FUNCS([sigaction])
+AC_CHECK_FUNCS([getuid])

 dnl NOTE: We need to remove the gl_cv_ignore_unused_libraries flag if we
 dnl detected one earlier.  libreadline on some platforms (e.g., RHEL and
@@ -497,11 +497,11 @@ dnl Fedora) is left with
 if test "$with_readline" = yes; then
 	OLD_LIBS="$LIBS"
 	LIBS="$LIBS $PARTED_LIBS -lreadline"
-	AC_CHECK_FUNCS(rl_completion_matches)
+	AC_CHECK_FUNCS([rl_completion_matches])
 	LIBS="$OLD_LIBS"
 fi

-AC_CHECK_FUNCS(canonicalize_file_name)
+AC_CHECK_FUNCS([canonicalize_file_name])

 # CFLAGS="$CFLAGS -W -Wall -Wno-unused -Wno-switch -Wno-format"

@@ -513,7 +513,7 @@ DATE=$(date '+%d %b %Y %H:%M')
 USER=$(whoami)
 HOST=$(hostname)
 BUILDINFO="$USER@$HOST, $DATE"
-AC_SUBST(BUILDINFO)
+AC_SUBST([BUILDINFO])

 AC_OUTPUT([
 Makefile
diff --git a/m4/parted.m4 b/m4/parted.m4
index 9f1e81d..9f3114e 100644
--- a/m4/parted.m4
+++ b/m4/parted.m4
@@ -9,7 +9,7 @@ dnl Example:
 dnl PARTED_CHECK_LIBPARTED(1.2.8, , [AC_MSG_ERROR([*** libparted >= 1.2.8 not installed - please install first ***])])
 dnl
 dnl Adds the required libraries to $PARTED_LIBS and does an
-dnl AC_SUBST(PARTED_LIBS)
+dnl AC_SUBST([PARTED_LIBS])
 dnl


@@ -21,13 +21,13 @@ dnl save LIBS
 saved_LIBS="$LIBS"

 dnl Check for headers and library
-AC_CHECK_HEADER(parted/parted.h, ,
+AC_CHECK_HEADER([parted/parted.h], ,
 		[AC_MSG_ERROR([<parted/parted.h> not found; install GNU/Parted])]
 		$3)
-AC_CHECK_LIB(uuid, uuid_generate, ,
+AC_CHECK_LIB([uuid], [uuid_generate], ,
 	     [AC_MSG_ERROR([libuuid not found; install e2fsprogs available at http://web.mit.edu/tytso/www/linux/e2fsprogs.html])]
              $3)
-AC_CHECK_LIB(parted,ped_device_read, ,
+AC_CHECK_LIB([parted],ped_device_read, ,
              [AC_MSG_ERROR([libparted not found; install GNU/Parted available at http://www.gnu.org/software/parted/parted.html])]
              $3)

@@ -36,21 +36,21 @@ case "$host_os" in
 		# with very generic names, which is why we special
 		# case these tests.

-		AC_CHECK_LIB(shouldbeinlibc,lcm, ,
+		AC_CHECK_LIB([shouldbeinlibc], [lcm], ,
                 	[AC_MSG_ERROR([libshouldbeinlibc not found; install the Hurd development libraries.])]
                 $3)

-		AC_CHECK_LIB(store,store_open, ,
+		AC_CHECK_LIB([store], [store_open], ,
                 	[AC_MSG_ERROR([libstore not found; install the Hurd development libraries.])]
                 $3)
 		;;
 	*)	;;
 esac

-AC_MSG_CHECKING(for libparted - version >= $1)
+AC_MSG_CHECKING([for libparted - version >= $1])

-AC_TRY_LINK_FUNC(ped_get_version,,
-                 AC_MSG_RESULT(failed)
+AC_TRY_LINK_FUNC([ped_get_version], ,
+                 AC_MSG_RESULT([failed])
                  AC_MSG_ERROR([*** libparted < 1.2.8 or == 1.3.0 can't execute test ***]))

 dnl Get major, minor, and micro version from arg MINIMUM-VERSION
@@ -95,14 +95,14 @@ int main ()
 	}
 }
 ],
-    AC_MSG_RESULT(yes),
-    AC_MSG_RESULT(no) ; $3,
+    AC_MSG_RESULT([yes]),
+    AC_MSG_RESULT([no]) ; $3,
     [echo $ac_n "cross compiling; assumed OK... $ac_c"])

 dnl restore orignial LIBS and set @PARTED_LIBS@
 PARTED_LIBS="$LIBS"
 LIBS="$saved_LIBS"
-AC_SUBST(PARTED_LIBS)
+AC_SUBST([PARTED_LIBS])

 dnl Execute ACTION-IF-FOUND
 $2
--
1.6.1.1.347.g3f81d



More information about the parted-devel mailing list