Create a file with the content below.
chmod 700 to the file and execute it INSIDE THE MYSQL SOURCE FOLDER!
It will search for *.c, *.cc, *.cpp and *.h files and replaces min/max() functions
with MYSQL_MIN/MYSQL_MAX().
This will fix all "min/max was not declared in this scope" errors when compiling with GCC 4.x.
GL HF :)
#!/bin/bash
for ext in "c" "cc" "cpp" "h" ; do
for file in $(find ./ -iname "*.$ext" ! -iname "extra/yassl") ; do
sed "s/\(\W\)\(max\)\((\)/\1MYSQL_MAX\3/g" "$file" > "$file.sed"
mv "$file.sed" "$file"
sed "s/\(\W\)\(min\)\((\)/\1MYSQL_MIN\3/g" "$file" > "$file.sed"
mv "$file.sed" "$file"
done
done