Austin Schuh | 906616c | 2019-01-21 20:25:11 -0800 | [diff] [blame] | 1 | # Allow users to override the namespace we define our application's classes in |
| 2 | # Arg $1 is the default namespace to use if --enable-namespace isn't present. |
| 3 | |
| 4 | # In general, $1 should be 'google', so we put all our exported symbols in a |
| 5 | # unique namespace that is not likely to conflict with anyone else. However, |
| 6 | # when it makes sense -- for instance, when publishing stl-like code -- you |
| 7 | # may want to go with a different default, like 'std'. |
| 8 | |
| 9 | AC_DEFUN([AC_DEFINE_GOOGLE_NAMESPACE], |
| 10 | [google_namespace_default=[$1] |
| 11 | AC_ARG_ENABLE(namespace, [ --enable-namespace=FOO to define these Google |
| 12 | classes in the FOO namespace. --disable-namespace |
| 13 | to define them in the global namespace. Default |
| 14 | is to define them in namespace $1.], |
| 15 | [case "$enableval" in |
| 16 | yes) google_namespace="$google_namespace_default" ;; |
| 17 | no) google_namespace="" ;; |
| 18 | *) google_namespace="$enableval" ;; |
| 19 | esac], |
| 20 | [google_namespace="$google_namespace_default"]) |
| 21 | if test -n "$google_namespace"; then |
| 22 | ac_google_namespace="$google_namespace" |
| 23 | ac_google_start_namespace="namespace $google_namespace {" |
| 24 | ac_google_end_namespace="}" |
| 25 | else |
| 26 | ac_google_namespace="" |
| 27 | ac_google_start_namespace="" |
| 28 | ac_google_end_namespace="" |
| 29 | fi |
| 30 | AC_DEFINE_UNQUOTED(GOOGLE_NAMESPACE, $ac_google_namespace, |
| 31 | Namespace for Google classes) |
| 32 | AC_DEFINE_UNQUOTED(_START_GOOGLE_NAMESPACE_, $ac_google_start_namespace, |
| 33 | Puts following code inside the Google namespace) |
| 34 | AC_DEFINE_UNQUOTED(_END_GOOGLE_NAMESPACE_, $ac_google_end_namespace, |
| 35 | Stops putting the code inside the Google namespace) |
| 36 | ]) |