| 1 | dnl --------------------------------------------------------------------------- |
|---|
| 2 | dnl Support macros for makefiles generated with Bakefile presets |
|---|
| 3 | dnl --------------------------------------------------------------------------- |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | dnl --------------------------------------------------------------------------- |
|---|
| 7 | dnl AM_YESNO_OPTCHECK([name of the boolean variable to set], |
|---|
| 8 | dnl [name of the variable with yes/no values], |
|---|
| 9 | dnl [name of the --enable/--with option]) |
|---|
| 10 | dnl |
|---|
| 11 | dnl Converts the $3 variable, supposed to contain a yes/no value to a 1/0 |
|---|
| 12 | dnl boolean variable and saves the result into $1. |
|---|
| 13 | dnl Outputs also the standard checking-option message. |
|---|
| 14 | dnl Used by the m4 macros of the presets. |
|---|
| 15 | dnl --------------------------------------------------------------------------- |
|---|
| 16 | AC_DEFUN([AC_BAKEFILE_YESNO_OPTCHECK], |
|---|
| 17 | [ |
|---|
| 18 | AC_MSG_CHECKING([for the $3 option]) |
|---|
| 19 | if [[ "x$$2" = "xyes" ]]; then |
|---|
| 20 | AC_MSG_RESULT([yes]) |
|---|
| 21 | $1=1 |
|---|
| 22 | else |
|---|
| 23 | AC_MSG_RESULT([no]) |
|---|
| 24 | $1=0 |
|---|
| 25 | fi |
|---|
| 26 | ]) |
|---|
| 27 | |
|---|
| 28 | dnl --------------------------------------------------------------------------- |
|---|
| 29 | dnl AC_BAKEFILE_UNICODEOPT([default value for the --enable-unicode option]) |
|---|
| 30 | dnl |
|---|
| 31 | dnl Adds the --enable-unicode option to the configure script and sets the |
|---|
| 32 | dnl UNICODE=0/1 variable accordingly to the value of the option. |
|---|
| 33 | dnl To be used with unicodeopt.bkl preset. |
|---|
| 34 | dnl --------------------------------------------------------------------------- |
|---|
| 35 | AC_DEFUN([AC_BAKEFILE_UNICODEOPT], |
|---|
| 36 | [ |
|---|
| 37 | default="$1" |
|---|
| 38 | if [[ -z "$default" ]]; then |
|---|
| 39 | default="no" |
|---|
| 40 | fi |
|---|
| 41 | |
|---|
| 42 | AC_ARG_ENABLE([unicode], |
|---|
| 43 | AC_HELP_STRING([--enable-unicode], [Builds in Unicode mode]), |
|---|
| 44 | [], [enableval="$default"]) |
|---|
| 45 | |
|---|
| 46 | AC_BAKEFILE_YESNO_OPTCHECK([UNICODE], [enableval], [--enable-unicode]) |
|---|
| 47 | ]) |
|---|
| 48 | |
|---|
| 49 | dnl --------------------------------------------------------------------------- |
|---|
| 50 | dnl AC_BAKEFILE_DEBUGOPT([default value for the --enable-debug option]) |
|---|
| 51 | dnl |
|---|
| 52 | dnl Adds the --enable-debug option to the configure script and sets the |
|---|
| 53 | dnl DEBUG=0/1 variable accordingly to the value of the option. |
|---|
| 54 | dnl To be used with debugopt.bkl preset. |
|---|
| 55 | dnl --------------------------------------------------------------------------- |
|---|
| 56 | AC_DEFUN([AC_BAKEFILE_DEBUGOPT], |
|---|
| 57 | [ |
|---|
| 58 | default="$1" |
|---|
| 59 | if [[ -z "$default" ]]; then |
|---|
| 60 | default="no" |
|---|
| 61 | fi |
|---|
| 62 | |
|---|
| 63 | AC_ARG_ENABLE([debug], |
|---|
| 64 | AC_HELP_STRING([--enable-debug], [Builds in debug mode]), |
|---|
| 65 | [], [enableval="$default"]) |
|---|
| 66 | |
|---|
| 67 | AC_BAKEFILE_YESNO_OPTCHECK([DEBUG], [enableval], [--enable-debug]) |
|---|
| 68 | |
|---|
| 69 | dnl add the optimize/debug flags |
|---|
| 70 | if [[ "x$DEBUG" = "x1" ]]; then |
|---|
| 71 | |
|---|
| 72 | dnl NOTE: the -Wundef and -Wno-ctor-dtor-privacy are not enabled automatically by -Wall |
|---|
| 73 | dnl NOTE2: the '-Wno-ctor-dtor-privacy' has sense only when compiling C++ source files |
|---|
| 74 | dnl and thus we must be careful to add it only to CXXFLAGS and not to CFLAGS |
|---|
| 75 | dnl (remember that CPPFLAGS is reserved for both C and C++ compilers while |
|---|
| 76 | dnl CFLAGS is intended as flags for C compiler only and CXXFLAGS for C++ only) |
|---|
| 77 | CXXFLAGS="$CXXFLAGS -g -O0 -Wall -Wundef -Wno-ctor-dtor-privacy" |
|---|
| 78 | CFLAGS="$CFLAGS -g -O0 -Wall -Wundef" |
|---|
| 79 | else |
|---|
| 80 | CXXFLAGS="$CXXFLAGS -O2" |
|---|
| 81 | CFLAGS="$CFLAGS -O2" |
|---|
| 82 | fi |
|---|
| 83 | ]) |
|---|
| 84 | |
|---|
| 85 | dnl --------------------------------------------------------------------------- |
|---|
| 86 | dnl AC_BAKEFILE_SHAREDOPT([default value for the --enable-shared option]) |
|---|
| 87 | dnl |
|---|
| 88 | dnl Adds the --enable-shared option to the configure script and sets the |
|---|
| 89 | dnl SHARED=0/1 variable accordingly to the value of the option. |
|---|
| 90 | dnl To be used with sharedopt.bkl preset. |
|---|
| 91 | dnl --------------------------------------------------------------------------- |
|---|
| 92 | AC_DEFUN([AC_BAKEFILE_SHAREDOPT], |
|---|
| 93 | [ |
|---|
| 94 | default="$1" |
|---|
| 95 | if [[ -z "$default" ]]; then |
|---|
| 96 | default="no" |
|---|
| 97 | fi |
|---|
| 98 | |
|---|
| 99 | AC_ARG_ENABLE([shared], |
|---|
| 100 | AC_HELP_STRING([--enable-shared], [Builds in shared mode]), |
|---|
| 101 | [], [enableval="$default"]) |
|---|
| 102 | |
|---|
| 103 | AC_BAKEFILE_YESNO_OPTCHECK([SHARED], [enableval], [--enable-shared]) |
|---|
| 104 | ]) |
|---|
| 105 | |
|---|
| 106 | dnl --------------------------------------------------------------------------- |
|---|
| 107 | dnl AC_BAKEFILE_SHOW_DEBUGOPT |
|---|
| 108 | dnl |
|---|
| 109 | dnl Prints a message on stdout about the value of the DEBUG variable. |
|---|
| 110 | dnl This macro is useful to show summary messages at the end of the configure scripts. |
|---|
| 111 | dnl --------------------------------------------------------------------------- |
|---|
| 112 | AC_DEFUN([AC_BAKEFILE_SHOW_DEBUGOPT], |
|---|
| 113 | [ |
|---|
| 114 | if [[ "$DEBUG" = "1" ]]; then |
|---|
| 115 | echo " - DEBUG build" |
|---|
| 116 | else |
|---|
| 117 | echo " - RELEASE build" |
|---|
| 118 | fi |
|---|
| 119 | ]) |
|---|
| 120 | |
|---|
| 121 | dnl --------------------------------------------------------------------------- |
|---|
| 122 | dnl AC_BAKEFILE_SHOW_SHAREDOPT |
|---|
| 123 | dnl |
|---|
| 124 | dnl Prints a message on stdout about the value of the SHARED variable. |
|---|
| 125 | dnl This macro is useful to show summary messages at the end of the configure scripts. |
|---|
| 126 | dnl --------------------------------------------------------------------------- |
|---|
| 127 | AC_DEFUN([AC_BAKEFILE_SHOW_SHAREDOPT], |
|---|
| 128 | [ |
|---|
| 129 | if [[ "$SHARED" = "1" ]]; then |
|---|
| 130 | echo " - SHARED mode" |
|---|
| 131 | else |
|---|
| 132 | echo " - STATIC mode" |
|---|
| 133 | fi |
|---|
| 134 | ]) |
|---|
| 135 | |
|---|
| 136 | dnl --------------------------------------------------------------------------- |
|---|
| 137 | dnl AC_BAKEFILE_SHOW_UNICODEOPT |
|---|
| 138 | dnl |
|---|
| 139 | dnl Prints a message on stdout about the value of the UNICODE variable. |
|---|
| 140 | dnl This macro is useful to show summary messages at the end of the configure scripts. |
|---|
| 141 | dnl --------------------------------------------------------------------------- |
|---|
| 142 | AC_DEFUN([AC_BAKEFILE_SHOW_UNICODEOPT], |
|---|
| 143 | [ |
|---|
| 144 | if [[ "$UNICODE" = "1" ]]; then |
|---|
| 145 | echo " - UNICODE mode" |
|---|
| 146 | else |
|---|
| 147 | echo " - ANSI mode" |
|---|
| 148 | fi |
|---|
| 149 | ]) |
|---|
| 150 | |
|---|
| 151 | |
|---|