Archive: Include Page only if Macros are Defined

Include Page only if Macros are Defined

In NSIS is there a Pre-Processor directive called 'defined'? I am attempting to include a specific page in my installer only if a macro/s are defined.

!define INSTALL_V8 1
!define INSTALL_V10 1

#if we are installing to more than 1 version of 12d Model: Show 'Version Selector' Page
!if defined(INSTALL_V8) && defined(INSTALL_V9) || defined(INSTALL_V8) && defined(INSTALL_V10) || defined(INSTALL_V9) && defined(INSTALL_V10)
Page Custom CustomPageInitialise CustomPageFinalise

The above code gives a compile error saying:
!if expects 1-4 parameters, got 11
Do you know how I could check if multiple macros are defined?

NSIS is not C compatible, use !ifdef foo | bar

Thanks for the reply :)

A macro to count the defines would simplify the test

!define INSTALL_V8
!define INSTALL_V9
!define count 0
# call the macro for every possible def value
${CountDefs} count INSTALL_V8
${CountDefs} count INSTALL_V9
${CountDefs} count INSTALL_V10
!if ${count} > 1
Page Custom ...
Here's the macro to do that
!macro CountDefs Counter DefName
!ifdef ${DefName}
!define tmpval ${${Counter}}
!undef ${Counter}
!define /math ${Counter} ${tmpval} + 1
!undef tmpval
!define CountDefs "!insertmacro CountDefs"

Thanks for the code example :D Much appreciated.

Some people when you ask if its possible to do something in programming its always littered with, cant or not possible. Whereas some people like yourself see the outcome that is desired and come up with a way to achieve it within the parameters of the language. I vehemently believe there is no such a thing as not possible in programming. I often wonder how the former people are able to get employed. I like to think I am firmly in the latter category.

Thanks again.