summaryrefslogtreecommitdiffstats
path: root/source/aclocal.m4
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2003-02-15 22:51:15 +0000
committerAlexander Bokovoy <ab@samba.org>2003-02-15 22:51:15 +0000
commit643172ac1a9b53823d704690eb03120074bbef78 (patch)
tree90a40473136d394ca45548519ff7c2e634b5989f /source/aclocal.m4
parentdc934412b0190ea75073cccddac45e74ebcd4a6b (diff)
downloadsamba-643172ac1a9b53823d704690eb03120074bbef78.tar.gz
samba-643172ac1a9b53823d704690eb03120074bbef78.tar.xz
samba-643172ac1a9b53823d704690eb03120074bbef78.zip
Third-party configuration scripts may produce undesirable additions to CFLAGS/CPPFLAGS
and LIBS/LDFALGS. In particular, they often don't check where the appropriate libraries were installed and pass -I/usr/include and -L/usr/lib as part of CFLAGS/LDFLAGS. While the latter isn't dangerous, passing system include directory through -I lead to change of its status in CPP from system to user-defined in many cases. This patch cleans up CFLAGS/CPPFLAGS from errorenous -I/usr/include and LIBS/LDFLAGS from -L/usr/lib. This is done as two m4 macros which are called before AC_OUTPUT.
Diffstat (limited to 'source/aclocal.m4')
-rw-r--r--source/aclocal.m423
1 files changed, 23 insertions, 0 deletions
diff --git a/source/aclocal.m4 b/source/aclocal.m4
index 758dfa3b379..5b1500106cb 100644
--- a/source/aclocal.m4
+++ b/source/aclocal.m4
@@ -462,3 +462,26 @@ int main(int argc, char *argv[])
rm -f conf.mysqltest
])
+dnl Removes -I/usr/include/? from given variable
+AC_DEFUN(CFLAGS_REMOVE_USR_INCLUDE,[
+ ac_new_flags=""
+ for i in [$]$1; do
+ case [$]i in
+ -I/usr/include|-I/usr/include/) ;;
+ *) ac_new_flags="[$]ac_new_flags [$]i" ;;
+ esac
+ done
+ $1=[$]ac_new_flags
+])
+
+dnl Removes -L/usr/lib/? from given variable
+AC_DEFUN(LIB_REMOVE_USR_LIB,[
+ ac_new_flags=""
+ for i in [$]$1; do
+ case [$]i in
+ -L/usr/lib|-L/usr/lib/) ;;
+ *) ac_new_flags="[$]ac_new_flags [$]i" ;;
+ esac
+ done
+ $1=[$]ac_new_flags
+])