summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authordevzero2000 <devzero2000>2010-07-23 14:47:38 +0000
committerdevzero2000 <devzero2000>2010-07-23 14:47:38 +0000
commitee2ed799c566b9fd4b2c359adb0503a1b53fa0c8 (patch)
tree4d9d1c2e56b126f864342b4ae7f6301fe73c340e /m4
parentbb02be3a0ce16aee65c4846ebb425bfc15c56d36 (diff)
downloadlibpopt-ee2ed799c566b9fd4b2c359adb0503a1b53fa0c8.tar.gz
added popt_CFLAGS_ADD macros
Diffstat (limited to 'm4')
-rw-r--r--m4/popt.m434
1 files changed, 34 insertions, 0 deletions
diff --git a/m4/popt.m4 b/m4/popt.m4
new file mode 100644
index 0000000..8869fff
--- /dev/null
+++ b/m4/popt.m4
@@ -0,0 +1,34 @@
+# popt.m4 serial 1
+dnl Copyright (C) Elia Pinto (devzero2000@rpm5.org)
+dnl Inspired from gnulib warning.m4 and other
+dnl but not from ac_archive
+
+
+# popt_AS_VAR_APPEND(VAR, VALUE)
+# ----------------------------
+# Provide the functionality of AS_VAR_APPEND if Autoconf does not have it.
+m4_ifdef([AS_VAR_APPEND],
+[m4_copy([AS_VAR_APPEND], [popt_AS_VAR_APPEND])],
+[m4_define([popt_AS_VAR_APPEND],
+[AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])])
+
+# popt_CFLAGS_ADD(PARAMETER, [VARIABLE = POPT_CFLAGS])
+# ------------------------------------------------
+# Adds parameter to POPT_CFLAGS if the compiler supports it. For example,
+# popt_CFLAGS_ADD([-Wall],[POPT_CFLAGS]).
+AC_DEFUN([popt_CFLAGS_ADD],
+[AS_VAR_PUSHDEF([popt_my_cflags], [popt_cv_warn_$1])dnl
+AC_CACHE_CHECK([whether compiler handles $1], [popt_my_cflags], [
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="${CFLAGS} $1"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
+ [AS_VAR_SET([popt_my_cflags], [yes])],
+ [AS_VAR_SET([popt_my_cflags], [no])])
+ CFLAGS="$save_CFLAGS"
+])
+AS_VAR_PUSHDEF([popt_cflags], m4_if([$2], [], [[POPT_CFLAGS]], [[$2]]))dnl
+AS_VAR_IF([popt_my_cflags], [yes], [popt_AS_VAR_APPEND([popt_cflags], [" $1"])])
+AS_VAR_POPDEF([popt_cflags])dnl
+AS_VAR_POPDEF([popt_my_cflags])dnl
+m4_ifval([$2], [AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])])dnl
+])