OLD | NEW |
(Empty) | |
| 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 # We guarantee the invariant that GOOGLE_NAMESPACE starts with ::, |
| 10 # unless it's the empty string. Thus, it's always safe to do |
| 11 # GOOGLE_NAMESPACE::foo and be sure you're getting the foo that's |
| 12 # actually in the google namespace, and not some other namespace that |
| 13 # the namespace rules might kick in. |
| 14 |
| 15 AC_DEFUN([AC_DEFINE_GOOGLE_NAMESPACE], |
| 16 [google_namespace_default=[$1] |
| 17 AC_ARG_ENABLE(namespace, [ --enable-namespace=FOO to define these Google |
| 18 classes in the FOO namespace. --disable-namespace |
| 19 to define them in the global namespace. Default |
| 20 is to define them in namespace $1.], |
| 21 [case "$enableval" in |
| 22 yes) google_namespace="$google_namespace_default" ;; |
| 23 no) google_namespace="" ;; |
| 24 *) google_namespace="$enableval" ;; |
| 25 esac], |
| 26 [google_namespace="$google_namespace_default"]) |
| 27 if test -n "$google_namespace"; then |
| 28 ac_google_namespace="::$google_namespace" |
| 29 ac_google_start_namespace="namespace $google_namespace {" |
| 30 ac_google_end_namespace="}" |
| 31 else |
| 32 ac_google_namespace="" |
| 33 ac_google_start_namespace="" |
| 34 ac_google_end_namespace="" |
| 35 fi |
| 36 AC_DEFINE_UNQUOTED(GOOGLE_NAMESPACE, $ac_google_namespace, |
| 37 Namespace for Google classes) |
| 38 AC_DEFINE_UNQUOTED(_START_GOOGLE_NAMESPACE_, $ac_google_start_namespace, |
| 39 Puts following code inside the Google namespace) |
| 40 AC_DEFINE_UNQUOTED(_END_GOOGLE_NAMESPACE_, $ac_google_end_namespace, |
| 41 Stops putting the code inside the Google namespace) |
| 42 ]) |
OLD | NEW |